Interpreter Offsets (was RE: ARM Interpreter)

Andrew Haley aph at redhat.com
Thu Aug 13 02:14:29 PDT 2009


Edward Nevill wrote:

> > The way to handle this is to write a tool which generates the offsets
> (called say 'mkoffsets'). You then in the build do something like
> 
> 	gcc -o mkoffsets mkoffsets.cpp
> 	./mkoffsets > offsets.s
> 
> And the #include "offsets.s".
> 
> As it happens there is an interface in OpenJDK for doing exactly this sort
> of thing. It is called VMStructs. I have written a version of mkoffsets.cpp
> using VMStructs (see below).
> 
> I am not sure of the best way to handle the PRODUCT vs non PRODUCT issue.
> There are two possible approaches.
> 
> 1) The first is to generate both sets of offsets in the build and use #ifdef
> PRODUCT to select the correct offsets.
> 
> Eg.
> 	gcc -o mkoffsets mkoffsets.cpp -DPRODUCT
> 	./mkoffsets > product_offsets.s
> 	gcc -o mkoffsets mkoffsets.cpp -DDEBUG
> 	./mkoffsets > debug_offsets.s
> 
> Then in the asm loop do
> 
> #ifdef PRODUCT
> #include "product_offsets.s"
> #else
> #include "debug_offsets.s"
> #endif
> 
> 2) The 2nd is to ensure that mkoffsets is 'cleaned' for every build so that
> if you switch between PRODUCT and non PRODUCT builds the offsets.s file
> always gets regenerated.
> 
> I am leaning towards the first option as the consequences of the offsets
> file not being regenerated correctly are horrible.


I don't quite get things, since it would be pretty trivial to do this
unconditionally, but it doesn't matter much.  Please amend the interpreter
patch and we can get it *in*.  :-)

Andrew.



More information about the zero-dev mailing list