Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java @ 14863:ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 27 Mar 2014 22:17:54 -0700 |
parents | 17a735726670 |
children | b14cb2d9253d |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.api.code.MemoryBarriers.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static com.oracle.graal.api.meta.DeoptimizationAction.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import static com.oracle.graal.api.meta.DeoptimizationReason.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import static com.oracle.graal.api.meta.LocationIdentity.*; |
12430
c0e660b07e02
introduced HotSpotRegistersProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
29 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
30 import static com.oracle.graal.hotspot.meta.HotSpotForeignCallsProviderImpl.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import static com.oracle.graal.nodes.java.ArrayLengthNode.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import static com.oracle.graal.phases.GraalOptions.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 |
12606
86e5fc5ba6bd
Reorder commit allocation's node writes to account for deferred barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12587
diff
changeset
|
36 import java.util.*; |
86e5fc5ba6bd
Reorder commit allocation's node writes to account for deferred barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12587
diff
changeset
|
37 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.api.code.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 import com.oracle.graal.api.meta.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 import com.oracle.graal.asm.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.graal.graph.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 import com.oracle.graal.hotspot.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 import com.oracle.graal.hotspot.debug.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 import com.oracle.graal.hotspot.nodes.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 import com.oracle.graal.hotspot.replacements.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 import com.oracle.graal.java.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 import com.oracle.graal.nodes.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 import com.oracle.graal.nodes.HeapAccess.BarrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 import com.oracle.graal.nodes.calc.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 import com.oracle.graal.nodes.debug.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 import com.oracle.graal.nodes.extended.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 import com.oracle.graal.nodes.java.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 import com.oracle.graal.nodes.spi.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 import com.oracle.graal.nodes.type.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 import com.oracle.graal.nodes.virtual.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 import com.oracle.graal.replacements.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 * HotSpot implementation of {@link LoweringProvider}. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 */ |
12796
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
62 public class HotSpotLoweringProvider implements LoweringProvider { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12430
diff
changeset
|
64 protected final HotSpotGraalRuntime runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 protected final MetaAccessProvider metaAccess; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 protected final ForeignCallsProvider foreignCalls; |
12786
7e9c00c54866
pass stack pointer register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
67 protected final HotSpotRegistersProvider registers; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 |
12796
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
69 protected CheckCastDynamicSnippets.Templates checkcastDynamicSnippets; |
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
70 protected InstanceOfSnippets.Templates instanceofSnippets; |
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
71 protected NewObjectSnippets.Templates newObjectSnippets; |
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
72 protected MonitorSnippets.Templates monitorSnippets; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 protected WriteBarrierSnippets.Templates writeBarrierSnippets; |
12796
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
74 protected BoxingSnippets.Templates boxingSnippets; |
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
75 protected LoadExceptionObjectSnippets.Templates exceptionObjectSnippets; |
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
76 protected UnsafeLoadSnippets.Templates unsafeLoadSnippets; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 |
12796
68ff7abbfae5
renamed HotSpotHostLoweringProvider to HotSpotLoweringProvider
Doug Simon <doug.simon@oracle.com>
parents:
12794
diff
changeset
|
78 public HotSpotLoweringProvider(HotSpotGraalRuntime runtime, MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls, HotSpotRegistersProvider registers) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12430
diff
changeset
|
79 this.runtime = runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 this.metaAccess = metaAccess; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 this.foreignCalls = foreignCalls; |
12786
7e9c00c54866
pass stack pointer register into monitorenter snippet instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
82 this.registers = registers; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 |
12463
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
85 public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
86 TargetDescription target = providers.getCodeCache().getTarget(); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
87 checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
88 instanceofSnippets = new InstanceOfSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
89 newObjectSnippets = new NewObjectSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
90 monitorSnippets = new MonitorSnippets.Templates(providers, target, config.useFastLocking); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
91 writeBarrierSnippets = new WriteBarrierSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
92 boxingSnippets = new BoxingSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
93 exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(providers, target); |
3661954321aa
removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
94 unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(providers, target); |
12576
847819feb98e
moved registration of HotSpot method substitutions out of HotSpotLoweringProvider into separate HotSpotSubstitutions class
Doug Simon <doug.simon@oracle.com>
parents:
12469
diff
changeset
|
95 providers.getReplacements().registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(providers, target)); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 public void lower(Node n, LoweringTool tool) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 StructuredGraph graph = (StructuredGraph) n.graph(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 if (n instanceof ArrayLengthNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
103 lowerArrayLengthNode((ArrayLengthNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 } else if (n instanceof Invoke) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
105 lowerInvoke((Invoke) n, tool, graph); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 } else if (n instanceof LoadFieldNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
107 lowerLoadFieldNode((LoadFieldNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 } else if (n instanceof StoreFieldNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
109 lowerStoreFieldNode((StoreFieldNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 } else if (n instanceof CompareAndSwapNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
111 lowerCompareAndSwapNode((CompareAndSwapNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 } else if (n instanceof LoadIndexedNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
113 lowerLoadIndexedNode((LoadIndexedNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 } else if (n instanceof StoreIndexedNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
115 lowerStoreIndexedNode((StoreIndexedNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 } else if (n instanceof UnsafeLoadNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
117 lowerUnsafeLoadNode((UnsafeLoadNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 } else if (n instanceof UnsafeStoreNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
119 lowerUnsafeStoreNode((UnsafeStoreNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 } else if (n instanceof LoadHubNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
121 lowerLoadHubNode((LoadHubNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 } else if (n instanceof LoadMethodNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
123 lowerLoadMethodNode((LoadMethodNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 } else if (n instanceof StoreHubNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
125 lowerStoreHubNode((StoreHubNode) n, graph); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 } else if (n instanceof CommitAllocationNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
127 lowerCommitAllocationNode((CommitAllocationNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 } else if (n instanceof OSRStartNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
129 lowerOSRStartNode((OSRStartNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 } else if (n instanceof DynamicCounterNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
131 lowerDynamicCounterNode((DynamicCounterNode) n); |
13584
9267de45985b
remove ForeignCallProvider reference from GraphBuilderPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
13578
diff
changeset
|
132 } else if (n instanceof DeferredForeignCallNode) { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
133 lowerDeferredForeignCallNode((DeferredForeignCallNode) n); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } else if (n instanceof CheckCastDynamicNode) { |
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:
13490
diff
changeset
|
135 checkcastDynamicSnippets.lower((CheckCastDynamicNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 } else if (n instanceof InstanceOfNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 instanceofSnippets.lower((InstanceOfNode) n, tool); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 } else if (n instanceof InstanceOfDynamicNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 instanceofSnippets.lower((InstanceOfDynamicNode) n, tool); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 } else if (n instanceof NewInstanceNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
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:
13490
diff
changeset
|
146 newObjectSnippets.lower((NewInstanceNode) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 } |
13578
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13554
diff
changeset
|
148 } else if (n instanceof DynamicNewInstanceNode) { |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13554
diff
changeset
|
149 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13554
diff
changeset
|
150 newObjectSnippets.lower((DynamicNewInstanceNode) n, registers, tool); |
d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13554
diff
changeset
|
151 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 } else if (n instanceof NewArrayNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
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:
13490
diff
changeset
|
154 newObjectSnippets.lower((NewArrayNode) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 } else if (n instanceof DynamicNewArrayNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
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:
13490
diff
changeset
|
158 newObjectSnippets.lower((DynamicNewArrayNode) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 } else if (n instanceof MonitorEnterNode) { |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13654
diff
changeset
|
161 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
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:
13490
diff
changeset
|
162 monitorSnippets.lower((MonitorEnterNode) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 } else if (n instanceof MonitorExitNode) { |
13802
3e13ec261278
later lowering of MonitorEnterNode and MonitorExitNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13654
diff
changeset
|
165 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 monitorSnippets.lower((MonitorExitNode) n, tool); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 } else if (n instanceof G1PreWriteBarrier) { |
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:
13490
diff
changeset
|
169 writeBarrierSnippets.lower((G1PreWriteBarrier) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 } else if (n instanceof G1PostWriteBarrier) { |
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:
13490
diff
changeset
|
171 writeBarrierSnippets.lower((G1PostWriteBarrier) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 } else if (n instanceof G1ReferentFieldReadBarrier) { |
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:
13490
diff
changeset
|
173 writeBarrierSnippets.lower((G1ReferentFieldReadBarrier) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 } else if (n instanceof SerialWriteBarrier) { |
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:
13490
diff
changeset
|
175 writeBarrierSnippets.lower((SerialWriteBarrier) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 } else if (n instanceof SerialArrayRangeWriteBarrier) { |
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:
13490
diff
changeset
|
177 writeBarrierSnippets.lower((SerialArrayRangeWriteBarrier) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 } else if (n instanceof G1ArrayRangePreWriteBarrier) { |
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:
13490
diff
changeset
|
179 writeBarrierSnippets.lower((G1ArrayRangePreWriteBarrier) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 } else if (n instanceof G1ArrayRangePostWriteBarrier) { |
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:
13490
diff
changeset
|
181 writeBarrierSnippets.lower((G1ArrayRangePostWriteBarrier) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 } else if (n instanceof NewMultiArrayNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
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:
13490
diff
changeset
|
184 newObjectSnippets.lower((NewMultiArrayNode) n, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 } else if (n instanceof LoadExceptionObjectNode) { |
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:
13490
diff
changeset
|
187 exceptionObjectSnippets.lower((LoadExceptionObjectNode) n, registers, tool); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 // Nothing to do for division nodes. The HotSpot signal handler catches divisions by |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 // zero and the MIN_VALUE / -1 cases. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 } else if (n instanceof BoxNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 boxingSnippets.lower((BoxNode) n, tool); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 } else if (n instanceof UnboxNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 boxingSnippets.lower((UnboxNode) n, tool); |
13125
c65150049959
Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12796
diff
changeset
|
195 } else if (n instanceof DeoptimizeNode || n instanceof UnwindNode) { |
c65150049959
Allow DeoptimizeNode and UnwindNode to be lowered
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12796
diff
changeset
|
196 /* No lowering, we generate LIR directly for these nodes. */ |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 } else { |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
198 throw GraalInternalError.shouldNotReachHere("Node implementing Lowerable not handled: " + n); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
199 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
200 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
201 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
202 private void lowerArrayLengthNode(ArrayLengthNode arrayLengthNode, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
203 StructuredGraph graph = arrayLengthNode.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
204 ValueNode array = arrayLengthNode.array(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
205 ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, runtime.getConfig().arrayLengthOffset, graph), |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
206 StampFactory.positiveInt(), BarrierType.NONE, false)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
207 arrayLengthRead.setGuard(createNullCheck(array, arrayLengthNode, tool)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
208 graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
209 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
210 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
211 private void lowerInvoke(Invoke invoke, LoweringTool tool, StructuredGraph graph) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
212 if (invoke.callTarget() instanceof MethodCallTargetNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
213 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
214 NodeInputList<ValueNode> parameters = callTarget.arguments(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
215 ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
216 GuardingNode receiverNullCheck = null; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
217 if (!callTarget.isStatic() && receiver.stamp() instanceof ObjectStamp && !ObjectStamp.isObjectNonNull(receiver)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
218 receiverNullCheck = createNullCheck(receiver, invoke.asNode(), tool); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
219 invoke.setGuard(receiverNullCheck); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
220 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
221 JavaType[] signature = MetaUtil.signatureToTypes(callTarget.targetMethod().getSignature(), callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
222 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
223 LoweredCallTargetNode loweredCallTarget = null; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
224 if (callTarget.invokeKind() == InvokeKind.Virtual && InlineVTableStubs.getValue() && (AlwaysInlineVTableStubs.getValue() || invoke.isPolymorphic())) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
225 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
226 HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
227 if (!hsMethod.getDeclaringClass().isInterface()) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
228 if (hsMethod.isInVirtualMethodTable()) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
229 int vtableEntryOffset = hsMethod.vtableEntryOffset(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
230 assert vtableEntryOffset > 0; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
231 Kind wordKind = runtime.getTarget().wordKind; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
232 FloatingReadNode hub = createReadHub(graph, wordKind, receiver, receiverNullCheck); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
233 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
234 ReadNode metaspaceMethod = createReadVirtualMethod(graph, wordKind, hub, hsMethod); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
235 // We use LocationNode.ANY_LOCATION for the reads that access the |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
236 // compiled code entry as HotSpot does not guarantee they are final |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
237 // values. |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
238 ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, runtime.getConfig().methodCompiledEntryOffset, graph), |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
239 StampFactory.forKind(wordKind), BarrierType.NONE, false)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
240 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
241 loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
242 CallingConvention.Type.JavaCall)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
243 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
244 graph.addBeforeFixed(invoke.asNode(), metaspaceMethod); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
245 graph.addAfterFixed(metaspaceMethod, compiledEntry); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
246 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
247 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
248 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
249 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
250 if (loweredCallTarget == null) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
251 loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
252 callTarget.invokeKind())); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
253 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
254 callTarget.replaceAndDelete(loweredCallTarget); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
255 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
256 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
257 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
258 private void lowerLoadFieldNode(LoadFieldNode loadField, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
259 StructuredGraph graph = loadField.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
260 HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) loadField.field(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
261 ValueNode object = loadField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), metaAccess, graph) : loadField.object(); |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
262 assert loadField.getKind() != Kind.Illegal; |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
263 BarrierType barrierType = getFieldLoadBarrierType(field); |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
264 ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field, false), loadField.stamp(), barrierType, (loadField.getKind() == Kind.Object))); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
265 graph.replaceFixedWithFixed(loadField, memoryRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
266 memoryRead.setGuard(createNullCheck(object, memoryRead, tool)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
267 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
268 if (loadField.isVolatile()) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
269 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_READ)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
270 graph.addBeforeFixed(memoryRead, preMembar); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
271 MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_READ)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
272 graph.addAfterFixed(memoryRead, postMembar); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
273 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
274 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
275 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
276 private void lowerStoreFieldNode(StoreFieldNode storeField, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
277 StructuredGraph graph = storeField.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
278 HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
279 ValueNode object = storeField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), metaAccess, graph) : storeField.object(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
280 BarrierType barrierType = getFieldStoreBarrierType(storeField); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
281 WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field, false), barrierType, storeField.field().getKind() == Kind.Object)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
282 memoryWrite.setStateAfter(storeField.stateAfter()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
283 graph.replaceFixedWithFixed(storeField, memoryWrite); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
284 memoryWrite.setGuard(createNullCheck(object, memoryWrite, tool)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
285 FixedWithNextNode last = memoryWrite; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
286 FixedWithNextNode first = memoryWrite; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
287 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
288 if (storeField.isVolatile()) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
289 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_WRITE)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
290 graph.addBeforeFixed(first, preMembar); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
291 MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_WRITE)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
292 graph.addAfterFixed(last, postMembar); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
293 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
294 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
295 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
296 private static void lowerCompareAndSwapNode(CompareAndSwapNode cas) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
297 // Separate out GC barrier semantics |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
298 StructuredGraph graph = cas.graph(); |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
299 LocationNode location = IndexedLocationNode.create(cas.getLocationIdentity(), cas.expected().getKind(), cas.displacement(), cas.offset(), graph, 1); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
300 LoweredCompareAndSwapNode atomicNode = graph.add(new LoweredCompareAndSwapNode(cas.object(), location, cas.expected(), cas.newValue(), getCompareAndSwapBarrier(cas), |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
301 cas.expected().getKind() == Kind.Object)); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
302 atomicNode.setStateAfter(cas.stateAfter()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
303 graph.replaceFixedWithFixed(cas, atomicNode); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
304 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
305 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
306 private void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
307 StructuredGraph graph = loadIndexed.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
308 Kind elementKind = loadIndexed.elementKind(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
309 LocationNode arrayLocation = createArrayLocation(graph, elementKind, loadIndexed.index(), false); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
310 ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp(), BarrierType.NONE, elementKind == Kind.Object)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
311 memoryRead.setGuard(createBoundsCheck(loadIndexed, tool)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
312 graph.replaceFixedWithFixed(loadIndexed, memoryRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
313 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
314 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
315 private void lowerStoreIndexedNode(StoreIndexedNode storeIndexed, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
316 StructuredGraph graph = storeIndexed.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
317 GuardingNode boundsCheck = createBoundsCheck(storeIndexed, tool); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
318 Kind elementKind = storeIndexed.elementKind(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
319 LocationNode arrayLocation = createArrayLocation(graph, elementKind, storeIndexed.index(), false); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
320 ValueNode value = storeIndexed.value(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
321 ValueNode array = storeIndexed.array(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
322 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
323 CheckCastNode checkcastNode = null; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
324 CheckCastDynamicNode checkcastDynamicNode = null; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
325 if (elementKind == Kind.Object && !ObjectStamp.isObjectAlwaysNull(value)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
326 // Store check! |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
327 ResolvedJavaType arrayType = ObjectStamp.typeOrNull(array); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
328 if (arrayType != null && ObjectStamp.isExactType(array)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
329 ResolvedJavaType elementType = arrayType.getComponentType(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
330 if (!MetaUtil.isJavaLangObject(elementType)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
331 checkcastNode = graph.add(new CheckCastNode(elementType, value, null, true)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
332 graph.addBeforeFixed(storeIndexed, checkcastNode); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
333 value = checkcastNode; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
334 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
335 } else { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
336 Kind wordKind = runtime.getTarget().wordKind; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
337 FloatingReadNode arrayClass = createReadHub(graph, wordKind, array, boundsCheck); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
338 LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, runtime.getConfig().arrayClassElementOffset, graph); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
339 /* |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
340 * Anchor the read of the element klass to the cfg, because it is only valid when |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
341 * arrayClass is an object class, which might not be the case in other parts of the |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
342 * compiled method. |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
343 */ |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
344 FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind), BeginNode.prevBegin(storeIndexed))); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
345 checkcastDynamicNode = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
346 graph.addBeforeFixed(storeIndexed, checkcastDynamicNode); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
347 value = checkcastDynamicNode; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
348 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
349 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
350 BarrierType barrierType = getArrayStoreBarrierType(storeIndexed); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
351 WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType, elementKind == Kind.Object)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
352 memoryWrite.setGuard(boundsCheck); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
353 memoryWrite.setStateAfter(storeIndexed.stateAfter()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
354 graph.replaceFixedWithFixed(storeIndexed, memoryWrite); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
355 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
356 // Lower the associated checkcast node. |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
357 if (checkcastNode != null) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
358 checkcastNode.lower(tool); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
359 } else if (checkcastDynamicNode != null) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
360 checkcastDynamicSnippets.lower(checkcastDynamicNode, tool); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
361 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
362 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
363 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
364 private void lowerUnsafeLoadNode(UnsafeLoadNode load, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
365 StructuredGraph graph = load.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
366 if (load.getGuardingCondition() != null) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
367 boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
368 ConditionAnchorNode valueAnchorNode = graph.add(new ConditionAnchorNode(load.getGuardingCondition())); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
369 LocationNode location = createLocation(load); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
370 ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), valueAnchorNode, BarrierType.NONE, compressible)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
371 load.replaceAtUsages(memoryRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
372 graph.replaceFixedWithFixed(load, valueAnchorNode); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
373 graph.addAfterFixed(valueAnchorNode, memoryRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
374 } else if (graph.getGuardsStage().ordinal() > StructuredGraph.GuardsStage.FLOATING_GUARDS.ordinal()) { |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
375 assert load.getKind() != Kind.Illegal; |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
376 boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
377 if (addReadBarrier(load)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
378 unsafeLoadSnippets.lower(load, tool); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
379 } else { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
380 LocationNode location = createLocation(load); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
381 ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), BarrierType.NONE, compressible)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
382 // An unsafe read must not float outside its block otherwise |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
383 // it may float above an explicit null check on its object. |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
384 memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
385 graph.replaceFixedWithFixed(load, memoryRead); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
386 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
387 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
388 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
389 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
390 private static void lowerUnsafeStoreNode(UnsafeStoreNode store) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
391 StructuredGraph graph = store.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
392 LocationNode location = createLocation(store); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
393 ValueNode object = store.object(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
394 BarrierType barrierType = getUnsafeStoreBarrierType(store); |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
395 WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType, store.value().getKind() == Kind.Object)); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
396 write.setStateAfter(store.stateAfter()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
397 graph.replaceFixedWithFixed(store, write); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
398 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
399 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
400 private void lowerLoadHubNode(LoadHubNode loadHub) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
401 StructuredGraph graph = loadHub.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
402 if (graph.getGuardsStage().ordinal() >= StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal()) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
403 Kind wordKind = runtime.getTarget().wordKind; |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
404 assert loadHub.getKind() == wordKind; |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
405 ValueNode object = loadHub.object(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
406 GuardingNode guard = loadHub.getGuard(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
407 FloatingReadNode hub = createReadHub(graph, wordKind, object, guard); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
408 graph.replaceFloating(loadHub, hub); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
409 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
410 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
411 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
412 private void lowerLoadMethodNode(LoadMethodNode loadMethodNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
413 StructuredGraph graph = loadMethodNode.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
414 ResolvedJavaMethod method = loadMethodNode.getMethod(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
415 ReadNode metaspaceMethod = createReadVirtualMethod(graph, runtime.getTarget().wordKind, loadMethodNode.getHub(), method); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
416 graph.replaceFixed(loadMethodNode, metaspaceMethod); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
417 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
418 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
419 private void lowerStoreHubNode(StoreHubNode storeHub, StructuredGraph graph) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
420 WriteNode hub = createWriteHub(graph, runtime.getTarget().wordKind, storeHub.getObject(), storeHub.getValue()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
421 graph.replaceFixed(storeHub, hub); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
422 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
423 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
424 private void lowerCommitAllocationNode(CommitAllocationNode commit, LoweringTool tool) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
425 StructuredGraph graph = commit.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
426 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
427 ValueNode[] allocations = new ValueNode[commit.getVirtualObjects().size()]; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
428 BitSet omittedValues = new BitSet(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
429 int valuePos = 0; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
430 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
431 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
432 int entryCount = virtual.entryCount(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
433 FixedWithNextNode newObject; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
434 if (virtual instanceof VirtualInstanceNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
435 newObject = graph.add(new NewInstanceNode(virtual.type(), true)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
436 } else { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
437 newObject = graph.add(new NewArrayNode(((VirtualArrayNode) virtual).componentType(), ConstantNode.forInt(entryCount, graph), true)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
438 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
439 graph.addBeforeFixed(commit, newObject); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
440 allocations[objIndex] = newObject; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
441 for (int i = 0; i < entryCount; i++) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
442 ValueNode value = commit.getValues().get(valuePos); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
443 if (value instanceof VirtualObjectNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
444 value = allocations[commit.getVirtualObjects().indexOf(value)]; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
445 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
446 if (value == null) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
447 omittedValues.set(valuePos); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
448 } else if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
449 // Constant.illegal is always the defaultForKind, so it is skipped |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
450 Kind valueKind = value.getKind(); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
451 Kind entryKind = virtual.entryKind(i); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
452 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
453 // Truffle requires some leniency in terms of what can be put where: |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
454 Kind accessKind = valueKind.getStackKind() == entryKind.getStackKind() ? entryKind : valueKind; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
455 assert valueKind.getStackKind() == entryKind.getStackKind() || |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
456 (valueKind == Kind.Long || valueKind == Kind.Double || (valueKind == Kind.Int && virtual instanceof VirtualArrayNode)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
457 ConstantLocationNode location; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
458 BarrierType barrierType; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
459 if (virtual instanceof VirtualInstanceNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
460 ResolvedJavaField field = ((VirtualInstanceNode) virtual).field(i); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
461 location = ConstantLocationNode.create(INIT_LOCATION, accessKind, ((HotSpotResolvedJavaField) field).offset(), graph); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
462 barrierType = (entryKind == Kind.Object && !useDeferredInitBarriers()) ? BarrierType.IMPRECISE : BarrierType.NONE; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
463 } else { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
464 location = ConstantLocationNode.create(INIT_LOCATION, accessKind, getArrayBaseOffset(entryKind) + i * getScalingFactor(entryKind), graph); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
465 barrierType = (entryKind == Kind.Object && !useDeferredInitBarriers()) ? BarrierType.PRECISE : BarrierType.NONE; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
466 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
467 WriteNode write = new WriteNode(newObject, value, location, barrierType, entryKind == Kind.Object); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
468 graph.addAfterFixed(newObject, graph.add(write)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
469 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
470 valuePos++; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
471 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
472 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
473 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
474 valuePos = 0; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
475 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
476 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
477 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
478 int entryCount = virtual.entryCount(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
479 ValueNode newObject = allocations[objIndex]; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
480 for (int i = 0; i < entryCount; i++) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
481 if (omittedValues.get(valuePos)) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
482 ValueNode value = commit.getValues().get(valuePos); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
483 assert value instanceof VirtualObjectNode; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
484 ValueNode allocValue = allocations[commit.getVirtualObjects().indexOf(value)]; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
485 if (!(allocValue.isConstant() && allocValue.asConstant().isDefaultForKind())) { |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
486 assert virtual.entryKind(i) == Kind.Object && allocValue.getKind() == Kind.Object; |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
487 WriteNode write; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
488 if (virtual instanceof VirtualInstanceNode) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
489 VirtualInstanceNode virtualInstance = (VirtualInstanceNode) virtual; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
490 write = new WriteNode(newObject, allocValue, createFieldLocation(graph, (HotSpotResolvedJavaField) virtualInstance.field(i), true), BarrierType.IMPRECISE, true); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
491 } else { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
492 write = new WriteNode(newObject, allocValue, createArrayLocation(graph, virtual.entryKind(i), ConstantNode.forInt(i, graph), true), BarrierType.PRECISE, true); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
493 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
494 graph.addBeforeFixed(commit, graph.add(write)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
495 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
496 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
497 valuePos++; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
498 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
499 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
500 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
501 finishAllocatedObjects(tool, commit, allocations); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
502 graph.removeFixed(commit); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
503 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
504 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
505 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
506 private void lowerOSRStartNode(OSRStartNode osrStart) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
507 StructuredGraph graph = osrStart.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
508 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
509 StartNode newStart = graph.add(new StartNode()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
510 ParameterNode buffer = graph.unique(new ParameterNode(0, StampFactory.forKind(runtime.getTarget().wordKind))); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
511 ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(foreignCalls, OSR_MIGRATION_END, buffer)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
512 migrationEnd.setStateAfter(osrStart.stateAfter()); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
513 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
514 newStart.setNext(migrationEnd); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
515 FixedNode next = osrStart.next(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
516 osrStart.setNext(null); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
517 migrationEnd.setNext(next); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
518 graph.setStart(newStart); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
519 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
520 // mirroring the calculations in c1_GraphBuilder.cpp (setup_osr_entry_block) |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
521 int localsOffset = (graph.method().getMaxLocals() - 1) * 8; |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
522 for (OSRLocalNode osrLocal : graph.getNodes(OSRLocalNode.class)) { |
14817
80147dac0d6e
LIRFrameStateBuilder added
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14792
diff
changeset
|
523 int size = HIRFrameStateBuilder.stackSlots(osrLocal.getKind()); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
524 int offset = localsOffset - (osrLocal.index() + size - 1) * 8; |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
525 IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, osrLocal.getKind(), offset, ConstantNode.forLong(0, graph), graph, 1); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
526 ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), BarrierType.NONE, false)); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
527 osrLocal.replaceAndDelete(load); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
528 graph.addBeforeFixed(migrationEnd, load); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
529 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
530 osrStart.replaceAtUsages(newStart); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
531 osrStart.safeDelete(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
532 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
533 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
534 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
535 private void lowerDynamicCounterNode(DynamicCounterNode n) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
536 StructuredGraph graph = n.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
537 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.AFTER_FSA) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
538 BenchmarkCounters.lower(n, registers, runtime.getConfig(), runtime.getTarget().wordKind); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
539 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
540 } |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
541 |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
542 private void lowerDeferredForeignCallNode(DeferredForeignCallNode deferred) { |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
543 StructuredGraph graph = deferred.graph(); |
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
544 if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FLOATING_GUARDS) { |
14045
7b5269608cb3
put tighter types on some builtin operations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14035
diff
changeset
|
545 ForeignCallNode foreignCallNode = graph.add(new ForeignCallNode(foreignCalls, deferred.getDescriptor(), deferred.stamp(), deferred.getArguments())); |
14033
9d62cf8aa990
refactored com.oracle.graal.hotspot.meta.HotSpotLoweringProvider.lower(Node, LoweringTool) into smaller methods
twisti
parents:
14019
diff
changeset
|
546 graph.replaceFixedWithFixed(deferred, foreignCallNode); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
547 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
548 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
549 |
13549
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
550 protected static void finishAllocatedObjects(LoweringTool tool, CommitAllocationNode commit, ValueNode[] allocations) { |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
551 StructuredGraph graph = commit.graph(); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
552 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
553 FixedValueAnchorNode anchor = graph.add(new FixedValueAnchorNode(allocations[objIndex])); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
554 allocations[objIndex] = anchor; |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
555 graph.addBeforeFixed(commit, anchor); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
556 } |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
557 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
13554
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13549
diff
changeset
|
558 for (MonitorIdNode monitorId : commit.getLocks(objIndex)) { |
83fd2094ff66
rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents:
13549
diff
changeset
|
559 MonitorEnterNode enter = graph.add(new MonitorEnterNode(allocations[objIndex], monitorId)); |
13549
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
560 graph.addBeforeFixed(commit, enter); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
561 enter.lower(tool); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
562 } |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
563 } |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
564 for (Node usage : commit.usages().snapshot()) { |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
565 AllocatedObjectNode addObject = (AllocatedObjectNode) usage; |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
566 int index = commit.getVirtualObjects().indexOf(addObject.getVirtualObject()); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
567 graph.replaceFloating(addObject, allocations[index]); |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
568 } |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
569 } |
f8e8f3c499c1
refactor CommitAllocationNode lowering in HotSpotLoweringProvider
Lukas Stadler <lukas.stadler@jku.at>
parents:
13505
diff
changeset
|
570 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
571 private static LocationNode createLocation(UnsafeAccessNode access) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
572 ValueNode offset = access.offset(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
573 if (offset.isConstant()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
574 long offsetValue = offset.asConstant().asLong(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
575 return ConstantLocationNode.create(access.getLocationIdentity(), access.accessKind(), offsetValue, access.graph()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
576 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
577 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
578 long displacement = 0; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
579 int indexScaling = 1; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
580 if (offset instanceof IntegerAddNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
581 IntegerAddNode integerAddNode = (IntegerAddNode) offset; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
582 if (integerAddNode.y() instanceof ConstantNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
583 displacement = integerAddNode.y().asConstant().asLong(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
584 offset = integerAddNode.x(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
585 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
586 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
587 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
588 if (offset instanceof LeftShiftNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
589 LeftShiftNode leftShiftNode = (LeftShiftNode) offset; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
590 if (leftShiftNode.y() instanceof ConstantNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
591 long shift = leftShiftNode.y().asConstant().asLong(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
592 if (shift >= 1 && shift <= 3) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
593 if (shift == 1) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
594 indexScaling = 2; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
595 } else if (shift == 2) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
596 indexScaling = 4; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
597 } else { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
598 indexScaling = 8; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
599 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
600 offset = leftShiftNode.x(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
601 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
602 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
603 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
604 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
605 return IndexedLocationNode.create(access.getLocationIdentity(), access.accessKind(), displacement, offset, access.graph(), indexScaling); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
606 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
607 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
608 private static boolean addReadBarrier(UnsafeLoadNode load) { |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
609 if (useG1GC() && load.graph().getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS && load.object().getKind() == Kind.Object && load.accessKind() == Kind.Object && |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
610 !ObjectStamp.isObjectAlwaysNull(load.object())) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
611 ResolvedJavaType type = ObjectStamp.typeOrNull(load.object()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
612 if (type != null && !type.isArray()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
613 return true; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
614 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
615 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
616 return false; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
617 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
618 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
619 private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, ResolvedJavaMethod method) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
620 HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
621 assert !hsMethod.getDeclaringClass().isInterface(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
622 assert hsMethod.isInVirtualMethodTable(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
623 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
624 int vtableEntryOffset = hsMethod.vtableEntryOffset(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
625 assert vtableEntryOffset > 0; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
626 // We use LocationNode.ANY_LOCATION for the reads that access the vtable |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
627 // entry as HotSpot does not guarantee that this is a final value. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
628 ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind), BarrierType.NONE, false)); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
629 return metaspaceMethod; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
630 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
631 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
632 private FloatingReadNode createReadHub(StructuredGraph graph, Kind wordKind, ValueNode object, GuardingNode guard) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12430
diff
changeset
|
633 HotSpotVMConfig config = runtime.getConfig(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
634 LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
635 assert !object.isConstant() || object.asConstant().isNull(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
636 return graph.unique(new FloatingReadNode(object, location, null, StampFactory.forKind(wordKind), guard, BarrierType.NONE, config.useCompressedClassPointers)); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
637 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
638 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
639 private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12430
diff
changeset
|
640 HotSpotVMConfig config = runtime.getConfig(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
641 LocationNode location = ConstantLocationNode.create(HUB_LOCATION, wordKind, config.hubOffset, graph); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
642 assert !object.isConstant() || object.asConstant().isNull(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
643 return graph.add(new WriteNode(object, value, location, BarrierType.NONE, config.useCompressedClassPointers)); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
644 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
645 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
646 private static BarrierType getFieldLoadBarrierType(HotSpotResolvedJavaField loadField) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
647 BarrierType barrierType = BarrierType.NONE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
648 if (config().useG1GC && loadField.getKind() == Kind.Object && loadField.getDeclaringClass().mirror() == java.lang.ref.Reference.class && loadField.getName().equals("referent")) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
649 barrierType = BarrierType.PRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
650 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
651 return barrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
652 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
653 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
654 private static BarrierType getFieldStoreBarrierType(StoreFieldNode storeField) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
655 BarrierType barrierType = BarrierType.NONE; |
12606
86e5fc5ba6bd
Reorder commit allocation's node writes to account for deferred barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12587
diff
changeset
|
656 if (storeField.field().getKind() == Kind.Object) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
657 barrierType = BarrierType.IMPRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
658 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
659 return barrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
660 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
661 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
662 private static BarrierType getArrayStoreBarrierType(StoreIndexedNode store) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
663 BarrierType barrierType = BarrierType.NONE; |
12606
86e5fc5ba6bd
Reorder commit allocation's node writes to account for deferred barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
12587
diff
changeset
|
664 if (store.elementKind() == Kind.Object) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
665 barrierType = BarrierType.PRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
666 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
667 return barrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
668 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
669 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
670 private static BarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
671 BarrierType barrierType = BarrierType.NONE; |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
672 if (store.value().getKind() == Kind.Object) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
673 ResolvedJavaType type = ObjectStamp.typeOrNull(store.object()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
674 if (type != null && !type.isArray()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
675 barrierType = BarrierType.IMPRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
676 } else { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
677 barrierType = BarrierType.PRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
678 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
679 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
680 return barrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
681 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
682 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
683 private static BarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
684 BarrierType barrierType = BarrierType.NONE; |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14595
diff
changeset
|
685 if (cas.expected().getKind() == Kind.Object) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
686 ResolvedJavaType type = ObjectStamp.typeOrNull(cas.object()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
687 if (type != null && !type.isArray()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
688 barrierType = BarrierType.IMPRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
689 } else { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
690 barrierType = BarrierType.PRECISE; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
691 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
692 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
693 return barrierType; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
694 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
695 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
696 protected static ConstantLocationNode createFieldLocation(StructuredGraph graph, HotSpotResolvedJavaField field, boolean initialization) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
697 LocationIdentity loc = initialization ? INIT_LOCATION : field; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
698 return ConstantLocationNode.create(loc, field.getKind(), field.offset(), graph); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
699 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
700 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
701 public int getScalingFactor(Kind kind) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
702 if (useCompressedOops() && kind == Kind.Object) { |
14559
883fbd3e06e0
Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14045
diff
changeset
|
703 return this.runtime.getTarget().getSizeInBytes(Kind.Int); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
704 } else { |
14559
883fbd3e06e0
Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
14045
diff
changeset
|
705 return this.runtime.getTarget().getSizeInBytes(kind); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
706 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
707 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
708 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
709 protected IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index, boolean initialization) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
710 LocationIdentity loc = initialization ? INIT_LOCATION : NamedLocationIdentity.getArrayLocation(elementKind); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
711 int scale = getScalingFactor(elementKind); |
12430
c0e660b07e02
introduced HotSpotRegistersProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
712 return IndexedLocationNode.create(loc, elementKind, getArrayBaseOffset(elementKind), index, graph, scale); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
713 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
714 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
715 @Override |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
716 public ValueNode reconstructArrayIndex(LocationNode location) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
717 Kind elementKind = location.getValueKind(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
718 assert location.getLocationIdentity().equals(NamedLocationIdentity.getArrayLocation(elementKind)); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
719 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
720 long base; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
721 ValueNode index; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
722 int scale = getScalingFactor(elementKind); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
723 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
724 if (location instanceof ConstantLocationNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
725 base = ((ConstantLocationNode) location).getDisplacement(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
726 index = null; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
727 } else if (location instanceof IndexedLocationNode) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
728 IndexedLocationNode indexedLocation = (IndexedLocationNode) location; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
729 assert indexedLocation.getIndexScaling() == scale; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
730 base = indexedLocation.getDisplacement(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
731 index = indexedLocation.getIndex(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
732 } else { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
733 throw GraalInternalError.shouldNotReachHere(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
734 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
735 |
12430
c0e660b07e02
introduced HotSpotRegistersProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
736 base -= getArrayBaseOffset(elementKind); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
737 assert base >= 0 && base % scale == 0; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
738 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
739 base /= scale; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
740 assert NumUtil.isInt(base); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
741 |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12626
diff
changeset
|
742 StructuredGraph graph = location.graph(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
743 if (index == null) { |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12626
diff
changeset
|
744 return ConstantNode.forInt((int) base, graph); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
745 } else { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
746 if (base == 0) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
747 return index; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
748 } else { |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12626
diff
changeset
|
749 return IntegerArithmeticNode.add(graph, ConstantNode.forInt((int) base, graph), index); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
750 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
751 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
752 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
753 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
754 private GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
755 StructuredGraph g = n.graph(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
756 ValueNode array = n.array(); |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12626
diff
changeset
|
757 ValueNode arrayLength = readArrayLength(n.graph(), array, tool.getConstantReflection()); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
758 if (arrayLength == null) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
759 Stamp stamp = StampFactory.positiveInt(); |
14592
a23ca654a882
fix array length load location identity
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14045
diff
changeset
|
760 ReadNode readArrayLength = g.add(new ReadNode(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, runtime.getConfig().arrayLengthOffset, g), stamp, BarrierType.NONE, false)); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
761 g.addBeforeFixed(n, readArrayLength); |
13632
0f7d6359bdf3
Remove createNullCheckGuard from LoweringTool. Use generic createGuard instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
762 readArrayLength.setGuard(createNullCheck(array, readArrayLength, tool)); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
763 arrayLength = readArrayLength; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
764 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
765 |
14863
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
766 if (arrayLength.isConstant() && n.index().isConstant()) { |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
767 int l = arrayLength.asConstant().asInt(); |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
768 int i = n.index().asConstant().asInt(); |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
769 if (i >= 0 && i < l) { |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
770 // unneeded range check |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
771 return null; |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
772 } |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
773 } |
ea712c41c5a2
merge unsigned compare guards with constant indexes or limits
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14826
diff
changeset
|
774 |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13125
diff
changeset
|
775 return tool.createGuard(n, g.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
776 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
777 |
13632
0f7d6359bdf3
Remove createNullCheckGuard from LoweringTool. Use generic createGuard instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
778 private static GuardingNode createNullCheck(ValueNode object, FixedNode before, LoweringTool tool) { |
13654
32af063cc29c
Don't create null guards for values that are already known to be non-null.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13632
diff
changeset
|
779 if (ObjectStamp.isObjectNonNull(object)) { |
32af063cc29c
Don't create null guards for values that are already known to be non-null.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13632
diff
changeset
|
780 return null; |
32af063cc29c
Don't create null guards for values that are already known to be non-null.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13632
diff
changeset
|
781 } |
13632
0f7d6359bdf3
Remove createNullCheckGuard from LoweringTool. Use generic createGuard instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
782 return tool.createGuard(before, before.graph().unique(new IsNullNode(object)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true); |
0f7d6359bdf3
Remove createNullCheckGuard from LoweringTool. Use generic createGuard instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
783 } |
0f7d6359bdf3
Remove createNullCheckGuard from LoweringTool. Use generic createGuard instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
784 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
785 } |