* tarraydef.create_from_pointer changed to require the actual pointerdef as a

parameter, instead of the element def. This will allow e.g. creating huge
  arrays from huge pointers on i8086.

git-svn-id: trunk@28268 -
This commit is contained in:
nickysn 2014-07-26 10:39:18 +00:00
parent d46ae01589
commit e6c5c35d65
3 changed files with 17 additions and 13 deletions

View File

@ -457,7 +457,7 @@ implementation
if hp.resultdef.typ<>pointerdef then
internalerror(2010061904);
inserttypeconv(hp,
carraydef.create_from_pointer(tpointerdef(hp.resultdef).pointeddef));
carraydef.create_from_pointer(tpointerdef(hp.resultdef)));
hp:=cvecnode.create(hp,ctemprefnode.create(innerloopcounter));
addstatement(innerloopbodystatement,
cassignmentnode.create(hloopvar,hp));

View File

@ -833,7 +833,7 @@ implementation
function tvecnode.pass_typecheck:tnode;
var
hightree: tnode;
htype,elementdef : tdef;
htype,elementdef,elementptrdef : tdef;
newordtyp: tordtype;
valid : boolean;
begin
@ -1014,7 +1014,7 @@ implementation
) then
begin
{ convert pointer to array }
htype:=carraydef.create_from_pointer(tpointerdef(left.resultdef).pointeddef);
htype:=carraydef.create_from_pointer(tpointerdef(left.resultdef));
inserttypeconv(left,htype);
if right.nodetype=rangen then
resultdef:=htype
@ -1029,19 +1029,23 @@ implementation
case tstringdef(left.resultdef).stringtype of
st_unicodestring,
st_widestring :
elementdef:=cwidechartype;
st_ansistring :
elementdef:=cansichartype;
st_longstring :
elementdef:=cansichartype;
begin
elementdef:=cwidechartype;
elementptrdef:=widecharpointertype;
end;
st_ansistring,
st_longstring,
st_shortstring :
elementdef:=cansichartype;
begin
elementdef:=cansichartype;
elementptrdef:=charpointertype;
end;
else
internalerror(2013112902);
end;
if right.nodetype=rangen then
begin
htype:=carraydef.create_from_pointer(elementdef);
htype:=carraydef.create_from_pointer(tpointerdef(elementptrdef));
resultdef:=htype;
end
else

View File

@ -479,7 +479,7 @@ interface
function elesize : asizeint;
function elepackedbitsize : asizeint;
function elecount : asizeuint;
constructor create_from_pointer(def:tdef);virtual;
constructor create_from_pointer(def:tpointerdef);virtual;
constructor create(l,h:asizeint;def:tdef);virtual;
constructor ppuload(ppufile:tcompilerppufile);
destructor destroy; override;
@ -3408,12 +3408,12 @@ implementation
inherited;
end;
constructor tarraydef.create_from_pointer(def:tdef);
constructor tarraydef.create_from_pointer(def:tpointerdef);
begin
{ use -1 so that the elecount will not overflow }
self.create(0,high(asizeint)-1,ptrsinttype);
arrayoptions:=[ado_IsConvertedPointer];
setelementdef(def);
setelementdef(def.pointeddef);
end;