diff options
author | 2024-05-22 14:03:12 +0000 | |
---|---|---|
committer | 2024-05-22 14:37:00 +0000 | |
commit | db0551d164783866acf0cdcf9a7741ee6f21f0f2 (patch) | |
tree | e49897e10abe955d3315e48c1095caf71645c85c | |
parent | a11d8246f846148c83bbcbbe39511c460cc0319a (diff) |
Revert "Report method unwind events for native methods"
This reverts commit b42b645e26e206a2b1457cf9ea453b5021a873f5.
Reason for revert: Likely culprit for b/342131895 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: Ic2724b90528b5a9e299e0df7d909be60d5c1e0eb
-rw-r--r-- | runtime/quick_exception_handler.cc | 33 | ||||
-rw-r--r-- | test/989-method-trace-throw/expected-stdout.txt | 243 | ||||
-rw-r--r-- | test/989-method-trace-throw/src/art/Test989.java | 93 | ||||
-rw-r--r-- | test/jvmti-common/Trace.java | 5 | ||||
-rw-r--r-- | test/ti-agent/trace_helper.cc | 9 |
5 files changed, 36 insertions, 347 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 37734f7d74..2ebcbb0fd0 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -439,41 +439,19 @@ class DeoptimizeStackVisitor final : public StackVisitor { ArtMethod* method = GetMethod(); VLOG(deopt) << "Deoptimizing stack: depth: " << GetFrameDepth() << " at method " << ArtMethod::PrettyMethod(method); - if (method == nullptr || single_frame_done_) { FinishStackWalk(); return false; // End stack walk. - } - - // Update if method exit event needs to be reported. We should report exit event only if we - // have reported an entry event. So tell interpreter if/ an entry event was reported. - bool supports_exit_events = Runtime::Current()->GetInstrumentation()->MethodSupportsExitEvents( - method, GetCurrentOatQuickMethodHeader()); - - if (method->IsRuntimeMethod()) { + } else if (method->IsRuntimeMethod()) { // Ignore callee save method. DCHECK(method->IsCalleeSaveMethod()); return true; } else if (method->IsNative()) { // If we return from JNI with a pending exception and want to deoptimize, we need to skip // the native method. The top method is a runtime method, the native method comes next. - // We also deoptimize due to method instrumentation reasons from method exit callbacks. - // In these cases native method is at the top of stack. + // We also deoptimize due to method instrumentation reasons from method entry / exit + // callbacks. In these cases native method is at the top of stack. CHECK((GetFrameDepth() == 1U) || (GetFrameDepth() == 0U)); - // We see a native frame when: - // 1. returning from JNI with a pending exception - // 2. deopting from method exit callbacks (with or without a pending exception). - // skip_method_exit_callbacks_ is set in this case - // 3. handling async exception on suspend points for fast native methods. - // We only need to call method unwind event in the first case. - if (supports_exit_events && - !skip_method_exit_callbacks_ && - GetThread()->IsExceptionPending()) { - // An exception has occurred in a native method and we are deoptimizing past the native - // method. So report method unwind event here. - Runtime::Current()->GetInstrumentation()->MethodUnwindEvent( - GetThread(), method, dex::kDexNoIndex); - } callee_method_ = method; return true; } else if (!single_frame_deopt_ && @@ -504,6 +482,11 @@ class DeoptimizeStackVisitor final : public StackVisitor { } else { HandleOptimizingDeoptimization(method, new_frame, updated_vregs); } + // Update if method exit event needs to be reported. We should report exit event only if we + // have reported an entry event. So tell interpreter if/ an entry event was reported. + bool supports_exit_events = + Runtime::Current()->GetInstrumentation()->MethodSupportsExitEvents( + method, GetCurrentOatQuickMethodHeader()); new_frame->SetSkipMethodExitEvents(!supports_exit_events); // If we are deoptimizing after method exit callback we shouldn't call the method exit // callbacks again for the top frame. We may have to deopt after the callback if the callback diff --git a/test/989-method-trace-throw/expected-stdout.txt b/test/989-method-trace-throw/expected-stdout.txt index ab65f28736..0911bc35e8 100644 --- a/test/989-method-trace-throw/expected-stdout.txt +++ b/test/989-method-trace-throw/expected-stdout.txt @@ -1,4 +1,3 @@ -Expected ClassNotFoundException received Normal: Entering public static void art.Test989.doNothing() Normal: Leaving public static void art.Test989.doNothing() returned null Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$doNothingClass]. @@ -11,16 +10,6 @@ Received expected error for test[class art.Test989$NormalTracer, class art.Test9 Normal: Entering public static native void art.Test989.throwANative() Normal: Leaving public static native void art.Test989.throwANative() returned <exception> Received expected error for test[class art.Test989$NormalTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorA: Throwing Error A -Normal: Entering public static void art.Test989.returnNativeException() -Normal: Entering public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException -Normal: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -Normal: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -Normal: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -Normal: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -Normal: Leaving public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException returned <exception> -Expected ClassNotFoundException received -Normal: Leaving public static void art.Test989.returnNativeException() returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnNativeExceptionClass]. Normal: Entering public static java.lang.Object art.Test989.returnValue() Normal: Leaving public static java.lang.Object art.Test989.returnValue() returned TestObject(0) returnValue returned: TestObject(0) @@ -68,9 +57,6 @@ Received expected error for test[class art.Test989$ThrowEnterTracer, class art.T ThrowEnter: Entering public static native void art.Test989.throwANative() ThrowEnter: Leaving public static native void art.Test989.throwANative() returned <exception> Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorB: Throwing error while entering public static native void art.Test989.throwANative() -ThrowEnter: Entering public static void art.Test989.returnNativeException() -ThrowEnter: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.returnNativeException() ThrowEnter: Entering public static java.lang.Object art.Test989.returnValue() ThrowEnter: Leaving public static java.lang.Object art.Test989.returnValue() returned <exception> Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnValueClass] - art.Test989$ErrorB: Throwing error while entering public static java.lang.Object art.Test989.returnValue() @@ -110,15 +96,6 @@ Received expected error for test[class art.Test989$ThrowExitTracer, class art.Te ThrowExit: Entering public static native void art.Test989.throwANative() ThrowExit: Leaving public static native void art.Test989.throwANative() returned <exception> Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorB: Throwing error while exit public static native void art.Test989.throwANative() returned <exception> -ThrowExit: Entering public static void art.Test989.returnNativeException() -ThrowExit: Entering public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException -ThrowExit: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -ThrowExit: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -ThrowExit: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.returnNativeException() returned <exception> ThrowExit: Entering public static java.lang.Object art.Test989.returnValue() ThrowExit: Leaving public static java.lang.Object art.Test989.returnValue() returned TestObject(7) Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnValueClass] - art.Test989$ErrorB: Throwing error while exit public static java.lang.Object art.Test989.returnValue() returned TestObject(7) @@ -160,9 +137,6 @@ Received expected error for test[class art.Test989$ThrowBothTracer, class art.Te ThrowBoth: Entering public static native void art.Test989.throwANative() ThrowBoth: Leaving public static native void art.Test989.throwANative() returned <exception> Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorC: Throwing error while exit public static native void art.Test989.throwANative() returned <exception> -ThrowBoth: Entering public static void art.Test989.returnNativeException() -ThrowBoth: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.returnNativeException() returned <exception> ThrowBoth: Entering public static java.lang.Object art.Test989.returnValue() ThrowBoth: Leaving public static java.lang.Object art.Test989.returnValue() returned <exception> Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnValueClass] - art.Test989$ErrorC: Throwing error while exit public static java.lang.Object art.Test989.returnValue() returned <exception> @@ -194,8 +168,6 @@ Received no exception as expected for test[class art.Test989$ForceGCTracer, clas Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$doNothingNativeClass]. Received expected error for test[class art.Test989$ForceGCTracer, class art.Test989$throwAClass] - art.Test989$ErrorA: Throwing Error A Received expected error for test[class art.Test989$ForceGCTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorA: Throwing Error A -Expected ClassNotFoundException received -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnNativeExceptionClass]. returnValue returned: TestObject(14) Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnValueClass]. returnValueNative returned: TestObject(15) @@ -213,219 +185,4 @@ returnDouble returned: 3.14159628 Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnDoubleClass]. returnDoubleNative returned: 3.14159628 Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnDoubleNativeClass]. -Finished - without non-standard exits! -Normal: Entering public static void art.Test989.doNothing() -Normal: Leaving public static void art.Test989.doNothing() returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$doNothingClass]. -Normal: Entering public static native void art.Test989.doNothingNative() -Normal: Leaving public static native void art.Test989.doNothingNative() returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$doNothingNativeClass]. -Normal: Entering public static void art.Test989.throwA() -Normal: Leaving public static void art.Test989.throwA() returned <exception> -Received expected error for test[class art.Test989$NormalTracer, class art.Test989$throwAClass] - art.Test989$ErrorA: Throwing Error A -Normal: Entering public static native void art.Test989.throwANative() -Normal: Leaving public static native void art.Test989.throwANative() returned <exception> -Received expected error for test[class art.Test989$NormalTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorA: Throwing Error A -Normal: Entering public static void art.Test989.returnNativeException() -Normal: Entering public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException -Normal: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -Normal: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -Normal: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -Normal: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -Normal: Leaving public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException returned <exception> -Expected ClassNotFoundException received -Normal: Leaving public static void art.Test989.returnNativeException() returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnNativeExceptionClass]. -Normal: Entering public static java.lang.Object art.Test989.returnValue() -Normal: Leaving public static java.lang.Object art.Test989.returnValue() returned TestObject(19) -returnValue returned: TestObject(19) -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnValueClass]. -Normal: Entering public static native java.lang.Object art.Test989.returnValueNative() -Normal: Leaving public static native java.lang.Object art.Test989.returnValueNative() returned TestObject(20) -returnValueNative returned: TestObject(20) -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnValueNativeClass]. -Normal: Entering public static void art.Test989.acceptValue(java.lang.Object) -Recieved TestObject(21) -Normal: Leaving public static void art.Test989.acceptValue(java.lang.Object) returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$acceptValueClass]. -Normal: Entering public static native void art.Test989.acceptValueNative(java.lang.Object) -Recieved TestObject(22) -Normal: Leaving public static native void art.Test989.acceptValueNative(java.lang.Object) returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$acceptValueNativeClass]. -Normal: Entering public static void art.Test989.tryCatchExit() -Normal: Leaving public static void art.Test989.tryCatchExit() returned null -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$tryCatchExitClass]. -Normal: Entering public static float art.Test989.returnFloat() -Normal: Leaving public static float art.Test989.returnFloat() returned 1.618 -returnFloat returned: 1.618 -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnFloatClass]. -Normal: Entering public static native float art.Test989.returnFloatNative() -Normal: Leaving public static native float art.Test989.returnFloatNative() returned 1.618 -returnFloatNative returned: 1.618 -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnFloatNativeClass]. -Normal: Entering public static double art.Test989.returnDouble() -Normal: Leaving public static double art.Test989.returnDouble() returned 3.14159628 -returnDouble returned: 3.14159628 -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnDoubleClass]. -Normal: Entering public static native double art.Test989.returnDoubleNative() -Normal: Leaving public static native double art.Test989.returnDoubleNative() returned 3.14159628 -returnDoubleNative returned: 3.14159628 -Received no exception as expected for test[class art.Test989$NormalTracer, class art.Test989$returnDoubleNativeClass]. -ThrowEnter: Entering public static void art.Test989.doNothing() -ThrowEnter: Leaving public static void art.Test989.doNothing() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$doNothingClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.doNothing() -ThrowEnter: Entering public static native void art.Test989.doNothingNative() -ThrowEnter: Leaving public static native void art.Test989.doNothingNative() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$doNothingNativeClass] - art.Test989$ErrorB: Throwing error while entering public static native void art.Test989.doNothingNative() -ThrowEnter: Entering public static void art.Test989.throwA() -ThrowEnter: Leaving public static void art.Test989.throwA() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$throwAClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.throwA() -ThrowEnter: Entering public static native void art.Test989.throwANative() -ThrowEnter: Leaving public static native void art.Test989.throwANative() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorB: Throwing error while entering public static native void art.Test989.throwANative() -ThrowEnter: Entering public static void art.Test989.returnNativeException() -ThrowEnter: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.returnNativeException() -ThrowEnter: Entering public static java.lang.Object art.Test989.returnValue() -ThrowEnter: Leaving public static java.lang.Object art.Test989.returnValue() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnValueClass] - art.Test989$ErrorB: Throwing error while entering public static java.lang.Object art.Test989.returnValue() -ThrowEnter: Entering public static native java.lang.Object art.Test989.returnValueNative() -ThrowEnter: Leaving public static native java.lang.Object art.Test989.returnValueNative() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnValueNativeClass] - art.Test989$ErrorB: Throwing error while entering public static native java.lang.Object art.Test989.returnValueNative() -ThrowEnter: Entering public static void art.Test989.acceptValue(java.lang.Object) -ThrowEnter: Leaving public static void art.Test989.acceptValue(java.lang.Object) returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$acceptValueClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.acceptValue(java.lang.Object) -ThrowEnter: Entering public static native void art.Test989.acceptValueNative(java.lang.Object) -ThrowEnter: Leaving public static native void art.Test989.acceptValueNative(java.lang.Object) returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$acceptValueNativeClass] - art.Test989$ErrorB: Throwing error while entering public static native void art.Test989.acceptValueNative(java.lang.Object) -ThrowEnter: Entering public static void art.Test989.tryCatchExit() -ThrowEnter: Leaving public static void art.Test989.tryCatchExit() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$tryCatchExitClass] - art.Test989$ErrorB: Throwing error while entering public static void art.Test989.tryCatchExit() -ThrowEnter: Entering public static float art.Test989.returnFloat() -ThrowEnter: Leaving public static float art.Test989.returnFloat() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnFloatClass] - art.Test989$ErrorB: Throwing error while entering public static float art.Test989.returnFloat() -ThrowEnter: Entering public static native float art.Test989.returnFloatNative() -ThrowEnter: Leaving public static native float art.Test989.returnFloatNative() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnFloatNativeClass] - art.Test989$ErrorB: Throwing error while entering public static native float art.Test989.returnFloatNative() -ThrowEnter: Entering public static double art.Test989.returnDouble() -ThrowEnter: Leaving public static double art.Test989.returnDouble() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnDoubleClass] - art.Test989$ErrorB: Throwing error while entering public static double art.Test989.returnDouble() -ThrowEnter: Entering public static native double art.Test989.returnDoubleNative() -ThrowEnter: Leaving public static native double art.Test989.returnDoubleNative() returned <exception> -Received expected error for test[class art.Test989$ThrowEnterTracer, class art.Test989$returnDoubleNativeClass] - art.Test989$ErrorB: Throwing error while entering public static native double art.Test989.returnDoubleNative() -ThrowExit: Entering public static void art.Test989.doNothing() -ThrowExit: Leaving public static void art.Test989.doNothing() returned null -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$doNothingClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.doNothing() returned null -ThrowExit: Entering public static native void art.Test989.doNothingNative() -ThrowExit: Leaving public static native void art.Test989.doNothingNative() returned null -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$doNothingNativeClass] - art.Test989$ErrorB: Throwing error while exit public static native void art.Test989.doNothingNative() returned null -ThrowExit: Entering public static void art.Test989.throwA() -ThrowExit: Leaving public static void art.Test989.throwA() returned <exception> -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$throwAClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.throwA() returned <exception> -ThrowExit: Entering public static native void art.Test989.throwANative() -ThrowExit: Leaving public static native void art.Test989.throwANative() returned <exception> -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorB: Throwing error while exit public static native void art.Test989.throwANative() returned <exception> -ThrowExit: Entering public static void art.Test989.returnNativeException() -ThrowExit: Entering public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException -ThrowExit: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -ThrowExit: Entering static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException -ThrowExit: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving static native java.lang.Class java.lang.Class.classForName(java.lang.String,boolean,java.lang.ClassLoader) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving public static java.lang.Class java.lang.Class.forName(java.lang.String) throws java.lang.ClassNotFoundException returned <exception> -ThrowExit: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.returnNativeException() returned <exception> -ThrowExit: Entering public static java.lang.Object art.Test989.returnValue() -ThrowExit: Leaving public static java.lang.Object art.Test989.returnValue() returned TestObject(26) -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnValueClass] - art.Test989$ErrorB: Throwing error while exit public static java.lang.Object art.Test989.returnValue() returned TestObject(26) -ThrowExit: Entering public static native java.lang.Object art.Test989.returnValueNative() -ThrowExit: Leaving public static native java.lang.Object art.Test989.returnValueNative() returned TestObject(27) -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnValueNativeClass] - art.Test989$ErrorB: Throwing error while exit public static native java.lang.Object art.Test989.returnValueNative() returned TestObject(27) -ThrowExit: Entering public static void art.Test989.acceptValue(java.lang.Object) -Recieved TestObject(28) -ThrowExit: Leaving public static void art.Test989.acceptValue(java.lang.Object) returned null -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$acceptValueClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.acceptValue(java.lang.Object) returned null -ThrowExit: Entering public static native void art.Test989.acceptValueNative(java.lang.Object) -Recieved TestObject(29) -ThrowExit: Leaving public static native void art.Test989.acceptValueNative(java.lang.Object) returned null -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$acceptValueNativeClass] - art.Test989$ErrorB: Throwing error while exit public static native void art.Test989.acceptValueNative(java.lang.Object) returned null -ThrowExit: Entering public static void art.Test989.tryCatchExit() -ThrowExit: Leaving public static void art.Test989.tryCatchExit() returned null -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$tryCatchExitClass] - art.Test989$ErrorB: Throwing error while exit public static void art.Test989.tryCatchExit() returned null -ThrowExit: Entering public static float art.Test989.returnFloat() -ThrowExit: Leaving public static float art.Test989.returnFloat() returned 1.618 -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnFloatClass] - art.Test989$ErrorB: Throwing error while exit public static float art.Test989.returnFloat() returned 1.618 -ThrowExit: Entering public static native float art.Test989.returnFloatNative() -ThrowExit: Leaving public static native float art.Test989.returnFloatNative() returned 1.618 -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnFloatNativeClass] - art.Test989$ErrorB: Throwing error while exit public static native float art.Test989.returnFloatNative() returned 1.618 -ThrowExit: Entering public static double art.Test989.returnDouble() -ThrowExit: Leaving public static double art.Test989.returnDouble() returned 3.14159628 -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnDoubleClass] - art.Test989$ErrorB: Throwing error while exit public static double art.Test989.returnDouble() returned 3.14159628 -ThrowExit: Entering public static native double art.Test989.returnDoubleNative() -ThrowExit: Leaving public static native double art.Test989.returnDoubleNative() returned 3.14159628 -Received expected error for test[class art.Test989$ThrowExitTracer, class art.Test989$returnDoubleNativeClass] - art.Test989$ErrorB: Throwing error while exit public static native double art.Test989.returnDoubleNative() returned 3.14159628 -ThrowBoth: Entering public static void art.Test989.doNothing() -ThrowBoth: Leaving public static void art.Test989.doNothing() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$doNothingClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.doNothing() returned <exception> -ThrowBoth: Entering public static native void art.Test989.doNothingNative() -ThrowBoth: Leaving public static native void art.Test989.doNothingNative() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$doNothingNativeClass] - art.Test989$ErrorC: Throwing error while exit public static native void art.Test989.doNothingNative() returned <exception> -ThrowBoth: Entering public static void art.Test989.throwA() -ThrowBoth: Leaving public static void art.Test989.throwA() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$throwAClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.throwA() returned <exception> -ThrowBoth: Entering public static native void art.Test989.throwANative() -ThrowBoth: Leaving public static native void art.Test989.throwANative() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorC: Throwing error while exit public static native void art.Test989.throwANative() returned <exception> -ThrowBoth: Entering public static void art.Test989.returnNativeException() -ThrowBoth: Leaving public static void art.Test989.returnNativeException() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnNativeExceptionClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.returnNativeException() returned <exception> -ThrowBoth: Entering public static java.lang.Object art.Test989.returnValue() -ThrowBoth: Leaving public static java.lang.Object art.Test989.returnValue() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnValueClass] - art.Test989$ErrorC: Throwing error while exit public static java.lang.Object art.Test989.returnValue() returned <exception> -ThrowBoth: Entering public static native java.lang.Object art.Test989.returnValueNative() -ThrowBoth: Leaving public static native java.lang.Object art.Test989.returnValueNative() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnValueNativeClass] - art.Test989$ErrorC: Throwing error while exit public static native java.lang.Object art.Test989.returnValueNative() returned <exception> -ThrowBoth: Entering public static void art.Test989.acceptValue(java.lang.Object) -ThrowBoth: Leaving public static void art.Test989.acceptValue(java.lang.Object) returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$acceptValueClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.acceptValue(java.lang.Object) returned <exception> -ThrowBoth: Entering public static native void art.Test989.acceptValueNative(java.lang.Object) -ThrowBoth: Leaving public static native void art.Test989.acceptValueNative(java.lang.Object) returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$acceptValueNativeClass] - art.Test989$ErrorC: Throwing error while exit public static native void art.Test989.acceptValueNative(java.lang.Object) returned <exception> -ThrowBoth: Entering public static void art.Test989.tryCatchExit() -ThrowBoth: Leaving public static void art.Test989.tryCatchExit() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$tryCatchExitClass] - art.Test989$ErrorC: Throwing error while exit public static void art.Test989.tryCatchExit() returned <exception> -ThrowBoth: Entering public static float art.Test989.returnFloat() -ThrowBoth: Leaving public static float art.Test989.returnFloat() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnFloatClass] - art.Test989$ErrorC: Throwing error while exit public static float art.Test989.returnFloat() returned <exception> -ThrowBoth: Entering public static native float art.Test989.returnFloatNative() -ThrowBoth: Leaving public static native float art.Test989.returnFloatNative() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnFloatNativeClass] - art.Test989$ErrorC: Throwing error while exit public static native float art.Test989.returnFloatNative() returned <exception> -ThrowBoth: Entering public static double art.Test989.returnDouble() -ThrowBoth: Leaving public static double art.Test989.returnDouble() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnDoubleClass] - art.Test989$ErrorC: Throwing error while exit public static double art.Test989.returnDouble() returned <exception> -ThrowBoth: Entering public static native double art.Test989.returnDoubleNative() -ThrowBoth: Leaving public static native double art.Test989.returnDoubleNative() returned <exception> -Received expected error for test[class art.Test989$ThrowBothTracer, class art.Test989$returnDoubleNativeClass] - art.Test989$ErrorC: Throwing error while exit public static native double art.Test989.returnDoubleNative() returned <exception> -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$doNothingClass]. -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$doNothingNativeClass]. -Received expected error for test[class art.Test989$ForceGCTracer, class art.Test989$throwAClass] - art.Test989$ErrorA: Throwing Error A -Received expected error for test[class art.Test989$ForceGCTracer, class art.Test989$throwANativeClass] - art.Test989$ErrorA: Throwing Error A -Expected ClassNotFoundException received -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnNativeExceptionClass]. -returnValue returned: TestObject(33) -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnValueClass]. -returnValueNative returned: TestObject(34) -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnValueNativeClass]. -Recieved TestObject(35) -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$acceptValueClass]. -Recieved TestObject(36) -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$acceptValueNativeClass]. -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$tryCatchExitClass]. -returnFloat returned: 1.618 -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnFloatClass]. -returnFloatNative returned: 1.618 -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnFloatNativeClass]. -returnDouble returned: 3.14159628 -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnDoubleClass]. -returnDoubleNative returned: 3.14159628 -Received no exception as expected for test[class art.Test989$ForceGCTracer, class art.Test989$returnDoubleNativeClass]. Finished! diff --git a/test/989-method-trace-throw/src/art/Test989.java b/test/989-method-trace-throw/src/art/Test989.java index a7f90f9899..f18d5ef3d6 100644 --- a/test/989-method-trace-throw/src/art/Test989.java +++ b/test/989-method-trace-throw/src/art/Test989.java @@ -37,7 +37,6 @@ public class Test989 { testMethods.add(Test989.class.getDeclaredMethod("doNothingNative")); testMethods.add(Test989.class.getDeclaredMethod("throwA")); testMethods.add(Test989.class.getDeclaredMethod("throwANative")); - testMethods.add(Test989.class.getDeclaredMethod("returnNativeException")); testMethods.add(Test989.class.getDeclaredMethod("returnFloat")); testMethods.add(Test989.class.getDeclaredMethod("returnFloatNative")); testMethods.add(Test989.class.getDeclaredMethod("returnDouble")); @@ -47,9 +46,6 @@ public class Test989 { testMethods.add(Test989.class.getDeclaredMethod("acceptValue", Object.class)); testMethods.add(Test989.class.getDeclaredMethod("acceptValueNative", Object.class)); testMethods.add(Test989.class.getDeclaredMethod("tryCatchExit")); - testMethods.add(Class.class.getDeclaredMethod("forName", String.class)); - testMethods.add(Class.class.getDeclaredMethod( - "classForName", String.class, boolean.class, java.lang.ClassLoader.class)); } catch (Exception e) { throw new Error("Bad static!", e); } @@ -248,54 +244,35 @@ public class Test989 { } public static void run() throws Exception { - MyRunnable[] testCases = new MyRunnable[] { - new doNothingClass(), - new doNothingNativeClass(), - new throwAClass(), - new throwANativeClass(), - new returnNativeExceptionClass(), - new returnValueClass(), - new returnValueNativeClass(), - new acceptValueClass(), - new acceptValueNativeClass(), - new tryCatchExitClass(), - new returnFloatClass(), - new returnFloatNativeClass(), - new returnDoubleClass(), - new returnDoubleNativeClass(), - }; - MethodTracer[] tracers = new MethodTracer[] { - new NormalTracer(), - new ThrowEnterTracer(), - new ThrowExitTracer(), - new ThrowBothTracer(), - new ForceGCTracer(), - }; - - // Call once so the initialization of Class.forName is done before tracing to make the test - // output more readable. - new returnNativeExceptionClass().run(); - - setupTracing(); - for (MethodTracer t : tracers) { - for (MyRunnable r : testCases) { - doTest(t, r); - } - } - - maybeDisableTracing(); - System.out.println("Finished - without non-standard exits!"); - Trace.disableTracing(Thread.currentThread()); - - // Enabling frame pop events force a different path and deoptimize more often. So redo the - // tests by enabling frame pop events. - Trace.enableFramePopEvents(); - setupTracing(); - for (MethodTracer t : tracers) { - for (MyRunnable r : testCases) { - doTest(t, r); - } + MyRunnable[] testCases = new MyRunnable[] { + new doNothingClass(), + new doNothingNativeClass(), + new throwAClass(), + new throwANativeClass(), + new returnValueClass(), + new returnValueNativeClass(), + new acceptValueClass(), + new acceptValueNativeClass(), + new tryCatchExitClass(), + new returnFloatClass(), + new returnFloatNativeClass(), + new returnDoubleClass(), + new returnDoubleNativeClass(), + }; + MethodTracer[] tracers = new MethodTracer[] { + new NormalTracer(), + new ThrowEnterTracer(), + new ThrowExitTracer(), + new ThrowBothTracer(), + new ForceGCTracer(), + }; + + setupTracing(); + for (MethodTracer t : tracers) { + for (MyRunnable r : testCases) { + doTest(t, r); } + } maybeDisableTracing(); System.out.println("Finished!"); @@ -322,12 +299,6 @@ public class Test989 { } } - private static final class returnNativeExceptionClass implements MyRunnable { - public void run() { - returnNativeException(); - } - } - private static final class tryCatchExitClass implements MyRunnable { public void run() { tryCatchExit(); @@ -448,14 +419,6 @@ public class Test989 { throw new ErrorA("Throwing Error A"); } - public static void returnNativeException() { - try { - Class.forName("noclass.nonexistent.name"); - } catch (ClassNotFoundException e) { - System.out.println("Expected ClassNotFoundException received"); - } - } - static final class TestObject { private int idx; public TestObject(int v) { diff --git a/test/jvmti-common/Trace.java b/test/jvmti-common/Trace.java index 3df1737c91..8999bb1368 100644 --- a/test/jvmti-common/Trace.java +++ b/test/jvmti-common/Trace.java @@ -28,7 +28,6 @@ public class Trace { Method singleStep, Thread thr); public static native void disableTracing(Thread thr); - public static native void nativeEnableFramePopEvents(); public static void enableFieldTracing(Class<?> methodClass, Method fieldAccess, @@ -44,10 +43,6 @@ public class Trace { enableTracing(methodClass, entryMethod, exitMethod, null, null, null, thr); } - public static void enableFramePopEvents() { - nativeEnableFramePopEvents(); - } - public static void enableSingleStepTracing(Class<?> methodClass, Method singleStep, Thread thr) { diff --git a/test/ti-agent/trace_helper.cc b/test/ti-agent/trace_helper.cc index e34b5bdce9..58958cb268 100644 --- a/test/ti-agent/trace_helper.cc +++ b/test/ti-agent/trace_helper.cc @@ -466,15 +466,6 @@ extern "C" JNIEXPORT void JNICALL Java_art_Trace_watchFieldAccess( env->DeleteLocalRef(klass); } -extern "C" JNIEXPORT void JNICALL Java_art_Trace_nativeEnableFramePopEvents(JNIEnv* env) { - jvmtiCapabilities caps; - memset(&caps, 0, sizeof(caps)); - caps.can_pop_frame = 1; - if (JvmtiErrorToException(env, jvmti_env, jvmti_env->AddCapabilities(&caps))) { - return; - } -} - extern "C" JNIEXPORT void JNICALL Java_art_Trace_enableTracing2( JNIEnv* env, [[maybe_unused]] jclass trace, |