Mercurial > hg > truffle
annotate test/compiler/testlibrary/rtm/AbortType.java @ 18440:7aae90a0031c
LIR: map all VirtualStackSlot operands to StackSlots.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 11 Nov 2014 17:03:16 +0100 |
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 com.oracle.java.testlibrary.Asserts; |
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 import java.util.HashMap; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
30 import java.util.Map; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
31 |
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 * Type of transactional execution abort. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
34 * For more details on different abort types please see |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
35 * shared/vm/runtime/rtmLocking.hpp |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
36 */ |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
37 public enum AbortType { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
38 XABORT(0), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
39 RETRIABLE(1), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
40 MEM_CONFLICT(2), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
41 BUF_OVERFLOW(3), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
42 DEBUG_BREAKPOINT(4), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
43 NESTED_ABORT(5); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
44 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
45 private final int type; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
46 private static final Map<Integer, AbortType> LOOKUP_MAP = new HashMap<>(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
47 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
48 static { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
49 for (AbortType abortType : AbortType.values()) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
50 Asserts.assertFalse(LOOKUP_MAP.containsKey(abortType.type), |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
51 "Abort type values should be unique."); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
52 LOOKUP_MAP.put(abortType.type, abortType); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
53 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
54 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
55 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
56 private AbortType(int type) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
57 this.type = type; |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
58 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
59 |
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 * Returns AbortProvoker for aborts represented by this abort type. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
62 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
63 * @return an AbortProvoker instance |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
64 */ |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
65 public AbortProvoker provoker() { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
66 return AbortType.createNewProvoker(this); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
67 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
68 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
69 public static AbortType lookup(int type) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
70 Asserts.assertLT(type, AbortType.values().length, |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
71 "Unknown abort type."); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
72 return LOOKUP_MAP.get(type); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
73 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
74 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
75 /** |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
76 * Returns transaction execution abort provoker for specified abortion type. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
77 * |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
78 * @param type a type of abort which will be forced by returned |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
79 * AbortProvoker instance. |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
80 * @return AbortProvoker instance that will force abort of specified type |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
81 * @throws RuntimeException if there is no provoker for specified type |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
82 */ |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
83 private static AbortProvoker createNewProvoker(AbortType type) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
84 switch (type) { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
85 case XABORT: |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
86 return new XAbortProvoker(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
87 case MEM_CONFLICT: |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
88 return new MemoryConflictProvoker(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
89 case BUF_OVERFLOW: |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
90 return new BufferOverflowProvoker(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
91 case NESTED_ABORT: |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
92 return new NestedAbortProvoker(); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
93 default: |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
94 throw new RuntimeException("No provoker exists for type " |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
95 + type.name()); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
96 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
97 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
98 |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
99 @Override |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
100 public String toString() { |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
101 return Integer.toString(type); |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
102 } |
665bbe93823f
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
103 } |