mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-03 04:44:29 +00:00
better try..catch..finally detection
This commit is contained in:
60
libsrc/ffdec_lib/graphviz/try_finally_asc2.gv
Normal file
60
libsrc/ffdec_lib/graphviz/try_finally_asc2.gv
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
digraph try_finally_asc2 {
|
||||
label = "Try..Finally clause in ASC2";
|
||||
node[shape=rect];
|
||||
|
||||
start->before;
|
||||
before->finally_init->in_try;
|
||||
try_f_begin->in_try;
|
||||
try_c_begin->in_try;
|
||||
in_try->finally;
|
||||
try_c_end->finally;
|
||||
in_catch->finally;
|
||||
try_c_target->in_catch;
|
||||
try_f_end->finally;
|
||||
try_f_target->catch_f->finally:ne;
|
||||
|
||||
finally->lookupswitch;
|
||||
|
||||
lookupswitch->after;
|
||||
lookupswitch->finally_throw[label="X"];
|
||||
|
||||
after->end;
|
||||
|
||||
finally_init[label="loc_N=0;"];
|
||||
catch_f[label="loc_E = exception;\lloc_N = X;\l"];
|
||||
finally_throw[label="throw loc_E;"];
|
||||
|
||||
try_c_target[shape=ellipse];
|
||||
try_c_begin[shape=ellipse];
|
||||
try_c_end[shape=ellipse];
|
||||
|
||||
try_f_target[shape=ellipse];
|
||||
try_f_begin[shape=ellipse];
|
||||
try_f_end[shape=ellipse];
|
||||
|
||||
start[shape=ellipse];
|
||||
end[shape=ellipse];
|
||||
|
||||
lookupswitch[label="lookupswitch(loc_N)"]
|
||||
|
||||
in_try->in_try_ret[label=return];
|
||||
in_try_ret[label="loc_R = returnedValue;\lloc_N = Y;\l"]
|
||||
in_try_ret->finally;
|
||||
lookupswitch->finally_return[label="Y"];
|
||||
finally_return[label="return loc_R;"];
|
||||
|
||||
in_try->in_try_continue[label=continue];
|
||||
in_try_continue[label="loc_N = Z;"]
|
||||
in_try_continue->finally;
|
||||
lookupswitch->finally_continue[label="Z"];
|
||||
finally_continue[label="continue label;"];
|
||||
|
||||
/*
|
||||
All ways go through finally clause. There is also lookupswitch with getlocal.
|
||||
Local register is set before entering in_try block.
|
||||
For every return/continue, there is local register set to specific value.
|
||||
Lookupswitch then decides what will happen.
|
||||
*/
|
||||
|
||||
}
|
||||
BIN
libsrc/ffdec_lib/graphviz/try_finally_asc2.png
Normal file
BIN
libsrc/ffdec_lib/graphviz/try_finally_asc2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
60
libsrc/ffdec_lib/graphviz/try_finally_flex.gv
Normal file
60
libsrc/ffdec_lib/graphviz/try_finally_flex.gv
Normal file
@@ -0,0 +1,60 @@
|
||||
digraph try_finally_flex {
|
||||
label = "Try..Finally clause in Adobe Flex";
|
||||
node[shape=rect];
|
||||
|
||||
start->before;
|
||||
before->in_try;
|
||||
try_f_begin->in_try;
|
||||
try_c_begin->in_try;
|
||||
in_try->pushbyteminusone;
|
||||
try_c_end->pushbyteminusone;
|
||||
in_catch->pushbyteminusone;
|
||||
pushbyteminusone->finally;
|
||||
try_c_target->in_catch;
|
||||
try_f_end->finally;
|
||||
try_f_target->catch_f->finally:ne;
|
||||
|
||||
finally->lookupswitch;
|
||||
|
||||
lookupswitch->after;
|
||||
lookupswitch->finally_throw[label="X"];
|
||||
|
||||
after->end;
|
||||
|
||||
pushbyteminusone[label="pushbyte -1"];
|
||||
catch_f[label="loc_E = exception;\lpushbyte X;\l"];
|
||||
finally_throw[label="throw loc_E;"];
|
||||
|
||||
try_c_target[shape=ellipse];
|
||||
try_c_begin[shape=ellipse];
|
||||
try_c_end[shape=ellipse];
|
||||
|
||||
try_f_target[shape=ellipse];
|
||||
try_f_begin[shape=ellipse];
|
||||
try_f_end[shape=ellipse];
|
||||
|
||||
start[shape=ellipse];
|
||||
end[shape=ellipse];
|
||||
|
||||
lookupswitch[label="lookupswitch(§§pop())"]
|
||||
|
||||
in_try->in_try_ret[label=return];
|
||||
in_try_ret[label="loc_R = returnedValue;\lpushbyte Y;\l"]
|
||||
in_try_ret->finally;
|
||||
lookupswitch->finally_return[label="Y"];
|
||||
finally_return[label="return loc_R;"];
|
||||
|
||||
in_try->in_try_continue[label=continue];
|
||||
in_try_continue[label="pushbyte Z;"]
|
||||
in_try_continue->finally;
|
||||
lookupswitch->finally_continue[label="Z"];
|
||||
finally_continue[label="continue label;"];
|
||||
|
||||
/*
|
||||
All ways go through finally clause. There is also lookupswitch which uses value on stack..
|
||||
Value -1 is pushed on stack after in_try and after catch bodys.
|
||||
For every return/continue, there is also specific value pushed to stack.
|
||||
Lookupswitch then decides what will happen.
|
||||
*/
|
||||
|
||||
}
|
||||
BIN
libsrc/ffdec_lib/graphviz/try_finally_flex.png
Normal file
BIN
libsrc/ffdec_lib/graphviz/try_finally_flex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
44
libsrc/ffdec_lib/graphviz/try_finally_swftools.gv
Normal file
44
libsrc/ffdec_lib/graphviz/try_finally_swftools.gv
Normal file
@@ -0,0 +1,44 @@
|
||||
digraph try_finally_swftools {
|
||||
label = "Try..Finally clause in swftools";
|
||||
node[shape=rect];
|
||||
|
||||
start->before;
|
||||
before->in_try;
|
||||
try_f_begin->in_try;
|
||||
try_c_begin->in_try;
|
||||
in_try->finally;
|
||||
try_c_end->finally;
|
||||
in_catch->finally;
|
||||
try_c_target->in_catch;
|
||||
try_f_end->finally;
|
||||
try_f_target->catch_f;
|
||||
|
||||
finally->after;
|
||||
|
||||
|
||||
|
||||
after->end;
|
||||
|
||||
catch_f[label="finally;\lthrow exception;\l"];
|
||||
try_c_target[shape=ellipse];
|
||||
try_c_begin[shape=ellipse];
|
||||
try_c_end[shape=ellipse];
|
||||
|
||||
try_f_target[shape=ellipse];
|
||||
try_f_begin[shape=ellipse];
|
||||
try_f_end[shape=ellipse];
|
||||
|
||||
start[shape=ellipse];
|
||||
end[shape=ellipse];
|
||||
|
||||
in_try->in_try_ret[label=return];
|
||||
in_try_ret[label="§§push(returnedValue);\lfinally;\lreturn §§pop();\l"]
|
||||
|
||||
in_try->in_try_continue[label=continue];
|
||||
in_try_continue[label="finally;\lcontinue label;\l"];
|
||||
|
||||
/*
|
||||
Finally is inlined in every its usage.
|
||||
In try_f_target there is finnally alone with throw - we can take it from there.
|
||||
*/
|
||||
}
|
||||
BIN
libsrc/ffdec_lib/graphviz/try_finally_swftools.png
Normal file
BIN
libsrc/ffdec_lib/graphviz/try_finally_swftools.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Reference in New Issue
Block a user