Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java @ 11682:976ebd1973d1
The runtime might not always be able to report an array length
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 17 Sep 2013 10:31:22 -0700 |
parents | f091e0d6f4f3 |
children | 226ef8ab5bc0 |
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.*; |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
29 import static com.oracle.graal.api.meta.LocationIdentity.*; |
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.*; |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
32 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; |
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
33 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*; |
9747
8e5461c4c82e
replaced NewMultiArrayStub use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9743
diff
changeset
|
34 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
9590
5f9c41cd3b1e
replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9577
diff
changeset
|
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.*; |
9594
743326387173
replaced vm_error assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9593
diff
changeset
|
39 import static com.oracle.graal.hotspot.nodes.VMErrorNode.*; |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
40 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; |
9771
4de03457d5c8
replaced MonitorEnterStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9752
diff
changeset
|
41 import static com.oracle.graal.hotspot.replacements.MonitorSnippets.*; |
10586
110434bc2913
Remove unnecessary class.
Roland Schatz <roland.schatz@oracle.com>
parents:
10581
diff
changeset
|
42 import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8412
diff
changeset
|
43 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*; |
9772
9c5078e16fd9
replaced ThreadIsInterruptedStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9771
diff
changeset
|
44 import static com.oracle.graal.hotspot.replacements.ThreadSubstitutions.*; |
10542
554f67e4ff3f
Use slow-path stub call instead of deopt in lowering of DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10536
diff
changeset
|
45 import static com.oracle.graal.hotspot.replacements.WriteBarrierSnippets.*; |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
46 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*; |
9418
8d3a7fb9eb5f
moved binding of parameter locations to runtime call descriptors from platform specific code to shared code for stubs that are now compiled stubs
Doug Simon <doug.simon@oracle.com>
parents:
9380
diff
changeset
|
47 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
|
48 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*; |
9618
bd4a7d657dcc
moved static methods out of Stub into StubUtil
Doug Simon <doug.simon@oracle.com>
parents:
9616
diff
changeset
|
49 import static com.oracle.graal.hotspot.stubs.StubUtil.*; |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9504
diff
changeset
|
50 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*; |
7558
223f645acb9b
added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
51 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
|
52 import static com.oracle.graal.nodes.java.RegisterFinalizerNode.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9850
diff
changeset
|
53 import static com.oracle.graal.phases.GraalOptions.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8412
diff
changeset
|
54 import static com.oracle.graal.replacements.Log.*; |
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8412
diff
changeset
|
55 import static com.oracle.graal.replacements.MathSubstitutionsX86.*; |
8627
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8587
diff
changeset
|
56 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 import java.lang.reflect.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
7099
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
60 import sun.misc.*; |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
61 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
62 import com.oracle.graal.api.code.*; |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5728
diff
changeset
|
63 import com.oracle.graal.api.code.CodeUtil.RefMapFormatter; |
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5728
diff
changeset
|
64 import com.oracle.graal.api.code.CompilationResult.Call; |
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5728
diff
changeset
|
65 import com.oracle.graal.api.code.CompilationResult.DataPatch; |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9232
diff
changeset
|
66 import com.oracle.graal.api.code.CompilationResult.Infopoint; |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5728
diff
changeset
|
67 import com.oracle.graal.api.code.CompilationResult.Mark; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
68 import com.oracle.graal.api.meta.*; |
10835
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
69 import com.oracle.graal.asm.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
70 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
71 import com.oracle.graal.hotspot.*; |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
72 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect; |
9750
23a047fba2df
removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents:
9749
diff
changeset
|
73 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition; |
6462 | 74 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
|
75 import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
76 import com.oracle.graal.hotspot.nodes.*; |
9969
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
77 import com.oracle.graal.hotspot.phases.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8412
diff
changeset
|
78 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
|
79 import com.oracle.graal.hotspot.stubs.*; |
7784
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
80 import com.oracle.graal.java.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
81 import com.oracle.graal.nodes.*; |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
82 import com.oracle.graal.nodes.HeapAccess.BarrierType; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
83 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
84 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
85 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
|
86 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
|
87 import com.oracle.graal.nodes.spi.*; |
5076
01ffb0fc9aec
propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents:
5067
diff
changeset
|
88 import com.oracle.graal.nodes.type.*; |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
89 import com.oracle.graal.nodes.virtual.*; |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
90 import com.oracle.graal.phases.tiers.*; |
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
|
91 import com.oracle.graal.printer.*; |
8627
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8587
diff
changeset
|
92 import com.oracle.graal.replacements.*; |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7278
diff
changeset
|
93 import com.oracle.graal.word.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 /** |
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
|
96 * HotSpot implementation of {@link GraalCodeCacheProvider}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 */ |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
98 public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
99 |
9737
34c892fdfb6d
moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents:
9736
diff
changeset
|
100 public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class); |
34c892fdfb6d
moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents:
9736
diff
changeset
|
101 public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class); |
9773
8a1b0a3d4fc3
replaced VerifyOopStubCall with usage of ForeignCallNode
Doug Simon <doug.simon@oracle.com>
parents:
9772
diff
changeset
|
102 public static final ForeignCallDescriptor VERIFY_OOP = new ForeignCallDescriptor("verify_oop", Object.class, Object.class); |
9820
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9819
diff
changeset
|
103 public static final ForeignCallDescriptor LOAD_AND_CLEAR_EXCEPTION = new ForeignCallDescriptor("load_and_clear_exception", Object.class, Word.class); |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
104 |
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
|
105 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
|
106 |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9694
diff
changeset
|
107 protected final RegisterConfig regConfig; |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
108 protected final HotSpotGraalRuntime graalRuntime; |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
109 private final Suites defaultSuites; |
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
|
110 |
11226
422b0e9b9aed
removed obsolete checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
10953
diff
changeset
|
111 private CheckCastDynamicSnippets.Templates checkcastDynamicSnippets; |
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
|
112 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
|
113 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
|
114 private MonitorSnippets.Templates monitorSnippets; |
11457
fd1383d45420
Change scope of write barrier snippets
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11454
diff
changeset
|
115 protected 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
|
116 private BoxingSnippets.Templates boxingSnippets; |
8643
3d2c2b68fe93
lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents:
8642
diff
changeset
|
117 private LoadExceptionObjectSnippets.Templates exceptionObjectSnippets; |
10801
4bfbd4be6e7a
Replace custom graph building with snippet for unsafe load lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10798
diff
changeset
|
118 private UnsafeLoadSnippets.Templates unsafeLoadSnippets; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
120 private final Map<ForeignCallDescriptor, HotSpotForeignCallLinkage> foreignCalls = new HashMap<>(); |
7143
445193cc2a7d
added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents:
7130
diff
changeset
|
121 |
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
|
122 /** |
7099
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
123 * 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
|
124 * |
7099
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
125 * @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
|
126 */ |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
127 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
|
128 switch (kind) { |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
129 case Boolean: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
130 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
|
131 case Byte: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
132 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
|
133 case Char: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
134 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
|
135 case Short: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
136 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
|
137 case Int: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
138 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
|
139 case Long: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
140 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
|
141 case Float: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
142 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
|
143 case Double: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
144 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
|
145 case Object: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
146 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
|
147 default: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
148 throw GraalInternalError.shouldNotReachHere(); |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
149 } |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
150 } |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
151 |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
152 /** |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
153 * 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
|
154 * |
7099
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
155 * @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
|
156 */ |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
157 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
|
158 switch (kind) { |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
159 case Boolean: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
160 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
|
161 case Byte: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
162 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
|
163 case Char: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
164 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
|
165 case Short: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
166 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
|
167 case Int: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
168 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
|
169 case Long: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
170 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
|
171 case Float: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
172 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
|
173 case Double: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
174 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
|
175 case Object: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
176 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
|
177 default: |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
178 throw GraalInternalError.shouldNotReachHere(); |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
179 } |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
180 } |
3656236c7d27
Cleanup of Kind class: remove use of Unsafe class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
181 |
9693
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
182 public HotSpotRuntime(HotSpotVMConfig c, HotSpotGraalRuntime graalRuntime) { |
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
183 this.config = c; |
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
184 this.graalRuntime = graalRuntime; |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9694
diff
changeset
|
185 regConfig = createRegisterConfig(); |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
186 defaultSuites = createSuites(); |
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
|
187 } |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
188 |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
189 protected abstract RegisterConfig createRegisterConfig(); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
190 |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
191 /** |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
192 * Registers the linkage for a foreign call. |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
193 */ |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
194 protected HotSpotForeignCallLinkage register(HotSpotForeignCallLinkage linkage) { |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
195 assert !foreignCalls.containsKey(linkage.getDescriptor()) : "already registered linkage for " + linkage.getDescriptor(); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
196 foreignCalls.put(linkage.getDescriptor(), linkage); |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
197 return linkage; |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
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 |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
200 /** |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
201 * Creates and registers the details for linking a foreign call to a {@link Stub}. |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
202 * |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
203 * @param descriptor the signature of the call to the stub |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
204 * @param reexecutable specifies if the stub call can be re-executed without (meaningful) side |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
205 * effects. Deoptimization will not return to a point before a stub call that cannot |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
206 * be re-executed. |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
207 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
208 * @param killedLocations the memory locations killed by the stub call |
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
|
209 */ |
10837
981c8a4d711a
Make VerifyOopStub leaf call
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10829
diff
changeset
|
210 protected HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor, boolean reexecutable, Transition transition, LocationIdentity... killedLocations) { |
10870
886c2df7a7e4
Stubs need both an outgoing and incoming calling convention.
twisti
parents:
10865
diff
changeset
|
211 return register(HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations)); |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9504
diff
changeset
|
212 } |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9504
diff
changeset
|
213 |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9504
diff
changeset
|
214 /** |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
215 * Creates and registers the linkage for a foreign call. |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
216 * |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
217 * @param descriptor the signature of the foreign call |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
218 * @param address the address of the code to call |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
219 * @param outgoingCcType outgoing (caller) calling convention type |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
220 * @param effect specifies if the call destroys or preserves all registers (apart from |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
221 * temporaries which are always destroyed) |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
222 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
223 * @param reexecutable specifies if the foreign call can be re-executed without (meaningful) |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
224 * side effects. Deoptimization will not return to a point before a foreign call that |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
225 * cannot be re-executed. |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
226 * @param killedLocations the memory locations killed by the foreign call |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6500
diff
changeset
|
227 */ |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
228 protected HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type outgoingCcType, RegisterEffect effect, Transition transition, |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
229 boolean reexecutable, LocationIdentity... killedLocations) { |
9750
23a047fba2df
removed redundant methods
Doug Simon <doug.simon@oracle.com>
parents:
9749
diff
changeset
|
230 Class<?> resultType = descriptor.getResultType(); |
9819
8aea948c522b
added support for the runtime to specify for each foreign call whether deoptimization can occur during the call
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
231 assert transition == LEAF || resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "non-leaf foreign calls must return objects in thread local storage: " + descriptor; |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
232 return register(HotSpotForeignCallLinkage.create(descriptor, address, effect, outgoingCcType, null, transition, reexecutable, killedLocations)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
235 private static void link(Stub stub) { |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
236 stub.getLinkage().setCompiledStub(stub); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
237 } |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
238 |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
239 /** |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
240 * Creates a {@linkplain ForeignCallStub stub} for a foreign call. |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
241 * |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
242 * @param descriptor the signature of the call to the stub |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
243 * @param address the address of the foreign code to call |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
244 * @param prependThread true if the JavaThread value for the current thread is to be prepended |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
245 * to the arguments for the call to {@code address} |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
246 * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
247 * @param reexecutable specifies if the foreign call can be re-executed without (meaningful) |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
248 * side effects. Deoptimization will not return to a point before a foreign call that |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
249 * cannot be re-executed. |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
250 * @param killedLocations the memory locations killed by the foreign call |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
251 */ |
10666
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
252 private void linkForeignCall(Replacements replacements, ForeignCallDescriptor descriptor, long address, boolean prependThread, Transition transition, boolean reexecutable, |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
253 LocationIdentity... killedLocations) { |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
254 ForeignCallStub stub = new ForeignCallStub(this, replacements, address, descriptor, prependThread, transition, reexecutable, killedLocations); |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
255 HotSpotForeignCallLinkage linkage = stub.getLinkage(); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
256 HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage(); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
257 linkage.setCompiledStub(stub); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
258 register(linkage); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
259 register(targetLinkage); |
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
260 } |
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
|
261 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
262 public static final boolean PREPEND_THREAD = true; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
263 public static final boolean DONT_PREPEND_THREAD = !PREPEND_THREAD; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
264 |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
265 public static final boolean REEXECUTABLE = true; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
266 public static final boolean NOT_REEXECUTABLE = !REEXECUTABLE; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
267 |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
268 public static final LocationIdentity[] NO_LOCATIONS = {}; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
269 |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
270 public void registerReplacements(Replacements r) { |
9751
ff9829c21f21
replaced OSRMigrationEndStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9750
diff
changeset
|
271 HotSpotVMConfig c = config; |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
272 TargetDescription target = getTarget(); |
9693
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
273 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
274 registerForeignCall(UNCOMMON_TRAP, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
275 registerForeignCall(DEOPT_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
276 registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
9693
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
277 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
278 registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
279 registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
280 registerForeignCall(ARITHMETIC_SIN, c.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
281 registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
282 registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS); |
9820
1b60f639ac4b
implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents:
9819
diff
changeset
|
283 registerForeignCall(LOAD_AND_CLEAR_EXCEPTION, c.loadAndClearExceptionAddress, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); |
9693
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9692
diff
changeset
|
284 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
285 registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
286 registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
287 registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
288 registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
289 registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS); |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
290 |
10837
981c8a4d711a
Make VerifyOopStub leaf call
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10829
diff
changeset
|
291 link(new NewInstanceStub(this, r, target, registerStubCall(NEW_INSTANCE, REEXECUTABLE, NOT_LEAF, ANY_LOCATION))); |
981c8a4d711a
Make VerifyOopStub leaf call
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10829
diff
changeset
|
292 link(new NewArrayStub(this, r, target, registerStubCall(NEW_ARRAY, REEXECUTABLE, NOT_LEAF, ANY_LOCATION))); |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
293 link(new ExceptionHandlerStub(this, r, target, foreignCalls.get(EXCEPTION_HANDLER))); |
10837
981c8a4d711a
Make VerifyOopStub leaf call
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10829
diff
changeset
|
294 link(new UnwindExceptionToCallerStub(this, r, target, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, NOT_REEXECUTABLE, NOT_LEAF, ANY_LOCATION))); |
981c8a4d711a
Make VerifyOopStub leaf call
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10829
diff
changeset
|
295 link(new VerifyOopStub(this, r, target, registerStubCall(VERIFY_OOP, REEXECUTABLE, LEAF, NO_LOCATIONS))); |
9752
82689c1c0dab
replaced VMErrorStub with use of ForeignCallStub
Doug Simon <doug.simon@oracle.com>
parents:
9751
diff
changeset
|
296 |
10666
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
297 linkForeignCall(r, IDENTITY_HASHCODE, c.identityHashCodeAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, MARK_WORD_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
298 linkForeignCall(r, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
299 linkForeignCall(r, CREATE_NULL_POINTER_EXCEPTION, c.createNullPointerExceptionAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
300 linkForeignCall(r, CREATE_OUT_OF_BOUNDS_EXCEPTION, c.createOutOfBoundsExceptionAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
301 linkForeignCall(r, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
302 linkForeignCall(r, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
303 linkForeignCall(r, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
304 linkForeignCall(r, DYNAMIC_NEW_ARRAY, c.dynamicNewArrayAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
305 linkForeignCall(r, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
306 linkForeignCall(r, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
307 linkForeignCall(r, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
308 linkForeignCall(r, THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, ANY_LOCATION); |
11249
7b416466e269
made VM_ERROR foreign call a leaf
Doug Simon <doug.simon@oracle.com>
parents:
11238
diff
changeset
|
309 linkForeignCall(r, VM_ERROR, c.vmErrorAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
10666
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
310 linkForeignCall(r, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, LEAF, NOT_REEXECUTABLE, NO_LOCATIONS); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
311 linkForeignCall(r, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
9808158cfeab
Allow foreign call stubs to be declared as leaf methods.
Roland Schatz <roland.schatz@oracle.com>
parents:
10662
diff
changeset
|
312 linkForeignCall(r, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
11221
8d4bd13c6983
Field renaming
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11216
diff
changeset
|
313 linkForeignCall(r, VALIDATE_OBJECT, c.validateObject, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); |
10953
97e282186b5b
Add heap sanity checker with premature hard crash for debugging write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10947
diff
changeset
|
314 |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
315 r.registerSubstitutions(ObjectSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
316 r.registerSubstitutions(SystemSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
317 r.registerSubstitutions(ThreadSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
318 r.registerSubstitutions(UnsafeSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
319 r.registerSubstitutions(ClassSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
320 r.registerSubstitutions(AESCryptSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
321 r.registerSubstitutions(CipherBlockChainingSubstitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
322 r.registerSubstitutions(CRC32Substitutions.class); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11457
diff
changeset
|
323 r.registerSubstitutions(ReflectionSubstitutions.class); |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8627
diff
changeset
|
324 |
11226
422b0e9b9aed
removed obsolete checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
10953
diff
changeset
|
325 checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(this, r, graalRuntime.getTarget()); |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
326 instanceofSnippets = new InstanceOfSnippets.Templates(this, r, graalRuntime.getTarget()); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
327 newObjectSnippets = new NewObjectSnippets.Templates(this, r, graalRuntime.getTarget()); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
328 monitorSnippets = new MonitorSnippets.Templates(this, r, graalRuntime.getTarget(), c.useFastLocking); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
329 writeBarrierSnippets = new WriteBarrierSnippets.Templates(this, r, graalRuntime.getTarget()); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
330 boxingSnippets = new BoxingSnippets.Templates(this, r, graalRuntime.getTarget()); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
331 exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(this, r, graalRuntime.getTarget()); |
10801
4bfbd4be6e7a
Replace custom graph building with snippet for unsafe load lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10798
diff
changeset
|
332 unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(this, r, graalRuntime.getTarget()); |
10436
8c8285e345cc
Later lowering of arraycopy.
Roland Schatz <roland.schatz@oracle.com>
parents:
10434
diff
changeset
|
333 |
8c8285e345cc
Later lowering of arraycopy.
Roland Schatz <roland.schatz@oracle.com>
parents:
10434
diff
changeset
|
334 r.registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(this, r, graalRuntime.getTarget())); |
9656
53cbcd9ff217
replaced IdentityHashCodeStub[Call] with use of RuntimeStubCall
Doug Simon <doug.simon@oracle.com>
parents:
9636
diff
changeset
|
335 } |
53cbcd9ff217
replaced IdentityHashCodeStub[Call] with use of RuntimeStubCall
Doug Simon <doug.simon@oracle.com>
parents:
9636
diff
changeset
|
336 |
5780
64257cbef60c
removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
5776
diff
changeset
|
337 public HotSpotGraalRuntime getGraalRuntime() { |
64257cbef60c
removed compile method from GraalCodeCacheProvider interface
Doug Simon <doug.simon@oracle.com>
parents:
5776
diff
changeset
|
338 return graalRuntime; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 |
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
|
341 /** |
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
|
342 * 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
|
343 */ |
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
|
344 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
|
345 |
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
|
346 /** |
11474
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
347 * Returns the register used by the runtime for maintaining the heap base address for compressed |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
348 * pointers. |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
349 */ |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
350 public abstract Register heapBaseRegister(); |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
351 |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
352 /** |
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
|
353 * 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
|
354 */ |
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
|
355 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
|
356 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 @Override |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
358 public String disassemble(CompilationResult compResult, InstalledCode installedCode) { |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
359 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
|
360 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
|
361 TargetDescription target = graalRuntime.getTarget(); |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
362 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
|
363 if (compResult != null) { |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
364 HexCodeFile.addAnnotations(hcf, compResult.getAnnotations()); |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
365 addExceptionHandlersComment(compResult, hcf); |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9694
diff
changeset
|
366 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
|
367 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
|
368 for (Infopoint infopoint : compResult.getInfopoints()) { |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8895
diff
changeset
|
369 if (infopoint instanceof Call) { |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8895
diff
changeset
|
370 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
|
371 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
|
372 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
|
373 } |
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
|
374 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
|
375 } else { |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8895
diff
changeset
|
376 if (infopoint.debugInfo != null) { |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8895
diff
changeset
|
377 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
|
378 } |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8895
diff
changeset
|
379 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
|
380 } |
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
|
381 } |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
382 for (DataPatch site : compResult.getDataReferences()) { |
10861
6872c61c1d3e
Fix null reference access when dumping raw data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
10850
diff
changeset
|
383 hcf.addOperandComment(site.pcOffset, "{" + site.getDataString() + "}"); |
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
|
384 } |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
385 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
|
386 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
|
387 } |
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
|
388 } |
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
|
389 return hcf.toEmbeddedString(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 |
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
|
392 /** |
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
|
393 * 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
|
394 */ |
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
|
395 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
|
396 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
|
397 for (Field f : fields) { |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
398 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
|
399 f.setAccessible(true); |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
400 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
|
401 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
|
402 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
|
403 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
|
404 } |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
405 } catch (Exception e) { |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
406 } |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
407 } |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
408 } |
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
|
409 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
|
410 } |
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
|
411 |
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
|
412 /** |
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
|
413 * 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
|
414 */ |
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
|
415 private static String getMarkName(Mark mark) { |
6462 | 416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 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
|
422 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
|
423 } |
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
|
424 } 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
|
425 } |
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
|
426 } |
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
|
427 } |
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
|
428 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
|
429 } |
333930100018
enhanced disassembly to decode stub addresses for runtime calls
Doug Simon <doug.simon@oracle.com>
parents:
5213
diff
changeset
|
430 |
9301
ba441e21796f
rename variable that reflected legacy type name
Doug Simon <doug.simon@oracle.com>
parents:
9232
diff
changeset
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 } |
4291
015c53fefd3a
Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4262
diff
changeset
|
440 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
|
441 } |
015c53fefd3a
Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4262
diff
changeset
|
442 } |
015c53fefd3a
Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4262
diff
changeset
|
443 |
015c53fefd3a
Use HexCodeFile for disassembly to avoid loading slow disassembler.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4262
diff
changeset
|
444 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
|
445 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
|
446 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
|
447 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 @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
|
450 public ResolvedJavaType lookupJavaType(Constant constant) { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7096
diff
changeset
|
451 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
|
452 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
|
453 } |
62818f156081
added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7001
diff
changeset
|
454 Object o = constant.asObject(); |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
455 return HotSpotResolvedObjectType.fromClass(o.getClass()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 @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
|
459 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
|
460 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
|
461 } |
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
|
462 |
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
|
463 @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
|
464 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
|
465 return x.equals(y); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 @Override |
7838
a063308816d9
Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7836
diff
changeset
|
469 public RegisterConfig lookupRegisterConfig() { |
9717
f8e0bf2c70e2
consolidated the two RegisterConfig instances for HotSpotRuntime into one
Doug Simon <doug.simon@oracle.com>
parents:
9694
diff
changeset
|
470 return regConfig; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 @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
|
474 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
|
475 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
|
476 } |
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
|
477 |
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
|
478 @Override |
11682
976ebd1973d1
The runtime might not always be able to report an array length
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11652
diff
changeset
|
479 public Integer lookupArrayLength(Constant array) { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7096
diff
changeset
|
480 if (array.getKind() != Kind.Object || array.isNull() || !array.asObject().getClass().isArray()) { |
11682
976ebd1973d1
The runtime might not always be able to report an array length
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11652
diff
changeset
|
481 return null; |
7015
62818f156081
added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7001
diff
changeset
|
482 } |
62818f156081
added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents:
7001
diff
changeset
|
483 return Array.getLength(array.asObject()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 |
11474
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
486 public boolean useCompressedOops() { |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
487 return config.useCompressedOops; |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
488 } |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
489 |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
490 public boolean useCompressedKlassPointers() { |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
491 return config.useCompressedKlassPointers; |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
492 } |
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
493 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 @Override |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5705
diff
changeset
|
495 public void lower(Node n, LoweringTool tool) { |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
496 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
|
497 Kind wordKind = graalRuntime.getTarget().wordKind; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 if (n instanceof ArrayLengthNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 ArrayLengthNode arrayLengthNode = (ArrayLengthNode) n; |
8543
354d729ae588
remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
8521
diff
changeset
|
500 ValueNode array = arrayLengthNode.array(); |
9850
6e0c6526334b
Add HeapInfo interface for write barriers and compressed oops support
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9823
diff
changeset
|
501 ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt(), |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
502 BarrierType.NONE, false)); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
503 tool.createNullCheckGuard(arrayLengthRead, array); |
8543
354d729ae588
remove SafeAccessNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
8521
diff
changeset
|
504 graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); |
5822
ec65d0d0c873
moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents:
5780
diff
changeset
|
505 } 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
|
506 Invoke invoke = (Invoke) n; |
6462 | 507 if (invoke.callTarget() instanceof MethodCallTargetNode) { |
10637
ba1fbbfac0cd
remove null check semantics from LoadHubNode (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10587
diff
changeset
|
508 |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9106
diff
changeset
|
509 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
|
510 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
|
511 ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0); |
10637
ba1fbbfac0cd
remove null check semantics from LoadHubNode (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10587
diff
changeset
|
512 GuardingNode receiverNullCheck = null; |
11265 | 513 if (!callTarget.isStatic() && receiver.stamp() instanceof ObjectStamp && !ObjectStamp.isObjectNonNull(receiver)) { |
10637
ba1fbbfac0cd
remove null check semantics from LoadHubNode (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10587
diff
changeset
|
514 receiverNullCheck = tool.createNullCheckGuard(invoke, receiver); |
5823
f238fe91dc7f
partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents:
5822
diff
changeset
|
515 } |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7278
diff
changeset
|
516 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
|
517 |
9147
07f05f2a8149
Remove methodCallTarget() method from the Invoke interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9106
diff
changeset
|
518 LoweredCallTargetNode loweredCallTarget = null; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9850
diff
changeset
|
519 if (callTarget.invokeKind() == InvokeKind.Virtual && InlineVTableStubs.getValue() && (AlwaysInlineVTableStubs.getValue() || 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
|
520 |
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
|
521 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
|
522 if (!hsMethod.getDeclaringClass().isInterface()) { |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9619
diff
changeset
|
523 if (hsMethod.isInVirtualMethodTable()) { |
9610
ae17e540c5d2
More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9608
diff
changeset
|
524 int vtableEntryOffset = hsMethod.vtableEntryOffset(); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
525 assert vtableEntryOffset > 0; |
11258
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
526 FloatingReadNode hub = createReadHub(graph, wordKind, receiver, receiverNullCheck); |
10637
ba1fbbfac0cd
remove null check semantics from LoadHubNode (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10587
diff
changeset
|
527 |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
528 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
|
529 // 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
|
530 // 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
|
531 // values. |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
532 ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
533 StampFactory.forKind(wordKind()), BarrierType.NONE, false)); |
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
|
534 |
9089
5ab06146e985
Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9027
diff
changeset
|
535 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
|
536 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
|
537 |
11258
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
538 graph.addBeforeFixed(invoke.asNode(), metaspaceMethod); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
539 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
|
540 } |
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
|
541 } |
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
|
542 } |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6404
diff
changeset
|
543 |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6404
diff
changeset
|
544 if (loweredCallTarget == null) { |
9089
5ab06146e985
Rename "node()" methods in interfaces to "asNode"
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9027
diff
changeset
|
545 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
|
546 callTarget.invokeKind())); |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6404
diff
changeset
|
547 } |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6404
diff
changeset
|
548 callTarget.replaceAndDelete(loweredCallTarget); |
5822
ec65d0d0c873
moved HIR lowering of Invokes into HotspotRuntime
Doug Simon <doug.simon@oracle.com>
parents:
5780
diff
changeset
|
549 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
550 } 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
|
551 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
|
552 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
|
553 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
|
554 assert loadField.kind() != Kind.Illegal; |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
555 BarrierType barrierType = getFieldLoadBarrierType(field); |
10496
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
556 ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp(), barrierType, (loadField.kind() == Kind.Object))); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
557 tool.createNullCheckGuard(memoryRead, object); |
8502
ff4fa8b0516e
-Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8501
diff
changeset
|
558 |
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
|
559 graph.replaceFixedWithFixed(loadField, memoryRead); |
8502
ff4fa8b0516e
-Create push patch
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8501
diff
changeset
|
560 |
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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
567 } else if (n instanceof StoreFieldNode) { |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
568 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
|
569 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
|
570 ValueNode object = storeField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : storeField.object(); |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
571 BarrierType barrierType = getFieldStoreBarrierType(storeField); |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
572 WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType, storeField.field().getKind() == Kind.Object)); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
573 tool.createNullCheckGuard(memoryWrite, object); |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
574 memoryWrite.setStateAfter(storeField.stateAfter()); |
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
575 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
|
576 FixedWithNextNode last = memoryWrite; |
8501
41fc46da946a
-More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8498
diff
changeset
|
577 FixedWithNextNode first = memoryWrite; |
41fc46da946a
-More fixes and passrate(fop)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8498
diff
changeset
|
578 |
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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 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
|
584 } |
591f8231aa82
removed XIR & LIR code for nodes that are completely lowered in HotspotRuntime.lower()
Doug Simon <doug.simon@oracle.com>
parents:
5160
diff
changeset
|
585 } 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
|
586 // 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
|
587 CompareAndSwapNode cas = (CompareAndSwapNode) n; |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
588 LocationNode location = IndexedLocationNode.create(ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1); |
10850
e7679ec4f27f
Lower CAS nodes to their lowered versions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10838
diff
changeset
|
589 LoweredCompareAndSwapNode atomicNode = graph.add(new LoweredCompareAndSwapNode(cas.object(), location, cas.expected(), cas.newValue(), getCompareAndSwapBarrier(cas), |
e7679ec4f27f
Lower CAS nodes to their lowered versions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10838
diff
changeset
|
590 cas.expected().kind() == Kind.Object)); |
11215
113a303da13b
Set stateAfter in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10953
diff
changeset
|
591 atomicNode.setStateAfter(cas.stateAfter()); |
10850
e7679ec4f27f
Lower CAS nodes to their lowered versions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10838
diff
changeset
|
592 graph.replaceFixedWithFixed(cas, atomicNode); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 } else if (n instanceof LoadIndexedNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 LoadIndexedNode loadIndexed = (LoadIndexedNode) n; |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
595 GuardingNode boundsCheck = createBoundsCheck(loadIndexed, tool); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
596 Kind elementKind = loadIndexed.elementKind(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 LocationNode arrayLocation = createArrayLocation(graph, elementKind, loadIndexed.index()); |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
598 ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp(), BarrierType.NONE, elementKind == Kind.Object)); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
599 memoryRead.setGuard(boundsCheck); |
4305
0768bf0a4898
move part of the cfg-modifying operations into one place (currently: StructuredGraph)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4262
diff
changeset
|
600 graph.replaceFixedWithFixed(loadIndexed, memoryRead); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
601 } else if (n instanceof StoreIndexedNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
602 StoreIndexedNode storeIndexed = (StoreIndexedNode) n; |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
603 GuardingNode boundsCheck = createBoundsCheck(storeIndexed, tool); |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
604 Kind elementKind = storeIndexed.elementKind(); |
8521
6aa080855d7c
-Bug fixes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8517
diff
changeset
|
605 LocationNode arrayLocation = createArrayLocation(graph, elementKind, storeIndexed.index()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
606 ValueNode value = storeIndexed.value(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
607 ValueNode array = storeIndexed.array(); |
11265 | 608 if (elementKind == Kind.Object && !ObjectStamp.isObjectAlwaysNull(value)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
609 // Store check! |
11265 | 610 ResolvedJavaType arrayType = ObjectStamp.typeOrNull(array); |
611 if (arrayType != null && ObjectStamp.isExactType(array)) { | |
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
|
612 ResolvedJavaType elementType = arrayType.getComponentType(); |
7096
585fc9f79ebc
Remove ResolvedJavaType.isClass()
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7090
diff
changeset
|
613 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
|
614 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
|
615 graph.addBeforeFixed(storeIndexed, checkcast); |
4485e0edd1af
made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents:
5360
diff
changeset
|
616 value = checkcast; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
617 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
618 } else { |
11652
f091e0d6f4f3
Disallow add for global value numberable node types. Introduce addWithoutUnique.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11626
diff
changeset
|
619 LoadHubNode arrayClass = graph.unique(new LoadHubNode(array, wordKind, boundsCheck.asNode())); |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
620 LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph); |
11225
038a598da996
fix lowering of StoreIndexedNode (anchor read of element klass)
Lukas Stadler <lukas.stadler@jku.at>
parents:
11223
diff
changeset
|
621 /* |
038a598da996
fix lowering of StoreIndexedNode (anchor read of element klass)
Lukas Stadler <lukas.stadler@jku.at>
parents:
11223
diff
changeset
|
622 * Anchor the read of the element klass to the cfg, because it is only valid |
038a598da996
fix lowering of StoreIndexedNode (anchor read of element klass)
Lukas Stadler <lukas.stadler@jku.at>
parents:
11223
diff
changeset
|
623 * when arrayClass is an object class, which might not be the case in other |
038a598da996
fix lowering of StoreIndexedNode (anchor read of element klass)
Lukas Stadler <lukas.stadler@jku.at>
parents:
11223
diff
changeset
|
624 * parts of the compiled method. |
038a598da996
fix lowering of StoreIndexedNode (anchor read of element klass)
Lukas Stadler <lukas.stadler@jku.at>
parents:
11223
diff
changeset
|
625 */ |
11370
ece2cee9f85f
FloatingReadNode: don't use lastLocationAccess as anchor. use guard instead.
Bernhard Urban <bernhard.urban@jku.at>
parents:
11326
diff
changeset
|
626 FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind()), BeginNode.prevBegin(storeIndexed))); |
9478
fb22b4d5f475
Allow distinction between ClassCastException and ArrayStoreException. Add more canonicalizations for check casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9460
diff
changeset
|
627 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
|
628 graph.addBeforeFixed(storeIndexed, checkcast); |
4485e0edd1af
made CheckCastNode be a FixedNode instead of a BooleanNode
Doug Simon <doug.simon@oracle.com>
parents:
5360
diff
changeset
|
629 value = checkcast; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
630 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
631 } |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
632 BarrierType barrierType = getArrayStoreBarrierType(storeIndexed); |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
633 WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType, elementKind == Kind.Object)); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
634 memoryWrite.setGuard(boundsCheck); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
635 memoryWrite.setStateAfter(storeIndexed.stateAfter()); |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
636 graph.replaceFixedWithFixed(storeIndexed, memoryWrite); |
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4305
diff
changeset
|
637 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
638 } else if (n instanceof UnsafeLoadNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
639 if (graph.getGuardsPhase().ordinal() > StructuredGraph.GuardsStage.FLOATING_GUARDS.ordinal()) { |
10947
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
640 UnsafeLoadNode load = (UnsafeLoadNode) n; |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
641 assert load.kind() != Kind.Illegal; |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
642 boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11577
diff
changeset
|
643 if (addReadBarrier(load)) { |
10947
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
644 unsafeLoadSnippets.lower(load, tool); |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
645 } else { |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
646 IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
647 ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), BarrierType.NONE, compressible)); |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
648 // An unsafe read must not float outside its block otherwise |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
649 // it may float above an explicit null check on its object. |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
650 memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
651 graph.replaceFixedWithFixed(load, memoryRead); |
e8dac30e274d
Allow unsafeLoad lowering only when loweringType!=BEFORE_GUARDS
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10946
diff
changeset
|
652 } |
10801
4bfbd4be6e7a
Replace custom graph building with snippet for unsafe load lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10798
diff
changeset
|
653 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
654 } else if (n instanceof UnsafeStoreNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
655 UnsafeStoreNode store = (UnsafeStoreNode) n; |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
656 IndexedLocationNode location = IndexedLocationNode.create(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
|
657 ValueNode object = store.object(); |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
658 BarrierType barrierType = getUnsafeStoreBarrierType(store); |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
659 WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType, store.value().kind() == Kind.Object)); |
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
|
660 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
|
661 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
|
662 } 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
|
663 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
|
664 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
|
665 ValueNode object = loadHub.object(); |
11258
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
666 GuardingNode guard = loadHub.getGuard(); |
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
667 FloatingReadNode hub = createReadHub(graph, wordKind, object, guard); |
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
668 graph.replaceFloating(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
|
669 } 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
|
670 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
|
671 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
|
672 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
|
673 graph.replaceFixed(loadMethodNode, metaspaceMethod); |
10733
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
674 } else if (n instanceof StoreHubNode) { |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
675 StoreHubNode storeHub = (StoreHubNode) n; |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
676 WriteNode hub = createWriteHub(graph, wordKind, storeHub.getObject(), storeHub.getValue()); |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
677 graph.replaceFixed(storeHub, hub); |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
678 } else if (n instanceof CommitAllocationNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
679 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
680 CommitAllocationNode commit = (CommitAllocationNode) n; |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
681 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
682 ValueNode[] allocations = new ValueNode[commit.getVirtualObjects().size()]; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
683 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
684 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
685 int entryCount = virtual.entryCount(); |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
686 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
687 FixedWithNextNode newObject; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
688 if (virtual instanceof VirtualInstanceNode) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
689 newObject = graph.add(new NewInstanceNode(virtual.type(), true)); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
690 } else { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
691 ResolvedJavaType element = ((VirtualArrayNode) virtual).componentType(); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
692 newObject = graph.add(new NewArrayNode(element, ConstantNode.forInt(entryCount, graph), true)); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
693 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
694 graph.addBeforeFixed(commit, newObject); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
695 allocations[objIndex] = newObject; |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
696 } |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
697 int valuePos = 0; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
698 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
699 VirtualObjectNode virtual = commit.getVirtualObjects().get(objIndex); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
700 int entryCount = virtual.entryCount(); |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
701 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
702 ValueNode newObject = allocations[objIndex]; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
703 if (virtual instanceof VirtualInstanceNode) { |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
10638
diff
changeset
|
704 VirtualInstanceNode virtualInstance = (VirtualInstanceNode) virtual; |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
705 for (int i = 0; i < entryCount; i++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
706 ValueNode value = commit.getValues().get(valuePos++); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
707 if (value instanceof VirtualObjectNode) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
708 value = allocations[commit.getVirtualObjects().indexOf(value)]; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
709 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
710 if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { |
11315
dbcdae5ae741
Add write barriers in lowering of CommitAllocationNode.
Andreas Woess <andreas.woess@jku.at>
parents:
11300
diff
changeset
|
711 WriteNode write = new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) virtualInstance.field(i)), |
dbcdae5ae741
Add write barriers in lowering of CommitAllocationNode.
Andreas Woess <andreas.woess@jku.at>
parents:
11300
diff
changeset
|
712 virtualInstance.field(i).getKind() == Kind.Object ? BarrierType.IMPRECISE : BarrierType.NONE, virtualInstance.field(i).getKind() == Kind.Object); |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
713 |
9896 | 714 graph.addBeforeFixed(commit, graph.add(write)); |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
715 } |
9687
a7376cc486ff
don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
9676
diff
changeset
|
716 } |
9896 | 717 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
718 } else { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
719 VirtualArrayNode array = (VirtualArrayNode) virtual; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
720 ResolvedJavaType element = array.componentType(); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
721 for (int i = 0; i < entryCount; i++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
722 ValueNode value = commit.getValues().get(valuePos++); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
723 if (value instanceof VirtualObjectNode) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
724 int indexOf = commit.getVirtualObjects().indexOf(value); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
725 assert indexOf != -1 : commit + " " + value; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
726 value = allocations[indexOf]; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
727 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
728 if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { |
11315
dbcdae5ae741
Add write barriers in lowering of CommitAllocationNode.
Andreas Woess <andreas.woess@jku.at>
parents:
11300
diff
changeset
|
729 WriteNode write = new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), |
dbcdae5ae741
Add write barriers in lowering of CommitAllocationNode.
Andreas Woess <andreas.woess@jku.at>
parents:
11300
diff
changeset
|
730 value.kind() == Kind.Object ? BarrierType.PRECISE : BarrierType.NONE, value.kind() == Kind.Object); |
9896 | 731 graph.addBeforeFixed(commit, graph.add(write)); |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
732 } |
9687
a7376cc486ff
don't overwrite default entries when lowering CommitAllocationNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
9676
diff
changeset
|
733 } |
9501
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
734 } |
bef43373de39
coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents:
9500
diff
changeset
|
735 } |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
736 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
737 FixedValueAnchorNode anchor = graph.add(new FixedValueAnchorNode(allocations[objIndex])); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
738 allocations[objIndex] = anchor; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
739 graph.addBeforeFixed(commit, anchor); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
740 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
741 for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
742 for (int lockDepth : commit.getLocks().get(objIndex)) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
743 MonitorEnterNode enter = graph.add(new MonitorEnterNode(allocations[objIndex], lockDepth)); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
744 graph.addBeforeFixed(commit, enter); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
745 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
746 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
747 for (Node usage : commit.usages().snapshot()) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
748 AllocatedObjectNode addObject = (AllocatedObjectNode) usage; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
749 int index = commit.getVirtualObjects().indexOf(addObject.getVirtualObject()); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
750 graph.replaceFloating(addObject, allocations[index]); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
751 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
752 graph.removeFixed(commit); |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9502
diff
changeset
|
753 } |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
754 } else if (n instanceof OSRStartNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
755 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
756 OSRStartNode osrStart = (OSRStartNode) n; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
757 StartNode newStart = graph.add(new StartNode()); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
758 LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind()))); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
759 ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(this, OSR_MIGRATION_END, buffer)); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
760 migrationEnd.setStateAfter(osrStart.stateAfter()); |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
761 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
762 newStart.setNext(migrationEnd); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
763 FixedNode next = osrStart.next(); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
764 osrStart.setNext(null); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
765 migrationEnd.setNext(next); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
766 graph.setStart(newStart); |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
767 |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
768 // mirroring the calculations in c1_GraphBuilder.cpp (setup_osr_entry_block) |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
769 int localsOffset = (graph.method().getMaxLocals() - 1) * 8; |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
770 for (OSRLocalNode osrLocal : graph.getNodes(OSRLocalNode.class)) { |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
771 int size = FrameStateBuilder.stackSlots(osrLocal.kind()); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
772 int offset = localsOffset - (osrLocal.index() + size - 1) * 8; |
9896 | 773 IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, osrLocal.kind(), offset, ConstantNode.forLong(0, graph), graph, 1); |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
774 ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), BarrierType.NONE, false)); |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
775 osrLocal.replaceAndDelete(load); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
776 graph.addBeforeFixed(migrationEnd, load); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
777 } |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
778 osrStart.replaceAtUsages(newStart); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
779 osrStart.safeDelete(); |
9532
8f854c4deabf
Delay lowering of the platform specific OSR entry
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9504
diff
changeset
|
780 } |
6648
7bf5a6c42db7
factored CheckCastDynamicNode out of CheckCastNode
Doug Simon <doug.simon@oracle.com>
parents:
6582
diff
changeset
|
781 } else if (n instanceof CheckCastDynamicNode) { |
11226
422b0e9b9aed
removed obsolete checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
10953
diff
changeset
|
782 checkcastDynamicSnippets.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
|
783 } else if (n instanceof InstanceOfNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
784 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
11300
ee5ef0e132ce
made instanceof lowering happen after guard lowering
Doug Simon <doug.simon@oracle.com>
parents:
11265
diff
changeset
|
785 instanceofSnippets.lower((InstanceOfNode) n, tool); |
ee5ef0e132ce
made instanceof lowering happen after guard lowering
Doug Simon <doug.simon@oracle.com>
parents:
11265
diff
changeset
|
786 } |
7278
346336325337
added intrinsification of Class.isInstance()
Doug Simon <doug.simon@oracle.com>
parents:
7235
diff
changeset
|
787 } else if (n instanceof InstanceOfDynamicNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
788 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
11300
ee5ef0e132ce
made instanceof lowering happen after guard lowering
Doug Simon <doug.simon@oracle.com>
parents:
11265
diff
changeset
|
789 instanceofSnippets.lower((InstanceOfDynamicNode) n, tool); |
ee5ef0e132ce
made instanceof lowering happen after guard lowering
Doug Simon <doug.simon@oracle.com>
parents:
11265
diff
changeset
|
790 } |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
5554
diff
changeset
|
791 } else if (n instanceof NewInstanceNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
792 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.AFTER_FSA) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
793 newObjectSnippets.lower((NewInstanceNode) n); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
794 } |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5728
diff
changeset
|
795 } else if (n instanceof NewArrayNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
796 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.AFTER_FSA) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
797 newObjectSnippets.lower((NewArrayNode) n); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
798 } |
10027
e561e0a6f727
DynamicNewArrayNode
Roland Schatz <roland.schatz@oracle.com>
parents:
10020
diff
changeset
|
799 } else if (n instanceof DynamicNewArrayNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
800 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.AFTER_FSA) { |
10027
e561e0a6f727
DynamicNewArrayNode
Roland Schatz <roland.schatz@oracle.com>
parents:
10020
diff
changeset
|
801 newObjectSnippets.lower((DynamicNewArrayNode) n); |
e561e0a6f727
DynamicNewArrayNode
Roland Schatz <roland.schatz@oracle.com>
parents:
10020
diff
changeset
|
802 } |
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
|
803 } else if (n instanceof MonitorEnterNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
804 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
805 monitorSnippets.lower((MonitorEnterNode) n, tool); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
806 } |
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
|
807 } else if (n instanceof MonitorExitNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
808 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
809 monitorSnippets.lower((MonitorExitNode) n, tool); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
810 } |
10499
cbeafa74236c
Add G1 Barriers during lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10496
diff
changeset
|
811 } else if (n instanceof G1PreWriteBarrier) { |
cbeafa74236c
Add G1 Barriers during lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10496
diff
changeset
|
812 writeBarrierSnippets.lower((G1PreWriteBarrier) n, tool); |
cbeafa74236c
Add G1 Barriers during lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10496
diff
changeset
|
813 } else if (n instanceof G1PostWriteBarrier) { |
cbeafa74236c
Add G1 Barriers during lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10496
diff
changeset
|
814 writeBarrierSnippets.lower((G1PostWriteBarrier) n, tool); |
10829
761002c55728
Add new node for referent field read barrier (G1 GC)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10828
diff
changeset
|
815 } else if (n instanceof G1ReferentFieldReadBarrier) { |
761002c55728
Add new node for referent field read barrier (G1 GC)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10828
diff
changeset
|
816 writeBarrierSnippets.lower((G1ReferentFieldReadBarrier) n, tool); |
8905
c502db57e687
Rename ArrayWriteBarrier to SerialWriteBarrier and move it to graal.nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8904
diff
changeset
|
817 } 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
|
818 writeBarrierSnippets.lower((SerialWriteBarrier) n, tool); |
8963
63eae4723b18
Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8935
diff
changeset
|
819 } else if (n instanceof SerialArrayRangeWriteBarrier) { |
63eae4723b18
Creation of snippets for ArrayCopy write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8935
diff
changeset
|
820 writeBarrierSnippets.lower((SerialArrayRangeWriteBarrier) n, tool); |
10555
9210083b253f
Lower G1 Array Range Barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10545
diff
changeset
|
821 } else if (n instanceof G1ArrayRangePreWriteBarrier) { |
9210083b253f
Lower G1 Array Range Barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10545
diff
changeset
|
822 writeBarrierSnippets.lower((G1ArrayRangePreWriteBarrier) n, tool); |
9210083b253f
Lower G1 Array Range Barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10545
diff
changeset
|
823 } else if (n instanceof G1ArrayRangePostWriteBarrier) { |
9210083b253f
Lower G1 Array Range Barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10545
diff
changeset
|
824 writeBarrierSnippets.lower((G1ArrayRangePostWriteBarrier) n, tool); |
6431
2e376f8ea4e2
added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents:
6409
diff
changeset
|
825 } else if (n instanceof NewMultiArrayNode) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
826 if (graph.getGuardsPhase() == StructuredGraph.GuardsStage.AFTER_FSA) { |
9880
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
827 newObjectSnippets.lower((NewMultiArrayNode) n); |
f7ec3ec8a03c
HotSpotRuntime should decide when to lower which nodes, not the nodes themselves
Lukas Stadler <lukas.stadler@jku.at>
parents:
9870
diff
changeset
|
828 } |
8643
3d2c2b68fe93
lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents:
8642
diff
changeset
|
829 } else if (n instanceof LoadExceptionObjectNode) { |
3d2c2b68fe93
lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents:
8642
diff
changeset
|
830 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
|
831 } 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
|
832 // 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
|
833 // zero and the MIN_VALUE / -1 cases. |
9016
60b9fe7034e6
Allow lowering of DeoptimizeNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9015
diff
changeset
|
834 } 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
|
835 // 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
|
836 } else if (n instanceof BoxNode) { |
10569
6b9ebfcf5fc5
make BoxNode and UnboxNode floating
Lukas Stadler <lukas.stadler@jku.at>
parents:
10561
diff
changeset
|
837 boxingSnippets.lower((BoxNode) n, tool); |
8913
653110156f8a
refactored boxing identification and lowering, removed BoxingMethodPool and explicit boxing phases
Lukas Stadler <lukas.stadler@jku.at>
parents:
8627
diff
changeset
|
838 } else if (n instanceof UnboxNode) { |
10569
6b9ebfcf5fc5
make BoxNode and UnboxNode floating
Lukas Stadler <lukas.stadler@jku.at>
parents:
10561
diff
changeset
|
839 boxingSnippets.lower((UnboxNode) n, tool); |
5241
e24167877471
conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
840 } else { |
e24167877471
conditional support for translating ExceptionObjectNode without XIR
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
841 assert false : "Node implementing Lowerable not handled: " + n; |
7076 | 842 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
843 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
844 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
845 |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11577
diff
changeset
|
846 private static boolean addReadBarrier(UnsafeLoadNode load) { |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
847 if (useG1GC() && load.graph().getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS && load.object().kind() == Kind.Object && load.accessKind() == Kind.Object && |
11454
ea7a15d708a8
Allow conditional unsafe load lowering only AFTER_GUARDS (emmit G1 Ref barrier)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11370
diff
changeset
|
848 !ObjectStamp.isObjectAlwaysNull(load.object())) { |
ea7a15d708a8
Allow conditional unsafe load lowering only AFTER_GUARDS (emmit G1 Ref barrier)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11370
diff
changeset
|
849 ResolvedJavaType type = ObjectStamp.typeOrNull(load.object()); |
ea7a15d708a8
Allow conditional unsafe load lowering only AFTER_GUARDS (emmit G1 Ref barrier)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11370
diff
changeset
|
850 if (type != null && !type.isArray()) { |
ea7a15d708a8
Allow conditional unsafe load lowering only AFTER_GUARDS (emmit G1 Ref barrier)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11370
diff
changeset
|
851 return true; |
11265 | 852 } |
853 } | |
854 return false; | |
10801
4bfbd4be6e7a
Replace custom graph building with snippet for unsafe load lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10798
diff
changeset
|
855 } |
4bfbd4be6e7a
Replace custom graph building with snippet for unsafe load lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10798
diff
changeset
|
856 |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
857 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
|
858 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
|
859 assert !hsMethod.getDeclaringClass().isInterface(); |
9636
ff4e8218d3dd
Remove hasVtableEntry, use isInVirtualMethodTable instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9619
diff
changeset
|
860 assert hsMethod.isInVirtualMethodTable(); |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
861 |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
862 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
|
863 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
|
864 // 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
|
865 // entry as HotSpot does not guarantee that this is a final value. |
10829
761002c55728
Add new node for referent field read barrier (G1 GC)
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10828
diff
changeset
|
866 ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()), BarrierType.NONE, false)); |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
867 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
|
868 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
869 |
11258
56f1aa40e13b
made LoadHubNode be floating
Doug Simon <doug.simon@oracle.com>
parents:
11249
diff
changeset
|
870 private FloatingReadNode createReadHub(StructuredGraph graph, Kind wordKind, ValueNode object, GuardingNode guard) { |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
871 LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
872 assert !object.isConstant() || object.asConstant().isNull(); |
11652
f091e0d6f4f3
Disallow add for global value numberable node types. Introduce addWithoutUnique.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11626
diff
changeset
|
873 return graph.unique(new FloatingReadNode(object, location, null, StampFactory.forKind(wordKind()), guard, BarrierType.NONE, useCompressedKlassPointers())); |
9380
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
874 } |
ee8cd087a731
Dispatch based on method instead of type if it seems more beneficial.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9377
diff
changeset
|
875 |
10733
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
876 private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
877 LocationNode location = ConstantLocationNode.create(ANY_LOCATION, wordKind, config.hubOffset, graph); |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
878 assert !object.isConstant() || object.asConstant().isNull(); |
11474
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
879 return graph.add(new WriteNode(object, value, location, BarrierType.NONE, useCompressedKlassPointers())); |
10733
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
880 } |
6621bc66bfa4
Add WriteHubNode lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10715
diff
changeset
|
881 |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
882 private static BarrierType getFieldLoadBarrierType(HotSpotResolvedJavaField loadField) { |
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
883 BarrierType barrierType = BarrierType.NONE; |
10496
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
884 if (config().useG1GC && loadField.getKind() == Kind.Object && loadField.getDeclaringClass().mirror() == java.lang.ref.Reference.class && loadField.getName().equals("referent")) { |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
885 barrierType = BarrierType.PRECISE; |
10496
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
886 } |
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
887 return barrierType; |
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
888 } |
d18fbe96ba76
Attach G1 Pre barrier to load field of referent field
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10436
diff
changeset
|
889 |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
890 private static BarrierType getFieldStoreBarrierType(StoreFieldNode storeField) { |
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
891 BarrierType barrierType = BarrierType.NONE; |
10945
a03d31fa01d9
Writes with always null stamps omit only post barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10873
diff
changeset
|
892 if (storeField.field().getKind() == Kind.Object) { |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
893 barrierType = BarrierType.IMPRECISE; |
9105
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
894 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
895 return barrierType; |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
896 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
897 |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
898 private static BarrierType getArrayStoreBarrierType(StoreIndexedNode store) { |
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
899 BarrierType barrierType = BarrierType.NONE; |
10945
a03d31fa01d9
Writes with always null stamps omit only post barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10873
diff
changeset
|
900 if (store.elementKind() == Kind.Object) { |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
901 barrierType = BarrierType.PRECISE; |
9105
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
902 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
903 return barrierType; |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
904 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
905 |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
906 private static BarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) { |
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
907 BarrierType barrierType = BarrierType.NONE; |
10945
a03d31fa01d9
Writes with always null stamps omit only post barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10873
diff
changeset
|
908 if (store.value().kind() == Kind.Object) { |
11265 | 909 ResolvedJavaType type = ObjectStamp.typeOrNull(store.object()); |
10946
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
910 if (type != null && !type.isArray()) { |
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
911 barrierType = BarrierType.IMPRECISE; |
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
912 } else { |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
913 barrierType = BarrierType.PRECISE; |
9105
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
914 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
915 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
916 return barrierType; |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
917 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
918 |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
919 private static BarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) { |
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
920 BarrierType barrierType = BarrierType.NONE; |
10945
a03d31fa01d9
Writes with always null stamps omit only post barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10873
diff
changeset
|
921 if (cas.expected().kind() == Kind.Object) { |
11265 | 922 ResolvedJavaType type = ObjectStamp.typeOrNull(cas.object()); |
10946
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
923 if (type != null && !type.isArray()) { |
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
924 barrierType = BarrierType.IMPRECISE; |
0d6d064cd80c
Always use precise barriers when type==null
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10945
diff
changeset
|
925 } else { |
10828
b05e1ff3aac0
Rename WriteBarrierType to BarrierType
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10821
diff
changeset
|
926 barrierType = BarrierType.PRECISE; |
9105
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
927 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
928 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
929 return barrierType; |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
930 } |
2cae919cd3af
Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8980
diff
changeset
|
931 |
9608
7a330743a452
change visibility of createFieldLocation/createArrayLocation
Lukas Stadler <lukas.stadler@jku.at>
parents:
9605
diff
changeset
|
932 protected static ConstantLocationNode createFieldLocation(StructuredGraph graph, HotSpotResolvedJavaField field) { |
9500
9cc37ce426cc
factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents:
9491
diff
changeset
|
933 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
|
934 } |
9cc37ce426cc
factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents:
9491
diff
changeset
|
935 |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
936 public int getScalingFactor(Kind kind) { |
11474
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
937 if (useCompressedOops() && kind == Kind.Object) { |
9888
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
938 return this.graalRuntime.getTarget().arch.getSizeInBytes(Kind.Int); |
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
939 } else { |
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
940 return this.graalRuntime.getTarget().arch.getSizeInBytes(kind); |
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
941 } |
3d658d3b56f5
Attach compress info to Load/Store nodes
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9884
diff
changeset
|
942 } |
9500
9cc37ce426cc
factor out createFieldLocation in HotSpotRuntime
Lukas Stadler <lukas.stadler@jku.at>
parents:
9491
diff
changeset
|
943 |
9608
7a330743a452
change visibility of createFieldLocation/createArrayLocation
Lukas Stadler <lukas.stadler@jku.at>
parents:
9605
diff
changeset
|
944 protected IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) { |
9884
cecd40916b06
Add scaling factor for arrays
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9850
diff
changeset
|
945 int scale = getScalingFactor(elementKind); |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
9773
diff
changeset
|
946 return IndexedLocationNode.create(NamedLocationIdentity.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
|
947 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
948 |
10835
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
949 @Override |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
950 public ValueNode reconstructArrayIndex(LocationNode location) { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
951 Kind elementKind = location.getValueKind(); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
952 assert location.getLocationIdentity().equals(NamedLocationIdentity.getArrayLocation(elementKind)); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
953 |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
954 long base; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
955 ValueNode index; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
956 int scale = getScalingFactor(elementKind); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
957 |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
958 if (location instanceof ConstantLocationNode) { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
959 base = ((ConstantLocationNode) location).getDisplacement(); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
960 index = null; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
961 } else if (location instanceof IndexedLocationNode) { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
962 IndexedLocationNode indexedLocation = (IndexedLocationNode) location; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
963 assert indexedLocation.getIndexScaling() == scale; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
964 base = indexedLocation.getDisplacement(); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
965 index = indexedLocation.getIndex(); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
966 } else { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
967 throw GraalInternalError.shouldNotReachHere(); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
968 } |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
969 |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
970 base -= getArrayBaseOffset(elementKind); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
971 assert base >= 0 && base % scale == 0; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
972 |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
973 base /= scale; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
974 assert NumUtil.isInt(base); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
975 |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
976 if (index == null) { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
977 return ConstantNode.forInt((int) base, location.graph()); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
978 } else { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
979 if (base == 0) { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
980 return index; |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
981 } else { |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
982 return IntegerArithmeticNode.add(ConstantNode.forInt((int) base, location.graph()), index); |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
983 } |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
984 } |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
985 } |
04f817fb0456
Method to reconstruct array index from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10829
diff
changeset
|
986 |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
987 private static GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { |
9602
19c5a07c7843
Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9595
diff
changeset
|
988 StructuredGraph graph = n.graph(); |
5415
79f12805362b
Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5401
diff
changeset
|
989 ArrayLengthNode arrayLength = graph.add(new ArrayLengthNode(n.array())); |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9636
diff
changeset
|
990 GuardingNode guard = tool.createGuard(graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); |
5401
332a3c0d7b3b
remove array length input from LoadIndexedNode and StoreIndexedNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5400
diff
changeset
|
991 |
5415
79f12805362b
Use iterative lowering instead of manually applying lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5401
diff
changeset
|
992 graph.addBeforeFixed(n, arrayLength); |
5401
332a3c0d7b3b
remove array length input from LoadIndexedNode and StoreIndexedNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5400
diff
changeset
|
993 return guard; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
994 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
995 |
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
|
996 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
|
997 return HotSpotResolvedObjectType.fromClass(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
998 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
999 |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
1000 public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) { |
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
1001 HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor); |
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
1002 assert foreignCalls != null : descriptor; |
8627
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8587
diff
changeset
|
1003 callTarget.finalizeAddress(graalRuntime.getBackend()); |
75db7afee829
implemented lazy installation of replacements (GRAAL-137)
Doug Simon <doug.simon@oracle.com>
parents:
8587
diff
changeset
|
1004 return callTarget; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1005 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1006 |
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
|
1007 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
|
1008 CompilerToVM c2vm = graalRuntime.getCompilerToVM(); |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
1009 HotSpotResolvedObjectType[] resultHolder = {null}; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
1010 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
|
1011 assert metaspaceMethod != 0L; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6699
diff
changeset
|
1012 return resultHolder[0].createMethod(metaspaceMethod); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1013 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1014 |
7044
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1015 public ResolvedJavaMethod lookupJavaConstructor(Constructor reflectionConstructor) { |
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1016 CompilerToVM c2vm = graalRuntime.getCompilerToVM(); |
7084
9ba90252ce08
HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7083
diff
changeset
|
1017 HotSpotResolvedObjectType[] resultHolder = {null}; |
7044
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1018 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
|
1019 assert metaspaceMethod != 0L; |
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1020 return resultHolder[0].createMethod(metaspaceMethod); |
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1021 } |
34753b057324
added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
7034
diff
changeset
|
1022 |
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
|
1023 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
|
1024 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
|
1025 } |
45f682f7fea8
Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6431
diff
changeset
|
1026 |
10019
6e4b72bcc97f
Remove graph from HotSpotNMethod
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9983
diff
changeset
|
1027 public HotSpotInstalledCode installMethod(HotSpotResolvedJavaMethod method, int entryBCI, CompilationResult compResult) { |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1028 HotSpotInstalledCode installedCode = new HotSpotNmethod(method, true, null); |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9668
diff
changeset
|
1029 graalRuntime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, entryBCI, compResult), installedCode, method.getSpeculationLog()); |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
1030 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
|
1031 } |
6cc970203f30
moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
1032 |
6cc970203f30
moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents:
5323
diff
changeset
|
1033 @Override |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8217
diff
changeset
|
1034 public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1035 return addMethod(method, compResult, null); |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1036 } |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1037 |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1038 @Override |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1039 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
|
1040 HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method; |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10029
diff
changeset
|
1041 HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, false, graph); |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9668
diff
changeset
|
1042 CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(hotspotMethod, -1, compResult), code, null); |
7113
38076efb9062
Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7104
diff
changeset
|
1043 if (result != CodeInstallResult.OK) { |
38076efb9062
Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7104
diff
changeset
|
1044 return null; |
38076efb9062
Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7104
diff
changeset
|
1045 } |
38076efb9062
Do not print code installation failures from Java.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7104
diff
changeset
|
1046 return code; |
4319
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4312
diff
changeset
|
1047 } |
3c21eee8ab4d
Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents:
4312
diff
changeset
|
1048 |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1049 public InstalledCode addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult, Graph graph) { |
10581
63d0eaa9b25d
PTX checkstyle nits
Morris Meyer <morris.meyer@oracle.com>
parents:
10577
diff
changeset
|
1050 |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1051 // compResult.getTargetCode() == assembled PTX method string |
10581
63d0eaa9b25d
PTX checkstyle nits
Morris Meyer <morris.meyer@oracle.com>
parents:
10577
diff
changeset
|
1052 |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1053 HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1054 HotSpotInstalledCode icode = new HotSpotNmethod(javaMethod, false, true, graph); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1055 HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, -1, compResult); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1056 CompilerToVM vm = graalRuntime.getCompilerToVM(); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1057 CodeInstallResult result = vm.installCode(compiled, icode, null); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1058 if (result != CodeInstallResult.OK) { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1059 return null; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1060 } |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1061 return icode; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1062 } |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10569
diff
changeset
|
1063 |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4696
diff
changeset
|
1064 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
1065 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
|
1066 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
|
1067 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
|
1068 |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5110
diff
changeset
|
1069 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
|
1070 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
|
1071 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
|
1072 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5110
diff
changeset
|
1073 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
1074 public int convertDeoptAction(DeoptimizationAction action) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1075 switch (action) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1076 case None: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1077 return config.deoptActionNone; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1078 case RecompileIfTooManyDeopts: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1079 return config.deoptActionMaybeRecompile; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1080 case InvalidateReprofile: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1081 return config.deoptActionReinterpret; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1082 case InvalidateRecompile: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1083 return config.deoptActionMakeNotEntrant; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1084 case InvalidateStopCompiling: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1085 return config.deoptActionMakeNotCompilable; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1086 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1087 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
|
1088 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5110
diff
changeset
|
1089 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5110
diff
changeset
|
1090 |
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
|
1091 public int convertDeoptReason(DeoptimizationReason reason) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1092 switch (reason) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1093 case None: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1094 return config.deoptReasonNone; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1095 case NullCheckException: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1096 return config.deoptReasonNullCheck; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1097 case BoundsCheckException: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1098 return config.deoptReasonRangeCheck; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1099 case ClassCastException: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1100 return config.deoptReasonClassCheck; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1101 case ArrayStoreException: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1102 return config.deoptReasonArrayCheck; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1103 case UnreachedCode: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1104 return config.deoptReasonUnreached0; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1105 case TypeCheckedInliningViolated: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1106 return config.deoptReasonTypeCheckInlining; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1107 case OptimizedTypeCheckViolated: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1108 return config.deoptReasonOptimizedTypeCheck; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1109 case NotCompiledExceptionHandler: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1110 return config.deoptReasonNotCompiledExceptionHandler; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1111 case Unresolved: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1112 return config.deoptReasonUnresolved; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1113 case JavaSubroutineMismatch: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1114 return config.deoptReasonJsrMismatch; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1115 case ArithmeticException: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1116 return config.deoptReasonDiv0Check; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1117 case RuntimeConstraint: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1118 return config.deoptReasonConstraint; |
9444
fd60b73f1759
Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9441
diff
changeset
|
1119 case LoopLimitCheck: |
fd60b73f1759
Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9441
diff
changeset
|
1120 return config.deoptReasonLoopLimitCheck; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1121 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7522
diff
changeset
|
1122 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
|
1123 } |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4696
diff
changeset
|
1124 } |
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
|
1125 |
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
|
1126 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
|
1127 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
|
1128 } |
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
|
1129 |
7672
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1130 @Override |
10863
5404cde63c43
Remove redundant checks for loading compressed constants
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10850
diff
changeset
|
1131 public Constant readUnsafeConstant(Kind kind, Object base, long displacement, boolean compressible) { |
7672
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1132 switch (kind) { |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1133 case Boolean: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1134 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
|
1135 case Byte: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1136 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
|
1137 case Char: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1138 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
|
1139 case Short: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1140 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
|
1141 case Int: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1142 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
|
1143 case Long: |
11474
df18a4214c7c
Move compressed pointers' logic to HotSpot specific move
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11457
diff
changeset
|
1144 if (displacement == config().hubOffset && useCompressedKlassPointers()) { |
10744
45dc193567c2
Add assertions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10735
diff
changeset
|
1145 if (base == null) { |
45dc193567c2
Add assertions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10735
diff
changeset
|
1146 throw new GraalInternalError("Base of object must not be null"); |
45dc193567c2
Add assertions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10735
diff
changeset
|
1147 } else { |
45dc193567c2
Add assertions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10735
diff
changeset
|
1148 return Constant.forLong(this.getGraalRuntime().getCompilerToVM().readUnsafeKlassPointer(base)); |
45dc193567c2
Add assertions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10735
diff
changeset
|
1149 } |
10715
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10671
diff
changeset
|
1150 } else { |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10671
diff
changeset
|
1151 return Constant.forLong(base == null ? unsafe.getLong(displacement) : unsafe.getLong(base, displacement)); |
c3760150dc29
Add function to read compressed klass pointers of constant objects natively
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10671
diff
changeset
|
1152 } |
7672
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1153 case Float: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1154 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
|
1155 case Double: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1156 return Constant.forDouble(base == null ? unsafe.getDouble(displacement) : unsafe.getDouble(base, displacement)); |
10536
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1157 case Object: { |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1158 Object o = null; |
10863
5404cde63c43
Remove redundant checks for loading compressed constants
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10850
diff
changeset
|
1159 if (compressible) { |
10536
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1160 o = unsafe.getObject(base, displacement); |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1161 } else { |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1162 o = this.getGraalRuntime().getCompilerToVM().readUnsafeUncompressedPointer(base, displacement); |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1163 } |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1164 return Constant.forObject(o); |
26c69598db3e
Fix bug in canonicalization of non-compressed object pointers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10517
diff
changeset
|
1165 } |
7672
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1166 default: |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1167 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
|
1168 } |
1a4a00390113
Make the access of raw memory via Unsafe specific to HotSpot.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7558
diff
changeset
|
1169 } |
7733
f6bf0f6a8431
move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents:
7677
diff
changeset
|
1170 |
f6bf0f6a8431
move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents:
7677
diff
changeset
|
1171 @Override |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
1172 public boolean isReexecutable(ForeignCallDescriptor descriptor) { |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
1173 return foreignCalls.get(descriptor).isReexecutable(); |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
1174 } |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
1175 |
9819
8aea948c522b
added support for the runtime to specify for each foreign call whether deoptimization can occur during the call
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
1176 public boolean canDeoptimize(ForeignCallDescriptor descriptor) { |
9870
c65bad5126b0
pull HotSpotForeignCallLinkage.isLeaf into ForeignCallLinkage and rename to canDeoptimize
Lukas Stadler <lukas.stadler@jku.at>
parents:
9866
diff
changeset
|
1177 return foreignCalls.get(descriptor).canDeoptimize(); |
9819
8aea948c522b
added support for the runtime to specify for each foreign call whether deoptimization can occur during the call
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
1178 } |
8aea948c522b
added support for the runtime to specify for each foreign call whether deoptimization can occur during the call
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
1179 |
9823
9e6b6d5d6465
rename: getKilledLocationIdentities -> getKilledLocations
Doug Simon <doug.simon@oracle.com>
parents:
9820
diff
changeset
|
1180 public LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor) { |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
1181 return foreignCalls.get(descriptor).getKilledLocations(); |
9737
34c892fdfb6d
moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents:
9736
diff
changeset
|
1182 } |
34c892fdfb6d
moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents:
9736
diff
changeset
|
1183 |
34c892fdfb6d
moved responsibility for determining if a foreign call has a side effect to the runtime
Doug Simon <doug.simon@oracle.com>
parents:
9736
diff
changeset
|
1184 @Override |
7733
f6bf0f6a8431
move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents:
7677
diff
changeset
|
1185 public TargetDescription getTarget() { |
f6bf0f6a8431
move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents:
7677
diff
changeset
|
1186 return graalRuntime.getTarget(); |
f6bf0f6a8431
move AMD64HotSpotRuntime.getTarget up to HotSpotRuntime
Roland Schatz <roland.schatz@oracle.com>
parents:
7677
diff
changeset
|
1187 } |
7784
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1188 |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1189 public String disassemble(InstalledCode code) { |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1190 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
|
1191 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
|
1192 return graalRuntime.getCompilerToVM().disassembleCodeBlob(codeBlob); |
7784
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1193 } |
7912
06ecee106195
added unit tests for bytecode and machine code disassembly
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
1194 return null; |
7784
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1195 } |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1196 |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1197 public String disassemble(ResolvedJavaMethod method) { |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1198 return new BytecodeDisassembler().disassemble(method); |
016e23829147
added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents:
7764
diff
changeset
|
1199 } |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1200 |
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1201 public Suites getDefaultSuites() { |
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1202 return defaultSuites; |
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1203 } |
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1204 |
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1205 public Suites createSuites() { |
9969
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1206 Suites ret = Suites.createDefaultSuites(); |
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1207 |
10009
b5c87b5c6e9c
add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9983
diff
changeset
|
1208 if (AOTCompilation.getValue()) { |
b5c87b5c6e9c
add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9983
diff
changeset
|
1209 // lowering introduces class constants, therefore it must be after lowering |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10027
diff
changeset
|
1210 ret.getHighTier().appendPhase(new LoadJavaMirrorWithKlassPhase()); |
10015
deb5bd841422
aot: add verification phase
Bernhard Urban <bernhard.urban@jku.at>
parents:
10009
diff
changeset
|
1211 if (VerifyPhases.getValue()) { |
10420
672e126cf996
aot verify: s/AheadOfTimeVerifcationPhase/AheadOfTimeVerificationPhase/g
Bernhard Urban <bernhard.urban@jku.at>
parents:
10072
diff
changeset
|
1212 ret.getHighTier().appendPhase(new AheadOfTimeVerificationPhase()); |
10015
deb5bd841422
aot: add verification phase
Bernhard Urban <bernhard.urban@jku.at>
parents:
10009
diff
changeset
|
1213 } |
10009
b5c87b5c6e9c
add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9983
diff
changeset
|
1214 } |
b5c87b5c6e9c
add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9983
diff
changeset
|
1215 |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10027
diff
changeset
|
1216 ret.getMidTier().appendPhase(new WriteBarrierAdditionPhase()); |
9969
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1217 if (VerifyPhases.getValue()) { |
10776
f587a69c63ae
Minor refactoring
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10744
diff
changeset
|
1218 ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase()); |
9969
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1219 } |
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1220 |
b8b4d7f3e4aa
Use Suites mechanism for HotSpot specific compiler phases.
Roland Schatz <roland.schatz@oracle.com>
parents:
9968
diff
changeset
|
1221 return ret; |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9896
diff
changeset
|
1222 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1223 } |