mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 10:19:17 +02:00
- removed (non-working) implicit try/finally support for the JVM, and
disabled it under all circumstances on platforms that use garbage collection for managed types since it's not required there git-svn-id: branches/jvmbackend@18418 -
This commit is contained in:
parent
761ff19c7f
commit
4adb9a7ceb
@ -264,6 +264,9 @@ implementation
|
|||||||
reasonbuf,
|
reasonbuf,
|
||||||
exceptreg: tregister;
|
exceptreg: tregister;
|
||||||
begin
|
begin
|
||||||
|
{ not necessary on a garbage-collected platform }
|
||||||
|
if implicitframe then
|
||||||
|
internalerror(2011031803);
|
||||||
location_reset(location,LOC_VOID,OS_NO);
|
location_reset(location,LOC_VOID,OS_NO);
|
||||||
|
|
||||||
{ check if child nodes do a break/continue/exit }
|
{ check if child nodes do a break/continue/exit }
|
||||||
@ -276,25 +279,14 @@ implementation
|
|||||||
{ the finally block must catch break, continue and exit }
|
{ the finally block must catch break, continue and exit }
|
||||||
{ statements }
|
{ statements }
|
||||||
oldCurrExitLabel:=current_procinfo.CurrExitLabel;
|
oldCurrExitLabel:=current_procinfo.CurrExitLabel;
|
||||||
if implicitframe then
|
current_asmdata.getjumplabel(exitfinallylabel);
|
||||||
exitfinallylabel:=finallylabel
|
|
||||||
else
|
|
||||||
current_asmdata.getjumplabel(exitfinallylabel);
|
|
||||||
current_procinfo.CurrExitLabel:=exitfinallylabel;
|
current_procinfo.CurrExitLabel:=exitfinallylabel;
|
||||||
if assigned(current_procinfo.CurrBreakLabel) then
|
if assigned(current_procinfo.CurrBreakLabel) then
|
||||||
begin
|
begin
|
||||||
oldContinueLabel:=current_procinfo.CurrContinueLabel;
|
oldContinueLabel:=current_procinfo.CurrContinueLabel;
|
||||||
oldBreakLabel:=current_procinfo.CurrBreakLabel;
|
oldBreakLabel:=current_procinfo.CurrBreakLabel;
|
||||||
if implicitframe then
|
current_asmdata.getjumplabel(breakfinallylabel);
|
||||||
begin
|
current_asmdata.getjumplabel(continuefinallylabel);
|
||||||
breakfinallylabel:=finallylabel;
|
|
||||||
continuefinallylabel:=finallylabel;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
current_asmdata.getjumplabel(breakfinallylabel);
|
|
||||||
current_asmdata.getjumplabel(continuefinallylabel);
|
|
||||||
end;
|
|
||||||
current_procinfo.CurrContinueLabel:=continuefinallylabel;
|
current_procinfo.CurrContinueLabel:=continuefinallylabel;
|
||||||
current_procinfo.CurrBreakLabel:=breakfinallylabel;
|
current_procinfo.CurrBreakLabel:=breakfinallylabel;
|
||||||
end;
|
end;
|
||||||
@ -353,43 +345,40 @@ implementation
|
|||||||
2 = exit called
|
2 = exit called
|
||||||
3 = break called
|
3 = break called
|
||||||
4 = continue called }
|
4 = continue called }
|
||||||
if not(implicitframe) then
|
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,0,reasonbuf,endfinallylabel);
|
||||||
|
if fc_exit in tryflowcontrol then
|
||||||
|
if ([fc_break,fc_continue]*tryflowcontrol)<>[] then
|
||||||
|
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,2,reasonbuf,oldCurrExitLabel)
|
||||||
|
else
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
|
||||||
|
if fc_break in tryflowcontrol then
|
||||||
|
if fc_continue in tryflowcontrol then
|
||||||
|
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,3,reasonbuf,oldBreakLabel)
|
||||||
|
else
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
|
||||||
|
if fc_continue in tryflowcontrol then
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
|
||||||
|
{ now generate the trampolines for exit/break/continue to load the reasonbuf }
|
||||||
|
if fc_exit in tryflowcontrol then
|
||||||
begin
|
begin
|
||||||
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,0,reasonbuf,endfinallylabel);
|
hlcg.a_label(current_asmdata.CurrAsmList,exitfinallylabel);
|
||||||
if fc_exit in tryflowcontrol then
|
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,2,reasonbuf);
|
||||||
if ([fc_break,fc_continue]*tryflowcontrol)<>[] then
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
||||||
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,2,reasonbuf,oldCurrExitLabel)
|
|
||||||
else
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
|
|
||||||
if fc_break in tryflowcontrol then
|
|
||||||
if fc_continue in tryflowcontrol then
|
|
||||||
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,s32inttype,OC_EQ,3,reasonbuf,oldBreakLabel)
|
|
||||||
else
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
|
|
||||||
if fc_continue in tryflowcontrol then
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
|
|
||||||
{ now generate the trampolines for exit/break/continue to load the reasonbuf }
|
|
||||||
if fc_exit in tryflowcontrol then
|
|
||||||
begin
|
|
||||||
hlcg.a_label(current_asmdata.CurrAsmList,exitfinallylabel);
|
|
||||||
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,2,reasonbuf);
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
|
||||||
end;
|
|
||||||
if fc_break in tryflowcontrol then
|
|
||||||
begin
|
|
||||||
hlcg.a_label(current_asmdata.CurrAsmList,breakfinallylabel);
|
|
||||||
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,3,reasonbuf);
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
|
||||||
end;
|
|
||||||
if fc_continue in tryflowcontrol then
|
|
||||||
begin
|
|
||||||
hlcg.a_label(current_asmdata.CurrAsmList,continuefinallylabel);
|
|
||||||
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,4,reasonbuf);
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
|
||||||
end;
|
|
||||||
{ jump over finally-code-in-case-an-exception-happened }
|
|
||||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,endfinallylabel);
|
|
||||||
end;
|
end;
|
||||||
|
if fc_break in tryflowcontrol then
|
||||||
|
begin
|
||||||
|
hlcg.a_label(current_asmdata.CurrAsmList,breakfinallylabel);
|
||||||
|
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,3,reasonbuf);
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
||||||
|
end;
|
||||||
|
if fc_continue in tryflowcontrol then
|
||||||
|
begin
|
||||||
|
hlcg.a_label(current_asmdata.CurrAsmList,continuefinallylabel);
|
||||||
|
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,s32inttype,4,reasonbuf);
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
|
||||||
|
end;
|
||||||
|
{ jump over finally-code-in-case-an-exception-happened }
|
||||||
|
hlcg.a_jmp_always(current_asmdata.CurrAsmList,endfinallylabel);
|
||||||
|
|
||||||
{ generate finally code in case an exception occurred }
|
{ generate finally code in case an exception occurred }
|
||||||
if assigned(begintrylabel) then
|
if assigned(begintrylabel) then
|
||||||
@ -406,17 +395,6 @@ implementation
|
|||||||
{ generate the finally code again }
|
{ generate the finally code again }
|
||||||
secondpass(finallycodecopy);
|
secondpass(finallycodecopy);
|
||||||
finallycodecopy.free;
|
finallycodecopy.free;
|
||||||
{ in case of an implicit frame, also execute the exception handling
|
|
||||||
code }
|
|
||||||
if implicitframe then
|
|
||||||
begin
|
|
||||||
flowcontrol:=[fc_inflowcontrol];
|
|
||||||
secondpass(t1);
|
|
||||||
if flowcontrol<>[fc_inflowcontrol] then
|
|
||||||
CGMessage(cg_e_control_flow_outside_finally);
|
|
||||||
if codegenerror then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{ reraise the exception }
|
{ reraise the exception }
|
||||||
thlcgjvm(hlcg).a_load_reg_stack(current_asmdata.CurrAsmList,java_jlthrowable,exceptreg);
|
thlcgjvm(hlcg).a_load_reg_stack(current_asmdata.CurrAsmList,java_jlthrowable,exceptreg);
|
||||||
current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_athrow));
|
current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_athrow));
|
||||||
|
@ -736,7 +736,8 @@ implementation
|
|||||||
if (cs_implicit_exceptions in current_settings.moduleswitches) and
|
if (cs_implicit_exceptions in current_settings.moduleswitches) and
|
||||||
(pi_needs_implicit_finally in flags) and
|
(pi_needs_implicit_finally in flags) and
|
||||||
{ but it's useless in init/final code of units }
|
{ but it's useless in init/final code of units }
|
||||||
not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) then
|
not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) and
|
||||||
|
not(target_info.system in systems_garbage_collected_managed_types) then
|
||||||
begin
|
begin
|
||||||
{ Generate special exception block only needed when
|
{ Generate special exception block only needed when
|
||||||
implicit finaly is used }
|
implicit finaly is used }
|
||||||
@ -1229,7 +1230,8 @@ implementation
|
|||||||
if (cs_implicit_exceptions in current_settings.moduleswitches) and
|
if (cs_implicit_exceptions in current_settings.moduleswitches) and
|
||||||
not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) and
|
not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) and
|
||||||
(pi_needs_implicit_finally in flags) and
|
(pi_needs_implicit_finally in flags) and
|
||||||
not(pi_has_implicit_finally in flags) then
|
not(pi_has_implicit_finally in flags) and
|
||||||
|
not(target_info.system in systems_garbage_collected_managed_types) then
|
||||||
internalerror(200405231);
|
internalerror(200405231);
|
||||||
|
|
||||||
{$ifndef NoOpt}
|
{$ifndef NoOpt}
|
||||||
|
Loading…
Reference in New Issue
Block a user