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. So how do I get the address? ;) Cheers, Mark.
On Jan 23, 2009, at 06:23, Mark Shannon wrote:>> On Jan 22, 2009, at 3:45 AM, Mark Shannon wrote: >> >>> 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) >> >> 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. > > So how do I get the address? ;)Hi Mark, Dan was asking a loaded question. The answer is that LLVM doesn't support taking the address of a label because of the question he asked. — Gordon
Mark Shannon
2009-Jan-23 17:19 UTC
[LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]
Gordon Henriksen wrote:> On Jan 23, 2009, at 06:23, Mark Shannon wrote: > >>> On Jan 22, 2009, at 3:45 AM, Mark Shannon wrote: >>> >>>> 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) >>> 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. >> >> So how do I get the address? ;) > > > Hi Mark, > > Dan was asking a loaded question. The answer is that LLVM doesn't > support taking the address of a label because of the question he asked.So how does llvm.dbg.stoppoint work? Or does it? I can't seem to get anywhere with it. And how do the VMKit people support line number info for the JVM? I really need to get the machine addresses of particular points in the code, and I don't want to have to hack the x86 machine code emitter or introduce my own intrinsics. Mark
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. 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. Dan
Mark Shannon
2009-Jan-23 18:06 UTC
[LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]
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.
Seemingly Similar Threads
- [LLVMdev] Getting address of label in jitted code
- [LLVMdev] Getting address of label in jitted code
- [LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]
- [LLVMdev] Getting address of label in jitted code.
- [LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]