mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 19:10:14 +02:00
* fix compiling binaries on JVM: the entries list contains pinitfinalentry values, not tused_unit
This commit is contained in:
parent
1202b2612f
commit
366acce9ef
@ -390,35 +390,33 @@ implementation
|
|||||||
class procedure tjvmnodeutils.insert_init_final_table(main: tmodule; entries:tfplist);
|
class procedure tjvmnodeutils.insert_init_final_table(main: tmodule; entries:tfplist);
|
||||||
|
|
||||||
var
|
var
|
||||||
hp : tused_unit;
|
|
||||||
unitinits : TAsmList;
|
unitinits : TAsmList;
|
||||||
unitclassname: string;
|
unitclassname: string;
|
||||||
mainpsym: tsym;
|
mainpsym: tsym;
|
||||||
mainpd: tprocdef;
|
mainpd: tprocdef;
|
||||||
m : tmodule;
|
|
||||||
i : integer;
|
i : integer;
|
||||||
|
entry : pinitfinalentry;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
unitinits:=TAsmList.Create;
|
unitinits:=TAsmList.Create;
|
||||||
for I:=0 to entries.Count-1 do
|
for I:=0 to entries.Count-1 do
|
||||||
begin
|
begin
|
||||||
hp:=tused_unit(entries[i]);
|
entry:=pinitfinalentry(entries[i]);
|
||||||
m:=hp.u;
|
|
||||||
{ class constructors are automatically handled by the JVM }
|
{ class constructors are automatically handled by the JVM }
|
||||||
|
|
||||||
{ for non-main module, call the unit init code and make it external }
|
{ for non-main module, call the unit init code and make it external }
|
||||||
if (m<>main) and ((m.moduleflags*[mf_init,mf_finalize])<>[]) then
|
if (entry^.module<>main) and ((entry^.initfunc<>'') or (entry^.finifunc<>'')) then
|
||||||
begin
|
begin
|
||||||
{ trigger init code by referencing the class representing the
|
{ trigger init code by referencing the class representing the
|
||||||
unit; if necessary, it will register the fini code to run on
|
unit; if necessary, it will register the fini code to run on
|
||||||
exit}
|
exit}
|
||||||
unitclassname:='';
|
unitclassname:='';
|
||||||
if assigned(hp.u.namespace) then
|
if assigned(entry^.module.namespace) then
|
||||||
begin
|
begin
|
||||||
unitclassname:=hp.u.namespace^+'/';
|
unitclassname:=entry^.module.namespace^+'/';
|
||||||
replace(unitclassname,'.','/');
|
replace(unitclassname,'.','/');
|
||||||
end;
|
end;
|
||||||
unitclassname:=unitclassname+hp.u.realmodulename^;
|
unitclassname:=unitclassname+entry^.module.realmodulename^;
|
||||||
unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname,AT_METADATA)));
|
unitinits.concat(taicpu.op_sym(a_new,current_asmdata.RefAsmSymbol(unitclassname,AT_METADATA)));
|
||||||
unitinits.concat(taicpu.op_none(a_pop));
|
unitinits.concat(taicpu.op_none(a_pop));
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user