annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java @ 9773:8a1b0a3d4fc3

replaced VerifyOopStubCall with usage of ForeignCallNode
author Doug Simon <doug.simon@oracle.com>
date Fri, 17 May 2013 22:45:24 +0200
parents 9c5078e16fd9
children 06dc2d2324d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
23 package com.oracle.graal.hotspot.meta;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
25 import static com.oracle.graal.api.code.CallingConvention.Type.*;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
26 import static com.oracle.graal.api.code.DeoptimizationAction.*;
6498
6bc8aa568cb9 moved MemoryBarriers to com.oracle.graal.api.code
Doug Simon <doug.simon@oracle.com>
parents: 6494
diff changeset
27 import static com.oracle.graal.api.code.MemoryBarriers.*;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
28 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
7672
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
29 import static com.oracle.graal.graph.UnsafeAccess.*;
9455
62af2ee39bc5 moved initialization of UNCOMMON_TRAP descriptor from AMD64 code to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
30 import static com.oracle.graal.hotspot.HotSpotBackend.*;
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
31 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
32 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*;
9747
8e5461c4c82e replaced NewMultiArrayStub use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9743
diff changeset
33 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
34 import static com.oracle.graal.hotspot.nodes.MonitorExitStubCall.*;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
35 import static com.oracle.graal.hotspot.nodes.NewArrayStubCall.*;
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
36 import static com.oracle.graal.hotspot.nodes.NewInstanceStubCall.*;
9355
4e260c2ced0e removed new_multi_array assembler stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9339
diff changeset
37 import static com.oracle.graal.hotspot.nodes.NewMultiArrayStubCall.*;
9594
743326387173 replaced vm_error assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9593
diff changeset
38 import static com.oracle.graal.hotspot.nodes.VMErrorNode.*;
9595
db2125285960 replaced wb_pre_call and wb_post_call assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9594
diff changeset
39 import static com.oracle.graal.hotspot.nodes.WriteBarrierPostStubCall.*;
db2125285960 replaced wb_pre_call and wb_post_call assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9594
diff changeset
40 import static com.oracle.graal.hotspot.nodes.WriteBarrierPreStubCall.*;
9771
4de03457d5c8 replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents: 9752
diff changeset
41 import static com.oracle.graal.hotspot.replacements.MonitorSnippets.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
42 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*;
9772
9c5078e16fd9 replaced ThreadIsInterruptedStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents: 9771
diff changeset
43 import static com.oracle.graal.hotspot.replacements.ThreadSubstitutions.*;
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
44 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*;
9418
8d3a7fb9eb5f moved binding of parameter locations to runtime call descriptors from platform specific code to shared code for stubs that are now compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9380
diff changeset
45 import static com.oracle.graal.hotspot.stubs.NewArrayStub.*;
8d3a7fb9eb5f moved binding of parameter locations to runtime call descriptors from platform specific code to shared code for stubs that are now compiled stubs
Doug Simon <doug.simon@oracle.com>
parents: 9380
diff changeset
46 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
9618
bd4a7d657dcc moved static methods out of Stub into StubUtil
Doug Simon <doug.simon@oracle.com>
parents: 9616
diff changeset
47 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
48 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*;
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
49 import static com.oracle.graal.java.GraphBuilderPhase.RuntimeCalls.*;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
50 import static com.oracle.graal.nodes.java.RegisterFinalizerNode.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
51 import static com.oracle.graal.replacements.Log.*;
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
52 import static com.oracle.graal.replacements.MathSubstitutionsX86.*;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
53
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 import java.lang.reflect.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
57 import sun.misc.*;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
58
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
59 import com.oracle.graal.api.code.*;
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
60 import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
61 import com.oracle.graal.api.code.CompilationResult.Call;
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
62 import com.oracle.graal.api.code.CompilationResult.DataPatch;
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
63 import com.oracle.graal.api.code.CompilationResult.Infopoint;
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
64 import com.oracle.graal.api.code.CompilationResult.Mark;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
65 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
66 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
67 import com.oracle.graal.hotspot.*;
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
68 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect;
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
69 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
70 import com.oracle.graal.hotspot.bridge.*;
7113
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
71 import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
72 import com.oracle.graal.hotspot.nodes.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
73 import com.oracle.graal.hotspot.replacements.*;
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7130
diff changeset
74 import com.oracle.graal.hotspot.stubs.*;
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
75 import com.oracle.graal.java.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
76 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
77 import com.oracle.graal.nodes.calc.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
78 import com.oracle.graal.nodes.extended.*;
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
79 import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
80 import com.oracle.graal.nodes.java.*;
5829
0095a9c235c6 incomplete (non XIR) support for inlining virtual dispatch at call sites - all design questions yet to be addressed
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
81 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
5720
46ad94a0574a moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
82 import com.oracle.graal.nodes.spi.*;
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5067
diff changeset
83 import com.oracle.graal.nodes.type.*;
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
84 import com.oracle.graal.nodes.virtual.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6521
diff changeset
85 import com.oracle.graal.phases.*;
6699
d79098b9db3b Support for interfaces in the Graal API: Make interfaces implemented by a ResolvedJavaType available; change semantics of ResolvedJavaType.getSuperclass to return null for interfaces (to conform with java.lang.Class); change semantics of ResolvedJavaType.isInstanceClass to return false for interfaces.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6686
diff changeset
86 import com.oracle.graal.printer.*;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
87 import com.oracle.graal.replacements.*;
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
88 import com.oracle.graal.word.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 /**
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
91 * HotSpot implementation of {@link GraalCodeCacheProvider}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 */
8412
488a5f694786 removed unnecessary interface
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
93 public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
94
9737
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
95 public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class);
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
96 public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class);
9773
8a1b0a3d4fc3 replaced VerifyOopStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents: 9772
diff changeset
97 public static final ForeignCallDescriptor VERIFY_OOP = new ForeignCallDescriptor("verify_oop", Object.class, Object.class);
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
98
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
99 public final HotSpotVMConfig config;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
100
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9694
diff changeset
101 protected final RegisterConfig regConfig;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
102 protected final HotSpotGraalRuntime graalRuntime;
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
103
5563
6a2671066204 added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
104 private CheckCastSnippets.Templates checkcastSnippets;
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5842
diff changeset
105 private InstanceOfSnippets.Templates instanceofSnippets;
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
106 private NewObjectSnippets.Templates newObjectSnippets;
6386
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
107 private MonitorSnippets.Templates monitorSnippets;
8488
225c984588ee -Snippetization of CMS write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 7784
diff changeset
108 private WriteBarrierSnippets.Templates writeBarrierSnippets;
8913
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
109 private BoxingSnippets.Templates boxingSnippets;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
110 private LoadExceptionObjectSnippets.Templates exceptionObjectSnippets;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
112 private final Map<ForeignCallDescriptor, HotSpotForeignCallLinkage> foreignCalls = new HashMap<>();
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7130
diff changeset
113
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7130
diff changeset
114 /**
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
115 * The offset from the origin of an array to the first element.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
116 *
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
117 * @return the offset in bytes
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
118 */
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
119 public static int getArrayBaseOffset(Kind kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
120 switch (kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
121 case Boolean:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
122 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
123 case Byte:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
124 return Unsafe.ARRAY_BYTE_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
125 case Char:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
126 return Unsafe.ARRAY_CHAR_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
127 case Short:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
128 return Unsafe.ARRAY_SHORT_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
129 case Int:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
130 return Unsafe.ARRAY_INT_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
131 case Long:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
132 return Unsafe.ARRAY_LONG_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
133 case Float:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
134 return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
135 case Double:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
136 return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
137 case Object:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
138 return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
139 default:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
140 throw GraalInternalError.shouldNotReachHere();
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
141 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
142 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
143
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
144 /**
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
145 * The scale used for the index when accessing elements of an array of this kind.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
146 *
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
147 * @return the scale in order to convert the index into a byte offset
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
148 */
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
149 public static int getArrayIndexScale(Kind kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
150 switch (kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
151 case Boolean:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
152 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
153 case Byte:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
154 return Unsafe.ARRAY_BYTE_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
155 case Char:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
156 return Unsafe.ARRAY_CHAR_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
157 case Short:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
158 return Unsafe.ARRAY_SHORT_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
159 case Int:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
160 return Unsafe.ARRAY_INT_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
161 case Long:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
162 return Unsafe.ARRAY_LONG_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
163 case Float:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
164 return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
165 case Double:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
166 return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
167 case Object:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
168 return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
169 default:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
170 throw GraalInternalError.shouldNotReachHere();
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
171 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
172 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
173
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
174 public HotSpotRuntime(HotSpotVMConfig c, HotSpotGraalRuntime graalRuntime) {
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
175 this.config = c;
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
176 this.graalRuntime = graalRuntime;
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9694
diff changeset
177 regConfig = createRegisterConfig();
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
178 }
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
179
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
180 protected abstract RegisterConfig createRegisterConfig();
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
181
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
182 /**
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
183 * Registers the linkage for a foreign call.
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
184 */
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
185 protected HotSpotForeignCallLinkage register(HotSpotForeignCallLinkage linkage) {
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
186 assert !foreignCalls.containsKey(linkage.getDescriptor()) : "already registered linkage for " + linkage.getDescriptor();
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
187 foreignCalls.put(linkage.getDescriptor(), linkage);
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
188 return linkage;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
189 }
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
190
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
191 /**
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
192 * Creates and registers the details for linking a foreign call to a {@link Stub}.
9200
9be78aeab2e1 temporaries are recorded for compiled stubs, allowing for better register allocation around calls to such stubs (GRAAL-210)
Doug Simon <doug.simon@oracle.com>
parents: 9183
diff changeset
193 */
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
194 protected HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor) {
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
195 return register(HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCallee, NOT_LEAF));
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
196 }
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
197
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
198 /**
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
199 * Creates and registers the linkage for a foreign call.
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
200 */
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
201 protected HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type ccType, RegisterEffect effect, Transition transition) {
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
202 Class<?> resultType = descriptor.getResultType();
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
203 assert resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "foreign calls must return objects in thread local storage: " + descriptor;
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
204 return register(HotSpotForeignCallLinkage.create(descriptor, address, effect, ccType, transition));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
207 private static void link(Stub stub) {
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
208 stub.getLinkage().setCompiledStub(stub);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
209 }
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
210
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
211 /**
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
212 * Creates a {@linkplain ForeignCallStub stub} for a non-leaf foreign call.
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
213 *
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
214 * @param descriptor the signature of the call to this stub
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
215 * @param address the address of the code to call
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
216 * @param prependThread true if the JavaThread value for the current thread is to be prepended
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
217 * to the arguments for the call to {@code address}
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
218 */
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
219 private void linkForeignCall(ForeignCallDescriptor descriptor, long address, boolean prependThread, Replacements replacements) {
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
220 ForeignCallStub stub = new ForeignCallStub(address, descriptor, prependThread, this, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
221 HotSpotForeignCallLinkage linkage = stub.getLinkage();
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
222 HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage();
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
223 linkage.setCompiledStub(stub);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
224 register(linkage);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
225 register(targetLinkage);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
226 }
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
227
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
228 public void registerReplacements(Replacements replacements) {
9751
ff9829c21f21 replaced OSRMigrationEndStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9750
diff changeset
229 HotSpotVMConfig c = config;
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
230 TargetDescription target = getTarget();
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
231
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
232 registerForeignCall(UNCOMMON_TRAP, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
233 registerForeignCall(DEOPT_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
234 registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF);
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
235
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
236 registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
237 registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
238 registerForeignCall(ARITHMETIC_SIN, c.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
239 registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
240 registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
241
9750
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
242 registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
243 registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
244 registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
245 registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
23a047fba2df removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents: 9749
diff changeset
246 registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
247
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
248 link(new NewInstanceStub(this, replacements, target, registerStubCall(NEW_INSTANCE)));
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
249 link(new NewArrayStub(this, replacements, target, registerStubCall(NEW_ARRAY)));
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
250 link(new ExceptionHandlerStub(this, replacements, target, foreignCalls.get(EXCEPTION_HANDLER)));
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
251 link(new UnwindExceptionToCallerStub(this, replacements, target, registerStubCall(UNWIND_EXCEPTION_TO_CALLER)));
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
252 link(new VerifyOopStub(this, replacements, target, registerStubCall(VERIFY_OOP)));
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
253
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
254 linkForeignCall(IDENTITY_HASHCODE, c.identityHashCodeAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
255 linkForeignCall(REGISTER_FINALIZER, c.registerFinalizerAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
256 linkForeignCall(CREATE_NULL_POINTER_EXCEPTION, c.createNullPointerExceptionAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
257 linkForeignCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, c.createOutOfBoundsExceptionAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
258 linkForeignCall(MONITORENTER, c.monitorenterAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
259 linkForeignCall(MONITOREXIT, c.monitorexitAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
260 linkForeignCall(WRITE_BARRIER_PRE, c.writeBarrierPreAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
261 linkForeignCall(WRITE_BARRIER_POST, c.writeBarrierPostAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
262 linkForeignCall(NEW_MULTI_ARRAY, c.newMultiArrayAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
263 linkForeignCall(LOG_PRINTF, c.logPrintfAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
264 linkForeignCall(LOG_OBJECT, c.logObjectAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
265 linkForeignCall(LOG_PRIMITIVE, c.logPrimitiveAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
266 linkForeignCall(THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
267 linkForeignCall(VM_ERROR, c.vmErrorAddress, true, replacements);
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
268 linkForeignCall(OSR_MIGRATION_END, c.osrMigrationEndAddress, false, replacements);
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9692
diff changeset
269
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
270 if (GraalOptions.IntrinsifyObjectMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
271 replacements.registerSubstitutions(ObjectSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
272 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
273 if (GraalOptions.IntrinsifySystemMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
274 replacements.registerSubstitutions(SystemSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
275 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
276 if (GraalOptions.IntrinsifyThreadMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
277 replacements.registerSubstitutions(ThreadSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
278 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
279 if (GraalOptions.IntrinsifyUnsafeMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
280 replacements.registerSubstitutions(UnsafeSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
281 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
282 if (GraalOptions.IntrinsifyClassMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
283 replacements.registerSubstitutions(ClassSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
284 }
7384
d0fbdf2f7a0e added com.sun.crypto.provider.CipherBlockChaining intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 7373
diff changeset
285 if (GraalOptions.IntrinsifyAESMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
286 replacements.registerSubstitutions(AESCryptSubstitutions.class);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
287 replacements.registerSubstitutions(CipherBlockChainingSubstitutions.class);
7363
f4f3d63d35e6 AESCrypt intrinsification - disabled by default as it doesn't yet work
Doug Simon <doug.simon@oracle.com>
parents: 7359
diff changeset
288 }
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
289 if (GraalOptions.IntrinsifyReflectionMethods) {
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
290 replacements.registerSubstitutions(ReflectionSubstitutions.class);
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
291 }
8913
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
292
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
293 checkcastSnippets = new CheckCastSnippets.Templates(this, replacements, graalRuntime.getTarget());
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
294 instanceofSnippets = new InstanceOfSnippets.Templates(this, replacements, graalRuntime.getTarget());
9688
0d0645267c32 simplify NewObjectSnippets
Lukas Stadler <lukas.stadler@jku.at>
parents: 9687
diff changeset
295 newObjectSnippets = new NewObjectSnippets.Templates(this, replacements, graalRuntime.getTarget());
9752
82689c1c0dab replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents: 9751
diff changeset
296 monitorSnippets = new MonitorSnippets.Templates(this, replacements, graalRuntime.getTarget(), c.useFastLocking);
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
297 writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, replacements, graalRuntime.getTarget());
8913
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
298 boxingSnippets = new BoxingSnippets.Templates(this, replacements, graalRuntime.getTarget());
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
299 exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, replacements, graalRuntime.getTarget());
9656
53cbcd9ff217 replaced IdentityHashCodeStub[Call] with use of RuntimeStubCall
Doug Simon <doug.simon@oracle.com>
parents: 9636
diff changeset
300 }
53cbcd9ff217 replaced IdentityHashCodeStub[Call] with use of RuntimeStubCall
Doug Simon <doug.simon@oracle.com>
parents: 9636
diff changeset
301
5780
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
302 public HotSpotGraalRuntime getGraalRuntime() {
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
303 return graalRuntime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
304 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
305
6494
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
306 /**
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
307 * Gets the register holding the current thread.
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
308 */
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
309 public abstract Register threadRegister();
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
310
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
311 /**
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
312 * Gets the stack pointer register.
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
313 */
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
314 public abstract Register stackPointerRegister();
df02fa2bce58 refactored all AMD64 specific HotSpot code in com.oracle.graal.hotspot.target.amd64 package
Doug Simon <doug.simon@oracle.com>
parents: 6475
diff changeset
315
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 @Override
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
317 public String disassemble(CompilationResult compResult, InstalledCode installedCode) {
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
318 byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
319 long start = installedCode == null ? 0L : installedCode.getStart();
5780
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
320 TargetDescription target = graalRuntime.getTarget();
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
321 HexCodeFile hcf = new HexCodeFile(code, start, target.arch.getName(), target.wordSize * 8);
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
322 if (compResult != null) {
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
323 HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
324 addExceptionHandlersComment(compResult, hcf);
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9694
diff changeset
325 Register fp = regConfig.getFrameRegister();
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
326 RefMapFormatter slotFormatter = new RefMapFormatter(target.arch, target.wordSize, fp, 0);
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
327 for (Infopoint infopoint : compResult.getInfopoints()) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
328 if (infopoint instanceof Call) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
329 Call call = (Call) infopoint;
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
330 if (call.debugInfo != null) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
331 hcf.addComment(call.pcOffset + call.size, CodeUtil.append(new StringBuilder(100), call.debugInfo, slotFormatter).toString());
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
332 }
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
333 addOperandComment(hcf, call.pcOffset, "{" + getTargetName(call) + "}");
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
334 } else {
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
335 if (infopoint.debugInfo != null) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
336 hcf.addComment(infopoint.pcOffset, CodeUtil.append(new StringBuilder(100), infopoint.debugInfo, slotFormatter).toString());
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
337 }
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
338 addOperandComment(hcf, infopoint.pcOffset, "{infopoint: " + infopoint.reason + "}");
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
339 }
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
340 }
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
341 for (DataPatch site : compResult.getDataReferences()) {
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
342 hcf.addOperandComment(site.pcOffset, "{" + site.constant + "}");
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
343 }
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
344 for (Mark mark : compResult.getMarks()) {
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
345 hcf.addComment(mark.pcOffset, getMarkName(mark));
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
346 }
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
347 }
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5247
diff changeset
348 return hcf.toEmbeddedString();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
349 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
350
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
351 /**
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
352 * Decodes a call target to a mnemonic if possible.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
353 */
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
354 private String getTargetName(Call call) {
5230
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
355 Field[] fields = config.getClass().getDeclaredFields();
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
356 for (Field f : fields) {
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
357 if (f.getName().endsWith("Stub")) {
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
358 f.setAccessible(true);
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
359 try {
6475
67b94a9fba57 append global stub address when disassembling a call to a global stub
Doug Simon <doug.simon@oracle.com>
parents: 6463
diff changeset
360 Object address = f.get(config);
67b94a9fba57 append global stub address when disassembling a call to a global stub
Doug Simon <doug.simon@oracle.com>
parents: 6463
diff changeset
361 if (address.equals(call.target)) {
67b94a9fba57 append global stub address when disassembling a call to a global stub
Doug Simon <doug.simon@oracle.com>
parents: 6463
diff changeset
362 return f.getName() + ":0x" + Long.toHexString((Long) address);
5230
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
363 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
364 } catch (Exception e) {
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
365 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
366 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
367 }
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
368 return String.valueOf(call.target);
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
369 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
370
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
371 /**
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
372 * Decodes a mark to a mnemonic if possible.
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
373 */
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
374 private static String getMarkName(Mark mark) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
375 Field[] fields = Marks.class.getDeclaredFields();
5233
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
376 for (Field f : fields) {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
377 if (Modifier.isStatic(f.getModifiers()) && f.getName().startsWith("MARK_")) {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
378 f.setAccessible(true);
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
379 try {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
380 if (f.get(null).equals(mark.id)) {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
381 return f.getName();
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
382 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
383 } catch (Exception e) {
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
384 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
385 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
386 }
efbb1e33e2f3 removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents: 5230
diff changeset
387 return "MARK:" + mark.id;
5230
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
388 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
389
9301
ba441e21796f rename variable that reflected legacy type name
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
390 private static void addExceptionHandlersComment(CompilationResult compResult, HexCodeFile hcf) {
ba441e21796f rename variable that reflected legacy type name
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
391 if (!compResult.getExceptionHandlers().isEmpty()) {
4291
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
392 String nl = HexCodeFile.NEW_LINE;
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
393 StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl);
9301
ba441e21796f rename variable that reflected legacy type name
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
394 for (CompilationResult.ExceptionHandler e : compResult.getExceptionHandlers()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
395 buf.append(" ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl);
5241
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
396 hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]");
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
397 hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398 }
4291
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
399 hcf.addComment(0, buf.toString());
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
400 }
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
401 }
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
402
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
403 private static void addOperandComment(HexCodeFile hcf, int pos, String comment) {
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
404 String oldValue = hcf.addOperandComment(pos, comment);
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
405 assert oldValue == null : "multiple comments for operand of instruction at " + pos + ": " + comment + ", " + oldValue;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
409 public ResolvedJavaType lookupJavaType(Constant constant) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7096
diff changeset
410 if (constant.getKind() != Kind.Object || constant.isNull()) {
7015
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
411 return null;
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
412 }
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
413 Object o = constant.asObject();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
414 return HotSpotResolvedObjectType.fromClass(o.getClass());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
415 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
416
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 @Override
7359
6a16788a29a6 added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object
Doug Simon <doug.simon@oracle.com>
parents: 7356
diff changeset
418 public Signature parseMethodDescriptor(String signature) {
6a16788a29a6 added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object
Doug Simon <doug.simon@oracle.com>
parents: 7356
diff changeset
419 return new HotSpotSignature(signature);
6a16788a29a6 added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object
Doug Simon <doug.simon@oracle.com>
parents: 7356
diff changeset
420 }
6a16788a29a6 added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object
Doug Simon <doug.simon@oracle.com>
parents: 7356
diff changeset
421
6a16788a29a6 added API method for parsing a valid Method Descriptor string (JVMS 4.3.3) into a Signature object
Doug Simon <doug.simon@oracle.com>
parents: 7356
diff changeset
422 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
423 public boolean constantEquals(Constant x, Constant y) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
424 return x.equals(y);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
425 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 @Override
7838
a063308816d9 Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7836
diff changeset
428 public RegisterConfig lookupRegisterConfig() {
9717
f8e0bf2c70e2 consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents: 9694
diff changeset
429 return regConfig;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
430 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
432 @Override
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
433 public int getMinimumOutgoingSize() {
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
434 return config.runtimeCallStackSize;
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
435 }
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
436
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
437 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
438 public int lookupArrayLength(Constant array) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7096
diff changeset
439 if (array.getKind() != Kind.Object || array.isNull() || !array.asObject().getClass().isArray()) {
7015
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
440 throw new IllegalArgumentException(array + " is not an array");
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
441 }
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
442 return Array.getLength(array.asObject());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
444
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
445 @Override
5718
10341299528c renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents: 5705
diff changeset
446 public void lower(Node n, LoweringTool tool) {
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
447 StructuredGraph graph = (StructuredGraph) n.graph();
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
448 Kind wordKind = graalRuntime.getTarget().wordKind;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
449 if (n instanceof ArrayLengthNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
450 ArrayLengthNode arrayLengthNode = (ArrayLengthNode) n;
8543
354d729ae588 remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 8521
diff changeset
451 ValueNode array = arrayLengthNode.array();
9203
f78437ffb8d3 Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 9200
diff changeset
452 ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(LocationNode.FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt()));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
453 tool.createNullCheckGuard(arrayLengthRead, array);
8543
354d729ae588 remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 8521
diff changeset
454 graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead);
5822
ec65d0d0c873 moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents: 5780
diff changeset
455 } else if (n instanceof Invoke) {
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
456 Invoke invoke = (Invoke) n;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
457 if (invoke.callTarget() instanceof MethodCallTargetNode) {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9106
diff changeset
458 MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
459 NodeInputList<ValueNode> parameters = callTarget.arguments();
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
460 ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0);
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
461 if (!callTarget.isStatic() && receiver.kind() == Kind.Object && !receiver.objectStamp().nonNull()) {
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
462 tool.createNullCheckGuard(invoke, receiver);
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
463 }
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
464 JavaType[] signature = MetaUtil.signatureToTypes(callTarget.targetMethod().getSignature(), callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass());
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
465
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9106
diff changeset
466 LoweredCallTargetNode loweredCallTarget = null;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
467 if (callTarget.invokeKind() == InvokeKind.Virtual && GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || invoke.isPolymorphic())) {
5829
0095a9c235c6 incomplete (non XIR) support for inlining virtual dispatch at call sites - all design questions yet to be addressed
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
468
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
469 HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
470 if (!hsMethod.getDeclaringClass().isInterface()) {
9636
ff4e8218d3dd Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9619
diff changeset
471 if (hsMethod.isInVirtualMethodTable()) {
9610
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9608
diff changeset
472 int vtableEntryOffset = hsMethod.vtableEntryOffset();
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
473 assert vtableEntryOffset > 0;
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
474 ReadNode hub = this.createReadHub(tool, graph, wordKind, receiver);
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
475 ReadNode metaspaceMethod = createReadVirtualMethod(graph, wordKind, hub, hsMethod);
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
476 // We use LocationNode.ANY_LOCATION for the reads that access the
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
477 // compiled code entry as HotSpot does not guarantee they are final
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
478 // values.
9203
f78437ffb8d3 Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 9200
diff changeset
479 ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph),
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
480 StampFactory.forKind(wordKind())));
5841
f84d11672a86 vtable dispatch inlining for megamorphic virtual calls now works and is enabled by default
Doug Simon <doug.simon@oracle.com>
parents: 5829
diff changeset
481
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
482 loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(),
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
483 CallingConvention.Type.JavaCall));
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
484
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
485 graph.addBeforeFixed(invoke.asNode(), hub);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
486 graph.addAfterFixed(hub, metaspaceMethod);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
487 graph.addAfterFixed(metaspaceMethod, compiledEntry);
6686
363968be1018 Do not inline vtable lookup when the method's holder is not yet linked (no vtable offset available)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6677
diff changeset
488 }
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
489 }
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5822
diff changeset
490 }
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
491
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
492 if (loweredCallTarget == null) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
493 loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall,
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
494 callTarget.invokeKind()));
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
495 }
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
496 callTarget.replaceAndDelete(loweredCallTarget);
5822
ec65d0d0c873 moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents: 5780
diff changeset
497 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
498 } else if (n instanceof LoadFieldNode) {
7104
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
499 LoadFieldNode loadField = (LoadFieldNode) n;
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
500 HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) loadField.field();
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
501 ValueNode object = loadField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : loadField.object();
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
502 assert loadField.kind() != Kind.Illegal;
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
503 ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp()));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
504 tool.createNullCheckGuard(memoryRead, object);
8502
ff4fa8b0516e -Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8501
diff changeset
505
7104
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
506 graph.replaceFixedWithFixed(loadField, memoryRead);
8502
ff4fa8b0516e -Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8501
diff changeset
507
7104
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
508 if (loadField.isVolatile()) {
5167
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
509 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_READ));
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
510 graph.addBeforeFixed(memoryRead, preMembar);
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
511 MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_READ));
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
512 graph.addAfterFixed(memoryRead, postMembar);
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
513 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
514 } else if (n instanceof StoreFieldNode) {
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
515 StoreFieldNode storeField = (StoreFieldNode) n;
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5552
diff changeset
516 HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field();
7104
5c25483b5515 Remove the ResolvedJavaType.Representation for static fields. It is not necessary to emit the constant holder for static fields in the GraphBuilder. Only the VM-specific lowering needs to create the constants, and it can access the VM-specific metadata objects directly.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7099
diff changeset
517 ValueNode object = storeField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : storeField.object();
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
518 WriteBarrierType barrierType = getFieldStoreBarrierType(storeField);
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
519 WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
520 tool.createNullCheckGuard(memoryWrite, object);
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
521 memoryWrite.setStateAfter(storeField.stateAfter());
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
522 graph.replaceFixedWithFixed(storeField, memoryWrite);
5167
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
523 FixedWithNextNode last = memoryWrite;
8501
41fc46da946a -More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8498
diff changeset
524 FixedWithNextNode first = memoryWrite;
41fc46da946a -More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8498
diff changeset
525
5167
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
526 if (storeField.isVolatile()) {
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
527 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_WRITE));
8501
41fc46da946a -More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8498
diff changeset
528 graph.addBeforeFixed(first, preMembar);
5167
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
529 MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_WRITE));
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
530 graph.addAfterFixed(last, postMembar);
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
531 }
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
532 } else if (n instanceof CompareAndSwapNode) {
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
533 // Separate out GC barrier semantics
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
534 CompareAndSwapNode cas = (CompareAndSwapNode) n;
9183
34eba4e78a0a Attach LocationNode to CompareAndSwapNode
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9175
diff changeset
535 LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1);
34eba4e78a0a Attach LocationNode to CompareAndSwapNode
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9175
diff changeset
536 cas.setLocation(location);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
537 cas.setWriteBarrierType(getCompareAndSwapBarrier(cas));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
538 } else if (n instanceof LoadIndexedNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
539 LoadIndexedNode loadIndexed = (LoadIndexedNode) n;
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
540 GuardingNode boundsCheck = createBoundsCheck(loadIndexed, tool);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
541 Kind elementKind = loadIndexed.elementKind();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
542 LocationNode arrayLocation = createArrayLocation(graph, elementKind, loadIndexed.index());
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5067
diff changeset
543 ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp()));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
544 memoryRead.setGuard(boundsCheck);
4305
0768bf0a4898 move part of the cfg-modifying operations into one place (currently: StructuredGraph)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4262
diff changeset
545 graph.replaceFixedWithFixed(loadIndexed, memoryRead);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
546 } else if (n instanceof StoreIndexedNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
547 StoreIndexedNode storeIndexed = (StoreIndexedNode) n;
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
548 GuardingNode boundsCheck = createBoundsCheck(storeIndexed, tool);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
549 Kind elementKind = storeIndexed.elementKind();
8521
6aa080855d7c -Bug fixes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8517
diff changeset
550 LocationNode arrayLocation = createArrayLocation(graph, elementKind, storeIndexed.index());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
551 ValueNode value = storeIndexed.value();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
552 ValueNode array = storeIndexed.array();
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5780
diff changeset
553 if (elementKind == Kind.Object && !value.objectStamp().alwaysNull()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
554 // Store check!
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
555 ResolvedJavaType arrayType = array.objectStamp().type();
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
556 if (arrayType != null && array.objectStamp().isExactType()) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
557 ResolvedJavaType elementType = arrayType.getComponentType();
7096
585fc9f79ebc Remove ResolvedJavaType.isClass()
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7090
diff changeset
558 if (!MetaUtil.isJavaLangObject(elementType)) {
9478
fb22b4d5f475 Allow distinction between ClassCastException and ArrayStoreException. Add more canonicalizations for check casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9460
diff changeset
559 CheckCastNode checkcast = graph.add(new CheckCastNode(elementType, value, null, true));
5372
4485e0edd1af made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents: 5360
diff changeset
560 graph.addBeforeFixed(storeIndexed, checkcast);
4485e0edd1af made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents: 5360
diff changeset
561 value = checkcast;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
562 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
563 } else {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
564 LoadHubNode arrayClass = graph.add(new LoadHubNode(array, wordKind));
9203
f78437ffb8d3 Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 9200
diff changeset
565 LocationNode location = ConstantLocationNode.create(LocationNode.FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph);
7034
89df4e71940a More flexible handling of stamp for word type: Define a singleton Stamp instance for words that is then re-written to the target-specific primitive word stamp by the WordTypeRewriterPhase. This allows nodes to have a word stamp without any dependency on global or static state.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7017
diff changeset
566 FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind())));
9478
fb22b4d5f475 Allow distinction between ClassCastException and ArrayStoreException. Add more canonicalizations for check casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9460
diff changeset
567 CheckCastDynamicNode checkcast = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true));
5372
4485e0edd1af made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents: 5360
diff changeset
568 graph.addBeforeFixed(storeIndexed, checkcast);
6463
41f0849e107b reverted LoadHubNode to be a fixed node
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
569 graph.addBeforeFixed(checkcast, arrayClass);
5372
4485e0edd1af made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents: 5360
diff changeset
570 value = checkcast;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
571 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
572 }
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
573 WriteBarrierType barrierType = getArrayStoreBarrierType(storeIndexed);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
574 WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
575 memoryWrite.setGuard(boundsCheck);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
576 memoryWrite.setStateAfter(storeIndexed.stateAfter());
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
577 graph.replaceFixedWithFixed(storeIndexed, memoryWrite);
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
578
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
579 } else if (n instanceof UnsafeLoadNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
580 UnsafeLoadNode load = (UnsafeLoadNode) n;
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
581 assert load.kind() != Kind.Illegal;
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7814
diff changeset
582 IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1);
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5067
diff changeset
583 ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp()));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
584 // An unsafe read must not floating outside its block as may float above an explicit
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
585 // null check on its object.
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
586 memoryRead.setGuard(AbstractBeginNode.prevBegin(load));
4305
0768bf0a4898 move part of the cfg-modifying operations into one place (currently: StructuredGraph)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4262
diff changeset
587 graph.replaceFixedWithFixed(load, memoryRead);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
588 } else if (n instanceof UnsafeStoreNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
589 UnsafeStoreNode store = (UnsafeStoreNode) n;
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7814
diff changeset
590 IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, store.accessKind(), store.displacement(), store.offset(), graph, 1);
5705
f96e7b39e9fe Be more strict on isInt check in CAS lowering when index is constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5663
diff changeset
591 ValueNode object = store.object();
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
592 WriteBarrierType barrierType = getUnsafeStoreBarrierType(store);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
593 WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType));
5192
20993edddd73 write barrier for UnsafeStoreNode must be inserted after associated write node has replaced original store node in the graph
Doug Simon <doug.simon@oracle.com>
parents: 5190
diff changeset
594 write.setStateAfter(store.stateAfter());
20993edddd73 write barrier for UnsafeStoreNode must be inserted after associated write node has replaced original store node in the graph
Doug Simon <doug.simon@oracle.com>
parents: 5190
diff changeset
595 graph.replaceFixedWithFixed(store, write);
6460
78e352577028 renamed ReadHubNode to LoadHubNode to be imply higher level operation (c.f. UnsafeLoadNode vs ReadNode)
Doug Simon <doug.simon@oracle.com>
parents: 6459
diff changeset
596 } else if (n instanceof LoadHubNode) {
78e352577028 renamed ReadHubNode to LoadHubNode to be imply higher level operation (c.f. UnsafeLoadNode vs ReadNode)
Doug Simon <doug.simon@oracle.com>
parents: 6459
diff changeset
597 LoadHubNode loadHub = (LoadHubNode) n;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
598 assert loadHub.kind() == wordKind;
6460
78e352577028 renamed ReadHubNode to LoadHubNode to be imply higher level operation (c.f. UnsafeLoadNode vs ReadNode)
Doug Simon <doug.simon@oracle.com>
parents: 6459
diff changeset
599 ValueNode object = loadHub.object();
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
600 ReadNode hub = createReadHub(tool, graph, wordKind, object);
6463
41f0849e107b reverted LoadHubNode to be a fixed node
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
601 graph.replaceFixed(loadHub, hub);
9377
0f4041cc6be1 First draft of node for loading a method from the vtable of a hub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9376
diff changeset
602 } else if (n instanceof LoadMethodNode) {
0f4041cc6be1 First draft of node for loading a method from the vtable of a hub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9376
diff changeset
603 LoadMethodNode loadMethodNode = (LoadMethodNode) n;
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
604 ResolvedJavaMethod method = loadMethodNode.getMethod();
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
605 ReadNode metaspaceMethod = createReadVirtualMethod(graph, wordKind, loadMethodNode.getHub(), method);
9377
0f4041cc6be1 First draft of node for loading a method from the vtable of a hub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9376
diff changeset
606 graph.replaceFixed(loadMethodNode, metaspaceMethod);
7130
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
607 } else if (n instanceof FixedGuardNode) {
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
608 FixedGuardNode node = (FixedGuardNode) n;
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
609 ValueAnchorNode newAnchor = graph.add(new ValueAnchorNode(tool.createGuard(node.condition(), node.getReason(), node.getAction(), node.isNegated()).asNode()));
7130
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
610 graph.replaceFixedWithFixed(node, newAnchor);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
611 } else if (n instanceof CommitAllocationNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
612 CommitAllocationNode commit = (CommitAllocationNode) n;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
613
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
614 ValueNode[] allocations = new ValueNode[commit.getVirtualObjects().size()];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
615 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
616 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
617 int entryCount = virtual.entryCount();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
618
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
619 FixedWithNextNode newObject;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
620 if (virtual instanceof VirtualInstanceNode) {
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
621 newObject = graph.add(new NewInstanceNode(virtual.type(), true));
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
622 } else {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
623 ResolvedJavaType element = ((VirtualArrayNode) virtual).componentType();
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
624 newObject = graph.add(new NewArrayNode(element, ConstantNode.forInt(entryCount, graph), true));
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
625 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
626 graph.addBeforeFixed(commit, newObject);
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
627 allocations[objIndex] = newObject;
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
628 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
629 int valuePos = 0;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
630 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
631 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
632 int entryCount = virtual.entryCount();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
633
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
634 ValueNode newObject = allocations[objIndex];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
635 if (virtual instanceof VirtualInstanceNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
636 VirtualInstanceNode instance = (VirtualInstanceNode) virtual;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
637 for (int i = 0; i < entryCount; i++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
638 ValueNode value = commit.getValues().get(valuePos++);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
639 if (value instanceof VirtualObjectNode) {
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
640 value = allocations[commit.getVirtualObjects().indexOf(value)];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
641 }
9687
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
642 if (!(value.isConstant() && value.asConstant().isDefaultForKind())) {
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
643 graph.addBeforeFixed(commit, graph.add(new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) instance.field(i)), WriteBarrierType.NONE)));
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
644 }
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
645 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
646 } else {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
647 VirtualArrayNode array = (VirtualArrayNode) virtual;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
648 ResolvedJavaType element = array.componentType();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
649 for (int i = 0; i < entryCount; i++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
650 ValueNode value = commit.getValues().get(valuePos++);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
651 if (value instanceof VirtualObjectNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
652 int indexOf = commit.getVirtualObjects().indexOf(value);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
653 assert indexOf != -1 : commit + " " + value;
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
654 value = allocations[indexOf];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
655 }
9687
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
656 if (!(value.isConstant() && value.asConstant().isDefaultForKind())) {
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
657 graph.addBeforeFixed(commit,
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
658 graph.add(new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), WriteBarrierType.NONE)));
a7376cc486ff don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 9676
diff changeset
659 }
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
660 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
661 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
662 }
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
663 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) {
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
664 FixedValueAnchorNode anchor = graph.add(new FixedValueAnchorNode(allocations[objIndex]));
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
665 allocations[objIndex] = anchor;
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
666 graph.addBeforeFixed(commit, anchor);
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
667 }
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
668 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) {
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
669 for (int lockDepth : commit.getLocks().get(objIndex)) {
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
670 MonitorEnterNode enter = graph.add(new MonitorEnterNode(allocations[objIndex], lockDepth));
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
671 graph.addBeforeFixed(commit, enter);
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
672 }
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
673 }
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
674 for (Node usage : commit.usages().snapshot()) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
675 AllocatedObjectNode addObject = (AllocatedObjectNode) usage;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
676 int index = commit.getVirtualObjects().indexOf(addObject.getVirtualObject());
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
677 graph.replaceFloating(addObject, allocations[index]);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
678 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
679 graph.removeFixed(commit);
5379
c862951e769d moved checkcast lowering into LoweringPhase and added -G:HIRLowerCheckcast option to enable it (disabled by default) as it is not yet stable
Doug Simon <doug.simon@oracle.com>
parents: 5372
diff changeset
680 } else if (n instanceof CheckCastNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
681 checkcastSnippets.lower((CheckCastNode) n, tool);
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
682 } else if (n instanceof OSRStartNode) {
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
683 OSRStartNode osrStart = (OSRStartNode) n;
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
684 StartNode newStart = graph.add(new StartNode());
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
685 LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind())));
9738
857632c8086a renamed: RuntimeCallNode -> ForeignCallNode, RuntimeCallStateSplitNode -> ForeignCallStateSplitNode
Doug Simon <doug.simon@oracle.com>
parents: 9737
diff changeset
686 ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(OSR_MIGRATION_END, buffer));
9734
1313dd590c62 made RuntimeCallNode no longer be a StateSplit; for runtime calls that are state splits, the new RuntimeCallStateSplitNode class should be used
Doug Simon <doug.simon@oracle.com>
parents: 9731
diff changeset
687 newStart.setStateAfter(osrStart.stateAfter());
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
688
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
689 newStart.setNext(migrationEnd);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
690 FixedNode next = osrStart.next();
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
691 osrStart.setNext(null);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
692 migrationEnd.setNext(next);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
693 graph.setStart(newStart);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
694
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
695 // mirroring the calculations in c1_GraphBuilder.cpp (setup_osr_entry_block)
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
696 int localsOffset = (graph.method().getMaxLocals() - 1) * 8;
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
697 for (OSRLocalNode osrLocal : graph.getNodes(OSRLocalNode.class)) {
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
698 int size = FrameStateBuilder.stackSlots(osrLocal.kind());
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
699 int offset = localsOffset - (osrLocal.index() + size - 1) * 8;
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
700 UnsafeLoadNode load = graph.add(new UnsafeLoadNode(buffer, offset, ConstantNode.forInt(0, graph), osrLocal.kind()));
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
701 osrLocal.replaceAndDelete(load);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
702 graph.addBeforeFixed(migrationEnd, load);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
703 }
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
704 osrStart.replaceAtUsages(newStart);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
705 osrStart.safeDelete();
6648
7bf5a6c42db7 factored CheckCastDynamicNode out of CheckCastNode
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
706 } else if (n instanceof CheckCastDynamicNode) {
7bf5a6c42db7 factored CheckCastDynamicNode out of CheckCastNode
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
707 checkcastSnippets.lower((CheckCastDynamicNode) n);
6302
5d7d9a6953bd added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5842
diff changeset
708 } else if (n instanceof InstanceOfNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
709 instanceofSnippets.lower((InstanceOfNode) n, tool);
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7235
diff changeset
710 } else if (n instanceof InstanceOfDynamicNode) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7235
diff changeset
711 instanceofSnippets.lower((InstanceOfDynamicNode) n, tool);
5563
6a2671066204 added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
712 } else if (n instanceof NewInstanceNode) {
9688
0d0645267c32 simplify NewObjectSnippets
Lukas Stadler <lukas.stadler@jku.at>
parents: 9687
diff changeset
713 newObjectSnippets.lower((NewInstanceNode) n);
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
714 } else if (n instanceof NewArrayNode) {
9688
0d0645267c32 simplify NewObjectSnippets
Lukas Stadler <lukas.stadler@jku.at>
parents: 9687
diff changeset
715 newObjectSnippets.lower((NewArrayNode) n);
6386
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
716 } else if (n instanceof MonitorEnterNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
717 monitorSnippets.lower((MonitorEnterNode) n, tool);
6386
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
718 } else if (n instanceof MonitorExitNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
719 monitorSnippets.lower((MonitorExitNode) n, tool);
8905
c502db57e687 Rename ArrayWriteBarrier to SerialWriteBarrier and move it to graal.nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8904
diff changeset
720 } else if (n instanceof SerialWriteBarrier) {
c502db57e687 Rename ArrayWriteBarrier to SerialWriteBarrier and move it to graal.nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8904
diff changeset
721 writeBarrierSnippets.lower((SerialWriteBarrier) n, tool);
8963
63eae4723b18 Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
722 } else if (n instanceof SerialArrayRangeWriteBarrier) {
63eae4723b18 Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
723 writeBarrierSnippets.lower((SerialArrayRangeWriteBarrier) n, tool);
6431
2e376f8ea4e2 added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents: 6409
diff changeset
724 } else if (n instanceof NewMultiArrayNode) {
9688
0d0645267c32 simplify NewObjectSnippets
Lukas Stadler <lukas.stadler@jku.at>
parents: 9687
diff changeset
725 newObjectSnippets.lower((NewMultiArrayNode) n);
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
726 } else if (n instanceof LoadExceptionObjectNode) {
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
727 exceptionObjectSnippets.lower((LoadExceptionObjectNode) n);
7305
cd205ca515dd Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7300
diff changeset
728 } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
729 // Nothing to do for division nodes. The HotSpot signal handler catches divisions by
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
730 // zero and the MIN_VALUE / -1 cases.
9016
60b9fe7034e6 Allow lowering of DeoptimizeNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9015
diff changeset
731 } else if (n instanceof UnwindNode || n instanceof DeoptimizeNode) {
8357
5fbb2df2b47f Allow lowering of UnwindNode and ExceptionObjectNode. The HotSpot code still uses the old LIR lowering.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8217
diff changeset
732 // Nothing to do, using direct LIR lowering for these nodes.
8913
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
733 } else if (n instanceof BoxNode) {
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
734 boxingSnippets.lower((BoxNode) n);
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
735 } else if (n instanceof UnboxNode) {
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
736 boxingSnippets.lower((UnboxNode) n);
5241
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
737 } else {
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
738 assert false : "Node implementing Lowerable not handled: " + n;
7076
32408bd16b91 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7075
diff changeset
739 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
740 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
741 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
742
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
743 private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, ResolvedJavaMethod method) {
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
744 HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
745 assert !hsMethod.getDeclaringClass().isInterface();
9636
ff4e8218d3dd Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9619
diff changeset
746 assert hsMethod.isInVirtualMethodTable();
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
747
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
748 int vtableEntryOffset = hsMethod.vtableEntryOffset();
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
749 assert vtableEntryOffset > 0;
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
750 // We use LocationNode.ANY_LOCATION for the reads that access the vtable
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
751 // entry as HotSpot does not guarantee that this is a final value.
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
752 ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind())));
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
753 return metaspaceMethod;
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
754 }
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
755
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
756 private ReadNode createReadHub(LoweringTool tool, StructuredGraph graph, Kind wordKind, ValueNode object) {
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
757 LocationNode location = ConstantLocationNode.create(LocationNode.FINAL_LOCATION, wordKind, config.hubOffset, graph);
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
758 assert !object.isConstant() || object.asConstant().isNull();
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
759 ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind())));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
760 tool.createNullCheckGuard(hub, object);
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
761 return hub;
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
762 }
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
763
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
764 private static WriteBarrierType getFieldStoreBarrierType(StoreFieldNode storeField) {
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
765 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
766 if (storeField.field().getKind() == Kind.Object && !storeField.value().objectStamp().alwaysNull()) {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
767 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
768 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
769 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
770 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
771
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
772 private static WriteBarrierType getArrayStoreBarrierType(StoreIndexedNode store) {
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
773 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
774 if (store.elementKind() == Kind.Object && !store.value().objectStamp().alwaysNull()) {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
775 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
776 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
777 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
778 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
779
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
780 private static WriteBarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) {
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
781 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
782 if (store.value().kind() == Kind.Object && !store.value().objectStamp().alwaysNull()) {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
783 ResolvedJavaType type = store.object().objectStamp().type();
9175
5248c53f9978 Remove redundant checks from WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9174
diff changeset
784 if (type != null && type.isArray()) {
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
785 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
786 } else {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
787 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
788 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
789 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
790 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
791 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
792
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
793 private static WriteBarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
794 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
795 if (cas.expected().kind() == Kind.Object && !cas.newValue().objectStamp().alwaysNull()) {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
796 ResolvedJavaType type = cas.object().objectStamp().type();
9175
5248c53f9978 Remove redundant checks from WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9174
diff changeset
797 if (type != null && type.isArray()) {
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
798 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
799 } else {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
800 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
801 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
802 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
803 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
804 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
805
9608
7a330743a452 change visibility of createFieldLocation/createArrayLocation
Lukas Stadler <lukas.stadler@jku.at>
parents: 9605
diff changeset
806 protected static ConstantLocationNode createFieldLocation(StructuredGraph graph, HotSpotResolvedJavaField field) {
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
807 return ConstantLocationNode.create(field, field.getKind(), field.offset(), graph);
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
808 }
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
809
9608
7a330743a452 change visibility of createFieldLocation/createArrayLocation
Lukas Stadler <lukas.stadler@jku.at>
parents: 9605
diff changeset
810 protected IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) {
9423
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9421
diff changeset
811 int scale = this.graalRuntime.getTarget().arch.getSizeInBytes(elementKind);
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7814
diff changeset
812 return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, getArrayBaseOffset(elementKind), index, graph, scale);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
813 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
814
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
815 private static GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) {
9602
19c5a07c7843 Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9595
diff changeset
816 StructuredGraph graph = n.graph();
5415
79f12805362b Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5401
diff changeset
817 ArrayLengthNode arrayLength = graph.add(new ArrayLengthNode(n.array()));
9646
183d33c76419 Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9636
diff changeset
818 GuardingNode guard = tool.createGuard(graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile);
5401
332a3c0d7b3b remove array length input from LoadIndexedNode and StoreIndexedNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5400
diff changeset
819
5415
79f12805362b Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5401
diff changeset
820 graph.addBeforeFixed(n, arrayLength);
5401
332a3c0d7b3b remove array length input from LoadIndexedNode and StoreIndexedNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5400
diff changeset
821 return guard;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
822 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
823
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
824 public ResolvedJavaType lookupJavaType(Class<?> clazz) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
825 return HotSpotResolvedObjectType.fromClass(clazz);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
826 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
827
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
828 public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) {
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
829 HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor);
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
830 assert foreignCalls != null : descriptor;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
831 callTarget.finalizeAddress(graalRuntime.getBackend());
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
832 return callTarget;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
833 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
834
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
835 public ResolvedJavaMethod lookupJavaMethod(Method reflectionMethod) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
836 CompilerToVM c2vm = graalRuntime.getCompilerToVM();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
837 HotSpotResolvedObjectType[] resultHolder = {null};
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
838 long metaspaceMethod = c2vm.getMetaspaceMethod(reflectionMethod, resultHolder);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
839 assert metaspaceMethod != 0L;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
840 return resultHolder[0].createMethod(metaspaceMethod);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
841 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
842
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
843 public ResolvedJavaMethod lookupJavaConstructor(Constructor reflectionConstructor) {
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
844 CompilerToVM c2vm = graalRuntime.getCompilerToVM();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
845 HotSpotResolvedObjectType[] resultHolder = {null};
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
846 long metaspaceMethod = c2vm.getMetaspaceConstructor(reflectionConstructor, resultHolder);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
847 assert metaspaceMethod != 0L;
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
848 return resultHolder[0].createMethod(metaspaceMethod);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
849 }
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
850
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6534
diff changeset
851 public ResolvedJavaField lookupJavaField(Field reflectionField) {
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6431
diff changeset
852 return graalRuntime.getCompilerToVM().getJavaField(reflectionField);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6431
diff changeset
853 }
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6431
diff changeset
854
9041
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
855 public HotSpotInstalledCode installMethod(HotSpotResolvedJavaMethod method, Graph graph, int entryBCI, CompilationResult compResult) {
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9662
diff changeset
856 HotSpotInstalledCode installedCode = new HotSpotNmethod(method, graph, true);
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
857 graalRuntime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, entryBCI, compResult), installedCode, method.getSpeculationLog());
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
858 return installedCode;
5360
6cc970203f30 moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
859 }
6cc970203f30 moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
860
6cc970203f30 moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
861 @Override
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
862 public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) {
9041
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
863 return addMethod(method, compResult, null);
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
864 }
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
865
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
866 @Override
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
867 public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, Graph graph) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
868 HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9662
diff changeset
869 HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, graph, false);
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
870 CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(hotspotMethod, -1, compResult), code, null);
7113
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
871 if (result != CodeInstallResult.OK) {
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
872 return null;
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
873 }
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
874 return code;
4319
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4312
diff changeset
875 }
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4312
diff changeset
876
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4696
diff changeset
877 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
878 public int encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason) {
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
879 final int actionShift = 0;
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
880 final int reasonShift = 3;
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
881
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
882 int actionValue = convertDeoptAction(action);
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
883 int reasonValue = convertDeoptReason(reason);
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
884 return (~(((reasonValue) << reasonShift) + ((actionValue) << actionShift)));
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
885 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
886
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
887 public int convertDeoptAction(DeoptimizationAction action) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
888 switch (action) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
889 case None:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
890 return config.deoptActionNone;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
891 case RecompileIfTooManyDeopts:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
892 return config.deoptActionMaybeRecompile;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
893 case InvalidateReprofile:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
894 return config.deoptActionReinterpret;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
895 case InvalidateRecompile:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
896 return config.deoptActionMakeNotEntrant;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
897 case InvalidateStopCompiling:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
898 return config.deoptActionMakeNotCompilable;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
899 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
900 throw GraalInternalError.shouldNotReachHere();
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
901 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
902 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
903
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
904 public int convertDeoptReason(DeoptimizationReason reason) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
905 switch (reason) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
906 case None:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
907 return config.deoptReasonNone;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
908 case NullCheckException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
909 return config.deoptReasonNullCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
910 case BoundsCheckException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
911 return config.deoptReasonRangeCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
912 case ClassCastException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
913 return config.deoptReasonClassCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
914 case ArrayStoreException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
915 return config.deoptReasonArrayCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
916 case UnreachedCode:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
917 return config.deoptReasonUnreached0;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
918 case TypeCheckedInliningViolated:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
919 return config.deoptReasonTypeCheckInlining;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
920 case OptimizedTypeCheckViolated:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
921 return config.deoptReasonOptimizedTypeCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
922 case NotCompiledExceptionHandler:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
923 return config.deoptReasonNotCompiledExceptionHandler;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
924 case Unresolved:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
925 return config.deoptReasonUnresolved;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
926 case JavaSubroutineMismatch:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
927 return config.deoptReasonJsrMismatch;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
928 case ArithmeticException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
929 return config.deoptReasonDiv0Check;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
930 case RuntimeConstraint:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
931 return config.deoptReasonConstraint;
9444
fd60b73f1759 Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9441
diff changeset
932 case LoopLimitCheck:
fd60b73f1759 Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9441
diff changeset
933 return config.deoptReasonLoopLimitCheck;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
934 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
935 throw GraalInternalError.shouldNotReachHere();
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
936 }
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4696
diff changeset
937 }
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6954
diff changeset
938
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6954
diff changeset
939 public boolean needsDataPatch(Constant constant) {
7930
fe64b5da8229 Create direct call for Static and Special to avoid out-of-line patching stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7912
diff changeset
940 return constant.getPrimitiveAnnotation() != null;
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6954
diff changeset
941 }
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7130
diff changeset
942
7672
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
943 @Override
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
944 public Constant readUnsafeConstant(Kind kind, Object base, long displacement) {
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
945 switch (kind) {
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
946 case Boolean:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
947 return Constant.forBoolean(base == null ? unsafe.getByte(displacement) != 0 : unsafe.getBoolean(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
948 case Byte:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
949 return Constant.forByte(base == null ? unsafe.getByte(displacement) : unsafe.getByte(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
950 case Char:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
951 return Constant.forChar(base == null ? unsafe.getChar(displacement) : unsafe.getChar(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
952 case Short:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
953 return Constant.forShort(base == null ? unsafe.getShort(displacement) : unsafe.getShort(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
954 case Int:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
955 return Constant.forInt(base == null ? unsafe.getInt(displacement) : unsafe.getInt(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
956 case Long:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
957 return Constant.forLong(base == null ? unsafe.getLong(displacement) : unsafe.getLong(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
958 case Float:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
959 return Constant.forFloat(base == null ? unsafe.getFloat(displacement) : unsafe.getFloat(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
960 case Double:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
961 return Constant.forDouble(base == null ? unsafe.getDouble(displacement) : unsafe.getDouble(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
962 case Object:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
963 return Constant.forObject(unsafe.getObject(base, displacement));
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
964 default:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
965 throw GraalInternalError.shouldNotReachHere();
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
966 }
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
967 }
7733
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
968
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
969 @Override
9737
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
970 public boolean hasSideEffect(ForeignCallDescriptor descriptor) {
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
971 // Only these two foreign calls are expected to be made with
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
972 // a node that implements StateSplit. They need to be a state
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
973 // split so that the stack trace they produce is accurate.
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
974 assert descriptor == CREATE_NULL_POINTER_EXCEPTION || descriptor == CREATE_OUT_OF_BOUNDS_EXCEPTION : descriptor;
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
975 return false;
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
976 }
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
977
34c892fdfb6d moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents: 9736
diff changeset
978 @Override
7733
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
979 public TargetDescription getTarget() {
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
980 return graalRuntime.getTarget();
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
981 }
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
982
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
983 public String disassemble(InstalledCode code) {
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
984 if (code.isValid()) {
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9301
diff changeset
985 long codeBlob = ((HotSpotInstalledCode) code).getCodeBlob();
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9301
diff changeset
986 return graalRuntime.getCompilerToVM().disassembleCodeBlob(codeBlob);
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
987 }
7912
06ecee106195 added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents: 7838
diff changeset
988 return null;
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
989 }
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
990
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
991 public String disassemble(ResolvedJavaMethod method) {
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
992 return new BytecodeDisassembler().disassemble(method);
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
993 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
994 }