annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java @ 9595:db2125285960

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