[LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]

Mark Shannon marks at dcs.gla.ac.uk
Fri Jan 23 10:06:47 PST 2009


Dan Gohman wrote:
> On Jan 23, 2009, at 3:23 AM, Mark Shannon wrote:
> 
>> Dan,
>>
>>> On Jan 22, 2009, at 3:45 AM, Mark Shannon wrote:
>>>
>>>> Hi,
>>>>
>>>> I need to get the address of a label in jitted code.
>>>> (This is so that I can insert a jump into the machine code to resume
>>>> interpretation from compiled code)
>>> Hello,
>>>
>>> What's your plan for restoring register and memory state?
>> Put everything in memory at the yield point,
>> (its for x86 only at the moment).
>> Not super efficient, but should work.
> 
> 
> Is your interpreter stackless? If it's stackless, you can put
> your entrypoint at the beginning of a Function, and then just
> call it.

No it has a stack, but I can guarantee that the ENTIRE state of the VM 
is recoverable. (I force all variables into memory at the yield point).
And I need to insert the jump at runtime, but only under certain 
conditions, so I don't want to split the code into sub-functions.
> 
> LLVM doesn't support taking the real address of a label. It may
> some day, but that won't by itself make it safe to jump into
> compiled code from separately-compiled code. To do that, you'd
> need to arrange some stable set of assumptions about the state
> of the machine at the time of the jump, and a way to tell the
> code generator where and how to stay within the assumptions.
> And that's essentially what function calling conventions
> already are.

I can guarantee correctness, I just need  to be able to get that address!

Please answer the question, I answered yours ;)

Mark.



More information about the llvm-dev mailing list