Custom JVM Language: Create Working Stop Traces?

How do stack traces work in the JVM?

Is it possible to convert class files to have stack traces that are specific to the parent language and not pseudo java files?

To be specific, is it possible to modify this Mixin library https://github.com/SpongePowered/Mixin so that when rewriting / injecting it into methods, if an if error occurs, it will point to the correct mixin pseudo language in the source?

+3


source to share


1 answer


It is not necessary to have Java source files.

There are only two relevant attributes.



The stack trace simply reports the class and method names along with the source file name and line number, as indicated by the two attributes above. There is no additional semantics behind it.

These attributes are already sufficient to debug the step, since the debugger only needs to load the specified file (assuming it is text-based) and highlight a specific line. I have already gone through the XSLT file in a way that has been dynamically compiled into bytecode by the XSLT processor. If you want local variables to be checked, you also need to add to the code LocalVariableTable

.

I also used them the way you intend to create generated code, the meta information of which points to the source code that caused the code generation. This happens even when compiling regular Java source code, because the synthetic methods generated for lambda expressions contain tables of strings that point to the lambda expression in the source-level method by defining it.

+2


source







All Articles