JVM stack frames question
843811Apr 15 2004 — edited Apr 16 2004Does anyone know if it is possible to access local variables on stack frame of a method which called the current one? I am writing compiler which generates code for JVM and want to handle nested functions (like in Pascal). Nested functions should have access to local variables and parameters of calling "parent" function.
I want to enable recursive functions, so the jsr/ret mechanism is not sufficient.
One solution which I considered was passing values of local variables when calling function and retrieving changed values after the function returns but it is a significant performance loss. Any hints how it could be done in a more straightforward way (and not using JNI, only portable JVM instructions)?