@TruffleBoundary public void onReturnValue(AllocationEvent event) { Object object = event.getValue(); if (object == null) { return; } LanguageInfo language = event.getLanguage(); if (initializedLanguages.containsKey(language)) { newReferences.add(new ObjectPhantomReference(object, referenceQueue, language, getMetaObjectString(language, object), event.getOldSize(), event.getNewSize())); } }
@ExplodeLoop private void notifyAllocateOrReallocate(Object value, long oldSize, long newSizeEstimate) { CompilerAsserts.partialEvaluationConstant(this); if (!listenersNotChangedAssumption.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); } AllocationListener[] ls = this.listeners; if (ls != null) { AllocationEvent event = new AllocationEvent(language, value, oldSize, newSizeEstimate); for (AllocationListener l : ls) { l.onEnter(event); } } }
@ExplodeLoop private void notifyAllocated(Object value, long oldSize, long newSize) { CompilerAsserts.partialEvaluationConstant(this); if (!listenersNotChangedAssumption.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); } AllocationListener[] ls = this.listeners; if (ls != null) { AllocationEvent event = new AllocationEvent(language, value, oldSize, newSize); for (AllocationListener l : ls) { l.onReturnValue(event); } } }
@Override @TruffleBoundary public void onReturnValue(AllocationEvent event) { if (gettingMetaObject.get()) { return; } ShadowStack.ThreadLocalStack stack = shadowStack.getStack(Thread.currentThread()); if (stack == null || stack.getStackIndex() == -1) { // nothing on the stack return; } if (stack.hasStackOverflowed()) { stackOverflowed = true; return; } LanguageInfo languageInfo = event.getLanguage(); String metaObjectString; gettingMetaObject.set(true); Object metaObject = env.findMetaObject(languageInfo, event.getValue()); if (metaObject != null) { metaObjectString = env.toString(languageInfo, metaObject); } else { metaObjectString = "null"; } gettingMetaObject.set(false); AllocationEventInfo info = new AllocationEventInfo(languageInfo, event.getNewSize() - event.getOldSize(), event.getOldSize() != 0, metaObjectString); handleEvent(stack, info); }
@ExplodeLoop private void notifyAllocated(Object value, long oldSize, long newSize) { CompilerAsserts.partialEvaluationConstant(this); if (!listenersNotChangedAssumption.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); } AllocationListener[] ls = this.listeners; if (ls != null) { AllocationEvent event = new AllocationEvent(language, value, oldSize, newSize); for (AllocationListener l : ls) { l.onReturnValue(event); } } }
@ExplodeLoop private void notifyAllocateOrReallocate(Object value, long oldSize, long newSizeEstimate) { if (valueCheck != null) { setValueCheck(value); } CompilerAsserts.partialEvaluationConstant(this); if (!listenersNotChangedAssumption.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); } AllocationListener[] ls = this.listeners; if (ls != null) { AllocationEvent event = new AllocationEvent(language, value, oldSize, newSizeEstimate); for (AllocationListener l : ls) { l.onEnter(event); } } }