New pseudo instruction CodeBuilder.setDebugOption

- liangchenblue at gmail.com
Sat Mar 9 18:42:39 UTC 2024


Hi Øystein,
I think this debug option in particular is quite limited; it can carry only
2 integers. For the purpose of interleaved debugging instructions, I think
maybe expanding pseudo instructions to allow custom pseudo instructions
(such as from user-defined attributes) may be more applicable.

If you mean general Class-File generation options, we usually keep them in
the ClassFile object, stored as one of the ClassFile.Options.

Chen

On Sat, Mar 9, 2024 at 11:42 AM Øystein Myhre Andersen <o.myhre at gmail.com>
wrote:

> *Proposal:*
>
> Add a new  pseudo instruction:
>      CodeBuilder.setDebugOption(int kind, int level)
>
> Meaning:
> kind == 1 // CodeListing
>              2 .. n  // Reserved
>
> when kind == 1
> level == 0 // Off
>               1 // code listing as when "stack size mismatch" error.
>               2 // with additional Thread.dumpstack();
>               3 .. n  // Reserved
>
> Or something like it.
>
> *Motivation:*
>
> I am building a code generator for the Open Source Simula
> <https://portablesimula.github.io/github.io/> compiler.
>
> During debugging, it would be nice to be able to see the code that is
> generated and possibly where the individual instructions were generated
> from.
>
> This is particularly interesting for errors such as: "stack size
> mismatch", "operand stack underflow", etc.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240309/288f4168/attachment.htm>


More information about the classfile-api-dev mailing list