<div dir="ltr"><div dir="ltr">Oh, so you want more debugging info in error messages from CodeBuilder or StackMapGenerator. That usually goes to the overall ClassFile object in our current model. So you want to dump the instructions for the whole code upon code building failure, but dumping stack for each instruction is quite unrealistic. Your better bet would be a debugger.</div><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 9, 2024 at 2:09 PM Øystein Myhre Andersen <<a href="mailto:o.myhre@gmail.com">o.myhre@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Do you have other ideas. Have you ever written a code generator for a compiler ?<div><br></div><div>I don't think you understood the question</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 9, 2024 at 7:42 PM - <<a href="mailto:liangchenblue@gmail.com" target="_blank">liangchenblue@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Øystein,</div>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.<div><br></div><div>If you mean general Class-File generation options, we usually keep them in the ClassFile object, stored as one of the ClassFile.Options.</div><div><br></div><div>Chen</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 9, 2024 at 11:42 AM Øystein Myhre Andersen <<a href="mailto:o.myhre@gmail.com" target="_blank">o.myhre@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><b>Proposal:</b><div><br></div><div>Add a new  pseudo instruction:</div><div>     CodeBuilder.setDebugOption(int kind, int level)</div><div><br></div><div>Meaning:</div><div>kind == 1 // CodeListing  </div><div>             2 .. n  // Reserved</div><div><br></div><div>when kind == 1</div><div>level == 0 // Off</div><div>              1 // code listing as when "stack size mismatch" error.</div><div>              2 // with additional Thread.dumpstack(); </div><div>              3 .. n  // Reserved</div><div><br></div><div>Or something like it.</div><div><br></div><div><b>Motivation:</b></div><div><br></div><div><span style="background-color:rgb(248,249,250);color:rgb(32,33,36);font-family:inherit">I am building a code generator for the<a href="https://portablesimula.github.io/github.io/" target="_blank"> Open Source Simula</a> compiler.</span></div><div><span style="background-color:rgb(248,249,250);color:rgb(32,33,36);font-family:inherit"><br></span></div><div>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.</div><div><br></div><div>This is particularly interesting for errors such as: "stack size mismatch", "operand stack underflow", etc. <span style="background-color:rgb(248,249,250);color:rgb(32,33,36);font-family:inherit"><br></span></div><div><br></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div>