private boolean checkServices(String[] expectedServices) { LOOP: for (String name : expectedServices) { for (Object obj : services) { if (findType(name, obj.getClass())) { continue LOOP; } } failInstrumentInitialization(env, String.format("%s declares service %s but doesn't register it", instrumentClass.getName(), name), null); } return true; }
private boolean checkServices(String[] expectedServices) { LOOP: for (String name : expectedServices) { for (Object obj : services) { if (findType(name, obj.getClass())) { continue LOOP; } } failInstrumentInitialization(env, String.format("%s declares service %s but doesn't register it", instrumentClass.getName(), name), null); } return true; }
void initializeInstrument(Object vmObject, Class<?> instrumentClass) { Env env = new Env(vmObject, out, err, in, messageInterceptor); env.instrumenter = new InstrumentClientInstrumenter(env, instrumentClass); if (TRACE) { trace("Initialize instrument class %s %n", instrumentClass); } try { env.instrumenter.instrument = (TruffleInstrument) instrumentClass.getDeclaredConstructor().newInstance(); } catch (Exception e) { failInstrumentInitialization(env, String.format("Failed to create new instrumenter class %s", instrumentClass.getName()), e); return; } if (TRACE) { trace("Initialized instrument %s class %s %n", env.instrumenter.instrument, instrumentClass); } addInstrumenter(vmObject, env.instrumenter); }
void create(String[] expectedServices) { if (TRACE) { trace("Create instrument %s class %s %n", instrument, instrumentClass); } try { services = env.onCreate(instrument); if (expectedServices != null && !TruffleOptions.AOT) { checkServices(expectedServices); } } catch (Throwable e) { failInstrumentInitialization(env, String.format("Failed calling onCreate of instrument class %s", instrumentClass.getName()), e); return; } if (TRACE) { trace("Created instrument %s class %s %n", instrument, instrumentClass); } }
void initializeInstrument(Object vmObject, Class<?> instrumentClass) { Env env = new Env(vmObject, out, err, in); env.instrumenter = new InstrumentClientInstrumenter(env, instrumentClass); if (TRACE) { trace("Initialize instrument class %s %n", instrumentClass); } try { env.instrumenter.instrument = (TruffleInstrument) instrumentClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { failInstrumentInitialization(env, String.format("Failed to create new instrumenter class %s", instrumentClass.getName()), e); return; } if (TRACE) { trace("Initialized instrument %s class %s %n", env.instrumenter.instrument, instrumentClass); } addInstrumenter(vmObject, env.instrumenter); }