|
@@ -45,7 +45,7 @@ implementation
|
|
pbase,pexpr,pdecvar,
|
|
pbase,pexpr,pdecvar,
|
|
{ codegen }
|
|
{ codegen }
|
|
cpuinfo,cgbase,dbgbase,
|
|
cpuinfo,cgbase,dbgbase,
|
|
- wpobase
|
|
|
|
|
|
+ wpobase,asmutils
|
|
;
|
|
;
|
|
|
|
|
|
{$maxfpuregisters 0}
|
|
{$maxfpuregisters 0}
|
|
@@ -166,9 +166,16 @@ implementation
|
|
read typed const
|
|
read typed const
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
|
|
+ type
|
|
|
|
+ { context used for parsing complex types (arrays/records/objects) }
|
|
|
|
+ threc = record
|
|
|
|
+ list : tasmlist;
|
|
|
|
+ origsym: tstaticvarsym;
|
|
|
|
+ offset: aint;
|
|
|
|
+ end;
|
|
|
|
|
|
{ this procedure reads typed constants }
|
|
{ this procedure reads typed constants }
|
|
- procedure read_typed_const_data(list:tasmlist;def:tdef);
|
|
|
|
|
|
+ procedure read_typed_const_data(var hr:threc;def:tdef); forward;
|
|
|
|
|
|
procedure parse_orddef(list:tasmlist;def:torddef);
|
|
procedure parse_orddef(list:tasmlist;def:torddef);
|
|
var
|
|
var
|
|
@@ -408,7 +415,7 @@ implementation
|
|
else
|
|
else
|
|
varalign:=0;
|
|
varalign:=0;
|
|
varalign:=const_align(varalign);
|
|
varalign:=const_align(varalign);
|
|
- current_asmdata.asmlists[al_const].concat(Tai_align.Create(varalign));
|
|
|
|
|
|
+ new_section(current_asmdata.asmlists[al_const], sec_rodata, ll.name, varalign);
|
|
current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
|
|
current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
|
|
if p.nodetype=stringconstn then
|
|
if p.nodetype=stringconstn then
|
|
begin
|
|
begin
|
|
@@ -635,15 +642,15 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- procedure parse_stringdef(list:tasmlist;def:tstringdef);
|
|
|
|
|
|
+ procedure parse_stringdef(const hr:threc;def:tstringdef);
|
|
var
|
|
var
|
|
n : tnode;
|
|
n : tnode;
|
|
- i : longint;
|
|
|
|
strlength : aint;
|
|
strlength : aint;
|
|
strval : pchar;
|
|
strval : pchar;
|
|
strch : char;
|
|
strch : char;
|
|
- ll,ll2 : tasmlabel;
|
|
|
|
|
|
+ ll : tasmlabel;
|
|
ca : pchar;
|
|
ca : pchar;
|
|
|
|
+ winlike : boolean;
|
|
begin
|
|
begin
|
|
n:=comp_expr(true);
|
|
n:=comp_expr(true);
|
|
{ load strval and strlength of the constant tree }
|
|
{ load strval and strlength of the constant tree }
|
|
@@ -690,12 +697,12 @@ implementation
|
|
message2(parser_w_string_too_long,strpas(strval),tostr(def.size-1));
|
|
message2(parser_w_string_too_long,strpas(strval),tostr(def.size-1));
|
|
strlength:=def.size-1;
|
|
strlength:=def.size-1;
|
|
end;
|
|
end;
|
|
- list.concat(Tai_const.Create_8bit(strlength));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(strlength));
|
|
{ this can also handle longer strings }
|
|
{ this can also handle longer strings }
|
|
getmem(ca,strlength+1);
|
|
getmem(ca,strlength+1);
|
|
move(strval^,ca^,strlength);
|
|
move(strval^,ca^,strlength);
|
|
ca[strlength]:=#0;
|
|
ca[strlength]:=#0;
|
|
- list.concat(Tai_string.Create_pchar(ca,strlength));
|
|
|
|
|
|
+ hr.list.concat(Tai_string.Create_pchar(ca,strlength));
|
|
{ fillup with spaces if size is shorter }
|
|
{ fillup with spaces if size is shorter }
|
|
if def.size>strlength then
|
|
if def.size>strlength then
|
|
begin
|
|
begin
|
|
@@ -705,69 +712,41 @@ implementation
|
|
fillchar(ca[0],def.size-strlength-1,' ');
|
|
fillchar(ca[0],def.size-strlength-1,' ');
|
|
ca[def.size-strlength-1]:=#0;
|
|
ca[def.size-strlength-1]:=#0;
|
|
{ this can also handle longer strings }
|
|
{ this can also handle longer strings }
|
|
- list.concat(Tai_string.Create_pchar(ca,def.size-strlength-1));
|
|
|
|
|
|
+ hr.list.concat(Tai_string.Create_pchar(ca,def.size-strlength-1));
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
st_ansistring:
|
|
st_ansistring:
|
|
begin
|
|
begin
|
|
{ an empty ansi string is nil! }
|
|
{ an empty ansi string is nil! }
|
|
if (strlength=0) then
|
|
if (strlength=0) then
|
|
- list.concat(Tai_const.Create_sym(nil))
|
|
|
|
|
|
+ ll := nil
|
|
else
|
|
else
|
|
- begin
|
|
|
|
- current_asmdata.getdatalabel(ll);
|
|
|
|
- list.concat(Tai_const.Create_sym(ll));
|
|
|
|
- current_asmdata.getdatalabel(ll2);
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(pint))));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll2));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_pint(-1));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_pint(strlength));
|
|
|
|
- { make sure the string doesn't get dead stripped if the header is referenced }
|
|
|
|
- if (target_info.system in systems_darwin) then
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_directive.create(asd_reference,ll.name));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
|
|
|
|
- { ... and vice versa }
|
|
|
|
- if (target_info.system in systems_darwin) then
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_directive.create(asd_reference,ll2.name));
|
|
|
|
- getmem(ca,strlength+1);
|
|
|
|
- move(strval^,ca^,strlength);
|
|
|
|
- { The terminating #0 to be stored in the .data section (JM) }
|
|
|
|
- ca[strlength]:=#0;
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,strlength+1));
|
|
|
|
- end;
|
|
|
|
|
|
+ ll := emit_ansistring_const(current_asmdata.asmlists[al_const],strval,strlength);
|
|
|
|
+ hr.list.concat(Tai_const.Create_sym(ll));
|
|
end;
|
|
end;
|
|
st_unicodestring,
|
|
st_unicodestring,
|
|
st_widestring:
|
|
st_widestring:
|
|
begin
|
|
begin
|
|
- { an empty ansi string is nil! }
|
|
|
|
|
|
+ { an empty wide/unicode string is nil! }
|
|
if (strlength=0) then
|
|
if (strlength=0) then
|
|
- list.concat(Tai_const.Create_sym(nil))
|
|
|
|
|
|
+ ll := nil
|
|
else
|
|
else
|
|
|
|
+ begin
|
|
|
|
+ winlike := (def.stringtype=st_widestring) and (tf_winlikewidestring in target_info.flags);
|
|
|
|
+ ll := emit_unicodestring_const(current_asmdata.asmlists[al_const],
|
|
|
|
+ strval,
|
|
|
|
+ winlike);
|
|
|
|
+
|
|
|
|
+ { collect global Windows widestrings }
|
|
|
|
+ if winlike and (hr.origsym.owner.symtablelevel <= main_program_level) then
|
|
begin
|
|
begin
|
|
- current_asmdata.getdatalabel(ll);
|
|
|
|
- list.concat(Tai_const.Create_sym(ll));
|
|
|
|
- current_asmdata.getdatalabel(ll2);
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(pint))));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll2));
|
|
|
|
- if (def.stringtype=st_widestring) and (tf_winlikewidestring in target_info.flags) then
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_pint(-1));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_pint(strlength*cwidechartype.size));
|
|
|
|
- end;
|
|
|
|
- { make sure the string doesn't get dead stripped if the header is referenced }
|
|
|
|
- if (target_info.system in systems_darwin) then
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_directive.create(asd_reference,ll.name));
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
|
|
|
|
- { ... and vice versa }
|
|
|
|
- if (target_info.system in systems_darwin) then
|
|
|
|
- current_asmdata.asmlists[al_const].concat(tai_directive.create(asd_reference,ll2.name));
|
|
|
|
- for i:=0 to strlength-1 do
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_16bit(pcompilerwidestring(strval)^.data[i]));
|
|
|
|
- { ending #0 }
|
|
|
|
- current_asmdata.asmlists[al_const].concat(Tai_const.Create_16bit(0))
|
|
|
|
|
|
+ current_asmdata.WideInits.Concat(
|
|
|
|
+ TTCInitItem.Create(hr.origsym, hr.offset, ll)
|
|
|
|
+ );
|
|
|
|
+ ll := nil;
|
|
end;
|
|
end;
|
|
|
|
+ end;
|
|
|
|
+ hr.list.concat(Tai_const.Create_sym(ll));
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
internalerror(200107081);
|
|
internalerror(200107081);
|
|
@@ -838,7 +817,7 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- procedure parse_arraydef(list:tasmlist;def:tarraydef);
|
|
|
|
|
|
+ procedure parse_arraydef(hr:threc;def:tarraydef);
|
|
var
|
|
var
|
|
n : tnode;
|
|
n : tnode;
|
|
i : longint;
|
|
i : longint;
|
|
@@ -851,24 +830,26 @@ implementation
|
|
begin
|
|
begin
|
|
{ Only allow nil initialization }
|
|
{ Only allow nil initialization }
|
|
consume(_NIL);
|
|
consume(_NIL);
|
|
- list.concat(Tai_const.Create_sym(nil));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_sym(nil));
|
|
end
|
|
end
|
|
{ packed array constant }
|
|
{ packed array constant }
|
|
else if is_packed_array(def) and
|
|
else if is_packed_array(def) and
|
|
((def.elepackedbitsize mod 8 <> 0) or
|
|
((def.elepackedbitsize mod 8 <> 0) or
|
|
not ispowerof2(def.elepackedbitsize div 8,i)) then
|
|
not ispowerof2(def.elepackedbitsize div 8,i)) then
|
|
begin
|
|
begin
|
|
- parse_packed_array_def(list,def);
|
|
|
|
|
|
+ parse_packed_array_def(hr.list,def);
|
|
end
|
|
end
|
|
{ normal array const between brackets }
|
|
{ normal array const between brackets }
|
|
else if try_to_consume(_LKLAMMER) then
|
|
else if try_to_consume(_LKLAMMER) then
|
|
begin
|
|
begin
|
|
|
|
+ hr.offset:=0;
|
|
for i:=def.lowrange to def.highrange-1 do
|
|
for i:=def.lowrange to def.highrange-1 do
|
|
begin
|
|
begin
|
|
- read_typed_const_data(list,def.elementdef);
|
|
|
|
|
|
+ read_typed_const_data(hr,def.elementdef);
|
|
|
|
+ Inc(hr.offset,def.elementdef.size);
|
|
consume(_COMMA);
|
|
consume(_COMMA);
|
|
end;
|
|
end;
|
|
- read_typed_const_data(list,def.elementdef);
|
|
|
|
|
|
+ read_typed_const_data(hr,def.elementdef);
|
|
consume(_RKLAMMER);
|
|
consume(_RKLAMMER);
|
|
end
|
|
end
|
|
{ if array of char then we allow also a string }
|
|
{ if array of char then we allow also a string }
|
|
@@ -902,12 +883,12 @@ implementation
|
|
begin
|
|
begin
|
|
if i+1-def.lowrange<=len then
|
|
if i+1-def.lowrange<=len then
|
|
begin
|
|
begin
|
|
- list.concat(Tai_const.Create_8bit(byte(ca^)));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(byte(ca^)));
|
|
inc(ca);
|
|
inc(ca);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
{Fill the remaining positions with #0.}
|
|
{Fill the remaining positions with #0.}
|
|
- list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(0));
|
|
end;
|
|
end;
|
|
n.free;
|
|
n.free;
|
|
end
|
|
end
|
|
@@ -983,7 +964,7 @@ implementation
|
|
n.free;
|
|
n.free;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure parse_recorddef(list:tasmlist;def:trecorddef);
|
|
|
|
|
|
+ procedure parse_recorddef(hr:threc;def:trecorddef);
|
|
var
|
|
var
|
|
n : tnode;
|
|
n : tnode;
|
|
symidx : longint;
|
|
symidx : longint;
|
|
@@ -997,6 +978,7 @@ implementation
|
|
bp : tbitpackedval;
|
|
bp : tbitpackedval;
|
|
error,
|
|
error,
|
|
is_packed: boolean;
|
|
is_packed: boolean;
|
|
|
|
+ startoffset: aint;
|
|
|
|
|
|
procedure handle_stringconstn;
|
|
procedure handle_stringconstn;
|
|
var
|
|
var
|
|
@@ -1005,11 +987,11 @@ implementation
|
|
hs:=strpas(tstringconstnode(n).value_str);
|
|
hs:=strpas(tstringconstnode(n).value_str);
|
|
if string2guid(hs,tmpguid) then
|
|
if string2guid(hs,tmpguid) then
|
|
begin
|
|
begin
|
|
- list.concat(Tai_const.Create_32bit(longint(tmpguid.D1)));
|
|
|
|
- list.concat(Tai_const.Create_16bit(tmpguid.D2));
|
|
|
|
- list.concat(Tai_const.Create_16bit(tmpguid.D3));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_32bit(longint(tmpguid.D1)));
|
|
|
|
+ hr.list.concat(Tai_const.Create_16bit(tmpguid.D2));
|
|
|
|
+ hr.list.concat(Tai_const.Create_16bit(tmpguid.D3));
|
|
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
- list.concat(Tai_const.Create_8bit(tmpguid.D4[i]));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(tmpguid.D4[i]));
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Message(parser_e_improper_guid_syntax);
|
|
Message(parser_e_improper_guid_syntax);
|
|
@@ -1031,11 +1013,11 @@ implementation
|
|
if n.nodetype=guidconstn then
|
|
if n.nodetype=guidconstn then
|
|
begin
|
|
begin
|
|
tmpguid:=tguidconstnode(n).value;
|
|
tmpguid:=tguidconstnode(n).value;
|
|
- list.concat(Tai_const.Create_32bit(longint(tmpguid.D1)));
|
|
|
|
- list.concat(Tai_const.Create_16bit(tmpguid.D2));
|
|
|
|
- list.concat(Tai_const.Create_16bit(tmpguid.D3));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_32bit(longint(tmpguid.D1)));
|
|
|
|
+ hr.list.concat(Tai_const.Create_16bit(tmpguid.D2));
|
|
|
|
+ hr.list.concat(Tai_const.Create_16bit(tmpguid.D3));
|
|
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
for i:=Low(tmpguid.D4) to High(tmpguid.D4) do
|
|
- list.concat(Tai_const.Create_8bit(tmpguid.D4[i]));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(tmpguid.D4[i]));
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Message(parser_e_illegal_expression);
|
|
Message(parser_e_illegal_expression);
|
|
@@ -1071,6 +1053,7 @@ implementation
|
|
sorg:='';
|
|
sorg:='';
|
|
srsym:=tsym(def.symtable.SymList[symidx]);
|
|
srsym:=tsym(def.symtable.SymList[symidx]);
|
|
recsym := nil;
|
|
recsym := nil;
|
|
|
|
+ startoffset:=hr.offset;
|
|
while token<>_RKLAMMER do
|
|
while token<>_RKLAMMER do
|
|
begin
|
|
begin
|
|
s:=pattern;
|
|
s:=pattern;
|
|
@@ -1136,14 +1119,14 @@ implementation
|
|
fillbytes:=tfieldvarsym(srsym).fieldoffset-curroffset
|
|
fillbytes:=tfieldvarsym(srsym).fieldoffset-curroffset
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- flush_packed_value(list,bp);
|
|
|
|
|
|
+ flush_packed_value(hr.list,bp);
|
|
{ curoffset is now aligned to the next byte }
|
|
{ curoffset is now aligned to the next byte }
|
|
curroffset:=align(curroffset,8);
|
|
curroffset:=align(curroffset,8);
|
|
{ offsets are in bits in this case }
|
|
{ offsets are in bits in this case }
|
|
fillbytes:=(tfieldvarsym(srsym).fieldoffset-curroffset) div 8;
|
|
fillbytes:=(tfieldvarsym(srsym).fieldoffset-curroffset) div 8;
|
|
end;
|
|
end;
|
|
for i:=1 to fillbytes do
|
|
for i:=1 to fillbytes do
|
|
- list.concat(Tai_const.Create_8bit(0))
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(0))
|
|
end;
|
|
end;
|
|
|
|
|
|
{ new position }
|
|
{ new position }
|
|
@@ -1160,15 +1143,16 @@ implementation
|
|
begin
|
|
begin
|
|
if is_packed then
|
|
if is_packed then
|
|
begin
|
|
begin
|
|
- flush_packed_value(list,bp);
|
|
|
|
|
|
+ flush_packed_value(hr.list,bp);
|
|
curroffset:=align(curroffset,8);
|
|
curroffset:=align(curroffset,8);
|
|
end;
|
|
end;
|
|
- read_typed_const_data(list,tfieldvarsym(srsym).vardef);
|
|
|
|
|
|
+ hr.offset:=startoffset+tfieldvarsym(srsym).fieldoffset;
|
|
|
|
+ read_typed_const_data(hr,tfieldvarsym(srsym).vardef);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
bp.packedbitsize:=tfieldvarsym(srsym).vardef.packedbitsize;
|
|
bp.packedbitsize:=tfieldvarsym(srsym).vardef.packedbitsize;
|
|
- parse_single_packed_const(list,tfieldvarsym(srsym).vardef,bp);
|
|
|
|
|
|
+ parse_single_packed_const(hr.list,tfieldvarsym(srsym).vardef,bp);
|
|
end;
|
|
end;
|
|
|
|
|
|
{ keep previous field for checking whether whole }
|
|
{ keep previous field for checking whether whole }
|
|
@@ -1201,18 +1185,18 @@ implementation
|
|
fillbytes:=def.size-curroffset
|
|
fillbytes:=def.size-curroffset
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- flush_packed_value(list,bp);
|
|
|
|
|
|
+ flush_packed_value(hr.list,bp);
|
|
curroffset:=align(curroffset,8);
|
|
curroffset:=align(curroffset,8);
|
|
fillbytes:=def.size-(curroffset div 8);
|
|
fillbytes:=def.size-(curroffset div 8);
|
|
end;
|
|
end;
|
|
for i:=1 to fillbytes do
|
|
for i:=1 to fillbytes do
|
|
- list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
consume(_RKLAMMER);
|
|
consume(_RKLAMMER);
|
|
end;
|
|
end;
|
|
|
|
|
|
-
|
|
|
|
- procedure parse_objectdef(list:tasmlist;def:tobjectdef);
|
|
|
|
|
|
+ { note: hr is passed by value }
|
|
|
|
+ procedure parse_objectdef(hr:threc;def:tobjectdef);
|
|
var
|
|
var
|
|
n : tnode;
|
|
n : tnode;
|
|
i : longint;
|
|
i : longint;
|
|
@@ -1222,6 +1206,7 @@ implementation
|
|
curroffset : aint;
|
|
curroffset : aint;
|
|
s,sorg : TIDString;
|
|
s,sorg : TIDString;
|
|
vmtwritten : boolean;
|
|
vmtwritten : boolean;
|
|
|
|
+ startoffset:aint;
|
|
begin
|
|
begin
|
|
{ no support for packed object }
|
|
{ no support for packed object }
|
|
if is_packed_record_or_object(def) then
|
|
if is_packed_record_or_object(def) then
|
|
@@ -1240,7 +1225,7 @@ implementation
|
|
consume_all_until(_SEMICOLON);
|
|
consume_all_until(_SEMICOLON);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- list.concat(Tai_const.Create_sym(nil));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_sym(nil));
|
|
n.free;
|
|
n.free;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
@@ -1254,6 +1239,7 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
consume(_LKLAMMER);
|
|
consume(_LKLAMMER);
|
|
|
|
+ startoffset:=hr.offset;
|
|
curroffset:=0;
|
|
curroffset:=0;
|
|
vmtwritten:=false;
|
|
vmtwritten:=false;
|
|
while token<>_RKLAMMER do
|
|
while token<>_RKLAMMER do
|
|
@@ -1295,8 +1281,8 @@ implementation
|
|
(def.vmt_offset<fieldoffset) then
|
|
(def.vmt_offset<fieldoffset) then
|
|
begin
|
|
begin
|
|
for i:=1 to def.vmt_offset-curroffset do
|
|
for i:=1 to def.vmt_offset-curroffset do
|
|
- list.concat(tai_const.create_8bit(0));
|
|
|
|
- list.concat(tai_const.createname(def.vmt_mangledname,0));
|
|
|
|
|
|
+ hr.list.concat(tai_const.create_8bit(0));
|
|
|
|
+ hr.list.concat(tai_const.createname(def.vmt_mangledname,0));
|
|
{ this is more general }
|
|
{ this is more general }
|
|
curroffset:=def.vmt_offset + sizeof(pint);
|
|
curroffset:=def.vmt_offset + sizeof(pint);
|
|
vmtwritten:=true;
|
|
vmtwritten:=true;
|
|
@@ -1305,13 +1291,14 @@ implementation
|
|
{ if needed fill }
|
|
{ if needed fill }
|
|
if fieldoffset>curroffset then
|
|
if fieldoffset>curroffset then
|
|
for i:=1 to fieldoffset-curroffset do
|
|
for i:=1 to fieldoffset-curroffset do
|
|
- list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
{ new position }
|
|
{ new position }
|
|
curroffset:=fieldoffset+vardef.size;
|
|
curroffset:=fieldoffset+vardef.size;
|
|
|
|
|
|
{ read the data }
|
|
{ read the data }
|
|
- read_typed_const_data(list,vardef);
|
|
|
|
|
|
+ hr.offset:=startoffset+fieldoffset;
|
|
|
|
+ read_typed_const_data(hr,vardef);
|
|
|
|
|
|
if not try_to_consume(_SEMICOLON) then
|
|
if not try_to_consume(_SEMICOLON) then
|
|
break;
|
|
break;
|
|
@@ -1322,16 +1309,17 @@ implementation
|
|
(def.vmt_offset>=curroffset) then
|
|
(def.vmt_offset>=curroffset) then
|
|
begin
|
|
begin
|
|
for i:=1 to def.vmt_offset-curroffset do
|
|
for i:=1 to def.vmt_offset-curroffset do
|
|
- list.concat(tai_const.create_8bit(0));
|
|
|
|
- list.concat(tai_const.createname(def.vmt_mangledname,0));
|
|
|
|
|
|
+ hr.list.concat(tai_const.create_8bit(0));
|
|
|
|
+ hr.list.concat(tai_const.createname(def.vmt_mangledname,0));
|
|
{ this is more general }
|
|
{ this is more general }
|
|
curroffset:=def.vmt_offset + sizeof(pint);
|
|
curroffset:=def.vmt_offset + sizeof(pint);
|
|
end;
|
|
end;
|
|
for i:=1 to def.size-curroffset do
|
|
for i:=1 to def.size-curroffset do
|
|
- list.concat(Tai_const.Create_8bit(0));
|
|
|
|
|
|
+ hr.list.concat(Tai_const.Create_8bit(0));
|
|
consume(_RKLAMMER);
|
|
consume(_RKLAMMER);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ procedure read_typed_const_data(var hr:threc;def:tdef);
|
|
var
|
|
var
|
|
old_block_type : tblock_type;
|
|
old_block_type : tblock_type;
|
|
begin
|
|
begin
|
|
@@ -1339,27 +1327,27 @@ implementation
|
|
block_type:=bt_const;
|
|
block_type:=bt_const;
|
|
case def.typ of
|
|
case def.typ of
|
|
orddef :
|
|
orddef :
|
|
- parse_orddef(list,torddef(def));
|
|
|
|
|
|
+ parse_orddef(hr.list,torddef(def));
|
|
floatdef :
|
|
floatdef :
|
|
- parse_floatdef(list,tfloatdef(def));
|
|
|
|
|
|
+ parse_floatdef(hr.list,tfloatdef(def));
|
|
classrefdef :
|
|
classrefdef :
|
|
- parse_classrefdef(list,tclassrefdef(def));
|
|
|
|
|
|
+ parse_classrefdef(hr.list,tclassrefdef(def));
|
|
pointerdef :
|
|
pointerdef :
|
|
- parse_pointerdef(list,tpointerdef(def));
|
|
|
|
|
|
+ parse_pointerdef(hr.list,tpointerdef(def));
|
|
setdef :
|
|
setdef :
|
|
- parse_setdef(list,tsetdef(def));
|
|
|
|
|
|
+ parse_setdef(hr.list,tsetdef(def));
|
|
enumdef :
|
|
enumdef :
|
|
- parse_enumdef(list,tenumdef(def));
|
|
|
|
|
|
+ parse_enumdef(hr.list,tenumdef(def));
|
|
stringdef :
|
|
stringdef :
|
|
- parse_stringdef(list,tstringdef(def));
|
|
|
|
|
|
+ parse_stringdef(hr,tstringdef(def));
|
|
arraydef :
|
|
arraydef :
|
|
- parse_arraydef(list,tarraydef(def));
|
|
|
|
|
|
+ parse_arraydef(hr,tarraydef(def));
|
|
procvardef:
|
|
procvardef:
|
|
- parse_procvardef(list,tprocvardef(def));
|
|
|
|
|
|
+ parse_procvardef(hr.list,tprocvardef(def));
|
|
recorddef:
|
|
recorddef:
|
|
- parse_recorddef(list,trecorddef(def));
|
|
|
|
|
|
+ parse_recorddef(hr,trecorddef(def));
|
|
objectdef:
|
|
objectdef:
|
|
- parse_objectdef(list,tobjectdef(def));
|
|
|
|
|
|
+ parse_objectdef(hr,tobjectdef(def));
|
|
errordef:
|
|
errordef:
|
|
begin
|
|
begin
|
|
{ try to consume something useful }
|
|
{ try to consume something useful }
|
|
@@ -1380,7 +1368,7 @@ implementation
|
|
var
|
|
var
|
|
storefilepos : tfileposinfo;
|
|
storefilepos : tfileposinfo;
|
|
cursectype : TAsmSectionType;
|
|
cursectype : TAsmSectionType;
|
|
- valuelist : tasmlist;
|
|
|
|
|
|
+ hrec : threc;
|
|
begin
|
|
begin
|
|
{ mark the staticvarsym as typedconst }
|
|
{ mark the staticvarsym as typedconst }
|
|
include(sym.varoptions,vo_is_typed_const);
|
|
include(sym.varoptions,vo_is_typed_const);
|
|
@@ -1397,8 +1385,10 @@ implementation
|
|
else
|
|
else
|
|
cursectype:=sec_data;
|
|
cursectype:=sec_data;
|
|
maybe_new_object_file(list);
|
|
maybe_new_object_file(list);
|
|
- valuelist:=tasmlist.create;
|
|
|
|
- read_typed_const_data(valuelist,sym.vardef);
|
|
|
|
|
|
+ hrec.list:=tasmlist.create;
|
|
|
|
+ hrec.origsym:=sym;
|
|
|
|
+ hrec.offset:=0;
|
|
|
|
+ read_typed_const_data(hrec,sym.vardef);
|
|
|
|
|
|
{ Parse hints }
|
|
{ Parse hints }
|
|
try_consume_hintdirective(sym.symoptions,sym.deprecatedmsg);
|
|
try_consume_hintdirective(sym.symoptions,sym.deprecatedmsg);
|
|
@@ -1435,8 +1425,8 @@ implementation
|
|
list.concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,0));
|
|
list.concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,0));
|
|
|
|
|
|
{ add the parsed value }
|
|
{ add the parsed value }
|
|
- list.concatlist(valuelist);
|
|
|
|
- valuelist.free;
|
|
|
|
|
|
+ list.concatlist(hrec.list);
|
|
|
|
+ hrec.list.free;
|
|
list.concat(tai_symbol_end.Createname(sym.mangledname));
|
|
list.concat(tai_symbol_end.Createname(sym.mangledname));
|
|
current_filepos:=storefilepos;
|
|
current_filepos:=storefilepos;
|
|
end;
|
|
end;
|