mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
* converted gen_stack_check_call() to the high level code generator
git-svn-id: trunk@33990 -
This commit is contained in:
parent
4121facc7a
commit
98ac6c4797
@ -631,6 +631,8 @@ unit hlcgobj;
|
|||||||
procedure gen_load_return_value(list:TAsmList);virtual;
|
procedure gen_load_return_value(list:TAsmList);virtual;
|
||||||
|
|
||||||
{ extras refactored from other units }
|
{ extras refactored from other units }
|
||||||
|
procedure gen_stack_check_size_para(list:TAsmList); virtual;
|
||||||
|
procedure gen_stack_check_call(list:TAsmList); virtual;
|
||||||
|
|
||||||
{ queue the code/data generated for a procedure for writing out to
|
{ queue the code/data generated for a procedure for writing out to
|
||||||
the assembler/object file }
|
the assembler/object file }
|
||||||
@ -5191,6 +5193,35 @@ implementation
|
|||||||
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside])
|
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure thlcgobj.gen_stack_check_size_para(list: TAsmList);
|
||||||
|
var
|
||||||
|
paraloc1 : tcgpara;
|
||||||
|
pd : tprocdef;
|
||||||
|
begin
|
||||||
|
pd:=search_system_proc('fpc_stackcheck');
|
||||||
|
paraloc1.init;
|
||||||
|
paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,paraloc1);
|
||||||
|
hlcg.a_load_const_cgpara(list,paraloc1.def,current_procinfo.calc_stackframe_size,paraloc1);
|
||||||
|
paramanager.freecgpara(list,paraloc1);
|
||||||
|
paraloc1.done;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure thlcgobj.gen_stack_check_call(list: TAsmList);
|
||||||
|
var
|
||||||
|
paraloc1 : tcgpara;
|
||||||
|
pd : tprocdef;
|
||||||
|
begin
|
||||||
|
pd:=search_system_proc('fpc_stackcheck');
|
||||||
|
paraloc1.init;
|
||||||
|
{ The parameter to fpc_stackcheck is loaded seperately via
|
||||||
|
gen_stack_check_size_para() }
|
||||||
|
paramanager.getintparaloc(list,pd,1,paraloc1);
|
||||||
|
paramanager.freecgpara(list,paraloc1);
|
||||||
|
{ Call the helper }
|
||||||
|
hlcg.g_call_system_proc(list,pd,[@paraloc1],nil);
|
||||||
|
paraloc1.done;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure thlcgobj.record_generated_code_for_procdef(pd: tprocdef; code, data: TAsmList);
|
procedure thlcgobj.record_generated_code_for_procdef(pd: tprocdef; code, data: TAsmList);
|
||||||
var
|
var
|
||||||
alt: TAsmListType;
|
alt: TAsmListType;
|
||||||
|
@ -79,8 +79,6 @@ interface
|
|||||||
procedure release_proc_symbol(pd:tprocdef);
|
procedure release_proc_symbol(pd:tprocdef);
|
||||||
procedure gen_proc_entry_code(list:TAsmList);
|
procedure gen_proc_entry_code(list:TAsmList);
|
||||||
procedure gen_proc_exit_code(list:TAsmList);
|
procedure gen_proc_exit_code(list:TAsmList);
|
||||||
procedure gen_stack_check_size_para(list:TAsmList);
|
|
||||||
procedure gen_stack_check_call(list:TAsmList);
|
|
||||||
procedure gen_save_used_regs(list:TAsmList);
|
procedure gen_save_used_regs(list:TAsmList);
|
||||||
procedure gen_restore_used_regs(list:TAsmList);
|
procedure gen_restore_used_regs(list:TAsmList);
|
||||||
procedure gen_load_para_value(list:TAsmList);
|
procedure gen_load_para_value(list:TAsmList);
|
||||||
@ -1467,38 +1465,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure gen_stack_check_size_para(list:TAsmList);
|
|
||||||
var
|
|
||||||
paraloc1 : tcgpara;
|
|
||||||
pd : tprocdef;
|
|
||||||
begin
|
|
||||||
pd:=search_system_proc('fpc_stackcheck');
|
|
||||||
paraloc1.init;
|
|
||||||
paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,paraloc1);
|
|
||||||
cg.a_load_const_cgpara(list,OS_INT,current_procinfo.calc_stackframe_size,paraloc1);
|
|
||||||
paramanager.freecgpara(list,paraloc1);
|
|
||||||
paraloc1.done;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure gen_stack_check_call(list:TAsmList);
|
|
||||||
var
|
|
||||||
paraloc1 : tcgpara;
|
|
||||||
pd : tprocdef;
|
|
||||||
begin
|
|
||||||
pd:=search_system_proc('fpc_stackcheck');
|
|
||||||
paraloc1.init;
|
|
||||||
{ Also alloc the register needed for the parameter }
|
|
||||||
paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,paraloc1);
|
|
||||||
paramanager.freecgpara(list,paraloc1);
|
|
||||||
{ Call the helper }
|
|
||||||
cg.allocallcpuregisters(list);
|
|
||||||
cg.a_call_name(list,'FPC_STACKCHECK',false);
|
|
||||||
cg.deallocallcpuregisters(list);
|
|
||||||
paraloc1.done;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure gen_save_used_regs(list:TAsmList);
|
procedure gen_save_used_regs(list:TAsmList);
|
||||||
begin
|
begin
|
||||||
{ Pure assembler routines need to save the registers themselves }
|
{ Pure assembler routines need to save the registers themselves }
|
||||||
|
@ -1556,7 +1556,7 @@ implementation
|
|||||||
(procdef.proctypeoption<>potype_proginit) then
|
(procdef.proctypeoption<>potype_proginit) then
|
||||||
begin
|
begin
|
||||||
current_filepos:=entrypos;
|
current_filepos:=entrypos;
|
||||||
gen_stack_check_call(templist);
|
hlcg.gen_stack_check_call(templist);
|
||||||
aktproccode.insertlistafter(stackcheck_asmnode.currenttai,templist)
|
aktproccode.insertlistafter(stackcheck_asmnode.currenttai,templist)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1627,7 +1627,7 @@ implementation
|
|||||||
(procdef.proctypeoption<>potype_proginit) then
|
(procdef.proctypeoption<>potype_proginit) then
|
||||||
begin
|
begin
|
||||||
current_filepos:=entrypos;
|
current_filepos:=entrypos;
|
||||||
gen_stack_check_size_para(templist);
|
hlcg.gen_stack_check_size_para(templist);
|
||||||
aktproccode.insertlistafter(stackcheck_asmnode.currenttai,templist)
|
aktproccode.insertlistafter(stackcheck_asmnode.currenttai,templist)
|
||||||
end;
|
end;
|
||||||
{ Add entry code (stack allocation) after header }
|
{ Add entry code (stack allocation) after header }
|
||||||
|
Loading…
Reference in New Issue
Block a user