From 6a4afd3a333a99f6ea82d58e59834e2071b4d466 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 2 Feb 2014 09:09:51 +0000 Subject: [PATCH] * changed uses of "exit" in constructors to if/then constructs, to avoid the constructor result/SSA bug in 2.6.x git-svn-id: trunk@26651 - --- compiler/x86_64/nx64flw.pas | 70 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/compiler/x86_64/nx64flw.pas b/compiler/x86_64/nx64flw.pas index 3323dd90c1..3b1eac9380 100644 --- a/compiler/x86_64/nx64flw.pas +++ b/compiler/x86_64/nx64flw.pas @@ -159,51 +159,53 @@ function copy_parasize(var n: tnode; arg: pointer): foreachnoderesult; constructor tx64tryfinallynode.create(l, r: TNode); begin inherited create(l,r); - if (target_info.system<>system_x86_64_win64) or ( + if (target_info.system=system_x86_64_win64) and + ( { Don't create child procedures for generic methods, their nested-like behavior causes compilation errors because real nested procedures aren't allowed for generics. Not creating them doesn't harm because generic node tree is discarded without generating code. } - assigned(current_procinfo.procdef.struct) and - (df_generic in current_procinfo.procdef.struct.defoptions) - ) then - exit; - finalizepi:=tcgprocinfo(cprocinfo.create(current_procinfo)); - finalizepi.force_nested; - finalizepi.procdef:=create_finalizer_procdef; - finalizepi.entrypos:=r.fileinfo; - finalizepi.entryswitches:=r.localswitches; - finalizepi.exitpos:=current_filepos; // last_endtoken_pos? - finalizepi.exitswitches:=current_settings.localswitches; - { the init/final code is messing with asm nodes, so inform the compiler about this } - include(finalizepi.flags,pi_has_assembler_block); - { Regvar optimization for symbols is suppressed when using exceptions, but - temps may be still placed into registers. This must be fixed. } - foreachnodestatic(r,@reset_regvars,finalizepi); + not assigned(current_procinfo.procdef.struct) or + not(df_generic in current_procinfo.procdef.struct.defoptions) + ) then + begin + finalizepi:=tcgprocinfo(cprocinfo.create(current_procinfo)); + finalizepi.force_nested; + finalizepi.procdef:=create_finalizer_procdef; + finalizepi.entrypos:=r.fileinfo; + finalizepi.entryswitches:=r.localswitches; + finalizepi.exitpos:=current_filepos; // last_endtoken_pos? + finalizepi.exitswitches:=current_settings.localswitches; + { the init/final code is messing with asm nodes, so inform the compiler about this } + include(finalizepi.flags,pi_has_assembler_block); + { Regvar optimization for symbols is suppressed when using exceptions, but + temps may be still placed into registers. This must be fixed. } + foreachnodestatic(r,@reset_regvars,finalizepi); + end; end; constructor tx64tryfinallynode.create_implicit(l, r, _t1: TNode); begin inherited create_implicit(l, r, _t1); - if (target_info.system<>system_x86_64_win64) then - exit; + if (target_info.system=system_x86_64_win64) then + begin + if assigned(current_procinfo.procdef.struct) and + (df_generic in current_procinfo.procdef.struct.defoptions) then + InternalError(2013012501); - if assigned(current_procinfo.procdef.struct) and - (df_generic in current_procinfo.procdef.struct.defoptions) then - InternalError(2013012501); + finalizepi:=tcgprocinfo(cprocinfo.create(current_procinfo)); + finalizepi.force_nested; + finalizepi.procdef:=create_finalizer_procdef; - finalizepi:=tcgprocinfo(cprocinfo.create(current_procinfo)); - finalizepi.force_nested; - finalizepi.procdef:=create_finalizer_procdef; - - finalizepi.entrypos:=current_filepos; - finalizepi.exitpos:=current_filepos; // last_endtoken_pos? - finalizepi.entryswitches:=r.localswitches; - finalizepi.exitswitches:=current_settings.localswitches; - include(finalizepi.flags,pi_do_call); - { the init/final code is messing with asm nodes, so inform the compiler about this } - include(finalizepi.flags,pi_has_assembler_block); - finalizepi.allocate_push_parasize(32); + finalizepi.entrypos:=current_filepos; + finalizepi.exitpos:=current_filepos; // last_endtoken_pos? + finalizepi.entryswitches:=r.localswitches; + finalizepi.exitswitches:=current_settings.localswitches; + include(finalizepi.flags,pi_do_call); + { the init/final code is messing with asm nodes, so inform the compiler about this } + include(finalizepi.flags,pi_has_assembler_block); + finalizepi.allocate_push_parasize(32); + end; end; function tx64tryfinallynode.simplify(forinline: boolean): tnode;