I am working on a research project for deterministic fault reproduction in the JVM and am struggling to make classloading deterministic between different app runs. By that I mean that I want to ensure that always the same thread loads a class that loaded it in a previous run as well.
Let's say I recorded which thread loaded a given class in the first run (that's the easy part) and stored that information somewhere. I then want to control that no other thread will load the class in any following application runs (e.g. by halting them before they would lead to a load class event).
While most of the things I managed to do via byte code modifications or JVMTI I am not sure how I could approach this problem as the loading is controlled by the JVM and there is obviously no byte code saying before load class
, neither a proper JVMTI event.
I am open for any suggestion, no matter how 'freaky'. So even using non-public JVM internals would be fine; C/C++ or Java. Not sure where to hook in though.