* It is still needed to release the temp allocated for the result of an assembler function if the result is not referenced. This fixes some EXTDEBUG warnings.

This commit is contained in:
Yuriy Sydorov 2021-08-06 21:43:10 +03:00
parent 5920d169c0
commit 136f042972

View File

@ -5414,29 +5414,36 @@ implementation
(po_nostackframe in current_procinfo.procdef.procoptions) (po_nostackframe in current_procinfo.procdef.procoptions)
) )
) then ) then
exit;
{ constructors return self }
if current_procinfo.procdef.generate_safecall_wrapper then
begin begin
if not current_procinfo.procdef.get_safecall_funcretsym_info(ressym,retdef) then ressym:=current_procinfo.procdef.funcretsym;
internalerror(2019112402); if not assigned(ressym) then
gen_load_loc_function_result(list,retdef,tabstractnormalvarsym(ressym).localloc); exit;
end end
else else
begin begin
if not current_procinfo.procdef.get_funcretsym_info(ressym,retdef) then { constructors return self }
internalerror(2018122501); if current_procinfo.procdef.generate_safecall_wrapper then
if (ressym.refs>0) or
is_managed_type(retdef) then
begin begin
{ was: don't do anything if funcretloc.loc in [LOC_INVALID,LOC_REFERENCE] } if not current_procinfo.procdef.get_safecall_funcretsym_info(ressym,retdef) then
if not paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef) then internalerror(2019112402);
gen_load_loc_function_result(list,retdef,tabstractnormalvarsym(ressym).localloc); gen_load_loc_function_result(list,retdef,tabstractnormalvarsym(ressym).localloc);
end end
else else
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside]); begin
if not current_procinfo.procdef.get_funcretsym_info(ressym,retdef) then
internalerror(2018122501);
if (ressym.refs>0) or
is_managed_type(retdef) then
begin
{ was: don't do anything if funcretloc.loc in [LOC_INVALID,LOC_REFERENCE] }
if not paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef) then
gen_load_loc_function_result(list,retdef,tabstractnormalvarsym(ressym).localloc);
end
else
gen_load_uninitialized_function_result(list,current_procinfo.procdef,retdef,current_procinfo.procdef.funcretloc[calleeside]);
end;
end; end;
if tabstractnormalvarsym(ressym).localloc.loc=LOC_REFERENCE then if tabstractnormalvarsym(ressym).localloc.loc=LOC_REFERENCE then
tg.UnGetLocal(list,tabstractnormalvarsym(ressym).localloc.reference); tg.UnGetLocal(list,tabstractnormalvarsym(ressym).localloc.reference);
end; end;