annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java @ 9590:5f9c41cd3b1e

replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
author Doug Simon <doug.simon@oracle.com>
date Mon, 06 May 2013 22:37:00 +0200
parents ffd3d85e055f
children 0381c7937e7a
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.*;
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
29 import static com.oracle.graal.api.meta.Value.*;
7672
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
30 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
31 import static com.oracle.graal.hotspot.HotSpotBackend.*;
6954
0e20ad1ea98b removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents: 6952
diff changeset
32 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
9461
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
33 import static com.oracle.graal.hotspot.nodes.IdentityHashCodeStubCall.*;
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.MonitorEnterStubCall.*;
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
35 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
36 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
37 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
38 import static com.oracle.graal.hotspot.nodes.NewMultiArrayStubCall.*;
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
39 import static com.oracle.graal.hotspot.nodes.ThreadIsInterruptedStubCall.*;
9574
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
40 import static com.oracle.graal.hotspot.nodes.VerifyOopStubCall.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
41 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*;
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
42 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*;
9461
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
43 import static com.oracle.graal.hotspot.stubs.IdentityHashCodeStub.*;
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
44 import static com.oracle.graal.hotspot.stubs.MonitorEnterStub.*;
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
45 import static com.oracle.graal.hotspot.stubs.MonitorExitStub.*;
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
46 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
47 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
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
48 import static com.oracle.graal.hotspot.stubs.NewMultiArrayStub.*;
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
49 import static com.oracle.graal.hotspot.stubs.RegisterFinalizerStub.*;
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
50 import static com.oracle.graal.hotspot.stubs.ThreadIsInterruptedStub.*;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
51 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
52 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
53 import static com.oracle.graal.nodes.java.RegisterFinalizerNode.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
54 import static com.oracle.graal.replacements.Log.*;
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
55 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
56
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 import java.lang.reflect.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
60 import sun.misc.*;
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
61
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
62 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
63 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
64 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
65 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
66 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
67 import com.oracle.graal.api.code.CompilationResult.Mark;
7144
ae69cd8c08a9 rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents: 7143
diff changeset
68 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
69 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
70 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
71 import com.oracle.graal.hotspot.*;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
72 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
73 import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
74 import com.oracle.graal.hotspot.nodes.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 8412
diff changeset
75 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
76 import com.oracle.graal.hotspot.stubs.*;
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
77 import com.oracle.graal.java.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
78 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
79 import com.oracle.graal.nodes.calc.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
80 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
81 import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
82 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
83 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
84 import com.oracle.graal.nodes.spi.*;
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5067
diff changeset
85 import com.oracle.graal.nodes.type.*;
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
86 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
87 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
88 import com.oracle.graal.printer.*;
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
89 import com.oracle.graal.replacements.*;
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
90 import com.oracle.graal.word.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 /**
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
93 * HotSpot implementation of {@link GraalCodeCacheProvider}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 */
8412
488a5f694786 removed unnecessary interface
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
95 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
96
9532
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
97 public static final Descriptor OSR_MIGRATION_END = new Descriptor("OSR_migration_end", true, void.class, long.class);
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
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
101 protected final RegisterConfig regConfig;
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 RegisterConfig globalStubRegConfig;
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 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
104
5563
6a2671066204 added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
105 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
106 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
107 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
108 private MonitorSnippets.Templates monitorSnippets;
8488
225c984588ee -Snippetization of CMS write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 7784
diff changeset
109 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
110 private BoxingSnippets.Templates boxingSnippets;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
111 private LoadExceptionObjectSnippets.Templates exceptionObjectSnippets;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112
7144
ae69cd8c08a9 rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents: 7143
diff changeset
113 private final Map<Descriptor, HotSpotRuntimeCallTarget> runtimeCalls = 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
114 private final Map<ResolvedJavaMethod, Stub> stubs = new HashMap<>();
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
115
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
116 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
117 * Holds onto objects that will be embedded in compiled code. HotSpot treats oops embedded in
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
118 * code as weak references so without an external strong root, such an embedded oop will quickly
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
119 * die. This in turn will cause the nmethod to be unloaded.
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
120 */
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
121 private final Map<Object, Object> gcRoots = new HashMap<>();
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
122
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
123 /**
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
124 * 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
125 *
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
126 * @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
127 */
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
128 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
129 switch (kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
130 case Boolean:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
131 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
132 case Byte:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
133 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
134 case Char:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
135 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
136 case Short:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
137 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
138 case Int:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
139 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
140 case Long:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
141 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
142 case Float:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
143 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
144 case Double:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
145 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
146 case Object:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
147 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
148 default:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
149 throw GraalInternalError.shouldNotReachHere();
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
150 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
151 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
152
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
153 /**
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
154 * 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
155 *
7099
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
156 * @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
157 */
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
158 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
159 switch (kind) {
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
160 case Boolean:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
161 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
162 case Byte:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
163 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
164 case Char:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
165 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
166 case Short:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
167 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
168 case Int:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
169 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
170 case Long:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
171 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
172 case Float:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
173 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
174 case Double:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
175 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
176 case Object:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
177 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
178 default:
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
179 throw GraalInternalError.shouldNotReachHere();
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
180 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
181 }
3656236c7d27 Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
182
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
183 protected AllocatableValue ret(Kind kind) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7096
diff changeset
184 if (kind == Kind.Void) {
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
185 return ILLEGAL;
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
186 }
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
187 return globalStubRegConfig.getReturnRegister(kind).asValue(kind);
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
188 }
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
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
190 protected AllocatableValue[] javaCallingConvention(Kind... arguments) {
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
191 return callingConvention(arguments, RuntimeCall);
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
192 }
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
193
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
194 protected AllocatableValue[] nativeCallingConvention(Kind... arguments) {
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
195 return callingConvention(arguments, NativeCall);
7364
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7363
diff changeset
196 }
1489cd4eabe7 added support for making calls with the native/C ABI
Doug Simon <doug.simon@oracle.com>
parents: 7363
diff changeset
197
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
198 private AllocatableValue[] callingConvention(Kind[] arguments, CallingConvention.Type type) {
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
199 AllocatableValue[] result = new AllocatableValue[arguments.length];
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
200
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
201 TargetDescription target = graalRuntime.getTarget();
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
202 int currentStackOffset = 0;
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
203 for (int i = 0; i < arguments.length; i++) {
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
204 Kind kind = arguments[i];
9425
3ec29630cfb4 Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents: 9423
diff changeset
205 Register[] ccRegs = globalStubRegConfig.getCallingConventionRegisters(type, kind);
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
206 if (i < ccRegs.length) {
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
207 result[i] = ccRegs[i].asValue(kind);
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
208 } else {
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
209 result[i] = StackSlot.get(kind.getStackKind(), currentStackOffset, false);
9423
3426008293e7 Move getSizeInBytes method to Architecture class.
Roland Schatz <roland.schatz@oracle.com>
parents: 9421
diff changeset
210 currentStackOffset += Math.max(target.arch.getSizeInBytes(kind), target.wordSize);
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
211 }
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
212 }
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
213 return result;
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
214 }
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
215
5780
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
216 public HotSpotRuntime(HotSpotVMConfig config, HotSpotGraalRuntime graalRuntime) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 this.config = config;
5780
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
218 this.graalRuntime = graalRuntime;
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
219 regConfig = createRegisterConfig(false);
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
220 globalStubRegConfig = createRegisterConfig(true);
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
221 Kind word = graalRuntime.getTarget().wordKind;
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
222
7522
4cc0efe5cffe disabled auto-formatting of manually formatted code
Doug Simon <doug.simon@oracle.com>
parents: 7393
diff changeset
223 // @formatter:off
4cc0efe5cffe disabled auto-formatting of manually formatted code
Doug Simon <doug.simon@oracle.com>
parents: 7393
diff changeset
224
9574
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
225 addStubCall(VERIFY_OOP,
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
226 /* ret */ ret(Kind.Object),
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
227 /* arg0: object */ javaCallingConvention(Kind.Object));
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
228
9577
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
229 addStubCall(OSR_MIGRATION_END,
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6674
diff changeset
230 /* ret */ ret(Kind.Void),
9577
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
231 /* arg0: buffer */ javaCallingConvention(word));
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
232
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
233 addCRuntimeCall(OSRMigrationEndStub.OSR_MIGRATION_END_C, config.osrMigrationEndAddress,
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
234 /* ret */ ret(Kind.Void),
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
235 /* arg0: buffer */ nativeCallingConvention(word));
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6674
diff changeset
236
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
237 addRuntimeCall(UNCOMMON_TRAP, config.uncommonTrapStub,
62af2ee39bc5 moved initialization of UNCOMMON_TRAP descriptor from AMD64 code to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
238 /* temps */ null,
62af2ee39bc5 moved initialization of UNCOMMON_TRAP descriptor from AMD64 code to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
239 /* ret */ ret(Kind.Void));
62af2ee39bc5 moved initialization of UNCOMMON_TRAP descriptor from AMD64 code to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
240
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
241 addCRuntimeCall(EXCEPTION_HANDLER_FOR_PC, config.exceptionHandlerForPcAddress,
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
242 /* ret */ ret(word),
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
243 /* arg0: thread */ nativeCallingConvention(word));
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
244
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
245 addStubCall(UNWIND_EXCEPTION_TO_CALLER,
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
246 /* ret */ ret(Kind.Void),
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
247 /* arg0: exception */ javaCallingConvention(Kind.Object,
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
248 /* arg1: returnAddress */ word));
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
249
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
250 addCRuntimeCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, config.exceptionHandlerForReturnAddressAddress,
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
251 /* ret */ ret(word),
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
252 /* arg0: thread */ nativeCallingConvention(word,
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
253 /* arg1: returnAddress */ word));
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
254 addStubCall(REGISTER_FINALIZER,
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
255 /* ret */ ret(Kind.Void),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
256 /* arg0: object */ javaCallingConvention(Kind.Object));
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
257
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
258 addCRuntimeCall(REGISTER_FINALIZER_C, config.registerFinalizerAddress,
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
259 /* ret */ ret(Kind.Void),
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
260 /* arg0: thread */ nativeCallingConvention(word,
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
261 /* arg1: object */ Kind.Object));
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
262
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
263 addStubCall(NEW_ARRAY,
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
264 /* ret */ ret(Kind.Object),
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
265 /* arg0: hub */ javaCallingConvention(word,
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
266 /* arg1: length */ Kind.Int));
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
267
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
268 addCRuntimeCall(NEW_ARRAY_C, config.newArrayAddress,
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
269 /* ret */ ret(Kind.Void),
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
270 /* arg0: thread */ nativeCallingConvention(word,
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
271 /* arg1: hub */ word,
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
272 /* arg2: length */ Kind.Int));
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
273
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
274 addStubCall(NEW_INSTANCE,
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
275 /* ret */ ret(Kind.Object),
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
276 /* arg0: hub */ javaCallingConvention(word));
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
277
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
278 addCRuntimeCall(NEW_INSTANCE_C, config.newInstanceAddress,
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
279 /* ret */ ret(Kind.Void),
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
280 /* arg0: thread */ nativeCallingConvention(word,
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
281 /* arg1: hub */ word));
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
282
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
283 addStubCall(NEW_MULTI_ARRAY,
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
284 /* ret */ ret(Kind.Object),
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
285 /* arg0: hub */ javaCallingConvention(word,
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
286 /* arg1: rank */ Kind.Int,
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
287 /* arg2: dims */ word));
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
288
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
289 addCRuntimeCall(NEW_MULTI_ARRAY_C, config.newMultiArrayAddress,
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
290 /* ret */ ret(Kind.Void),
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
291 /* arg0: thread */ nativeCallingConvention(word,
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
292 /* arg1: hub */ word,
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
293 /* arg2: rank */ Kind.Int,
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
294 /* arg3: dims */ word));
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
295
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
296 addRuntimeCall(CREATE_NULL_POINTER_EXCEPTION, config.createNullPointerExceptionStub,
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
297 /* temps */ null,
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
298 /* ret */ ret(Kind.Object));
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
299
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
300 addRuntimeCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, config.createOutOfBoundsExceptionStub,
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
301 /* temps */ null,
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
302 /* ret */ ret(Kind.Object),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
303 /* arg0: index */ javaCallingConvention(Kind.Int));
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
304
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
305 addRuntimeCall(JAVA_TIME_MILLIS, config.javaTimeMillisStub,
8979
b87f042d1f29 Set correct temp registers for runtime calls that directly call C methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8966
diff changeset
306 /* temps */ this.regConfig.getCallerSaveRegisters(),
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
307 /* ret */ ret(Kind.Long));
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
308
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
309 addRuntimeCall(JAVA_TIME_NANOS, config.javaTimeNanosStub,
8979
b87f042d1f29 Set correct temp registers for runtime calls that directly call C methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8966
diff changeset
310 /* temps */ this.regConfig.getCallerSaveRegisters(),
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
311 /* ret */ ret(Kind.Long));
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
312
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
313 addRuntimeCall(ARITHMETIC_SIN, config.arithmeticSinStub,
8980
92b00825c037 Fixing more runtime call registrations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8979
diff changeset
314 /* temps */ this.regConfig.getCallerSaveRegisters(),
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
315 /* ret */ ret(Kind.Double),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
316 /* arg0: index */ javaCallingConvention(Kind.Double));
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
317
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
318 addRuntimeCall(ARITHMETIC_COS, config.arithmeticCosStub,
8980
92b00825c037 Fixing more runtime call registrations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8979
diff changeset
319 /* temps */ this.regConfig.getCallerSaveRegisters(),
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
320 /* ret */ ret(Kind.Double),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
321 /* arg0: index */ javaCallingConvention(Kind.Double));
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
322
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
323 addRuntimeCall(ARITHMETIC_TAN, config.arithmeticTanStub,
8980
92b00825c037 Fixing more runtime call registrations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8979
diff changeset
324 /* temps */ this.regConfig.getCallerSaveRegisters(),
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
325 /* ret */ ret(Kind.Double),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
326 /* arg0: index */ javaCallingConvention(Kind.Double));
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
327
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
328 addRuntimeCall(LOG_PRIMITIVE, config.logPrimitiveStub,
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
329 /* temps */ null,
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
330 /* ret */ ret(Kind.Void),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
331 /* arg0: typeChar */ javaCallingConvention(Kind.Int,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
332 /* arg1: value */ Kind.Long,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
333 /* arg2: newline */ Kind.Boolean));
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
334
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
335 addRuntimeCall(LOG_PRINTF, config.logPrintfStub,
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
336 /* temps */ null,
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
337 /* ret */ ret(Kind.Void),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
338 /* arg0: format */ javaCallingConvention(Kind.Object,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
339 /* arg1: value */ Kind.Long,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
340 /* arg2: value */ Kind.Long,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
341 /* arg3: value */ Kind.Long));
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
342
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9480
diff changeset
343 addCRuntimeCall(VM_MESSAGE_C, config.vmMessageAddress,
9232
bb2447c64055 strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents: 9203
diff changeset
344 /* ret */ ret(Kind.Void),
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
345 /* arg0: vmError */ nativeCallingConvention(Kind.Boolean,
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
346 /* arg1: format */ word,
9457
3e7d22d31f7e replaced stub_printf assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9456
diff changeset
347 /* arg2: value */ Kind.Long,
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
348 /* arg3: value */ Kind.Long,
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
349 /* arg4: value */ Kind.Long));
9232
bb2447c64055 strings used in compiled stubs are lowered to malloc'ed C strings so that there are no embedded oops (for the strings) in the resulting installed code
Doug Simon <doug.simon@oracle.com>
parents: 9203
diff changeset
350
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6525
diff changeset
351 addRuntimeCall(LOG_OBJECT, config.logObjectStub,
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
352 /* temps */ null,
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
353 /* ret */ ret(Kind.Void),
7393
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
354 /* arg0: object */ javaCallingConvention(Kind.Object,
5f00bf5a530d windows-specific bugfix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7384
diff changeset
355 /* arg1: flags */ Kind.Int));
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
356
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
357 addStubCall(THREAD_IS_INTERRUPTED,
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
358 /* ret */ ret(Kind.Boolean),
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
359 /* arg0: thread */ javaCallingConvention(Kind.Object,
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
360 /* arg1: clearInterrupted */ Kind.Boolean));
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
361
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
362 addCRuntimeCall(THREAD_IS_INTERRUPTED_C, config.threadIsInterruptedAddress,
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
363 /* ret */ ret(Kind.Boolean),
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
364 /* arg0: thread */ nativeCallingConvention(word,
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
365 /* arg1: receiverThread */ Kind.Object,
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
366 /* arg1: clearInterrupted */ Kind.Boolean));
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
367
9456
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
368 addRuntimeCall(DEOPT_HANDLER, config.handleDeoptStub,
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
369 /* temps */ null,
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
370 /* ret */ ret(Kind.Void));
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
371
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
372 addRuntimeCall(IC_MISS_HANDLER, config.inlineCacheMissStub,
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
373 /* temps */ null,
21ccdce289b2 moved declaration of EXCEPTION_HANDLER, DEOPT_HANDLER and IC_MISS_HANDLER descriptors to platform independent code
Doug Simon <doug.simon@oracle.com>
parents: 9455
diff changeset
374 /* ret */ ret(Kind.Void));
9463
Doug Simon <doug.simon@oracle.com>
parents: 9462 9460
diff changeset
375
9461
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
376 addStubCall(IDENTITY_HASHCODE,
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
377 /* ret */ ret(Kind.Int),
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
378 /* arg0: obj */ javaCallingConvention(Kind.Object));
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
379
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
380 addCRuntimeCall(IDENTITY_HASH_CODE_C, config.identityHashCodeAddress,
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
381 /* ret */ ret(Kind.Int),
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
382 /* arg0: thread */ nativeCallingConvention(word,
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
383 /* arg1: object */ Kind.Object));
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
384
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
385 addStubCall(MONITORENTER,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
386 /* ret */ ret(Kind.Void),
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
387 /* arg0: object */ javaCallingConvention(Kind.Object,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
388 /* arg1: lock */ word));
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
389
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
390 addCRuntimeCall(MONITORENTER_C, config.monitorenterAddress,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
391 /* ret */ ret(Kind.Void),
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
392 /* arg0: thread */ nativeCallingConvention(word,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
393 /* arg1: object */ Kind.Object,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
394 /* arg1: lock */ word));
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
395
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
396 addStubCall(MONITOREXIT,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
397 /* ret */ ret(Kind.Void),
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
398 /* arg0: object */ javaCallingConvention(Kind.Object,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
399 /* arg1: lock */ word));
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
400
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
401 addCRuntimeCall(MONITOREXIT_C, config.monitorexitAddress,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
402 /* ret */ ret(Kind.Void),
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
403 /* arg0: thread */ nativeCallingConvention(word,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
404 /* arg1: object */ Kind.Object,
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
405 /* arg1: lock */ word));
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
406
7522
4cc0efe5cffe disabled auto-formatting of manually formatted code
Doug Simon <doug.simon@oracle.com>
parents: 7393
diff changeset
407 // @formatter:on
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
408 }
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
409
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
410 /**
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
411 * Registers the details for linking a call to a compiled {@link Stub}.
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
412 *
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
413 * @param descriptor name and signature of the call
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
414 * @param ret where the call returns its result
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
415 * @param args where arguments are passed to the call
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
416 */
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
417 protected RuntimeCallTarget addStubCall(Descriptor descriptor, AllocatableValue ret, AllocatableValue... args) {
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
418 return addRuntimeCall(descriptor, 0L, null, ret, args);
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
419 }
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
420
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
421 /**
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
422 * Registers the details for a jump to a target that has a signature (i.e. expects arguments in
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
423 * specified locations).
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
424 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
425 * @param descriptor name and signature of the jump target
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
426 * @param args where arguments are passed to the call
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
427 */
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
428 protected RuntimeCallTarget addJump(Descriptor descriptor, AllocatableValue... args) {
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
429 return addRuntimeCall(descriptor, HotSpotRuntimeCallTarget.JUMP_ADDRESS, null, ret(Kind.Void), args);
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
430 }
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
431
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
432 /**
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
433 * Registers the details for a call to a runtime C/C++ function.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
434 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
435 * @param descriptor name and signature of the call
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
436 * @param args where arguments are passed to the call
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
437 */
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
438 protected RuntimeCallTarget addCRuntimeCall(Descriptor descriptor, long address, AllocatableValue ret, AllocatableValue... args) {
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
439 return addRuntimeCall(descriptor, address, true, null, ret, args);
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
440 }
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
441
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
442 protected RuntimeCallTarget addRuntimeCall(Descriptor descriptor, long address, Register[] tempRegs, AllocatableValue ret, AllocatableValue... args) {
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
443 return addRuntimeCall(descriptor, address, false, tempRegs, ret, args);
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
444 }
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
445
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
446 /**
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
447 * Registers the details for linking a runtime call.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
448 *
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
449 * @param descriptor name and signature of the call
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
450 * @param address target address of the call
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
451 * @param tempRegs temporary registers used (and killed) by the call (null if none)
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
452 * @param ret where the call returns its result
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
453 * @param args where arguments are passed to the call
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
454 */
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
455 protected RuntimeCallTarget addRuntimeCall(Descriptor descriptor, long address, boolean isCRuntimeCall, Register[] tempRegs, AllocatableValue ret, AllocatableValue... args) {
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9232
diff changeset
456 AllocatableValue[] temps = tempRegs == null || tempRegs.length == 0 ? AllocatableValue.NONE : new AllocatableValue[tempRegs.length];
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
457 for (int i = 0; i < temps.length; i++) {
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
458 temps[i] = tempRegs[i].asValue();
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
459 }
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
460 assert checkAssignable(descriptor.getResultType(), ret) : descriptor + " incompatible with result location " + ret;
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
461 Class[] argTypes = descriptor.getArgumentTypes();
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
462 assert argTypes.length == args.length : descriptor + " incompatible with number of argument locations: " + args.length;
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
463 for (int i = 0; i < argTypes.length; i++) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
464 assert checkAssignable(argTypes[i], args[i]) : descriptor + " incompatible with argument location " + i + ": " + args[i];
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
465 }
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
466 HotSpotRuntimeCallTarget runtimeCall = new HotSpotRuntimeCallTarget(descriptor, address, isCRuntimeCall, new CallingConvention(temps, 0, ret, args), graalRuntime.getCompilerToVM());
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
467 runtimeCalls.put(descriptor, runtimeCall);
8979
b87f042d1f29 Set correct temp registers for runtime calls that directly call C methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8966
diff changeset
468 return runtimeCall;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
469 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
470
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
471 private boolean checkAssignable(Class spec, Value value) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
472 Kind kind = value.getKind();
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
473 if (kind == Kind.Illegal) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
474 kind = Kind.Void;
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
475 }
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
476 if (WordBase.class.isAssignableFrom(spec)) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
477 return kind == graalRuntime.getTarget().wordKind;
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
478 }
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
479 return kind == Kind.fromJavaClass(spec);
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
480 }
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
481
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
482 protected abstract RegisterConfig createRegisterConfig(boolean globalStubConfig);
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
483
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
484 public void registerReplacements(Replacements replacements) {
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
485 if (GraalOptions.IntrinsifyObjectMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
486 replacements.registerSubstitutions(ObjectSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
487 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
488 if (GraalOptions.IntrinsifySystemMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
489 replacements.registerSubstitutions(SystemSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
490 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
491 if (GraalOptions.IntrinsifyThreadMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
492 replacements.registerSubstitutions(ThreadSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
493 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
494 if (GraalOptions.IntrinsifyUnsafeMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
495 replacements.registerSubstitutions(UnsafeSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
496 }
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
497 if (GraalOptions.IntrinsifyClassMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
498 replacements.registerSubstitutions(ClassSubstitutions.class);
7220
fcae6d960acd added more compiler intrinsics
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7113
diff changeset
499 }
7384
d0fbdf2f7a0e added com.sun.crypto.provider.CipherBlockChaining intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 7373
diff changeset
500 if (GraalOptions.IntrinsifyAESMethods) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
501 replacements.registerSubstitutions(AESCryptSubstitutions.class);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
502 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
503 }
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
504 if (GraalOptions.IntrinsifyReflectionMethods) {
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
505 replacements.registerSubstitutions(ReflectionSubstitutions.class);
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9380
diff changeset
506 }
8913
653110156f8a refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents: 8627
diff changeset
507
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
508 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
509 instanceofSnippets = new InstanceOfSnippets.Templates(this, replacements, graalRuntime.getTarget());
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
510 newObjectSnippets = new NewObjectSnippets.Templates(this, replacements, graalRuntime.getTarget(), config.useTLAB);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
511 monitorSnippets = new MonitorSnippets.Templates(this, replacements, graalRuntime.getTarget(), config.useFastLocking);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
512 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
513 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
514 exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, replacements, graalRuntime.getTarget());
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
515
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
516 registerStub(new NewInstanceStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_INSTANCE)));
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
517 registerStub(new NewArrayStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_ARRAY)));
9355
4e260c2ced0e removed new_multi_array assembler stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9339
diff changeset
518 registerStub(new NewMultiArrayStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_MULTI_ARRAY)));
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9418
diff changeset
519 registerStub(new RegisterFinalizerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(REGISTER_FINALIZER)));
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
520 registerStub(new ThreadIsInterruptedStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(THREAD_IS_INTERRUPTED)));
9461
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
521 registerStub(new IdentityHashCodeStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(IDENTITY_HASHCODE)));
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
522 registerStub(new ExceptionHandlerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(EXCEPTION_HANDLER)));
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9504
diff changeset
523 registerStub(new UnwindExceptionToCallerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(UNWIND_EXCEPTION_TO_CALLER)));
9574
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9564
diff changeset
524 registerStub(new VerifyOopStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(VERIFY_OOP)));
9577
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
525 registerStub(new OSRMigrationEndStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(OSR_MIGRATION_END)));
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
526 registerStub(new MonitorEnterStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(MONITORENTER)));
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9577
diff changeset
527 registerStub(new MonitorExitStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(MONITOREXIT)));
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
528 }
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
529
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
530 private void registerStub(Stub stub) {
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
531 stub.getLinkage().setStub(stub);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
532 stubs.put(stub.getMethod(), stub);
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
533 }
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
534
5780
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
535 public HotSpotGraalRuntime getGraalRuntime() {
64257cbef60c removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
536 return graalRuntime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
537 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
538
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
539 /**
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
540 * 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
541 */
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
542 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
543
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
544 /**
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
545 * 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
546 */
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
547 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
548
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
549 @Override
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
550 public String disassemble(CompilationResult compResult, InstalledCode installedCode) {
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
551 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
552 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
553 TargetDescription target = graalRuntime.getTarget();
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
554 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
555 if (compResult != null) {
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
556 HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
557 addExceptionHandlersComment(compResult, hcf);
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
558 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
559 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
560 for (Infopoint infopoint : compResult.getInfopoints()) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
561 if (infopoint instanceof Call) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
562 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
563 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
564 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
565 }
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
566 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
567 } else {
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
568 if (infopoint.debugInfo != null) {
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
569 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
570 }
9003
a8fea2979e63 eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents: 8895
diff changeset
571 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
572 }
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
573 }
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
574 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
575 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
576 }
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
577 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
578 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
579 }
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
580 }
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
581 return hcf.toEmbeddedString();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
582 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
583
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
584 /**
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
585 * 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
586 */
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
587 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
588 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
589 for (Field f : fields) {
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
590 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
591 f.setAccessible(true);
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
592 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
593 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
594 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
595 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
596 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
597 } catch (Exception e) {
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
598 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
599 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
600 }
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
601 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
602 }
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
603
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
604 /**
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
605 * 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
606 */
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
607 private static String getMarkName(Mark mark) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
608 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
609 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
610 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
611 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
612 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
613 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
614 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
615 }
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
616 } 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
617 }
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
618 }
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
619 }
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
620 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
621 }
333930100018 enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents: 5213
diff changeset
622
9301
ba441e21796f rename variable that reflected legacy type name
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
623 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
624 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
625 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
626 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
627 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
628 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
629 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
630 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
631 }
4291
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
632 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
633 }
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
634 }
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
635
015c53fefd3a Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4262
diff changeset
636 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
637 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
638 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
639 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
640
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
641 @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
642 public ResolvedJavaType lookupJavaType(Constant constant) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7096
diff changeset
643 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
644 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
645 }
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
646 Object o = constant.asObject();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
647 return HotSpotResolvedObjectType.fromClass(o.getClass());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
648 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
649
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
650 @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
651 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
652 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
653 }
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
654
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
655 @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
656 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
657 return x.equals(y);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
658 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
659
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
660 @Override
7838
a063308816d9 Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7836
diff changeset
661 public RegisterConfig lookupRegisterConfig() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
662 return regConfig;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
663 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
664
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
665 @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
666 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
667 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
668 }
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
669
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
670 @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
671 public int lookupArrayLength(Constant array) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7096
diff changeset
672 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
673 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
674 }
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7001
diff changeset
675 return Array.getLength(array.asObject());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
676 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
677
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
678 @Override
5718
10341299528c renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents: 5705
diff changeset
679 public void lower(Node n, LoweringTool tool) {
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
680 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
681 Kind wordKind = graalRuntime.getTarget().wordKind;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
682 if (n instanceof ArrayLengthNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
683 ArrayLengthNode arrayLengthNode = (ArrayLengthNode) n;
8543
354d729ae588 remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 8521
diff changeset
684 ValueNode array = arrayLengthNode.array();
9203
f78437ffb8d3 Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 9200
diff changeset
685 ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(LocationNode.FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt()));
9376
ee75b4f569ed Don't create null check guard if object is kown to be non-null.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9355
diff changeset
686 tool.createNullCheckGuard(arrayLengthRead.dependencies(), array);
8543
354d729ae588 remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 8521
diff changeset
687 graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead);
5822
ec65d0d0c873 moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents: 5780
diff changeset
688 } 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
689 Invoke invoke = (Invoke) n;
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
690 if (invoke.callTarget() instanceof MethodCallTargetNode) {
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9106
diff changeset
691 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
692 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
693 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
694 if (!callTarget.isStatic() && receiver.kind() == Kind.Object && !receiver.objectStamp().nonNull()) {
9376
ee75b4f569ed Don't create null check guard if object is kown to be non-null.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9355
diff changeset
695 tool.createNullCheckGuard(invoke.asNode().dependencies(), 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
696 }
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7278
diff changeset
697 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
698
9147
07f05f2a8149 Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9106
diff changeset
699 LoweredCallTargetNode loweredCallTarget = null;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
700 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
701
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
702 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
703 if (!hsMethod.getDeclaringClass().isInterface()) {
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
704 int vtableEntryOffset = hsMethod.vtableEntryOffset();
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
705 if (vtableEntryOffset > 0) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
706 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
707 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
708 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
709 // 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
710 // 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
711 // values.
9203
f78437ffb8d3 Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 9200
diff changeset
712 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
713 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
714
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
715 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
716 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
717
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
718 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
719 graph.addAfterFixed(hub, metaspaceMethod);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
720 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
721 }
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
722 }
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
723 }
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
724
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
725 if (loweredCallTarget == null) {
9089
5ab06146e985 Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9027
diff changeset
726 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
727 callTarget.invokeKind()));
6409
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
728 }
823a2978e7ba Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6404
diff changeset
729 callTarget.replaceAndDelete(loweredCallTarget);
5822
ec65d0d0c873 moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents: 5780
diff changeset
730 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
731 } 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
732 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
733 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
734 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
735 assert loadField.kind() != Kind.Illegal;
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
736 ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp()));
9376
ee75b4f569ed Don't create null check guard if object is kown to be non-null.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9355
diff changeset
737 tool.createNullCheckGuard(memoryRead.dependencies(), object);
8502
ff4fa8b0516e -Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8501
diff changeset
738
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
739 graph.replaceFixedWithFixed(loadField, memoryRead);
8502
ff4fa8b0516e -Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8501
diff changeset
740
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
741 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
742 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
743 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
744 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
745 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
746 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
747 } else if (n instanceof StoreFieldNode) {
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
748 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
749 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
750 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
751 WriteBarrierType barrierType = getFieldStoreBarrierType(storeField);
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
752 WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType));
9376
ee75b4f569ed Don't create null check guard if object is kown to be non-null.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9355
diff changeset
753 tool.createNullCheckGuard(memoryWrite.dependencies(), object);
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
754 memoryWrite.setStateAfter(storeField.stateAfter());
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
755 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
756 FixedWithNextNode last = memoryWrite;
8501
41fc46da946a -More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8498
diff changeset
757 FixedWithNextNode first = memoryWrite;
41fc46da946a -More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8498
diff changeset
758
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
759 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
760 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
761 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
762 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
763 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
764 }
591f8231aa82 removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents: 5160
diff changeset
765 } 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
766 // 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
767 CompareAndSwapNode cas = (CompareAndSwapNode) n;
9183
34eba4e78a0a Attach LocationNode to CompareAndSwapNode
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9175
diff changeset
768 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
769 cas.setLocation(location);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
770 cas.setWriteBarrierType(getCompareAndSwapBarrier(cas));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
771 } else if (n instanceof LoadIndexedNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
772 LoadIndexedNode loadIndexed = (LoadIndexedNode) n;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
773 ValueNode boundsCheck = createBoundsCheck(loadIndexed, tool);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
774 Kind elementKind = loadIndexed.elementKind();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
775 LocationNode arrayLocation = createArrayLocation(graph, elementKind, loadIndexed.index());
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5067
diff changeset
776 ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp()));
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5372
diff changeset
777 memoryRead.dependencies().add(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
778 graph.replaceFixedWithFixed(loadIndexed, memoryRead);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
779 } else if (n instanceof StoreIndexedNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
780 StoreIndexedNode storeIndexed = (StoreIndexedNode) n;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
781 ValueNode boundsCheck = createBoundsCheck(storeIndexed, tool);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
782 Kind elementKind = storeIndexed.elementKind();
8521
6aa080855d7c -Bug fixes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8517
diff changeset
783 LocationNode arrayLocation = createArrayLocation(graph, elementKind, storeIndexed.index());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
784 ValueNode value = storeIndexed.value();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
785 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
786 if (elementKind == Kind.Object && !value.objectStamp().alwaysNull()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
787 // 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
788 ResolvedJavaType arrayType = array.objectStamp().type();
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5426
diff changeset
789 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
790 ResolvedJavaType elementType = arrayType.getComponentType();
7096
585fc9f79ebc Remove ResolvedJavaType.isClass()
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7090
diff changeset
791 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
792 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
793 graph.addBeforeFixed(storeIndexed, checkcast);
4485e0edd1af made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents: 5360
diff changeset
794 value = checkcast;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
795 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
796 } else {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
797 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
798 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
799 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
800 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
801 graph.addBeforeFixed(storeIndexed, checkcast);
6463
41f0849e107b reverted LoadHubNode to be a fixed node
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
802 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
803 value = checkcast;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
804 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
805 }
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
806 WriteBarrierType barrierType = getArrayStoreBarrierType(storeIndexed);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
807 WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType));
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5372
diff changeset
808 memoryWrite.dependencies().add(boundsCheck);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
809 memoryWrite.setStateAfter(storeIndexed.stateAfter());
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
810 graph.replaceFixedWithFixed(storeIndexed, memoryWrite);
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents: 4305
diff changeset
811
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
812 } else if (n instanceof UnsafeLoadNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
813 UnsafeLoadNode load = (UnsafeLoadNode) n;
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
814 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
815 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
816 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
817 // 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
818 // null check on its object.
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9380
diff changeset
819 memoryRead.dependencies().add(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
820 graph.replaceFixedWithFixed(load, memoryRead);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
821 } else if (n instanceof UnsafeStoreNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
822 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
823 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
824 ValueNode object = store.object();
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
825 WriteBarrierType barrierType = getUnsafeStoreBarrierType(store);
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
826 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
827 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
828 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
829 } 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
830 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
831 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
832 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
833 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
834 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
835 } 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
836 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
837 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
838 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
839 graph.replaceFixed(loadMethodNode, metaspaceMethod);
7130
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
840 } else if (n instanceof FixedGuardNode) {
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
841 FixedGuardNode node = (FixedGuardNode) n;
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
842 ValueAnchorNode newAnchor = graph.add(new ValueAnchorNode(tool.createGuard(node.condition(), node.getReason(), node.getAction(), node.isNegated())));
7130
3a2f8b313bc5 Allow VM-specific lowering of FixedGuardNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7113
diff changeset
843 graph.replaceFixedWithFixed(node, newAnchor);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
844 } else if (n instanceof CommitAllocationNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
845 CommitAllocationNode commit = (CommitAllocationNode) n;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
846
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
847 ValueNode[] allocations = new ValueNode[commit.getVirtualObjects().size()];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
848 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
849 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
850 int entryCount = virtual.entryCount();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
851
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
852 FixedWithNextNode newObject;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
853 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
854 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
855 } else {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
856 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
857 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
858 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
859 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
860 allocations[objIndex] = newObject;
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
861 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
862 int valuePos = 0;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
863 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
864 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
865 int entryCount = virtual.entryCount();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
866
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
867 ValueNode newObject = allocations[objIndex];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
868 if (virtual instanceof VirtualInstanceNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
869 VirtualInstanceNode instance = (VirtualInstanceNode) virtual;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
870 for (int i = 0; i < entryCount; i++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
871 ValueNode value = commit.getValues().get(valuePos++);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
872 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
873 value = allocations[commit.getVirtualObjects().indexOf(value)];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
874 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
875 graph.addBeforeFixed(commit, graph.add(new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) instance.field(i)), WriteBarrierType.NONE)));
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
876 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
877 } else {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
878 VirtualArrayNode array = (VirtualArrayNode) virtual;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
879 ResolvedJavaType element = array.componentType();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
880 for (int i = 0; i < entryCount; i++) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
881 ValueNode value = commit.getValues().get(valuePos++);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
882 if (value instanceof VirtualObjectNode) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
883 int indexOf = commit.getVirtualObjects().indexOf(value);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
884 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
885 value = allocations[indexOf];
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
886 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
887 graph.addBeforeFixed(commit, graph.add(new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), WriteBarrierType.NONE)));
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
888 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
889 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
890 }
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
891 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
892 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
893 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
894 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
895 }
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
896 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
897 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
898 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
899 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
900 }
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9502
diff changeset
901 }
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
902 for (Node usage : commit.usages().snapshot()) {
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
903 AllocatedObjectNode addObject = (AllocatedObjectNode) usage;
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
904 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
905 graph.replaceFloating(addObject, allocations[index]);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
906 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 9500
diff changeset
907 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
908 } else if (n instanceof CheckCastNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
909 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
910 } else if (n instanceof OSRStartNode) {
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
911 OSRStartNode osrStart = (OSRStartNode) n;
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
912 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
913 LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind())));
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
914 RuntimeCallNode migrationEnd = graph.add(new RuntimeCallNode(OSR_MIGRATION_END, buffer));
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
915 migrationEnd.setStateAfter(osrStart.stateAfter());
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
916
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
917 newStart.setNext(migrationEnd);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
918 FixedNode next = osrStart.next();
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
919 osrStart.setNext(null);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
920 migrationEnd.setNext(next);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
921 graph.setStart(newStart);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
922
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
923 // 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
924 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
925 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
926 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
927 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
928 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
929 osrLocal.replaceAndDelete(load);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
930 graph.addBeforeFixed(migrationEnd, load);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
931 }
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
932 osrStart.replaceAtUsages(newStart);
8f854c4deabf Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9504
diff changeset
933 osrStart.safeDelete();
6648
7bf5a6c42db7 factored CheckCastDynamicNode out of CheckCastNode
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
934 } else if (n instanceof CheckCastDynamicNode) {
7bf5a6c42db7 factored CheckCastDynamicNode out of CheckCastNode
Doug Simon <doug.simon@oracle.com>
parents: 6582
diff changeset
935 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
936 } else if (n instanceof InstanceOfNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
937 instanceofSnippets.lower((InstanceOfNode) n, tool);
7278
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7235
diff changeset
938 } else if (n instanceof InstanceOfDynamicNode) {
346336325337 added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents: 7235
diff changeset
939 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
940 } else if (n instanceof NewInstanceNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
941 newObjectSnippets.lower((NewInstanceNode) n, tool);
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
942 } else if (n instanceof NewArrayNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
943 newObjectSnippets.lower((NewArrayNode) 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
944 } else if (n instanceof MonitorEnterNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
945 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
946 } else if (n instanceof MonitorExitNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
947 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
948 } 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
949 writeBarrierSnippets.lower((SerialWriteBarrier) n, tool);
8963
63eae4723b18 Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
950 } else if (n instanceof SerialArrayRangeWriteBarrier) {
63eae4723b18 Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
951 writeBarrierSnippets.lower((SerialArrayRangeWriteBarrier) n, tool);
5663
77069a28a983 split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents: 5602
diff changeset
952 } else if (n instanceof TLABAllocateNode) {
5760
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
953 newObjectSnippets.lower((TLABAllocateNode) n, tool);
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
954 } else if (n instanceof InitializeObjectNode) {
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
955 newObjectSnippets.lower((InitializeObjectNode) n, tool);
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
956 } else if (n instanceof InitializeArrayNode) {
87e8baf5447c added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents: 5728
diff changeset
957 newObjectSnippets.lower((InitializeArrayNode) n, tool);
6431
2e376f8ea4e2 added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents: 6409
diff changeset
958 } else if (n instanceof NewMultiArrayNode) {
6462
b3f5dc099f9d removed XIR
Doug Simon <doug.simon@oracle.com>
parents: 6460
diff changeset
959 newObjectSnippets.lower((NewMultiArrayNode) n, tool);
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
960 } else if (n instanceof LoadExceptionObjectNode) {
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8642
diff changeset
961 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
962 } 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
963 // 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
964 // zero and the MIN_VALUE / -1 cases.
9016
60b9fe7034e6 Allow lowering of DeoptimizeNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9015
diff changeset
965 } 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
966 // 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
967 } 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
968 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
969 } 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
970 boxingSnippets.lower((UnboxNode) n);
5241
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
971 } else {
e24167877471 conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
972 assert false : "Node implementing Lowerable not handled: " + n;
7076
32408bd16b91 fixes after merge
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7075
diff changeset
973 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
974 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
975 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
976
9380
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
977 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
978 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
979 assert !hsMethod.getDeclaringClass().isInterface();
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
980
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
981 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
982 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
983 // 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
984 // 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
985 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
986 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
987 }
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
988
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
989 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
990 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
991 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
992 ReadNode hub = graph.add(new ReadNode(object, location, 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
993 tool.createNullCheckGuard(hub.dependencies(), object);
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
994 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
995 }
ee8cd087a731 Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9377
diff changeset
996
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
997 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
998 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
999 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
1000 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1001 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1002 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1003 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1004
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
1005 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
1006 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1007 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
1008 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1009 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1010 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1011 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1012
9174
f6a8efb8d104 Better naming for WriteBarrierType get-functions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9147
diff changeset
1013 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
1014 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1015 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
1016 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
1017 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
1018 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1019 } else {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1020 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1021 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1022 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1023 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1024 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1025
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1026 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
1027 WriteBarrierType barrierType = WriteBarrierType.NONE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1028 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
1029 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
1030 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
1031 barrierType = WriteBarrierType.PRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1032 } else {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1033 barrierType = WriteBarrierType.IMPRECISE;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1034 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1035 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1036 return barrierType;
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1037 }
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8980
diff changeset
1038
9500
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
1039 private static ConstantLocationNode createFieldLocation(StructuredGraph graph, HotSpotResolvedJavaField field) {
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
1040 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
1041 }
9cc37ce426cc factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents: 9491
diff changeset
1042
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
1043 private 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
1044 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
1045 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
1046 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1047
5718
10341299528c renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents: 5705
diff changeset
1048 private static ValueNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) {
5415
79f12805362b Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5401
diff changeset
1049 StructuredGraph graph = (StructuredGraph) n.graph();
79f12805362b Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5401
diff changeset
1050 ArrayLengthNode arrayLength = graph.add(new ArrayLengthNode(n.array()));
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7558
diff changeset
1051 ValueNode 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
1052
5415
79f12805362b Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5401
diff changeset
1053 graph.addBeforeFixed(n, arrayLength);
5401
332a3c0d7b3b remove array length input from LoadIndexedNode and StoreIndexedNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 5400
diff changeset
1054 return guard;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1055 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1056
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
1057 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
1058 return HotSpotResolvedObjectType.fromClass(clazz);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1059 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1060
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
1061 /**
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
1062 * Gets the stub corresponding to a given method.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1063 *
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1064 * @return the stub {@linkplain Stub#getMethod() implemented} by {@code method} or null if
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1065 * {@code method} does not implement a stub
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
1066 */
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
1067 public Stub asStub(ResolvedJavaMethod method) {
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
1068 return stubs.get(method);
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
1069 }
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
1070
7144
ae69cd8c08a9 rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents: 7143
diff changeset
1071 public HotSpotRuntimeCallTarget lookupRuntimeCall(Descriptor descriptor) {
8627
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
1072 HotSpotRuntimeCallTarget callTarget = runtimeCalls.get(descriptor);
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
1073 assert runtimeCalls != null : descriptor;
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
1074 callTarget.finalizeAddress(graalRuntime.getBackend());
75db7afee829 implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents: 8587
diff changeset
1075 return callTarget;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1076 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1077
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
1078 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
1079 CompilerToVM c2vm = graalRuntime.getCompilerToVM();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
1080 HotSpotResolvedObjectType[] resultHolder = {null};
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
1081 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
1082 assert metaspaceMethod != 0L;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
1083 return resultHolder[0].createMethod(metaspaceMethod);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1084 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1085
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1086 public ResolvedJavaMethod lookupJavaConstructor(Constructor reflectionConstructor) {
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1087 CompilerToVM c2vm = graalRuntime.getCompilerToVM();
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7083
diff changeset
1088 HotSpotResolvedObjectType[] resultHolder = {null};
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1089 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
1090 assert metaspaceMethod != 0L;
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1091 return resultHolder[0].createMethod(metaspaceMethod);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1092 }
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
1093
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
1094 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
1095 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
1096 }
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6431
diff changeset
1097
9041
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1098 public HotSpotInstalledCode installMethod(HotSpotResolvedJavaMethod method, Graph graph, int entryBCI, CompilationResult compResult) {
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1099 HotSpotInstalledCode installedCode = new HotSpotInstalledCode(method, graph, true);
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
1100 graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(method, entryBCI, compResult), installedCode, method.getSpeculationLog());
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
1101 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
1102 }
6cc970203f30 moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
1103
6cc970203f30 moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
1104 @Override
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
1105 public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) {
9041
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1106 return addMethod(method, compResult, null);
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1107 }
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1108
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1109 @Override
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1110 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
1111 HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
9041
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 9027
diff changeset
1112 HotSpotInstalledCode code = new HotSpotInstalledCode(hotspotMethod, graph, false);
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8217
diff changeset
1113 CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(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
1114 if (result != CodeInstallResult.OK) {
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
1115 return null;
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
1116 }
38076efb9062 Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7104
diff changeset
1117 return code;
4319
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4312
diff changeset
1118 }
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4312
diff changeset
1119
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4696
diff changeset
1120 @Override
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
1121 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
1122 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
1123 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
1124
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
1125 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
1126 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
1127 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
1128 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
1129
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
1130 public int convertDeoptAction(DeoptimizationAction action) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1131 switch (action) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1132 case None:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1133 return config.deoptActionNone;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1134 case RecompileIfTooManyDeopts:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1135 return config.deoptActionMaybeRecompile;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1136 case InvalidateReprofile:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1137 return config.deoptActionReinterpret;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1138 case InvalidateRecompile:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1139 return config.deoptActionMakeNotEntrant;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1140 case InvalidateStopCompiling:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1141 return config.deoptActionMakeNotCompilable;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1142 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1143 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
1144 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
1145 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5110
diff changeset
1146
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
1147 public int convertDeoptReason(DeoptimizationReason reason) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1148 switch (reason) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1149 case None:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1150 return config.deoptReasonNone;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1151 case NullCheckException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1152 return config.deoptReasonNullCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1153 case BoundsCheckException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1154 return config.deoptReasonRangeCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1155 case ClassCastException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1156 return config.deoptReasonClassCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1157 case ArrayStoreException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1158 return config.deoptReasonArrayCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1159 case UnreachedCode:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1160 return config.deoptReasonUnreached0;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1161 case TypeCheckedInliningViolated:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1162 return config.deoptReasonTypeCheckInlining;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1163 case OptimizedTypeCheckViolated:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1164 return config.deoptReasonOptimizedTypeCheck;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1165 case NotCompiledExceptionHandler:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1166 return config.deoptReasonNotCompiledExceptionHandler;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1167 case Unresolved:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1168 return config.deoptReasonUnresolved;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1169 case JavaSubroutineMismatch:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1170 return config.deoptReasonJsrMismatch;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1171 case ArithmeticException:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1172 return config.deoptReasonDiv0Check;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1173 case RuntimeConstraint:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1174 return config.deoptReasonConstraint;
9444
fd60b73f1759 Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9441
diff changeset
1175 case LoopLimitCheck:
fd60b73f1759 Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9441
diff changeset
1176 return config.deoptReasonLoopLimitCheck;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1177 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1178 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
1179 }
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4696
diff changeset
1180 }
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
1181
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
1182 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
1183 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
1184 }
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
1185
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
1186 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1187 * Registers an object created by the compiler and referenced by some generated code. HotSpot
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1188 * treats oops embedded in code as weak references so without an external strong root, such an
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7522
diff changeset
1189 * embedded oop will quickly die. This in turn will cause the nmethod to be unloaded.
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
1190 */
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
1191 public synchronized Object registerGCRoot(Object object) {
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
1192 Object existing = gcRoots.get(object);
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
1193 if (existing != null) {
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
1194 return existing;
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
1195 }
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
1196 gcRoots.put(object, object);
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
1197 return object;
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
1198 }
7672
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1199
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1200 @Override
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1201 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
1202 switch (kind) {
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1203 case Boolean:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1204 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
1205 case Byte:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1206 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
1207 case Char:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1208 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
1209 case Short:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1210 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
1211 case Int:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1212 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
1213 case Long:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1214 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
1215 case Float:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1216 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
1217 case Double:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1218 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
1219 case Object:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1220 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
1221 default:
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1222 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
1223 }
1a4a00390113 Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7558
diff changeset
1224 }
7733
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
1225
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
1226 @Override
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
1227 public TargetDescription getTarget() {
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
1228 return graalRuntime.getTarget();
f6bf0f6a8431 move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents: 7677
diff changeset
1229 }
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1230
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1231 public String disassemble(InstalledCode code) {
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1232 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
1233 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
1234 return graalRuntime.getCompilerToVM().disassembleCodeBlob(codeBlob);
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1235 }
7912
06ecee106195 added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents: 7838
diff changeset
1236 return null;
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1237 }
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1238
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1239 public String disassemble(ResolvedJavaMethod method) {
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1240 return new BytecodeDisassembler().disassemble(method);
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7764
diff changeset
1241 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1242 }