Mercurial > hg > truffle
annotate test/compiler/testlibrary/rtm/NestedAbortProvoker.java @ 18377:ed0fce2e999a
Fold klass._java_mirror._klass into klass and improve stamps from layout_helper
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 14 Nov 2014 09:32:59 -0800 |
parents | 665bbe93823f |
children |
rev | line source |
---|---|
17871
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
1 /* |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
4 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
8 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
13 * accompanied this code). |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
14 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
18 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
21 * questions. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
22 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
23 */ |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
24 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
25 package rtm; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
26 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
27 import java.util.Arrays; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
28 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
29 /** |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
30 * In order to force nested transaction abort NestedAbortProvoker |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
31 * invoke BufferOverflowProvoker from transactional region. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
32 */ |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
33 class NestedAbortProvoker extends AbortProvoker { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
34 // Following field have to be static in order to avoid escape analysis. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
35 @SuppressWarnings("UnsuedDeclaration") |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
36 private static int field = 0; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
37 private final AbortProvoker nestedAbortProvoker; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
38 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
39 public NestedAbortProvoker() { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
40 this.nestedAbortProvoker = new XAbortProvoker(monitor); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
41 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
42 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
43 @Override |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
44 public void forceAbort() { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
45 synchronized(monitor) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
46 NestedAbortProvoker.field++; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
47 nestedAbortProvoker.forceAbort(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
48 NestedAbortProvoker.field--; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
49 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
50 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
51 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
52 @Override |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
53 public String[] getMethodsToCompileNames() { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
54 String nestedProvokerMethods[] |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
55 = nestedAbortProvoker.getMethodsToCompileNames(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
56 String methods[] = Arrays.copyOf(nestedProvokerMethods, |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
57 nestedProvokerMethods.length + 1); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
58 methods[methods.length - 1] = getMethodWithLockName(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
59 return methods; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
60 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
61 } |