mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-05-29 04:41:27 +00:00
Dynamically allocate string space, and make it larger.
This increases the limit on total bytes of strings in a function, and also frees up space in the blank segment.
This commit is contained in:
parent
3c2b492618
commit
161bb952e3
8
CGI.pas
8
CGI.pas
|
@ -209,7 +209,7 @@ const
|
||||||
{Note: maxlabel is also defined in CGC.asm}
|
{Note: maxlabel is also defined in CGC.asm}
|
||||||
maxLabel = 3200; {max # of internal labels}
|
maxLabel = 3200; {max # of internal labels}
|
||||||
maxLocalLabel = 220; {max # local variables}
|
maxLocalLabel = 220; {max # local variables}
|
||||||
maxString = 12500; {max # chars in string space}
|
maxString = 32760; {max # chars in string space}
|
||||||
|
|
||||||
{size of internal types}
|
{size of internal types}
|
||||||
{----------------------}
|
{----------------------}
|
||||||
|
@ -225,6 +225,7 @@ const
|
||||||
|
|
||||||
type
|
type
|
||||||
segNameType = packed array[1..10] of char; {segment name}
|
segNameType = packed array[1..10] of char; {segment name}
|
||||||
|
stringSpaceType = packed array[1..maxstring] of char; {string space}
|
||||||
|
|
||||||
{p code}
|
{p code}
|
||||||
{------}
|
{------}
|
||||||
|
@ -343,7 +344,7 @@ var
|
||||||
stackSize: integer; {amount of stack space to reserve}
|
stackSize: integer; {amount of stack space to reserve}
|
||||||
strictVararg: boolean; {repair stack around vararg calls?}
|
strictVararg: boolean; {repair stack around vararg calls?}
|
||||||
stringsize: 0..maxstring; {amount of string space left}
|
stringsize: 0..maxstring; {amount of string space left}
|
||||||
stringspace: packed array[1..maxstring] of char; {string table}
|
stringspace: ^stringSpaceType; {string table}
|
||||||
symLength: integer; {length of debug symbol table}
|
symLength: integer; {length of debug symbol table}
|
||||||
toolParms: boolean; {generate tool format parameters?}
|
toolParms: boolean; {generate tool format parameters?}
|
||||||
volatile: boolean; {has a volatile qualifier been used?}
|
volatile: boolean; {has a volatile qualifier been used?}
|
||||||
|
@ -822,6 +823,9 @@ fastMath := cLineOptimize;
|
||||||
commonSubexpression := cLineOptimize; {not doing common subexpression elimination}
|
commonSubexpression := cLineOptimize; {not doing common subexpression elimination}
|
||||||
loopOptimizations := cLineOptimize; {not doing loop optimizations, yet}
|
loopOptimizations := cLineOptimize; {not doing loop optimizations, yet}
|
||||||
|
|
||||||
|
{allocate string space}
|
||||||
|
new(stringspace);
|
||||||
|
|
||||||
{allocate the initial p-code}
|
{allocate the initial p-code}
|
||||||
code := pointer(Calloc(sizeof(intermediate_code)));
|
code := pointer(Calloc(sizeof(intermediate_code)));
|
||||||
code^.optype := cgWord;
|
code^.optype := cgWord;
|
||||||
|
|
12
Gen.pas
12
Gen.pas
|
@ -5136,9 +5136,9 @@ len := debugFile^.theString.size;
|
||||||
if len > 255 then
|
if len > 255 then
|
||||||
len := 255;
|
len := 255;
|
||||||
if maxString-stringSize >= len+1 then begin
|
if maxString-stringSize >= len+1 then begin
|
||||||
stringSpace[stringSize+1] := chr(len);
|
stringSpace^[stringSize+1] := chr(len);
|
||||||
for i := 1 to len do
|
for i := 1 to len do
|
||||||
stringSpace[i+stringSize+1] :=
|
stringSpace^[i+stringSize+1] :=
|
||||||
debugFile^.theString.theString[i];
|
debugFile^.theString.theString[i];
|
||||||
stringSize := stringSize + len + 1;
|
stringSize := stringSize + len + 1;
|
||||||
end {if}
|
end {if}
|
||||||
|
@ -5937,7 +5937,7 @@ procedure GenTree {op: icptr};
|
||||||
GenNative(m_pea, immediate, stringSize, nil, stringReference);
|
GenNative(m_pea, immediate, stringSize, nil, stringReference);
|
||||||
if maxString-stringSize >= op^.q then begin
|
if maxString-stringSize >= op^.q then begin
|
||||||
for i := 1 to op^.q do
|
for i := 1 to op^.q do
|
||||||
stringSpace[i+stringSize] := op^.str^.str[i];
|
stringSpace^[i+stringSize] := op^.str^.str[i];
|
||||||
stringSize := stringSize+op^.q;
|
stringSize := stringSize+op^.q;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -6375,7 +6375,7 @@ procedure GenTree {op: icptr};
|
||||||
GenNative(opcode, immediate, stringsize, nil, StringReference);
|
GenNative(opcode, immediate, stringsize, nil, StringReference);
|
||||||
if maxstring-stringsize >= op^.q then begin
|
if maxstring-stringsize >= op^.q then begin
|
||||||
for i := 1 to op^.q do
|
for i := 1 to op^.q do
|
||||||
stringspace[i+stringsize] := op^.str^.str[i];
|
stringspace^[i+stringsize] := op^.str^.str[i];
|
||||||
stringsize := stringsize + op^.q;
|
stringsize := stringsize + op^.q;
|
||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
|
@ -6491,9 +6491,9 @@ procedure GenTree {op: icptr};
|
||||||
|
|
||||||
{place the name in the string buffer}
|
{place the name in the string buffer}
|
||||||
if maxString-stringSize >= op^.q+1 then begin
|
if maxString-stringSize >= op^.q+1 then begin
|
||||||
stringSpace[stringSize+1] := chr(op^.q);
|
stringSpace^[stringSize+1] := chr(op^.q);
|
||||||
for i := 1 to op^.q do
|
for i := 1 to op^.q do
|
||||||
stringSpace[i+stringSize+1] := op^.str^.str[i];
|
stringSpace^[i+stringSize+1] := op^.str^.str[i];
|
||||||
stringSize := stringSize + op^.q + 1;
|
stringSize := stringSize + op^.q + 1;
|
||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
|
|
|
@ -676,7 +676,7 @@ case mode of
|
||||||
j := sptr^.length;
|
j := sptr^.length;
|
||||||
if maxString-stringSize >= j then begin
|
if maxString-stringSize >= j then begin
|
||||||
for k := 1 to j do
|
for k := 1 to j do
|
||||||
stringSpace[k+stringSize] :=
|
stringSpace^[k+stringSize] :=
|
||||||
sptr^.str[k];
|
sptr^.str[k];
|
||||||
stringSize := stringSize+j;
|
stringSize := stringSize+j;
|
||||||
end {if}
|
end {if}
|
||||||
|
@ -1337,7 +1337,7 @@ Purge; {dump constant buffer}
|
||||||
if stringsize <> 0 then begin {define string space}
|
if stringsize <> 0 then begin {define string space}
|
||||||
UpDate(maxLabel, pc); {define the local label for the string space}
|
UpDate(maxLabel, pc); {define the local label for the string space}
|
||||||
for i := 1 to stringsize do
|
for i := 1 to stringsize do
|
||||||
CnOut(ord(stringspace[i]));
|
CnOut(ord(stringspace^[i]));
|
||||||
Purge;
|
Purge;
|
||||||
end; {if}
|
end; {if}
|
||||||
Out(0); {end the segment}
|
Out(0); {end the segment}
|
||||||
|
|
|
@ -1176,9 +1176,9 @@ var
|
||||||
Out(0);
|
Out(0);
|
||||||
len := length(ip^.name^); {place the name in the string buffer}
|
len := length(ip^.name^); {place the name in the string buffer}
|
||||||
if maxstring-stringsize >= len+1 then begin
|
if maxstring-stringsize >= len+1 then begin
|
||||||
stringspace[stringsize+1] := chr(len);
|
stringspace^[stringsize+1] := chr(len);
|
||||||
for j := 1 to len do
|
for j := 1 to len do
|
||||||
stringspace[j+stringsize+1] := ip^.name^[j];
|
stringspace^[j+stringsize+1] := ip^.name^[j];
|
||||||
stringsize := stringsize+len+1;
|
stringsize := stringsize+len+1;
|
||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
|
|
2
cc.notes
2
cc.notes
|
@ -144,7 +144,7 @@ Character and string constants may now have prefixes indicating they should use
|
||||||
|
|
||||||
p. 238
|
p. 238
|
||||||
|
|
||||||
The limit on the length of a single string constant is now 32760 bytes. The limit on the total length of string constants in a single function is now 12500 bytes (larger string constants can be used to initialize static arrays).
|
The limits on the length of a single string constant and on the total length of string constants in a single function have both been raised to 32760 bytes.
|
||||||
|
|
||||||
p. 239
|
p. 239
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user