JNIF: Java Native Instrumentation Framework

Conference Paper: PPPJ'14, September, 2014

The development of instrumentation-based dynamic analyses for Java bytecode is enabled by various bytecode rewriting frameworks. Those frameworks are all implemented in Java. This complicates their use for developing full-coverage analyses that not only observe application code, but that also observe the execution of the complete Java class library. Moreover, it makes it hard to avoid perturbation due to the Java code of the instrumentation tool
interfering with the Java code of the observed program. So far, workarounds for these problems required either statically instrumenting the runtime library or running a separate JVM as an instrumentation server.

This paper solves this problem. It introduces JNIF, the first complete bytecode rewriting framework implemented in native code. JNIF can be used in a JVMTI agent to create isolated, full-coverage, in-process dynamic instrumentation tools. JNIF is written in C++ and has an object-oriented design familiar to users of Java-based rewriting libraries. JNIF is able to decode, analyze, edit, and encode Java class files. This includes the generation of stack maps required by split-time verifiers of modern JVMs. Our performance evaluation shows that JNIF is often faster than the most performant competitive approach based on ASM.

@inproceedings{Mastrangelo14, author = {Mastrangelo, Luis and Hauswirth, Matthias}, title = {JNIF: Java Native Instrumentation Framework}, booktitle = {Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools}, series = {PPPJ '14}, year = {2014}, publisher = {ACM}, address = {New York, NY, USA}, }