mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 21:49:24 +01:00
* wrap the init/finalization code even when it is implicitly generated
* only wrap the init/finalization code after the main program has been
completely processed (pass1, codegen), because this may influence
the required wrapping in case of the JVM target
* replace periods with slashes in the package name when constructing
the classes corresponding to the units (to execute their initialization
code) -- didn't notice this was wrong previously because due to the
incomplete wrapping, they were never being initialized until now
git-svn-id: branches/jvmbackend@18645 -
This commit is contained in:
parent
466f6751c8
commit
2376003cd0
@ -54,7 +54,7 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
verbose,globals,constexp,fmodule,
|
verbose,cutils,globals,constexp,fmodule,
|
||||||
aasmdata,aasmtai,cpubase,aasmcpu,
|
aasmdata,aasmtai,cpubase,aasmcpu,
|
||||||
symdef,symbase,symtable,defutil,jvmdef,
|
symdef,symbase,symtable,defutil,jvmdef,
|
||||||
nbas,ncnv,ncon,ninl,ncal,
|
nbas,ncnv,ncon,ninl,ncal,
|
||||||
@ -157,7 +157,10 @@ implementation
|
|||||||
exit}
|
exit}
|
||||||
unitclassname:='';
|
unitclassname:='';
|
||||||
if assigned(hp.u.namespace) then
|
if assigned(hp.u.namespace) then
|
||||||
unitclassname:=hp.u.namespace^+'.';
|
begin
|
||||||
|
unitclassname:=hp.u.namespace^+'/';
|
||||||
|
replace(unitclassname,'.','/');
|
||||||
|
end;
|
||||||
unitclassname:=unitclassname+hp.u.realmodulename^;
|
unitclassname:=unitclassname+hp.u.realmodulename^;
|
||||||
unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname)));
|
unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname)));
|
||||||
unitinits.concat(taicpu.op_none(a_pop));
|
unitinits.concat(taicpu.op_none(a_pop));
|
||||||
|
|||||||
@ -954,12 +954,14 @@ implementation
|
|||||||
a register that is also used in the finalize body (PFV) }
|
a register that is also used in the finalize body (PFV) }
|
||||||
if assigned(init_procinfo) then
|
if assigned(init_procinfo) then
|
||||||
begin
|
begin
|
||||||
|
init_procinfo.code:=cnodeutils.wrap_proc_body(init_procinfo.procdef,init_procinfo.code);
|
||||||
init_procinfo.generate_code;
|
init_procinfo.generate_code;
|
||||||
init_procinfo.resetprocdef;
|
init_procinfo.resetprocdef;
|
||||||
release_main_proc(init_procinfo);
|
release_main_proc(init_procinfo);
|
||||||
end;
|
end;
|
||||||
if assigned(finalize_procinfo) then
|
if assigned(finalize_procinfo) then
|
||||||
begin
|
begin
|
||||||
|
finalize_procinfo.code:=cnodeutils.wrap_proc_body(finalize_procinfo.procdef,finalize_procinfo.code);
|
||||||
finalize_procinfo.generate_code;
|
finalize_procinfo.generate_code;
|
||||||
finalize_procinfo.resetprocdef;
|
finalize_procinfo.resetprocdef;
|
||||||
release_main_proc(finalize_procinfo);
|
release_main_proc(finalize_procinfo);
|
||||||
@ -1889,12 +1891,14 @@ implementation
|
|||||||
release_main_proc(main_procinfo);
|
release_main_proc(main_procinfo);
|
||||||
if assigned(init_procinfo) then
|
if assigned(init_procinfo) then
|
||||||
begin
|
begin
|
||||||
|
init_procinfo.code:=cnodeutils.wrap_proc_body(init_procinfo.procdef,init_procinfo.code);
|
||||||
init_procinfo.generate_code;
|
init_procinfo.generate_code;
|
||||||
init_procinfo.resetprocdef;
|
init_procinfo.resetprocdef;
|
||||||
release_main_proc(init_procinfo);
|
release_main_proc(init_procinfo);
|
||||||
end;
|
end;
|
||||||
if assigned(finalize_procinfo) then
|
if assigned(finalize_procinfo) then
|
||||||
begin
|
begin
|
||||||
|
finalize_procinfo.code:=cnodeutils.wrap_proc_body(finalize_procinfo.procdef,finalize_procinfo.code);
|
||||||
finalize_procinfo.generate_code;
|
finalize_procinfo.generate_code;
|
||||||
finalize_procinfo.resetprocdef;
|
finalize_procinfo.resetprocdef;
|
||||||
release_main_proc(finalize_procinfo);
|
release_main_proc(finalize_procinfo);
|
||||||
|
|||||||
@ -269,7 +269,10 @@ implementation
|
|||||||
finish_parentfpstruct(current_procinfo.procdef);
|
finish_parentfpstruct(current_procinfo.procdef);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
block:=cnodeutils.wrap_proc_body(current_procinfo.procdef,block);
|
{ init/final code must be wrapped later (after code for main proc body
|
||||||
|
has been generated }
|
||||||
|
if not(current_procinfo.procdef.proctypeoption in [potype_unitinit,potype_unitfinalize]) then
|
||||||
|
block:=cnodeutils.wrap_proc_body(current_procinfo.procdef,block);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user