The general structure of the basic try-with-resources:
RESOURCE
BLOCK
Primary Exception Handler
Automatic Closing of Resource
Suppressed Exception Handler
re-throw primary exception
Automatic Closing of Resource
Pseudocode for basic try-with-resources:
0 .resourceBegin
1 emit RESOURCE
0 store resource
0 .resourceEnd
0 .blockBegin
0 emit BLOCK
0 .blockEnd
0 goto outerFinally
1 .resourceException
1 throw
#if BLOCK is not empty:
1 .catchPrimary
0 store primary
0 .tryCloseBegin
1 load resource
0 ifnull innerFinally
1 load resource
0 invoke java.lang.AutoCloseable.close()
0 .tryCloseEnd
0 goto innerFinally
1 .catchSuppressed
0 store suppressed
1 load primary
2 load suppressed
0 invoke java.lang.Throwable.addSuppressed(Throwable)
0 .innerFinally
1 load primary
1 throw
#endif BLOCK is not empty
0 .outerFinally
1 load resource
0 ifnull tryEnd
1 load resource
0 invoke java.lang.AutoCloseable.close()
0 .tryEnd
Exception Table:
resourceBegin .. resourceEnd : resourceException
blockBegin .. blockEnd : catchPrimary
tryCloseBegin .. tryCloseEnd : catchSuppressed
Overrides:createBCode
in class Stmt
- Source
- Declared in
/home/jesper/git/extendj/java7/backend/TryWithResources.jrag
at line 157
- Aspect
- TryWithResources