|
@@ -731,9 +731,10 @@ implementation
|
|
if not p^.cargs then
|
|
if not p^.cargs then
|
|
begin
|
|
begin
|
|
reset_reference(p^.location.reference);
|
|
reset_reference(p^.location.reference);
|
|
|
|
+ { Allocate always a temp, also if no elements are required, to
|
|
|
|
+ ensure that location is valid (PFV) }
|
|
if parraydef(p^.resulttype)^.highrange=-1 then
|
|
if parraydef(p^.resulttype)^.highrange=-1 then
|
|
- begin
|
|
|
|
- end
|
|
|
|
|
|
+ gettempofsizereference(8,p^.location.reference)
|
|
else
|
|
else
|
|
gettempofsizereference((parraydef(p^.resulttype)^.highrange+1)*8,p^.location.reference);
|
|
gettempofsizereference((parraydef(p^.resulttype)^.highrange+1)*8,p^.location.reference);
|
|
href:=p^.location.reference;
|
|
href:=p^.location.reference;
|
|
@@ -741,80 +742,89 @@ implementation
|
|
hp:=p;
|
|
hp:=p;
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|
|
begin
|
|
begin
|
|
- secondpass(hp^.left);
|
|
|
|
- if codegenerror then
|
|
|
|
- exit;
|
|
|
|
- { find the correct vtype value }
|
|
|
|
- vtype:=$ff;
|
|
|
|
- vaddr:=false;
|
|
|
|
- lt:=hp^.left^.resulttype;
|
|
|
|
- case lt^.deftype of
|
|
|
|
- enumdef,
|
|
|
|
- orddef : begin
|
|
|
|
- if (lt^.deftype=enumdef) or
|
|
|
|
- is_integer(lt) then
|
|
|
|
- vtype:=vtInteger
|
|
|
|
- else
|
|
|
|
- if is_boolean(lt) then
|
|
|
|
- vtype:=vtBoolean
|
|
|
|
- else
|
|
|
|
|
|
+ if assigned(hp^.left) then
|
|
|
|
+ begin
|
|
|
|
+ secondpass(hp^.left);
|
|
|
|
+ if codegenerror then
|
|
|
|
+ exit;
|
|
|
|
+ { find the correct vtype value }
|
|
|
|
+ vtype:=$ff;
|
|
|
|
+ vaddr:=false;
|
|
|
|
+ lt:=hp^.left^.resulttype;
|
|
|
|
+ case lt^.deftype of
|
|
|
|
+ enumdef,
|
|
|
|
+ orddef :
|
|
|
|
+ begin
|
|
|
|
+ if (lt^.deftype=enumdef) or
|
|
|
|
+ is_integer(lt) then
|
|
|
|
+ vtype:=vtInteger
|
|
|
|
+ else
|
|
|
|
+ if is_boolean(lt) then
|
|
|
|
+ vtype:=vtBoolean
|
|
|
|
+ else
|
|
if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then
|
|
if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then
|
|
- vtype:=vtChar;
|
|
|
|
- end;
|
|
|
|
- floatdef : begin
|
|
|
|
- vtype:=vtExtended;
|
|
|
|
|
|
+ vtype:=vtChar;
|
|
|
|
+ end;
|
|
|
|
+ floatdef :
|
|
|
|
+ begin
|
|
|
|
+ vtype:=vtExtended;
|
|
|
|
+ vaddr:=true;
|
|
|
|
+ end;
|
|
|
|
+ procvardef,
|
|
|
|
+ pointerdef :
|
|
|
|
+ begin
|
|
|
|
+ if is_pchar(lt) then
|
|
|
|
+ vtype:=vtPChar
|
|
|
|
+ else
|
|
|
|
+ vtype:=vtPointer;
|
|
|
|
+ end;
|
|
|
|
+ classrefdef :
|
|
|
|
+ vtype:=vtClass;
|
|
|
|
+ objectdef :
|
|
|
|
+ begin
|
|
|
|
+ vtype:=vtObject;
|
|
|
|
+ end;
|
|
|
|
+ stringdef :
|
|
|
|
+ begin
|
|
|
|
+ if is_shortstring(lt) then
|
|
|
|
+ begin
|
|
|
|
+ vtype:=vtString;
|
|
vaddr:=true;
|
|
vaddr:=true;
|
|
- end;
|
|
|
|
- procvardef,
|
|
|
|
- pointerdef : begin
|
|
|
|
- if is_pchar(lt) then
|
|
|
|
- vtype:=vtPChar
|
|
|
|
- else
|
|
|
|
- vtype:=vtPointer;
|
|
|
|
- end;
|
|
|
|
- classrefdef : vtype:=vtClass;
|
|
|
|
- objectdef : begin
|
|
|
|
- vtype:=vtObject;
|
|
|
|
- end;
|
|
|
|
- stringdef : begin
|
|
|
|
- if is_shortstring(lt) then
|
|
|
|
- begin
|
|
|
|
- vtype:=vtString;
|
|
|
|
- vaddr:=true;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- if is_ansistring(lt) then
|
|
|
|
- vtype:=vtAnsiString;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- if vtype=$ff then
|
|
|
|
- internalerror(14357);
|
|
|
|
- { write C style pushes or an pascal array }
|
|
|
|
- if p^.cargs then
|
|
|
|
- begin
|
|
|
|
- if vaddr then
|
|
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ if is_ansistring(lt) then
|
|
|
|
+ vtype:=vtAnsiString;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ if vtype=$ff then
|
|
|
|
+ internalerror(14357);
|
|
|
|
+ { write C style pushes or an pascal array }
|
|
|
|
+ if p^.cargs then
|
|
begin
|
|
begin
|
|
- emit_to_reference(hp^.left);
|
|
|
|
- emit_push_lea_loc(hp^.left^.location);
|
|
|
|
|
|
+ if vaddr then
|
|
|
|
+ begin
|
|
|
|
+ emit_to_reference(hp^.left);
|
|
|
|
+ emit_push_lea_loc(hp^.left^.location);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ emit_push_loc(hp^.left^.location);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- emit_push_loc(hp^.left^.location);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- { update href to the vtype field and write it }
|
|
|
|
- exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,
|
|
|
|
- vtype,newreference(href))));
|
|
|
|
- inc(href.offset,4);
|
|
|
|
- { write changing field update href to the next element }
|
|
|
|
- if vaddr then
|
|
|
|
begin
|
|
begin
|
|
- emit_to_reference(hp^.left);
|
|
|
|
- emit_lea_loc_ref(hp^.left^.location,href);
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- emit_mov_loc_ref(hp^.left^.location,href);
|
|
|
|
- inc(href.offset,4);
|
|
|
|
|
|
+ { update href to the vtype field and write it }
|
|
|
|
+ exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,
|
|
|
|
+ vtype,newreference(href))));
|
|
|
|
+ inc(href.offset,4);
|
|
|
|
+ { write changing field update href to the next element }
|
|
|
|
+ if vaddr then
|
|
|
|
+ begin
|
|
|
|
+ emit_to_reference(hp^.left);
|
|
|
|
+ emit_lea_loc_ref(hp^.left^.location,href);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ emit_mov_loc_ref(hp^.left^.location,href);
|
|
|
|
+ inc(href.offset,4);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
{ load next entry }
|
|
{ load next entry }
|
|
hp:=hp^.right;
|
|
hp:=hp^.right;
|
|
@@ -825,7 +835,10 @@ implementation
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.59 1999-05-27 19:44:14 peter
|
|
|
|
|
|
+ Revision 1.60 1999-05-31 12:42:43 peter
|
|
|
|
+ * fixed crash with empty array constructor
|
|
|
|
+
|
|
|
|
+ Revision 1.59 1999/05/27 19:44:14 peter
|
|
* removed oldasm
|
|
* removed oldasm
|
|
* plabel -> pasmlabel
|
|
* plabel -> pasmlabel
|
|
* -a switches to source writing automaticly
|
|
* -a switches to source writing automaticly
|