Convenient methods to build switch and try/finally in Classfile API

Adam Sotona adam.sotona at oracle.com
Mon May 22 07:57:01 UTC 2023



From: Paul Sandoz <paul.sandoz at oracle.com>

Also, it can get complex for nested try with finally, where we need to keep track of the layering and know where exit points “break”/“continue” to within that layering so as to know what finalizer code to inline in the required order. It’s probably the most complex lowering step that the java compiler does.

Paul.

Yes, I’m aware of the complexity and layering. In this working prototype I tried to test the idea that all returns and exceptions thrown in try block are finalized automatically, while all break labels must be explicitly declared by user to be recognized and all related branch instructions pre-pended by appropriate finalizer. Implementation by code transformation of the try block is chainable, so any outer try/finally block transforms it again to correctly pre-pend its own finalizer block. I’m trying to find and test appropriate Classfile API solution to make future javac conversion easier.

Thanks,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20230522/6c526657/attachment-0001.htm>


More information about the classfile-api-dev mailing list