@MJI public void $init(MJIEnv env, int objref, FeatureExpr ctx) { ThreadInfo ti = env.getThreadInfo(); StackFrame caller = ti.getCallerStackFrame(); Instruction insn = caller.getPC().getValue(); 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(ctx, objref, "id", new One<>(a.count)); }