Identifying bound/free name in a FrameDescriptor
kovariadam at gmail.com
Tue Feb 5 20:03:11 UTC 2019
I have usecase concerning recursive calls (thus, as I noticed, one
instance of FrameDescriptor which is being reused for recursive calls)
and detecting whether a variable is bound or free within that
For example, this simple recursive function:
factorial 1 = 1
factorial n = n * (factorial n - 1)
In the first invocation, this function's FrameDescriptor would not
contain "n", but in the next call to itself, it will, because it will
be written to local stack in the second line.
The situation is, when in second invocation of this recursive
function, the FrameSlot for "n" will exist, so something like:
will return true, however, the value will be null and code such as this one:
will end up throwing an IllegalStateException.
That said, I think I understand that this is because the
FrameDescriptor is being reused here, my question is, how to
effectively decide whether a name is bound or not, that would not
involve findFrameSlot or catching IllegalStateException.
I hope my example can be understood, please let me know if it is
unclear. I will appreciate any feedback.
Adam Kovari(mailto:kovariadam at gmail.com)
More information about the graal-dev