|
@@ -373,11 +373,16 @@ implementation
|
|
if assigned(srsym) and
|
|
if assigned(srsym) and
|
|
(srsym.typ=procsym) then
|
|
(srsym.typ=procsym) then
|
|
begin
|
|
begin
|
|
- { if vmt<>0 then afterconstruction }
|
|
|
|
|
|
+ { Self can be nil when fail is called }
|
|
|
|
+ { if self<>nil and vmt<>nil then afterconstruction }
|
|
addstatement(newstatement,cifnode.create(
|
|
addstatement(newstatement,cifnode.create(
|
|
- caddnode.create(unequaln,
|
|
|
|
- load_vmt_pointer_node,
|
|
|
|
- cnilnode.create),
|
|
|
|
|
|
+ caddnode.create(andn,
|
|
|
|
+ caddnode.create(unequaln,
|
|
|
|
+ load_self_pointer_node,
|
|
|
|
+ cnilnode.create),
|
|
|
|
+ caddnode.create(unequaln,
|
|
|
|
+ load_vmt_pointer_node,
|
|
|
|
+ cnilnode.create)),
|
|
ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node),
|
|
ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node),
|
|
nil));
|
|
nil));
|
|
end
|
|
end
|
|
@@ -499,7 +504,7 @@ implementation
|
|
|
|
|
|
procedure tcgprocinfo.add_entry_exit_code;
|
|
procedure tcgprocinfo.add_entry_exit_code;
|
|
var
|
|
var
|
|
- trycode,
|
|
|
|
|
|
+ finalcode,
|
|
bodyentrycode,
|
|
bodyentrycode,
|
|
bodyexitcode,
|
|
bodyexitcode,
|
|
exceptcode : tnode;
|
|
exceptcode : tnode;
|
|
@@ -534,9 +539,9 @@ implementation
|
|
aktfilepos:=exitpos;
|
|
aktfilepos:=exitpos;
|
|
exceptcode:=generate_except_block;
|
|
exceptcode:=generate_except_block;
|
|
{ Generate code that will be in the try...finally }
|
|
{ Generate code that will be in the try...finally }
|
|
- trycode:=internalstatements(codestatement,true);
|
|
|
|
- addstatement(codestatement,code);
|
|
|
|
|
|
+ finalcode:=internalstatements(codestatement,true);
|
|
addstatement(codestatement,bodyexitcode);
|
|
addstatement(codestatement,bodyexitcode);
|
|
|
|
+ addstatement(codestatement,final_asmnode);
|
|
{ Initialize before try...finally...end frame }
|
|
{ Initialize before try...finally...end frame }
|
|
addstatement(newstatement,entry_asmnode);
|
|
addstatement(newstatement,entry_asmnode);
|
|
addstatement(newstatement,loadpara_asmnode);
|
|
addstatement(newstatement,loadpara_asmnode);
|
|
@@ -544,8 +549,8 @@ implementation
|
|
addstatement(newstatement,bodyentrycode);
|
|
addstatement(newstatement,bodyentrycode);
|
|
aktfilepos:=entrypos;
|
|
aktfilepos:=entrypos;
|
|
addstatement(newstatement,ctryfinallynode.create_implicit(
|
|
addstatement(newstatement,ctryfinallynode.create_implicit(
|
|
- trycode,
|
|
|
|
- final_asmnode,
|
|
|
|
|
|
+ code,
|
|
|
|
+ finalcode,
|
|
exceptcode));
|
|
exceptcode));
|
|
addstatement(newstatement,exitlabel_asmnode);
|
|
addstatement(newstatement,exitlabel_asmnode);
|
|
end
|
|
end
|
|
@@ -556,8 +561,8 @@ implementation
|
|
addstatement(newstatement,init_asmnode);
|
|
addstatement(newstatement,init_asmnode);
|
|
addstatement(newstatement,bodyentrycode);
|
|
addstatement(newstatement,bodyentrycode);
|
|
addstatement(newstatement,code);
|
|
addstatement(newstatement,code);
|
|
- addstatement(newstatement,bodyexitcode);
|
|
|
|
addstatement(newstatement,exitlabel_asmnode);
|
|
addstatement(newstatement,exitlabel_asmnode);
|
|
|
|
+ addstatement(newstatement,bodyexitcode);
|
|
addstatement(newstatement,final_asmnode);
|
|
addstatement(newstatement,final_asmnode);
|
|
end;
|
|
end;
|
|
resulttypepass(newblock);
|
|
resulttypepass(newblock);
|
|
@@ -1303,7 +1308,10 @@ implementation
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.168 2003-10-30 16:22:40 peter
|
|
|
|
|
|
+ Revision 1.169 2003-10-31 15:52:18 peter
|
|
|
|
+ * fix crash with fail in constructor
|
|
|
|
+
|
|
|
|
+ Revision 1.168 2003/10/30 16:22:40 peter
|
|
* call firstpass before allocation and codegeneration is started
|
|
* call firstpass before allocation and codegeneration is started
|
|
* move leftover code from pass_2.generatecode() to psub
|
|
* move leftover code from pass_2.generatecode() to psub
|
|
|
|
|