New pseudo instruction CodeBuilder.setDebugOption

Øystein Myhre Andersen o.myhre at gmail.com
Sat Mar 9 20:09:43 UTC 2024


Do you have other ideas. Have you ever written a code generator for a
compiler ?

I don't think you understood the question

On Sat, Mar 9, 2024 at 7:42 PM - <liangchenblue at gmail.com> wrote:

> 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/cc5a817c/attachment.htm>


More information about the classfile-api-dev mailing list