Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java @ 18674:ecb9d0cedbab
First draft of option classification.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 13 Dec 2014 15:03:20 +0100 |
parents | f38677340519 |
children | f57d86eb036f |
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 /* |
18362
ea0fbb571466
Use pointer stamps in LoadHub and LoadMethod.
Roland Schatz <roland.schatz@oracle.com>
parents:
18307
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
6386
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.*; |
18370
6713fef8c859
Make the @Fold annotation a top-level interface in the api project. It is not tied to the Snippet class where it was located before.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18362
diff
changeset
|
37 import com.oracle.graal.api.replacements.*; |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
38 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
|
39 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
|
40 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
|
41 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
|
42 import com.oracle.graal.hotspot.nodes.*; |
18502
f38677340519
Add memory operations to MetaspacePointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18401
diff
changeset
|
43 import com.oracle.graal.hotspot.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
|
44 import com.oracle.graal.nodes.*; |
16563
1e63cb55f61d
Move InvokeKind from MethodCallTargetNode to CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16480
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 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
|
49 import com.oracle.graal.nodes.spi.*; |
11265 | 50 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
|
51 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
|
52 import com.oracle.graal.phases.common.inlining.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
53 import com.oracle.graal.replacements.*; |
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.Snippet.ConstantParameter; |
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.AbstractTemplates; |
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.Arguments; |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
57 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
|
58 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
|
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 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 * 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
|
62 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
63 * 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
|
64 * 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
|
65 * 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
|
66 * 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
|
67 */ |
8413
d9347ee39fbe
rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents:
7868
diff
changeset
|
68 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
|
69 |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
70 public static class Options { |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
71 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
72 //@formatter:off |
18674
ecb9d0cedbab
First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18502
diff
changeset
|
73 @Option(help = "", type = OptionType.Debug) |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
74 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
|
75 //@formatter:on |
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 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
78 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
|
79 |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
80 @Fold |
12381
20150eaa1dc7
remove unused parameters from doProfile methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
12054
diff
changeset
|
81 private static boolean doProfile() { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
82 return Options.ProfileMonitors.getValue(); |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
83 } |
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
84 |
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
|
85 /** |
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
|
86 * 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
|
87 */ |
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
|
88 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
|
89 |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
90 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
91 * 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
|
92 * traced. |
6424
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
93 */ |
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
|
94 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
|
95 |
6453
3bba61323b38
added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
6451
diff
changeset
|
96 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
|
97 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 @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
|
99 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
|
100 @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
|
101 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
|
102 |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
103 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
|
104 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
|
105 } |
15005
9fa900dd3f96
create special-purpose SnippetAnchorNode to replace usages of BeginNode in snippets
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14956
diff
changeset
|
106 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
|
107 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 // 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
|
109 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
|
110 |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
111 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
|
112 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
113 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
|
114 trace(trace, " lock: 0x%016lx\n", lock); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
115 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
|
116 |
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 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
|
118 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 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
|
120 // 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
|
121 // 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
|
122 // 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
|
123 // 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
|
124 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
|
125 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 // 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
|
127 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
|
128 // 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
|
129 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 // 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
|
131 // whether the bias owner and the epoch are both still current. |
18502
f38677340519
Add memory operations to MetaspacePointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18401
diff
changeset
|
132 KlassPointer hub = loadHubIntrinsic(object, anchorNode); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 trace(trace, "prototypeMarkWord: 0x%016lx\n", prototypeMarkWord); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
137 trace(trace, " thread: 0x%016lx\n", thread); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
138 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
|
139 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
|
140 // 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
|
141 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
|
142 return; |
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 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 // 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
|
146 // 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
|
147 // 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
|
148 // 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
|
149 // 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
|
150 |
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 // 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
|
152 // 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
|
153 // 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
|
154 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
|
155 // 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
|
156 // 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
|
157 // 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
|
158 // 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
|
159 // 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
|
160 // 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
|
161 // 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
|
162 // 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
|
163 // illegal. |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
164 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
|
165 // 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
|
166 // 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
|
167 // 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
|
168 // 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
|
169 // 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
|
170 // 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
|
171 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
|
172 Word biasedMark = unbiasedMark.or(thread); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
173 trace(trace, " unbiasedMark: 0x%016lx\n", unbiasedMark); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
174 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
|
175 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
|
176 // 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
|
177 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
|
178 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 } |
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
|
180 // 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
|
181 // 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
|
182 // in the interpreter runtime. |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
183 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
|
184 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
|
185 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 // 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
|
188 // 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
|
189 // 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
|
190 // 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
|
191 // 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
|
192 // 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
|
193 Word biasedMark = prototypeMarkWord.or(thread); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
194 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
|
195 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
|
196 // 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
|
197 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
|
198 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
199 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 // 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
|
201 // 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
|
202 // 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
|
203 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
|
204 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
|
205 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 // 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
|
209 // 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
|
210 // 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
|
211 // 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
|
212 // 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
|
213 // 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
|
214 // 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
|
215 // normal locking code. |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
216 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
|
217 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 // 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
|
219 // 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
|
220 // 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
|
221 |
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
222 if (ENABLE_BREAKPOINT) { |
be2f614bdeac
fixed bug in MonitorSnippets and enabled them for general use
Doug Simon <doug.simon@oracle.com>
parents:
6419
diff
changeset
|
223 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
|
224 } |
6386
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 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 // 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
|
230 Word unlockedMark = mark.or(unlockedMask()); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
231 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
|
232 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 // 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
|
234 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
|
235 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 // 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
|
237 // (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
|
238 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
|
239 if (currentMark.notEqual(unlockedMark)) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
240 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
|
241 // 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
|
242 // 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
|
243 // 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
|
244 // 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
|
245 // |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
246 // 1) (currentMark & aligned_mask) == 0 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
247 // 2) rsp <= currentMark |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
248 // 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
|
249 // |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 // 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
|
251 // |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
252 // (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
|
253 // |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 // 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
|
255 // 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
|
256 final Word alignedMask = Word.unsigned(wordSize() - 1); |
16647
e87d16c605d2
[SPARC] Small typo in monitorSnippets
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16643
diff
changeset
|
257 final Word stackPointer = registerAsWord(stackPointerRegister).add(config().stackBias); |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9015
diff
changeset
|
258 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
|
259 // 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
|
260 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
|
261 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
|
262 return; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
263 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
264 // 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
|
265 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
|
266 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
|
267 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
268 } else { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
269 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
|
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 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
274 * 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
|
275 */ |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 @Snippet |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
277 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
|
278 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
|
279 incCounter(); |
11337
39e83065426e
Add anchors for loadHubs in verifyObject and monitor enter.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
280 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
|
281 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
|
282 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 // 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
|
284 // 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
|
285 final Word lock = beginLockScope(lockDepth); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
286 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
|
287 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
|
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 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
290 @Snippet |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 // 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
|
295 // 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
|
296 // 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
|
297 // 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
|
298 // 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
|
299 // 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
|
300 final Word mark = loadWordFromObject(object, markOffset()); |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 decCounter(); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
305 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
|
306 return; |
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 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
309 |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
310 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
|
311 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
312 // Load displaced mark |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
313 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
|
314 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
|
315 |
7701
47467b2c3fc5
Use equal() and notEqual() instead of == and != to compare words
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7660
diff
changeset
|
316 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
|
317 // Recursive locking => done |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
318 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
|
319 } else { |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
320 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
|
321 // 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
|
322 // 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
|
323 // 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
|
324 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
|
325 // 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
|
326 // 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
|
327 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
|
328 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
|
329 } else { |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
330 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
|
331 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
332 } |
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
|
333 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
|
334 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
|
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 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 * 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
|
339 */ |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
340 @Snippet |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
341 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
|
342 verifyOop(object); |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
343 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
|
344 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
|
345 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
|
346 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
|
347 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
|
348 } |
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
|
349 |
11873
8a201c64cd18
in-depth profiling of allocations and monitors
Lukas Stadler <lukas.stadler@jku.at>
parents:
11732
diff
changeset
|
350 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
|
351 if (doProfile()) { |
11893
ec267141f753
more javadoc and output tweaks for dynamic counters
Lukas Stadler <lukas.stadler@jku.at>
parents:
11873
diff
changeset
|
352 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
|
353 } |
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
|
354 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
|
355 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
|
356 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
|
357 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
|
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 } |
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
|
360 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
361 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
|
362 if (enabled) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7276
diff
changeset
|
363 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
|
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 |
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
|
367 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
368 * 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
|
369 * 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
|
370 */ |
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 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
|
372 |
18307
85f5227a7a37
add mutable/immutable factory methods to NamedLocationIdentity
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18295
diff
changeset
|
373 private static final LocationIdentity MONITOR_COUNTER_LOCATION = NamedLocationIdentity.mutable("MonitorCounter"); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7708
diff
changeset
|
374 |
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
|
375 @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
|
376 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
|
377 |
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 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
|
379 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
|
380 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
|
381 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
|
382 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
|
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 |
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 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
|
387 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
|
388 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
|
389 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
|
390 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
|
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 |
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 @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
|
395 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
|
396 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
|
397 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
|
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 |
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
|
400 @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
|
401 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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 } |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
407 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
408 |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
409 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
|
410 |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
411 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
|
412 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
418 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
|
419 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15005
diff
changeset
|
420 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
|
421 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
|
422 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
|
423 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
424 |
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
|
425 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
|
426 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
|
427 checkBalancedMonitors(graph, tool); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
428 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
429 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
|
430 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
|
431 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
|
432 } 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
|
433 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
|
434 } |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
435 args.add("object", monitorenterNode.object()); |
13554
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
436 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
|
437 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
|
438 args.addConst("stackPointerRegister", registers.getStackPointerRegister()); |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
439 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
|
440 |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
441 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
|
442 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
443 |
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
|
444 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
|
445 StructuredGraph graph = monitorexitNode.graph(); |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
446 |
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
447 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
|
448 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
|
449 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
|
450 } 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
|
451 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
|
452 } |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9316
diff
changeset
|
453 args.add("object", monitorexitNode.object()); |
13554
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
454 args.addConst("lockDepth", monitorexitNode.getMonitorId().getLockDepth()); |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
455 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
|
456 |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13690
diff
changeset
|
457 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
|
458 } |
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
|
459 |
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
|
460 static boolean isTracingEnabledForType(ValueNode object) { |
15260
61363577a184
Move static helpers from ObjectStamp to StampTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 } 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
|
465 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
|
466 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
|
467 } |
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 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
|
469 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
|
470 } |
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
|
471 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
|
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 |
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 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
|
476 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
|
477 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
|
478 } 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
|
479 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
|
480 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
|
481 } |
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 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
|
483 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
|
484 } |
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
|
485 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
|
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 |
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
|
489 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7490
diff
changeset
|
490 * 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
|
491 * 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
|
492 */ |
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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 // 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
|
498 JavaType returnType = initCounter.getMethod().getSignature().getReturnType(initCounter.getMethod().getDeclaringClass()); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16662
diff
changeset
|
499 MethodCallTargetNode callTarget = graph.add(MethodCallTargetNode.create(InvokeKind.Static, initCounter.getMethod(), new ValueNode[0], returnType)); |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16662
diff
changeset
|
500 InvokeNode invoke = graph.add(InvokeNode.create(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
|
501 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
|
502 graph.addAfterFixed(graph.start(), invoke); |
8627
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8586
diff
changeset
|
503 |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
504 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
|
505 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
|
506 |
13690
08f58bfde0dd
add IterableNodeType to ReturnNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13554
diff
changeset
|
507 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
|
508 for (ReturnNode ret : rets) { |
9015
92d2bedb5dfc
Change of Snippet template and instantiation process
Christian Wimmer <christian.wimmer@oracle.com>
parents:
8637
diff
changeset
|
509 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
|
510 String msg = "unbalanced monitors in " + graph.method().format("%H.%n(%p)") + ", count = %d"; |
18295
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
511 ConstantNode errMsg = ConstantNode.forConstant(tool.getConstantReflection().forString(msg), providers.getMetaAccess(), graph); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16662
diff
changeset
|
512 callTarget = graph.add(MethodCallTargetNode.create(InvokeKind.Static, checkCounter.getMethod(), new ValueNode[]{errMsg}, returnType)); |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16662
diff
changeset
|
513 invoke = graph.add(InvokeNode.create(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
|
514 List<ValueNode> stack = Collections.emptyList(); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16662
diff
changeset
|
515 FrameState stateAfter = FrameState.create(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
|
516 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
|
517 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
|
518 |
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
|
519 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
|
520 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
|
521 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
|
522 |
1a87230c775d
removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents:
9602
diff
changeset
|
523 // 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
|
524 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
|
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 } |
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
|
528 } |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
529 } |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
530 |
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
531 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
|
532 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
|
533 |
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9605
diff
changeset
|
534 @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
|
535 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
|
536 |
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
|
537 @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
|
538 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
|
539 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
540 } |