libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libjit] stack maps / patchpoint


From: Jakob Löw
Subject: Re: [Libjit] stack maps / patchpoint
Date: Wed, 17 Jan 2018 23:17:18 +0100

Hey,

Currently there is nothing like that in libjit, at least not that i
know of. However there are two approaches that might solve your
problem:

1.
Calling the internal function _jit_gen_fix_value gives a value a
location on the stack frame stored in value->frame_offset. This even
works when building the function and allows you to know the location of
values relative to the base pointer

2.
You could add a new pseudo instruction which takes an array of values
and when compiled fills information about the location of those values
into a structure similar to LLVM's StkMapRecord. The problem is that
when you call your tracing function directly after such a pseudo
instruction values might get spilled or moved around, especially out of
callee saved registers. So you would need to add a "dangerous call"
instruction which does not spill anything and assumes that the callee
does not change anything.

2. involves more work and requires you to modify libjit, 1. requires
you to use internal functions and might be less performant.

- Jakob

On Wed, 2018-01-17 at 19:54 +0000, David Meyer wrote:
> Does libjit have a mechanism that is equivalent to LLVM’s stack maps
> and patch points? ( https://llvm.org/docs/StackMaps.html ).
>  
> I need to be able to determine the location of live values at a
> particular place, just before a call to a special hand-written
> tracing function. The tracing function immediately pushes all
> registers, so that it can inspect the execution state of the caller.
> But to be useful, it needs to know which registers corresponds to
> which values.
> 
> In other words, right before the call to this function, I need to
> know, for a particular set of jit_value_t’s: does this value live in
> a register, If so, which one, or if not, where is it on the stack?
> 
> Thanks,
> - David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]