BCI Library for Java in C

I am looking for a BCI (Bytecode Instrumentation) library for Java in C or C ++ for use in the JVMTI agent.

A better script would look like ASM or BCEL in pure C.

The closest thing I've found so far is just the java_crw_demo demo written by Kelly O'Hair a few years ago and used in Sun / Oracle Tutorials since then.

Do you know anything else?

Some justification: I create a toolkit to add the getter method to java.lang.Object and overload this getter in each direct subclass of Object . For this reason, I cannot use the Java agent. In addition, I would like to avoid the appearance of an irregular JVM to run the toolkit - for reasons of complexity and speed.

+4
source share
2 answers

I once started writing one in C quite recently, but I didn’t go very hard due to lack of motivation. AFAIK there are no public releases in C, but it’s not difficult to write simple for your needs according to the JVM specification . You are particularly interested in the chapter on the class file format , as well as on the set of instructions .

+1
source

The only reasonable solution I found was to actually transfer the byte codes to a separate Java program that uses ASM (or the BCI structure of your choice). This is not fast, but you only need to do this once for each class.

+1
source

All Articles