/** Adds an {@link AbstractInstrumentNode} to this chain. */ @TruffleBoundary void addInstrument(ProbeInstrument instrument) { assert instrument.getProbe() == probe; // The existing chain of nodes may be empty // Attach the modified chain. firstInstrumentNode = insert(instrument.addToChain(firstInstrumentNode)); }
/** * Removes an instrument from this chain of instruments. * * @throws RuntimeException if no matching instrument is found, */ @TruffleBoundary void removeInstrument(ProbeInstrument instrument) { assert instrument.getProbe() == probe; final AbstractInstrumentNode modifiedChain = instrument.removeFromChain(firstInstrumentNode); if (modifiedChain == null) { firstInstrumentNode = null; } else { firstInstrumentNode = insert(modifiedChain); } }