mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
capture speedup - introduced lazy this object in evaluation context
This commit is contained in:
+18
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,20 +20,34 @@ import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.NullableLazyValue;
|
||||
import com.sun.jdi.ClassLoaderReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class EvaluationContextImpl implements EvaluationContext{
|
||||
private final Value myThisObject;
|
||||
private final NullableLazyValue<Value> myThisObject;
|
||||
private final SuspendContextImpl mySuspendContext;
|
||||
private final StackFrameProxyImpl myFrameProxy;
|
||||
private boolean myAutoLoadClasses = true;
|
||||
private ClassLoaderReference myClassLoader;
|
||||
|
||||
public EvaluationContextImpl(@NotNull SuspendContextImpl suspendContext, StackFrameProxyImpl frameProxy, @Nullable Value thisObject) {
|
||||
myThisObject = thisObject;
|
||||
myThisObject = NullableLazyValue.createValue(() -> thisObject);
|
||||
myFrameProxy = frameProxy;
|
||||
mySuspendContext = suspendContext;
|
||||
}
|
||||
|
||||
public EvaluationContextImpl(@NotNull SuspendContextImpl suspendContext, @NotNull StackFrameProxyImpl frameProxy) {
|
||||
myThisObject = NullableLazyValue.createValue(() -> {
|
||||
try {
|
||||
return frameProxy.thisObject();
|
||||
}
|
||||
catch (EvaluateException ignore) {
|
||||
}
|
||||
return null;
|
||||
});
|
||||
myFrameProxy = frameProxy;
|
||||
mySuspendContext = suspendContext;
|
||||
}
|
||||
@@ -41,7 +55,7 @@ public final class EvaluationContextImpl implements EvaluationContext{
|
||||
@Nullable
|
||||
@Override
|
||||
public Value getThisObject() {
|
||||
return myThisObject;
|
||||
return myThisObject.getValue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-2
@@ -113,7 +113,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint {
|
||||
stacks = new CapturedStacksMap();
|
||||
process.putUserData(CAPTURED_STACKS, Collections.synchronizedMap(stacks));
|
||||
}
|
||||
Value key = myCaptureEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frameProxy, frameProxy.thisObject()));
|
||||
Value key = myCaptureEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frameProxy));
|
||||
if (key instanceof ObjectReference) {
|
||||
List<StackFrameItem> frames = StackFrameItem.createFrames(suspendContext, true);
|
||||
if (frames.size() > MAX_STACK_LENGTH) {
|
||||
@@ -214,7 +214,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint {
|
||||
if ((StringUtil.isEmpty(insertClassName) || StringUtil.equals(insertClassName, className)) &&
|
||||
StringUtil.equals(b.myCapturePoint.myInsertMethodName, methodName)) {
|
||||
try {
|
||||
Value key = b.myInsertEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frame, frame.thisObject()));
|
||||
Value key = b.myInsertEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frame));
|
||||
if (key instanceof ObjectReference) {
|
||||
return capturedStacks.get(getKey((ObjectReference)key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user