Hi Volkan,

> My next step will be to run this at compile time. (Will keep you posted.)
>
> Please note the specialization on `Logger#info(String)` call in
> `AppTransforming`. Since Ralph did not like thread-locals, we need to
> implement every such possible specialization of the public API.

I think we just need a helper class that has a static method for each
method of the `Logger` class. E.g. for `Logger#info(String)` we can
have `LoggerUtil#info(Logger, String, int)`. Since the signatures are
almost identical we just need to push the location index onto the
stack and replace the call of one method with the other. Since the
util methods will be very short, the JIT compiler will end up inlining
them and we don't have to play with the order of the arguments at a
bytecode level.

I have a working prototype here: https://github.com/ppkarwasz/asm-playground

The main problem with the prototype is that it adds a static field to
the woven class, but that can be corrected by either generating an
internal class or using an external registry like you do.

Piotr

Reply via email to