[LLVMdev] Re: Newbie questions
archie at dellroad.org
Wed Apr 26 13:18:25 PDT 2006
Tom Tromey wrote:
>>>>>> "Archie" == Archie Cobbs <archie at dellroad.org> writes:
> Archie> In JCVM for example, there is a bit in type->flags that
> Archie> determines whether the class is initialized or not. This bit
> Archie> has to be checked before every static method invocation or
> Archie> static field access. You could reserve an entire byte instead
> Archie> of a bit, but I don't know if that would make it any easier to
> Archie> do this optimization.
> My plan for this in my JIT is to just recompile the bytecode for the
> function after class initializations, constant pool resolutions, and
> the like. This is somewhat crude, but seems like it should work fine.
> The full plan is to have some kind of heuristic so we don't go around
> recompiling functions that are rarely called.
> Thoughts on that?
Which bytecode will you recompile? In particular I'm thinking
about active use checks: as you know the checks for class A have to
be implemented in every other class B, C, D, ... that references a
static field or method of A. Presumably you won't recompile every
class that references A after A is initialized...
> Archie> I.e., my question is the more general one:
> Archie> how do optimizations that are specific to the front-end language get
> Archie> done? How does the front-end "secret knowledge" get passed through
> Archie> somehow so it can be used for optimization purposes?
> I was thinking that I would write some extra JVM-specific LLVM passes
> and add them to the pass manager I construct.
> I haven't started this, so I have no idea how I would handle passing
> the information back and forth.
With no annotation support, it doesn't seem like you can. This is
the problem. I'm not saying annotations are good, just that they
represent one (sub-optimal) solution to the problem. Without them,
we have zero solutions to the problem.
Of course the ideal is to come up with the "right way" (if such
exists) to solve this issue, which people are starting to think
about, which is good. It's definitely a challenging and interesting
question and I'm not sure what would be the best answer.
Archie Cobbs * CTO, Awarix * http://www.awarix.com
More information about the llvm-dev