Compare commits
No commits in common. "136e3f74a0bd544aef2213d94baec2f90e51d9d5" and "21a45b06cfaf84a7e59f321a49bff1445b470295" have entirely different histories.
136e3f74a0
...
21a45b06cf
3 changed files with 13 additions and 66 deletions
|
|
@ -68,27 +68,5 @@ Running benchmarks.prog
|
||||||
exp() 10K 00:00:32
|
exp() 10K 00:00:32
|
||||||
cos() 10K 00:00:06
|
cos() 10K 00:00:06
|
||||||
|
|
||||||
|
|
||||||
Arty-A7-35T
|
|
||||||
76.92MHz, 64KB SRAM, 256MB DRAM, 16B instruction cache
|
|
||||||
running in DRAM (except corelib, stdlib, runtime)
|
|
||||||
|
|
||||||
Running benchmarks.prog
|
Running benchmarks.prog
|
||||||
empty loop 10M 00:00:16
|
|
||||||
write variable 10M 00:00:17
|
|
||||||
read variable 10M 00:00:19
|
|
||||||
integer addition 10M 00:00:24
|
|
||||||
real addition 1M 00:00:30
|
|
||||||
integer multiplication 1M 00:01:14
|
|
||||||
real multiplication 1M 00:01:05
|
|
||||||
integer division 1M 00:01:53
|
|
||||||
real division 1M 00:01:13
|
|
||||||
string indexing 1M 00:00:41
|
|
||||||
string iteration 1M 00:00:21
|
|
||||||
new/dispose 1k 1M 00:00:25
|
|
||||||
new/dispose 128k 1M 00:00:26
|
|
||||||
array copy 1k 10K 00:00:03
|
|
||||||
array copy 128k 1K 00:00:48
|
|
||||||
exp() 10K 00:00:32
|
|
||||||
cos() 10K 00:00:06
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ begin
|
||||||
emitIns2('BRANCH','@+2'); (* NOP, to make alignment explicit *)
|
emitIns2('BRANCH','@+2'); (* NOP, to make alignment explicit *)
|
||||||
emitIns('.CPOOL'); (* header/prologue + 2 constants is 32 bytes *)
|
emitIns('.CPOOL'); (* header/prologue + 2 constants is 32 bytes *)
|
||||||
|
|
||||||
if useStdlib and not useStandalone then
|
if useStdlib then
|
||||||
begin
|
begin
|
||||||
writeln(outfile, '%include "stdlib.lsym"');
|
writeln(outfile, '%include "stdlib.lsym"');
|
||||||
writeln(outfile, '%incbin "stdlib.lib"');
|
writeln(outfile, '%incbin "stdlib.lib"');
|
||||||
|
|
@ -312,12 +312,7 @@ begin
|
||||||
emitArrayConsts;
|
emitArrayConsts;
|
||||||
|
|
||||||
if useStandalone then
|
if useStandalone then
|
||||||
begin
|
emitInclude('corelib.s')
|
||||||
emitInclude('corelib.s');
|
|
||||||
emitInclude('runtime.s');
|
|
||||||
emitInclude('float32.s');
|
|
||||||
emitInclude('stdlib.s');
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
emitInclude('coreloader.lsym');
|
emitInclude('coreloader.lsym');
|
||||||
|
|
||||||
|
|
@ -1064,7 +1059,6 @@ end;
|
||||||
*)
|
*)
|
||||||
procedure emitProcedureCall(aProc: ProcRef);
|
procedure emitProcedureCall(aProc: ProcRef);
|
||||||
var procLabel: IdentString;
|
var procLabel: IdentString;
|
||||||
i:integer;
|
|
||||||
begin
|
begin
|
||||||
(* pass pointer to stackframe of caller for nested procedures *)
|
(* pass pointer to stackframe of caller for nested procedures *)
|
||||||
if aProc^.isNested then
|
if aProc^.isNested then
|
||||||
|
|
@ -1075,17 +1069,9 @@ begin
|
||||||
if aProc^.level > curProcedure^.level then
|
if aProc^.level > curProcedure^.level then
|
||||||
emitIns2('LOADREG','FP')
|
emitIns2('LOADREG','FP')
|
||||||
else
|
else
|
||||||
begin
|
(* TODO: calling nested aProc with a lower nesting level.
|
||||||
(* Calling nested aProc with a lower nesting level.
|
need to chase a chain of old BP pointers. *)
|
||||||
Need to chase a chain of old BP pointers. *)
|
errorExit2('internal error: outward call of nested aProc not implemented', '');
|
||||||
emitIns2('LOADREG', 'BP');
|
|
||||||
(* BP points to the stackframe of the outer procedure,
|
|
||||||
@BP contains the stackframe of the procedure one step further
|
|
||||||
outwards, and so on.
|
|
||||||
*)
|
|
||||||
for i := aProc^.level + 1 to curProcedure^.level do
|
|
||||||
emitIns('LOADI');
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
emitFpAdjust(-curProcedure^.tempsSize);
|
emitFpAdjust(-curProcedure^.tempsSize);
|
||||||
|
|
@ -1264,7 +1250,7 @@ begin
|
||||||
(* nothing to do *)
|
(* nothing to do *)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (amount > 0) and (amount <= MaxTinyOffset) then
|
if amount <= MaxTinyOffset then
|
||||||
emitIns2Int('INC', amount)
|
emitIns2Int('INC', amount)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|
@ -1280,7 +1266,7 @@ begin
|
||||||
(* nothing to do *)
|
(* nothing to do *)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (amount > 0) and (amount <= MaxTinyOffset) then
|
if amount <= MaxTinyOffset then
|
||||||
emitIns2Int('DEC', amount)
|
emitIns2Int('DEC', amount)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -2186,7 +2186,7 @@ begin
|
||||||
if ch = '!' then
|
if ch = '!' then
|
||||||
(* special comment till end of line *)
|
(* special comment till end of line *)
|
||||||
begin
|
begin
|
||||||
while not (nextChar in [#13, #10]) do (* nothing *);
|
while not (nextChar = #13) do (* nothing *);
|
||||||
readNextToken;
|
readNextToken;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -2456,7 +2456,10 @@ begin
|
||||||
begin
|
begin
|
||||||
digits := curToken.tokenText;
|
digits := curToken.tokenText;
|
||||||
if matchTokenOrNot(MinusToken) then
|
if matchTokenOrNot(MinusToken) then
|
||||||
|
begin
|
||||||
|
readNextToken;
|
||||||
digits := digits + curToken.tokenText;
|
digits := digits + curToken.tokenText;
|
||||||
|
end;
|
||||||
parseInteger := integerFromString(digits);
|
parseInteger := integerFromString(digits);
|
||||||
end;
|
end;
|
||||||
readNextToken;
|
readNextToken;
|
||||||
|
|
@ -2809,8 +2812,6 @@ begin
|
||||||
|
|
||||||
if checkToken(CommaToken) then
|
if checkToken(CommaToken) then
|
||||||
begin
|
begin
|
||||||
(* TODO: handle comma syntax for indexing a char
|
|
||||||
from an array of strings *)
|
|
||||||
if elType.baseType <> ArrayType then
|
if elType.baseType <> ArrayType then
|
||||||
errorExit2('invalid array subscript for', name)
|
errorExit2('invalid array subscript for', name)
|
||||||
end;
|
end;
|
||||||
|
|
@ -3230,22 +3231,10 @@ begin
|
||||||
readNextToken;
|
readNextToken;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(* Handle an array range part. Very similar to parseInteger
|
|
||||||
but additionally handles Boolean, Enum and Char types which
|
|
||||||
can be used for array indices *)
|
|
||||||
procedure getRangePart(var value:integer; var typeReturn: TypeSpec);
|
procedure getRangePart(var value:integer; var typeReturn: TypeSpec);
|
||||||
var cnst: ConstRef;
|
var cnst: ConstRef;
|
||||||
negate:boolean;
|
|
||||||
digits: string[12];
|
|
||||||
begin
|
begin
|
||||||
setBaseType(typeReturn, NoType);
|
setBaseType(typeReturn, NoType);
|
||||||
negate := false;
|
|
||||||
|
|
||||||
if checkToken(MinusToken) then
|
|
||||||
begin
|
|
||||||
negate := true;
|
|
||||||
readNextToken;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if checkToken(IdentToken) then
|
if checkToken(IdentToken) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -3279,11 +3268,7 @@ begin
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
setBaseType(typeReturn, IntegerType);
|
setBaseType(typeReturn, IntegerType);
|
||||||
digits := curToken.tokenText;
|
value := parseInteger;
|
||||||
if negate then
|
|
||||||
insert('-', digits, 1);
|
|
||||||
value := integerFromString(digits);
|
|
||||||
readNextToken;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -3448,9 +3433,9 @@ begin
|
||||||
if savedType.baseType = NoType then
|
if savedType.baseType = NoType then
|
||||||
savedType := elementType;
|
savedType := elementType;
|
||||||
emitLoadConstantInt(cnst^.intValue);
|
emitLoadConstantInt(cnst^.intValue);
|
||||||
readNextToken;
|
|
||||||
end;
|
end;
|
||||||
emitAddToSet;
|
emitAddToSet;
|
||||||
|
readNextToken;
|
||||||
end
|
end
|
||||||
else if checkToken(NumberToken) then
|
else if checkToken(NumberToken) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -4014,8 +3999,6 @@ begin
|
||||||
begin
|
begin
|
||||||
readNextToken;
|
readNextToken;
|
||||||
length := parseInteger;
|
length := parseInteger;
|
||||||
if length < 1 then
|
|
||||||
errorExit2('invalid string length', '');
|
|
||||||
matchToken(RBracketToken);
|
matchToken(RBracketToken);
|
||||||
end;
|
end;
|
||||||
typSpec.size := getStringMemSize(length);
|
typSpec.size := getStringMemSize(length);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue