public static void $init(MJIEnv env, int objref) { ThreadInfo ti = env.getThreadInfo(); StackFrame caller = ti.getCallerStackFrame(); Instruction insn = caller.getPC(); InsnExecCount a = insn.getAttr(InsnExecCount.class); if (a == null) { a = new InsnExecCount(); insn.addAttr(a); } SystemState ss = env.getSystemState(); if (!ss.hasRestorer(a)) { env.getSystemState().putRestorer(a, new InsnCountRestorer(a)); } a.count++; env.setIntField(objref, "id", a.count); }