Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java @ 16563:1e63cb55f61d
Move InvokeKind from MethodCallTargetNode to CallTargetNode
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 14 Jul 2014 13:55:01 +0200 |
parents | 10c12d09a8d2 |
children | e7b7a5be4d21 |
rev | line source |
---|---|
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
23 package com.oracle.graal.hotspot.replacements; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.hotspot.nodes.BeginLockScopeNode.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import static com.oracle.graal.hotspot.nodes.EndLockScopeNode.*; |
6453
3bba61323b38
added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6451
diff
changeset
|
28 import static com.oracle.graal.hotspot.nodes.VMErrorNode.*; |
9513
659bb6cf930c
rename: HotSpotSnippetUtils -> HotSpotReplacementsUtil
Doug Simon <doug.simon@oracle.com>
parents:
9316
diff
changeset
|
29 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; |
10787
388fbd0dd4a4
moved BranchNodeProbabilities to graal.nodes project
Doug Simon <doug.simon@oracle.com>
parents:
10637
diff
changeset
|
30 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
31 import static com.oracle.graal.replacements.SnippetTemplate.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import java.util.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.api.code.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.graal.api.meta.*; |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
37 import com.oracle.graal.graph.Node.ConstantNodeParameter; |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
38 import com.oracle.graal.graph.Node.NodeIntrinsic; |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
39 import com.oracle.graal.graph.iterators.*; |
12788
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
40 import com.oracle.graal.hotspot.meta.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.graal.hotspot.nodes.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 import com.oracle.graal.nodes.*; |
16563
1e63cb55f61d
Move InvokeKind from MethodCallTargetNode to CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16480
diff
changeset
|
43 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
44 import com.oracle.graal.nodes.debug.*; |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
45 import com.oracle.graal.nodes.extended.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 import com.oracle.graal.nodes.java.*; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 import com.oracle.graal.nodes.spi.*; |
11265 | 48 import com.oracle.graal.nodes.type.*; |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
49 import com.oracle.graal.options.*; |
15470
c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15263
diff
changeset
|
50 import com.oracle.graal.phases.common.inlining.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
51 import com.oracle.graal.replacements.*; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
52 import com.oracle.graal.replacements.Snippet.ConstantParameter; |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
53 import com.oracle.graal.replacements.Snippet.Fold; |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
54 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
55 import com.oracle.graal.replacements.SnippetTemplate.Arguments; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
56 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo; |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
57 import com.oracle.graal.word.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 * Snippets used for implementing the monitorenter and monitorexit instructions. |
14956
a6bd51a7c14c
Remove MonitorExitStubCall, use a ForeignCallNode instead. Declare the linkage of MONITOREXIT as LEAF_SP.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13802
diff
changeset
|
61 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
62 * The locking algorithm used is described in the paper <a |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
63 * href="http://dl.acm.org/citation.cfm?id=1167515.1167496"> Eliminating synchronization-related |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
64 * atomic operations with biased locking and bulk rebiasing</a> by Kenneth Russell and David |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
65 * Detlefs. |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 */ |
8413
d9347ee39fbe
rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents:
7868
diff
changeset
|
67 public class MonitorSnippets implements Snippets { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
69 public static class Options { |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
70 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
71 //@formatter:off |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
72 @Option(help = "") |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
73 private static final OptionValue<Boolean> ProfileMonitors = new OptionValue<>(false); |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
74 //@formatter:on |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
75 } |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
76 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
77 private static final boolean PROFILE_CONTEXT = false; |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
78 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
79 @Fold |
12381
20150eaa1dc7
remove unused parameters from doProfile methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
12054
diff
changeset
|
80 private static boolean doProfile() { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
81 return Options.ProfileMonitors.getValue(); |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
82 } |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
83 |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
84 /** |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
85 * Monitor operations on objects whose type contains this substring will be traced. |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
86 */ |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
87 private static final String TRACE_TYPE_FILTER = System.getProperty("graal.monitors.trace.typeFilter"); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
89 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
90 * Monitor operations in methods whose fully qualified name contains this substring will be |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
91 * traced. |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
92 */ |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
93 private static final String TRACE_METHOD_FILTER = System.getProperty("graal.monitors.trace.methodFilter"); |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
94 |
6453
3bba61323b38
added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6451
diff
changeset
|
95 public static final boolean CHECK_BALANCED_MONITORS = Boolean.getBoolean("graal.monitors.checkBalanced"); |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
96 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 @Snippet |
12788
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
98 public static void monitorenter(Object object, @ConstantParameter int lockDepth, @ConstantParameter Register threadRegister, @ConstantParameter Register stackPointerRegister, |
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
99 @ConstantParameter boolean trace) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 verifyOop(object); |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
102 if (object == null) { |
6716
536dbb4dd212
removed null check from UnsafeLoadNode, UnsafeStoreNode, ReadNode and WriteNode as it violates the sun.misc.Unsafe API
Doug Simon <doug.simon@oracle.com>
parents:
6673
diff
changeset
|
103 DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException); |
536dbb4dd212
removed null check from UnsafeLoadNode, UnsafeStoreNode, ReadNode and WriteNode as it violates the sun.misc.Unsafe API
Doug Simon <doug.simon@oracle.com>
parents:
6673
diff
changeset
|
104 } |
15005
9fa900dd3f96
create special-purpose SnippetAnchorNode to replace usages of BeginNode in snippets
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14956
diff
changeset
|
105 GuardingNode anchorNode = SnippetAnchorNode.anchor(); |
6716
536dbb4dd212
removed null check from UnsafeLoadNode, UnsafeStoreNode, ReadNode and WriteNode as it violates the sun.misc.Unsafe API
Doug Simon <doug.simon@oracle.com>
parents:
6673
diff
changeset
|
106 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 // Load the mark word - this includes a null-check on object |
6419
b74402a7079b
fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents:
6389
diff
changeset
|
108 final Word mark = loadWordFromObject(object, markOffset()); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
110 final Word lock = beginLockScope(lockDepth); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
112 trace(trace, " object: 0x%016lx\n", Word.fromObject(object)); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
113 trace(trace, " lock: 0x%016lx\n", lock); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
114 trace(trace, " mark: 0x%016lx\n", mark); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
115 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
116 incCounter(); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
117 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 if (useBiasedLocking()) { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 // See whether the lock is currently biased toward our thread and |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 // whether the epoch is still valid. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 // Note that the runtime guarantees sufficient alignment of JavaThread |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 // pointers to allow age to be placed into low bits. |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
123 final Word biasableLockBits = mark.and(biasedLockMaskInPlace()); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 // First check to see whether biasing is enabled for this object |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
126 if (probability(NOT_FREQUENT_PROBABILITY, biasableLockBits.notEqual(Word.unsigned(biasedLockPattern())))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 // Biasing not enabled -> fall through to lightweight locking |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 // The bias pattern is present in the object's mark word. Need to check |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 // whether the bias owner and the epoch are both still current. |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
131 Word hub = loadHubIntrinsic(object, getWordKind(), anchorNode); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
132 final Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset(), PROTOTYPE_MARK_WORD_LOCATION); |
12788
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
133 final Word thread = registerAsWord(threadRegister); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 final Word tmp = prototypeMarkWord.or(thread).xor(mark).and(~ageMaskInPlace()); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
135 trace(trace, "prototypeMarkWord: 0x%016lx\n", prototypeMarkWord); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
136 trace(trace, " thread: 0x%016lx\n", thread); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
137 trace(trace, " tmp: 0x%016lx\n", tmp); |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
138 if (probability(FREQUENT_PROBABILITY, tmp.equal(0))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 // Object is already biased to current thread -> done |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
140 traceObject(trace, "+lock{bias:existing}", object, true); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 // At this point we know that the mark word has the bias pattern and |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 // that we are not the bias owner in the current epoch. We need to |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 // figure out more details about the state of the mark word in order to |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 // know what operations can be legally performed on the object's |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 // mark word. |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
149 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
150 // If the low three bits in the xor result aren't clear, that means |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
151 // the prototype header is no longer biasable and we have to revoke |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
152 // the bias on this object. |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
153 if (probability(FREQUENT_PROBABILITY, tmp.and(biasedLockMaskInPlace()).equal(0))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 // Biasing is still enabled for object's type. See whether the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 // epoch of the current bias is still valid, meaning that the epoch |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 // bits of the mark word are equal to the epoch bits of the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 // prototype mark word. (Note that the prototype mark word's epoch bits |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 // only change at a safepoint.) If not, attempt to rebias the object |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 // toward the current thread. Note that we must be absolutely sure |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 // that the current epoch is invalid in order to do this because |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 // otherwise the manipulations it performs on the mark word are |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 // illegal. |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
163 if (probability(FREQUENT_PROBABILITY, tmp.and(epochMaskInPlace()).equal(0))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 // The epoch of the current bias is still valid but we know nothing |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 // about the owner; it might be set or it might be clear. Try to |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 // acquire the bias of the object using an atomic operation. If this |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 // fails we will go in to the runtime to revoke the object's bias. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 // Note that we first construct the presumed unbiased header so we |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 // don't accidentally blow away another thread's valid bias. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 Word unbiasedMark = mark.and(biasedLockMaskInPlace() | ageMaskInPlace() | epochMaskInPlace()); |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 Word biasedMark = unbiasedMark.or(thread); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
172 trace(trace, " unbiasedMark: 0x%016lx\n", unbiasedMark); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
173 trace(trace, " biasedMark: 0x%016lx\n", biasedMark); |
9514
56dc7fe83f8a
rename: VERY_FAST_DEOPT_PATH_PROBABILITY -> VERY_FAST_PATH_PROBABILITY
Doug Simon <doug.simon@oracle.com>
parents:
9513
diff
changeset
|
174 if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(object, markOffset(), unbiasedMark, biasedMark, MARK_WORD_LOCATION).equal(unbiasedMark))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 // Object is now biased to current thread -> done |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
176 traceObject(trace, "+lock{bias:acquired}", object, true); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 } |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
179 // If the biasing toward our thread failed, this means that another thread |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
180 // owns the bias and we need to revoke that bias. The revocation will occur |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
181 // in the interpreter runtime. |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
182 traceObject(trace, "+lock{stub:revoke}", object, true); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
183 monitorenterStubC(MONITORENTER, object, lock); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 // At this point we know the epoch has expired, meaning that the |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
187 // current bias owner, if any, is actually invalid. Under these |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
188 // circumstances _only_, are we allowed to use the current mark word |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 // value as the comparison value when doing the CAS to acquire the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 // bias in the current epoch. In other words, we allow transfer of |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 // the bias from one thread to another directly in this situation. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 Word biasedMark = prototypeMarkWord.or(thread); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
193 trace(trace, " biasedMark: 0x%016lx\n", biasedMark); |
9514
56dc7fe83f8a
rename: VERY_FAST_DEOPT_PATH_PROBABILITY -> VERY_FAST_PATH_PROBABILITY
Doug Simon <doug.simon@oracle.com>
parents:
9513
diff
changeset
|
194 if (probability(VERY_FAST_PATH_PROBABILITY, compareAndSwap(object, markOffset(), mark, biasedMark, MARK_WORD_LOCATION).equal(mark))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 // Object is now biased to current thread -> done |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
196 traceObject(trace, "+lock{bias:transfer}", object, true); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
198 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
199 // If the biasing toward our thread failed, then another thread |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 // succeeded in biasing it toward itself and we need to revoke that |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 // bias. The revocation will occur in the runtime in the slow case. |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
202 traceObject(trace, "+lock{stub:epoch-expired}", object, true); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
203 monitorenterStubC(MONITORENTER, object, lock); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 // The prototype mark word doesn't have the bias bit set any |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 // more, indicating that objects of this data type are not supposed |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 // to be biased any more. We are going to try to reset the mark of |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 // this object to the prototype value and fall through to the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 // CAS-based locking scheme. Note that if our CAS fails, it means |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 // that another thread raced us for the privilege of revoking the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 // bias of this particular object, so it's okay to continue in the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 // normal locking code. |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
215 Word result = compareAndSwap(object, markOffset(), mark, prototypeMarkWord, MARK_WORD_LOCATION); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 // Fall through to the normal CAS-based lock, because no matter what |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 // the result of the above CAS, some thread must have succeeded in |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 // removing the bias bit from the object's header. |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
220 |
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
221 if (ENABLE_BREAKPOINT) { |
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
222 bkpt(object, mark, tmp, result); |
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
223 } |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 // Create the unlocked mark word pattern |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 Word unlockedMark = mark.or(unlockedMask()); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
230 trace(trace, " unlockedMark: 0x%016lx\n", unlockedMark); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 // Copy this unlocked mark word into the lock slot on the stack |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
233 lock.writeWord(lockDisplacedMarkOffset(), unlockedMark, DISPLACED_MARK_WORD_LOCATION); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 // Test if the object's mark word is unlocked, and if so, store the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 // (address of) the lock slot into the object's mark word. |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
237 Word currentMark = compareAndSwap(object, markOffset(), unlockedMark, lock, MARK_WORD_LOCATION); |
7701
47467b2c3fc5
Use equal() and notEqual() instead of == and != to compare words
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7660
diff
changeset
|
238 if (currentMark.notEqual(unlockedMark)) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
239 trace(trace, " currentMark: 0x%016lx\n", currentMark); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 // The mark word in the object header was not the same. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 // Either the object is locked by another thread or is already locked |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 // by the current thread. The latter is true if the mark word |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 // is a stack pointer into the current thread's stack, i.e.: |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 // |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
245 // 1) (currentMark & aligned_mask) == 0 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
246 // 2) rsp <= currentMark |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
247 // 3) currentMark <= rsp + page_size |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 // |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 // These 3 tests can be done by evaluating the following expression: |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 // |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
251 // (currentMark - rsp) & (aligned_mask - page_size) |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 // |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 // assuming both the stack pointer and page_size have their least |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 // significant 2 bits cleared and page_size is a power of 2 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
255 final Word alignedMask = Word.unsigned(wordSize() - 1); |
12788
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
256 final Word stackPointer = registerAsWord(stackPointerRegister); |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
257 if (probability(VERY_SLOW_PATH_PROBABILITY, currentMark.subtract(stackPointer).and(alignedMask.subtract(pageSize())).notEqual(0))) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 // Most likely not a recursive lock, go into a slow runtime call |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
259 traceObject(trace, "+lock{stub:failed-cas}", object, true); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
260 monitorenterStubC(MONITORENTER, object, lock); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
261 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
262 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
263 // Recursively locked => write 0 to the lock slot |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
264 lock.writeWord(lockDisplacedMarkOffset(), Word.zero(), DISPLACED_MARK_WORD_LOCATION); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
265 traceObject(trace, "+lock{recursive}", object, true); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
266 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
267 } else { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
268 traceObject(trace, "+lock{cas}", object, true); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
269 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
270 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
271 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
272 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
273 * Calls straight out to the monitorenter stub. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
274 */ |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
275 @Snippet |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
276 public static void monitorenterStub(Object object, @ConstantParameter int lockDepth, @ConstantParameter boolean trace) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
277 verifyOop(object); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
278 incCounter(); |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
279 if (object == null) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.NullCheckException); |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 // BeginLockScope nodes do not read from object so a use of object |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 // cannot float about the null check above |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
284 final Word lock = beginLockScope(lockDepth); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
285 traceObject(trace, "+lock{stub}", object, true); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
286 monitorenterStubC(MONITORENTER, object, lock); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 @Snippet |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
290 public static void monitorexit(Object object, @ConstantParameter int lockDepth, @ConstantParameter boolean trace) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
291 trace(trace, " object: 0x%016lx\n", Word.fromObject(object)); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
292 if (useBiasedLocking()) { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
293 // Check for biased locking unlock case, which is a no-op |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
294 // Note: we do not have to check the thread ID for two reasons. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
295 // First, the interpreter checks for IllegalMonitorStateException at |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
296 // a higher level. Second, if the bias was revoked while we held the |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
297 // lock, the object could not be rebiased toward another thread, so |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
298 // the bias bit would be clear. |
6419
b74402a7079b
fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents:
6389
diff
changeset
|
299 final Word mark = loadWordFromObject(object, markOffset()); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
300 trace(trace, " mark: 0x%016lx\n", mark); |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
301 if (probability(FREQUENT_PROBABILITY, mark.and(biasedLockMaskInPlace()).equal(Word.unsigned(biasedLockPattern())))) { |
6436
5395ecdfce8a
move monitors into FrameState (fixes subtle issues for tail duplication and other optimizations)
Lukas Stadler <lukas.stadler@jku.at>
parents:
6424
diff
changeset
|
302 endLockScope(); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
303 decCounter(); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
304 traceObject(trace, "-lock{bias}", object, false); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
305 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
306 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
307 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
308 |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
309 final Word lock = CurrentLockNode.currentLock(lockDepth); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
310 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
311 // Load displaced mark |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
312 final Word displacedMark = lock.readWord(lockDisplacedMarkOffset(), DISPLACED_MARK_WORD_LOCATION); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
313 trace(trace, " displacedMark: 0x%016lx\n", displacedMark); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
314 |
7701
47467b2c3fc5
Use equal() and notEqual() instead of == and != to compare words
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7660
diff
changeset
|
315 if (displacedMark.equal(0)) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
316 // Recursive locking => done |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
317 traceObject(trace, "-lock{recursive}", object, false); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
318 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
319 verifyOop(object); |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
320 // Test if object's mark word is pointing to the displaced mark word, and if so, restore |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
321 // the displaced mark in the object - if the object's mark word is not pointing to |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
322 // the displaced mark word, do unlocking via runtime call. |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
323 if (probability(VERY_SLOW_PATH_PROBABILITY, DirectCompareAndSwapNode.compareAndSwap(object, markOffset(), lock, displacedMark, MARK_WORD_LOCATION).notEqual(lock))) { |
7490
4c474119df1c
Probabilities for the monitor snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7300
diff
changeset
|
324 // The object's mark word was not pointing to the displaced header, |
4c474119df1c
Probabilities for the monitor snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7300
diff
changeset
|
325 // we do unlocking via runtime call. |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
326 traceObject(trace, "-lock{stub}", object, false); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
327 monitorexitStubC(MONITOREXIT, object, lock); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
328 } else { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
329 traceObject(trace, "-lock{cas}", object, false); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
330 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
331 } |
6436
5395ecdfce8a
move monitors into FrameState (fixes subtle issues for tail duplication and other optimizations)
Lukas Stadler <lukas.stadler@jku.at>
parents:
6424
diff
changeset
|
332 endLockScope(); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
333 decCounter(); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
334 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
335 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
336 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
337 * Calls straight out to the monitorexit stub. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 */ |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
339 @Snippet |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
340 public static void monitorexitStub(Object object, @ConstantParameter int lockDepth, @ConstantParameter boolean trace) { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
341 verifyOop(object); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
342 traceObject(trace, "-lock{stub}", object, false); |
14956
a6bd51a7c14c
Remove MonitorExitStubCall, use a ForeignCallNode instead. Declare the linkage of MONITOREXIT as LEAF_SP.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13802
diff
changeset
|
343 final Word lock = CurrentLockNode.currentLock(lockDepth); |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
344 monitorexitStubC(MONITOREXIT, object, lock); |
6436
5395ecdfce8a
move monitors into FrameState (fixes subtle issues for tail duplication and other optimizations)
Lukas Stadler <lukas.stadler@jku.at>
parents:
6424
diff
changeset
|
345 endLockScope(); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
346 decCounter(); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
347 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
348 |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
349 private static void traceObject(boolean enabled, String action, Object object, boolean enter) { |
12381
20150eaa1dc7
remove unused parameters from doProfile methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
12054
diff
changeset
|
350 if (doProfile()) { |
11893
ec267141f753
more javadoc and output tweaks for dynamic counters
Lukas Stadler <lukas.stadler@jku.at>
parents:
11873
diff
changeset
|
351 DynamicCounterNode.counter(action, enter ? "number of monitor enters" : "number of monitor exits", 1, PROFILE_CONTEXT); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
352 } |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
353 if (enabled) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
354 Log.print(action); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
355 Log.print(' '); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
356 Log.printlnObject(object); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
357 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
358 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
359 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
360 private static void trace(boolean enabled, String format, WordBase value) { |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
361 if (enabled) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
362 Log.printf(format, value.rawValue()); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
363 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
364 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
365 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
366 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
367 * Leaving the breakpoint code in to provide an example of how to use the {@link BreakpointNode} |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
368 * intrinsic. |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
369 */ |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
370 private static final boolean ENABLE_BREAKPOINT = false; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
371 |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
9771
diff
changeset
|
372 private static final LocationIdentity MONITOR_COUNTER_LOCATION = new NamedLocationIdentity("MonitorCounter"); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
373 |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
374 @NodeIntrinsic(BreakpointNode.class) |
6458
fb66841a0994
made all @NodeIntrinsic annotated methods be native (this is a requirement now enforced during snippet intrinsification)
Doug Simon <doug.simon@oracle.com>
parents:
6453
diff
changeset
|
375 static native void bkpt(Object object, Word mark, Word tmp, Word value); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
376 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
377 private static void incCounter() { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
378 if (CHECK_BALANCED_MONITORS) { |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6952
diff
changeset
|
379 final Word counter = MonitorCounterNode.counter(); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
380 final int count = counter.readInt(0, MONITOR_COUNTER_LOCATION); |
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
381 counter.writeInt(0, count + 1, MONITOR_COUNTER_LOCATION); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
382 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
383 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
384 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
385 private static void decCounter() { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
386 if (CHECK_BALANCED_MONITORS) { |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6952
diff
changeset
|
387 final Word counter = MonitorCounterNode.counter(); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
388 final int count = counter.readInt(0, MONITOR_COUNTER_LOCATION); |
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
389 counter.writeInt(0, count - 1, MONITOR_COUNTER_LOCATION); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
390 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
391 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
392 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
393 @Snippet |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
394 private static void initCounter() { |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6952
diff
changeset
|
395 final Word counter = MonitorCounterNode.counter(); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
396 counter.writeInt(0, 0, MONITOR_COUNTER_LOCATION); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
397 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
398 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
399 @Snippet |
9605
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
400 private static void checkCounter(@ConstantParameter String errMsg) { |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6952
diff
changeset
|
401 final Word counter = MonitorCounterNode.counter(); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
402 final int count = counter.readInt(0, MONITOR_COUNTER_LOCATION); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
403 if (count != 0) { |
6453
3bba61323b38
added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6451
diff
changeset
|
404 vmError(errMsg, count); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
405 } |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
406 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
407 |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
408 public static class Templates extends AbstractTemplates { |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
409 |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
410 private final SnippetInfo monitorenter = snippet(MonitorSnippets.class, "monitorenter"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
411 private final SnippetInfo monitorexit = snippet(MonitorSnippets.class, "monitorexit"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
412 private final SnippetInfo monitorenterStub = snippet(MonitorSnippets.class, "monitorenterStub"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
413 private final SnippetInfo monitorexitStub = snippet(MonitorSnippets.class, "monitorexitStub"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
414 private final SnippetInfo initCounter = snippet(MonitorSnippets.class, "initCounter"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
415 private final SnippetInfo checkCounter = snippet(MonitorSnippets.class, "checkCounter"); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
416 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
417 private final boolean useFastLocking; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
418 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15005
diff
changeset
|
419 public Templates(HotSpotProviders providers, TargetDescription target, boolean useFastLocking) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15005
diff
changeset
|
420 super(providers, providers.getSnippetReflection(), target); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
421 this.useFastLocking = useFastLocking; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
422 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
423 |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
424 public void lower(MonitorEnterNode monitorenterNode, HotSpotRegistersProvider registers, LoweringTool tool) { |
9602
19c5a07c7843
Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
425 StructuredGraph graph = monitorenterNode.graph(); |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
426 checkBalancedMonitors(graph, tool); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
427 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
428 Arguments args; |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
429 if (useFastLocking) { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
430 args = new Arguments(monitorenter, graph.getGuardsStage(), tool.getLoweringStage()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
431 } else { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
432 args = new Arguments(monitorenterStub, graph.getGuardsStage(), tool.getLoweringStage()); |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
433 } |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
434 args.add("object", monitorenterNode.object()); |
13554
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
435 args.addConst("lockDepth", monitorenterNode.getMonitorId().getLockDepth()); |
12788
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
436 args.addConst("threadRegister", registers.getThreadRegister()); |
100d20e8d460
pass thread register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12786
diff
changeset
|
437 args.addConst("stackPointerRegister", registers.getStackPointerRegister()); |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
438 args.addConst("trace", isTracingEnabledForType(monitorenterNode.object()) || isTracingEnabledForMethod(graph.method())); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
439 |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
440 template(args).instantiate(providers.getMetaAccess(), monitorenterNode, DEFAULT_REPLACER, args); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
441 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
442 |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
443 public void lower(MonitorExitNode monitorexitNode, LoweringTool tool) { |
9602
19c5a07c7843
Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
444 StructuredGraph graph = monitorexitNode.graph(); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
445 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
446 Arguments args; |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
447 if (useFastLocking) { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
448 args = new Arguments(monitorexit, graph.getGuardsStage(), tool.getLoweringStage()); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
449 } else { |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
450 args = new Arguments(monitorexitStub, graph.getGuardsStage(), tool.getLoweringStage()); |
6389
2d84f74e394c
enabled type-filter based logging of (snippet-based) monitor operations with the "graal.monitorsnippets.log" system property
Doug Simon <doug.simon@oracle.com>
parents:
6386
diff
changeset
|
451 } |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
452 args.add("object", monitorexitNode.object()); |
13554
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
453 args.addConst("lockDepth", monitorexitNode.getMonitorId().getLockDepth()); |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
454 args.addConst("trace", isTracingEnabledForType(monitorexitNode.object()) || isTracingEnabledForMethod(graph.method())); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
455 |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
456 template(args).instantiate(providers.getMetaAccess(), monitorexitNode, DEFAULT_REPLACER, args); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
457 } |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
458 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
459 static boolean isTracingEnabledForType(ValueNode object) { |
15260
61363577a184
Move static helpers from ObjectStamp to StampTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
460 ResolvedJavaType type = StampTool.typeOrNull(object.stamp()); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
461 if (TRACE_TYPE_FILTER == null) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
462 return false; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
463 } else { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
464 if (TRACE_TYPE_FILTER.length() == 0) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
465 return true; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
466 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
467 if (type == null) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
468 return false; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
469 } |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6526
diff
changeset
|
470 return (type.getName().contains(TRACE_TYPE_FILTER)); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
471 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
472 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
473 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
474 static boolean isTracingEnabledForMethod(ResolvedJavaMethod method) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
475 if (TRACE_METHOD_FILTER == null) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
476 return false; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
477 } else { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
478 if (TRACE_METHOD_FILTER.length() == 0) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
479 return true; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
480 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
481 if (method == null) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
482 return false; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
483 } |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16176
diff
changeset
|
484 return (method.format("%H.%n").contains(TRACE_METHOD_FILTER)); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
485 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
486 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
487 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
488 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
489 * If balanced monitor checking is enabled then nodes are inserted at the start and all |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
490 * return points of the graph to initialize and check the monitor counter respectively. |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
491 */ |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
492 private void checkBalancedMonitors(StructuredGraph graph, LoweringTool tool) { |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
493 if (CHECK_BALANCED_MONITORS) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
494 NodeIterable<MonitorCounterNode> nodes = graph.getNodes().filter(MonitorCounterNode.class); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
495 if (nodes.isEmpty()) { |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
496 // Only insert the nodes if this is the first monitorenter being lowered. |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
497 JavaType returnType = initCounter.getMethod().getSignature().getReturnType(initCounter.getMethod().getDeclaringClass()); |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
498 MethodCallTargetNode callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, initCounter.getMethod(), new ValueNode[0], returnType)); |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7556
diff
changeset
|
499 InvokeNode invoke = graph.add(new InvokeNode(callTarget, 0)); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
500 invoke.setStateAfter(graph.start().stateAfter()); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
501 graph.addAfterFixed(graph.start(), invoke); |
8627
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8586
diff
changeset
|
502 |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
503 StructuredGraph inlineeGraph = providers.getReplacements().getSnippet(initCounter.getMethod()); |
16176
5785eca138b0
improve tracking of nodes to canonicalize after inlining
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15926
diff
changeset
|
504 InliningUtil.inline(invoke, inlineeGraph, false, null); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
505 |
13690
08f58bfde0dd
add IterableNodeType to ReturnNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13554
diff
changeset
|
506 List<ReturnNode> rets = graph.getNodes(ReturnNode.class).snapshot(); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
507 for (ReturnNode ret : rets) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
508 returnType = checkCounter.getMethod().getSignature().getReturnType(checkCounter.getMethod().getDeclaringClass()); |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16176
diff
changeset
|
509 String msg = "unbalanced monitors in " + graph.method().format("%H.%n(%p)") + ", count = %d"; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15005
diff
changeset
|
510 ConstantNode errMsg = ConstantNode.forConstant(HotSpotObjectConstant.forObject(msg), providers.getMetaAccess(), graph); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
511 callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter.getMethod(), new ValueNode[]{errMsg}, returnType)); |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7556
diff
changeset
|
512 invoke = graph.add(new InvokeNode(callTarget, 0)); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
513 List<ValueNode> stack = Collections.emptyList(); |
15263
0b25b81414c9
Move various bci constants from FrameState (gral.nodes) to BytecodeFrame (graal.api.code)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15260
diff
changeset
|
514 FrameState stateAfter = new FrameState(graph.method(), BytecodeFrame.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], new MonitorIdNode[0], false, false); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
515 invoke.setStateAfter(graph.add(stateAfter)); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
516 graph.addBeforeFixed(ret, invoke); |
9605
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
517 |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12788
diff
changeset
|
518 Arguments args = new Arguments(checkCounter, graph.getGuardsStage(), tool.getLoweringStage()); |
9605
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
519 args.addConst("errMsg", msg); |
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
520 inlineeGraph = template(args).copySpecializedGraph(); |
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
521 |
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
522 // inlineeGraph = replacements.getSnippet(checkCounter.getMethod()); |
16176
5785eca138b0
improve tracking of nodes to canonicalize after inlining
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15926
diff
changeset
|
523 InliningUtil.inline(invoke, inlineeGraph, false, null); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
524 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
525 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
526 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
6436
diff
changeset
|
527 } |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
528 } |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
529 |
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
530 public static final ForeignCallDescriptor MONITORENTER = new ForeignCallDescriptor("monitorenter", void.class, Object.class, Word.class); |
14956
a6bd51a7c14c
Remove MonitorExitStubCall, use a ForeignCallNode instead. Declare the linkage of MONITOREXIT as LEAF_SP.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13802
diff
changeset
|
531 public static final ForeignCallDescriptor MONITOREXIT = new ForeignCallDescriptor("monitorexit", void.class, Object.class, Word.class); |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
532 |
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
533 @NodeIntrinsic(ForeignCallNode.class) |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
534 private static native void monitorenterStubC(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object, Word lock); |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
535 |
14956
a6bd51a7c14c
Remove MonitorExitStubCall, use a ForeignCallNode instead. Declare the linkage of MONITOREXIT as LEAF_SP.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13802
diff
changeset
|
536 @NodeIntrinsic(ForeignCallNode.class) |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15470
diff
changeset
|
537 private static native void monitorexitStubC(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object, Word lock); |
14956
a6bd51a7c14c
Remove MonitorExitStubCall, use a ForeignCallNode instead. Declare the linkage of MONITOREXIT as LEAF_SP.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13802
diff
changeset
|
538 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
539 } |