diff options
author | 2020-01-23 10:15:56 +0000 | |
---|---|---|
committer | 2020-01-31 08:20:57 +0000 | |
commit | e91e795a77b96d58276f75b1b244a5509ef8c215 (patch) | |
tree | d34f8164bb7adb8ed46e3c989877012555e194c3 /test/2011-stack-walk-concurrent-instrument/src/Main.java | |
parent | aa6f6f1c86705fe3cedf929bd30d1e6f51524594 (diff) |
Replace instrumention id with stack pointers.
Replace instrumentation ids for instrumentation frames, which are
inherently broken (see b/72608560), and use stack addresses instead
to properly identify which frames to pop / unwind.
Bug: 72608560
Bug: 148166031
Test: ./art/test/testrunner/testrunner.py --trace --debuggable --ndebuggable --optimizing --interpreter --jit --debug --ndebug -j32
Test: run-libjdwp-tests.sh
Test: 2011-stack-walk-concurrent-instrument
Test: ./art/test/run-test --host --dev --runtime-option -verbose:deopt,plugin --prebuild --compact-dex-level fast --jit --no-relocate --create-runner --runtime-option -Xcheck:jni 1965-get-set-local-primitive-no-tables
art/tools/parallel_run.py -j80 /tmp/path/to/runit.sh --out failure.txt
Change-Id: I71f6e55b9da608796cd3142b147f7b50bbd292ec
Diffstat (limited to 'test/2011-stack-walk-concurrent-instrument/src/Main.java')
-rw-r--r-- | test/2011-stack-walk-concurrent-instrument/src/Main.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/2011-stack-walk-concurrent-instrument/src/Main.java b/test/2011-stack-walk-concurrent-instrument/src/Main.java new file mode 100644 index 0000000000..8f96f937c9 --- /dev/null +++ b/test/2011-stack-walk-concurrent-instrument/src/Main.java @@ -0,0 +1,66 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.concurrent.*; + +public class Main { + public Main() { + } + + void $noinline$f(Runnable r) throws Exception { + $noinline$g(r); + } + + void $noinline$g(Runnable r) { + $noinline$h(r); + } + + void $noinline$h(Runnable r) { + r.run(); + } + + public native void resetTest(); + public native void waitAndDeopt(Thread t); + public native void doSelfStackWalk(); + + void testConcurrent() throws Exception { + resetTest(); + final Thread current = Thread.currentThread(); + Thread t = new Thread(() -> { + try { + this.waitAndDeopt(current); + } catch (Exception e) { + throw new Error("Fail!", e); + } + }); + t.start(); + $noinline$f(() -> { + try { + this.doSelfStackWalk(); + } catch (Exception e) { + throw new Error("Fail!", e); + } + }); + t.join(); + } + + public static void main(String[] args) throws Exception { + System.loadLibrary(args[0]); + Main st = new Main(); + st.testConcurrent(); + System.out.println("Done"); + } +} |