Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java @ 15968:42eaa579e134
more improvements to runtime initialization:
- replaced HotSpotSymbol with native method for reading a symbol
- moved more ForeignCallDescriptors to HotSpotBackend to reduce class initialization
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 28 May 2014 17:41:59 +0200 |
parents | 3eedf7a653ea |
children | 640a875667fe |
rev | line source |
---|---|
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.amd64.AMD64.*; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
15926
af0e42dad358
reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents:
15910
diff
changeset
|
27 import static com.oracle.graal.hotspot.HotSpotBackend.*; |
11832
97d6932a309b
CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11790
diff
changeset
|
28 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
29 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import java.util.*; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.amd64.*; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.api.code.*; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.api.meta.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
36 import com.oracle.graal.asm.amd64.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.graal.compiler.amd64.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15104
diff
changeset
|
38 import com.oracle.graal.compiler.common.*; |
15200
97eed257999b
Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
39 import com.oracle.graal.compiler.common.calc.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 import com.oracle.graal.hotspot.*; |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
41 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding; |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
42 import com.oracle.graal.hotspot.amd64.AMD64HotSpotMove.HotSpotStoreConstantOp; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
43 import com.oracle.graal.hotspot.data.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 import com.oracle.graal.hotspot.meta.*; |
14943
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
45 import com.oracle.graal.hotspot.nodes.type.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 import com.oracle.graal.hotspot.stubs.*; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 import com.oracle.graal.lir.*; |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
48 import com.oracle.graal.lir.StandardOp.NoOp; |
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
49 import com.oracle.graal.lir.StandardOp.SaveRegistersOp; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 import com.oracle.graal.lir.amd64.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
51 import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp; |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
52 import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
53 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp; |
14850 | 54 import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp; |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
55 import com.oracle.graal.lir.amd64.AMD64Move.LoadOp; |
8643
3d2c2b68fe93
lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents:
8641
diff
changeset
|
56 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp; |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
57 import com.oracle.graal.lir.amd64.AMD64Move.MoveToRegOp; |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
58 import com.oracle.graal.lir.amd64.AMD64Move.StoreOp; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
59 import com.oracle.graal.lir.asm.*; |
15292
a38d791982e1
Move LIRGenerationResult* to graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents:
15251
diff
changeset
|
60 import com.oracle.graal.lir.gen.*; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 /** |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 * LIR generator specialized for AMD64 HotSpot. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 */ |
9431
c0488f573091
Make AMD64 LIR generator extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
65 public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator { |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14834
diff
changeset
|
67 final HotSpotVMConfig config; |
15293
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
68 private HotSpotLockStack lockStack; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
69 |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
70 protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, HotSpotVMConfig config, CallingConvention cc, LIRGenerationResult lirGenRes) { |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
71 super(providers, cc, lirGenRes); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
72 assert config.basicLockSize == 8; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
73 this.config = config; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
76 @Override |
12787
9b62c748c9ae
get thread register from generator when lowering CurrentJavaThreadNode node instead of getting it from the host provider
Doug Simon <doug.simon@oracle.com>
parents:
12757
diff
changeset
|
77 public HotSpotProviders getProviders() { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
78 return (HotSpotProviders) super.getProviders(); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 /** |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
82 * Utility for emitting the instruction to save RBP. |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 */ |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
84 class SaveRbp { |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
85 |
13313
6dd9a1455e64
renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents:
13291
diff
changeset
|
86 final NoOp placeholder; |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
87 |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
88 /** |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
89 * The slot reserved for saving RBP. |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
90 */ |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
91 final StackSlot reservedSlot; |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
92 |
13313
6dd9a1455e64
renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents:
13291
diff
changeset
|
93 public SaveRbp(NoOp placeholder) { |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
94 this.placeholder = placeholder; |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
95 this.reservedSlot = getResult().getFrameMap().allocateSpillSlot(Kind.Long); |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
96 assert reservedSlot.getRawOffset() == -16 : reservedSlot.getRawOffset(); |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
97 } |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
99 /** |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
100 * Replaces this operation with the appropriate move for saving rbp. |
14859 | 101 * |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
102 * @param useStack specifies if rbp must be saved to the stack |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
103 */ |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
104 public AllocatableValue finalize(boolean useStack) { |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
105 AllocatableValue dst; |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
106 if (useStack) { |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
107 dst = reservedSlot; |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
108 } else { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
109 getResult().getFrameMap().freeSpillSlot(reservedSlot); |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
110 dst = newVariable(Kind.Long); |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
111 } |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
112 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
113 placeholder.replace(getResult().getLIR(), new MoveFromRegOp(Kind.Long, dst, rbp.asValue(Kind.Long))); |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
114 return dst; |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
115 } |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
116 } |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
117 |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14834
diff
changeset
|
118 SaveRbp saveRbp; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 /** |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 * List of epilogue operations that need to restore RBP. |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 */ |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 List<AMD64HotSpotEpilogueOp> epilogueOps = new ArrayList<>(2); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
125 @Override |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
126 public void append(LIRInstruction op) { |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
127 super.append(op); |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
128 if (op instanceof AMD64HotSpotEpilogueOp) { |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
129 epilogueOps.add((AMD64HotSpotEpilogueOp) op); |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
130 } |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
131 } |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9507
diff
changeset
|
132 |
8586
82f6a25321b8
modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents:
8367
diff
changeset
|
133 @Override |
82f6a25321b8
modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents:
8367
diff
changeset
|
134 public StackSlot getLockSlot(int lockDepth) { |
15293
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
135 return getLockStack().makeLockSlot(lockDepth); |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
136 } |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
137 |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
138 private HotSpotLockStack getLockStack() { |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
139 assert lockStack != null; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
140 return lockStack; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
141 } |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
142 |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
143 protected void setLockStack(HotSpotLockStack lockStack) { |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
144 assert this.lockStack == null; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
145 this.lockStack = lockStack; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
148 private Register findPollOnReturnScratchRegister() { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
149 RegisterConfig regConfig = getProviders().getCodeCache().getRegisterConfig(); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
150 for (Register r : regConfig.getAllocatableRegisters(Kind.Long)) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
151 if (r != regConfig.getReturnRegister(Kind.Long) && r != AMD64.rbp) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
152 return r; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
153 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
154 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
155 throw GraalInternalError.shouldNotReachHere(); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
156 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
157 |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
158 private Register pollOnReturnScratchRegister; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
159 |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 @Override |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14834
diff
changeset
|
161 public void emitReturn(Value input) { |
14949
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
162 AllocatableValue operand = Value.ILLEGAL; |
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
163 if (input != null) { |
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
164 operand = resultOperandFor(input.getKind()); |
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
165 emitMove(operand, input); |
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
166 } |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
167 if (pollOnReturnScratchRegister == null) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
168 pollOnReturnScratchRegister = findPollOnReturnScratchRegister(); |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
169 } |
14949
b65036798097
Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
170 append(new AMD64HotSpotReturnOp(operand, getStub() != null, pollOnReturnScratchRegister)); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 @Override |
15297
3a6151ed5a25
Move LIRGenerator to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15293
diff
changeset
|
174 public boolean needOnlyOopMaps() { |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 // Stubs only need oop maps |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
176 return ((AMD64HotSpotLIRGenerationResult) getResult()).getStub() != null; |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 |
14859 | 179 @Override |
14850 | 180 public void emitData(AllocatableValue dst, byte[] data) { |
181 append(new LeaDataOp(dst, data)); | |
182 } | |
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:
9247
diff
changeset
|
183 |
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:
9247
diff
changeset
|
184 private LIRFrameState currentRuntimeCallInfo; |
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:
9247
diff
changeset
|
185 |
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:
9247
diff
changeset
|
186 @Override |
9742
cff1e11941c0
moved temporaries from CallingConvention to ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9741
diff
changeset
|
187 protected void emitForeignCall(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info) { |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
188 currentRuntimeCallInfo = info; |
9742
cff1e11941c0
moved temporaries from CallingConvention to ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9741
diff
changeset
|
189 super.emitForeignCall(linkage, result, arguments, temps, info); |
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:
9247
diff
changeset
|
190 } |
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:
9247
diff
changeset
|
191 |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
192 public void emitLeaveCurrentStackFrame(SaveRegistersOp saveRegisterOp) { |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
193 append(new AMD64HotSpotLeaveCurrentStackFrameOp(saveRegisterOp)); |
15104 | 194 } |
195 | |
196 public void emitLeaveDeoptimizedStackFrame(Value frameSize, Value initialInfo) { | |
197 Variable frameSizeVariable = load(frameSize); | |
198 Variable initialInfoVariable = load(initialInfo); | |
199 append(new AMD64HotSpotLeaveDeoptimizedStackFrameOp(frameSizeVariable, initialInfoVariable)); | |
200 } | |
201 | |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
202 public void emitEnterUnpackFramesStackFrame(Value framePc, Value senderSp, Value senderFp, SaveRegistersOp saveRegisterOp) { |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
203 Register threadRegister = getProviders().getRegisters().getThreadRegister(); |
15104 | 204 Variable framePcVariable = load(framePc); |
205 Variable senderSpVariable = load(senderSp); | |
206 Variable senderFpVariable = load(senderFp); | |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
207 append(new AMD64HotSpotEnterUnpackFramesStackFrameOp(threadRegister, config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), framePcVariable, |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
208 senderSpVariable, senderFpVariable, saveRegisterOp)); |
15104 | 209 } |
210 | |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
211 public void emitLeaveUnpackFramesStackFrame(SaveRegistersOp saveRegisterOp) { |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
212 Register threadRegister = getProviders().getRegisters().getThreadRegister(); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
213 append(new AMD64HotSpotLeaveUnpackFramesStackFrameOp(threadRegister, config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadLastJavaFpOffset(), saveRegisterOp)); |
15104 | 214 } |
215 | |
216 /** | |
217 * @param savedRegisters the registers saved by this operation which may be subject to pruning | |
218 * @param savedRegisterLocations the slots to which the registers are saved | |
219 * @param supportsRemove determines if registers can be pruned | |
220 */ | |
221 protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlot[] savedRegisterLocations, boolean supportsRemove) { | |
222 AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations, supportsRemove); | |
9507
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
223 append(save); |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
224 return save; |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
225 } |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
226 |
15104 | 227 /** |
228 * Adds a node to the graph that saves all allocatable registers to the stack. | |
229 * | |
230 * @param supportsRemove determines if registers can be pruned | |
231 * @return the register save node | |
232 */ | |
233 private AMD64SaveRegistersOp emitSaveAllRegisters(Register[] savedRegisters, boolean supportsRemove) { | |
234 StackSlot[] savedRegisterLocations = new StackSlot[savedRegisters.length]; | |
235 for (int i = 0; i < savedRegisters.length; i++) { | |
236 PlatformKind kind = target().arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory()); | |
237 assert kind != Kind.Illegal; | |
238 StackSlot spillSlot = getResult().getFrameMap().allocateSpillSlot(kind); | |
239 savedRegisterLocations[i] = spillSlot; | |
240 } | |
241 return emitSaveRegisters(savedRegisters, savedRegisterLocations, supportsRemove); | |
242 } | |
243 | |
244 @Override | |
245 public SaveRegistersOp emitSaveAllRegisters() { | |
246 // We are saving all registers. | |
247 // TODO Save upper half of YMM registers. | |
248 return emitSaveAllRegisters(cpuxmmRegisters, false); | |
249 } | |
250 | |
9507
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
251 protected void emitRestoreRegisters(AMD64SaveRegistersOp save) { |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
252 append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save)); |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
253 } |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
254 |
14807
c3242028cc44
Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents:
14806
diff
changeset
|
255 public Stub getStub() { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
256 return ((AMD64HotSpotLIRGenerationResult) getResult()).getStub(); |
9613
0c17815817a4
removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents:
9612
diff
changeset
|
257 } |
0c17815817a4
removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents:
9612
diff
changeset
|
258 |
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:
9247
diff
changeset
|
259 @Override |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
260 public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) { |
14955
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
261 HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage; |
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
262 boolean destroysRegisters = hotspotLinkage.destroysRegisters(); |
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:
9247
diff
changeset
|
263 |
9415
016523a011b7
simplified register preservation in compiled stubs to avoid the need for using ParametersOp
Doug Simon <doug.simon@oracle.com>
parents:
9352
diff
changeset
|
264 AMD64SaveRegistersOp save = null; |
9693
d04944441454
cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents:
9613
diff
changeset
|
265 if (destroysRegisters) { |
14142
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14003
diff
changeset
|
266 if (getStub() != null) { |
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14003
diff
changeset
|
267 if (getStub().preservesRegisters()) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
268 Register[] savedRegisters = getResult().getFrameMap().registerConfig.getAllocatableRegisters(); |
15104 | 269 save = emitSaveAllRegisters(savedRegisters, true); |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
270 } |
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:
9247
diff
changeset
|
271 } |
9731
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
272 } |
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:
9247
diff
changeset
|
273 |
9768
cbf274a92e5b
a leaf foreign call does not need debug info
Doug Simon <doug.simon@oracle.com>
parents:
9742
diff
changeset
|
274 Variable result; |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
275 // TODO (je) check if we can remove this |
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
276 LIRFrameState deoptInfo = null; |
14955
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
277 if (hotspotLinkage.canDeoptimize()) { |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
278 deoptInfo = state; |
14955
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
279 assert deoptInfo != null || getStub() != null; |
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
280 assert hotspotLinkage.needsJavaFrameAnchor(); |
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
281 } |
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:
9247
diff
changeset
|
282 |
14955
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
283 if (hotspotLinkage.needsJavaFrameAnchor()) { |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
284 Register thread = getProviders().getRegisters().getThreadRegister(); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12456
diff
changeset
|
285 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread)); |
14955
be6fc21b25f8
Add possibility to have HotSpot linkages which are LEAF but still require a last_java_sp
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14949
diff
changeset
|
286 result = super.emitForeignCall(hotspotLinkage, deoptInfo, args); |
12559
ae412befde21
read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents:
12456
diff
changeset
|
287 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread)); |
9768
cbf274a92e5b
a leaf foreign call does not need debug info
Doug Simon <doug.simon@oracle.com>
parents:
9742
diff
changeset
|
288 } else { |
15377
ad5c1c4434ed
AMD64HotSpotLIRGenerator.emitForeignCall: add assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15370
diff
changeset
|
289 assert deoptInfo == null; |
ad5c1c4434ed
AMD64HotSpotLIRGenerator.emitForeignCall: add assert
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15370
diff
changeset
|
290 result = super.emitForeignCall(hotspotLinkage, null, args); |
9731
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
291 } |
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:
9247
diff
changeset
|
292 |
9731
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
293 if (destroysRegisters) { |
14142
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14003
diff
changeset
|
294 if (getStub() != null) { |
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14003
diff
changeset
|
295 if (getStub().preservesRegisters()) { |
15104 | 296 AMD64HotSpotLIRGenerationResult generationResult = (AMD64HotSpotLIRGenerationResult) getResult(); |
297 assert !generationResult.getCalleeSaveInfo().containsKey(currentRuntimeCallInfo); | |
298 generationResult.getCalleeSaveInfo().put(currentRuntimeCallInfo, save); | |
9731
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
299 emitRestoreRegisters(save); |
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
300 } else { |
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
301 assert zapRegisters(); |
f7bd4594cbbf
added support for declaring a foreign function call to be a leaf
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
302 } |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
303 } |
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:
9247
diff
changeset
|
304 } |
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:
9247
diff
changeset
|
305 |
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:
9247
diff
changeset
|
306 return result; |
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:
9247
diff
changeset
|
307 } |
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:
9247
diff
changeset
|
308 |
15104 | 309 public Value emitUncommonTrapCall(Value trapRequest, SaveRegistersOp saveRegisterOp) { |
310 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(UNCOMMON_TRAP); | |
311 | |
312 Register thread = getProviders().getRegisters().getThreadRegister(); | |
313 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread)); | |
314 Variable result = super.emitForeignCall(linkage, null, thread.asValue(Kind.Long), trapRequest); | |
315 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread)); | |
316 | |
317 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo(); | |
318 assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo); | |
319 calleeSaveInfo.put(currentRuntimeCallInfo, saveRegisterOp); | |
320 | |
321 return result; | |
322 } | |
323 | |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
324 public Value emitDeoptimizationFetchUnrollInfoCall(SaveRegistersOp saveRegisterOp) { |
15968
42eaa579e134
more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents:
15947
diff
changeset
|
325 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(FETCH_UNROLL_INFO); |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
326 |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
327 Register thread = getProviders().getRegisters().getThreadRegister(); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
328 append(new AMD64HotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread)); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
329 Variable result = super.emitForeignCall(linkage, null, thread.asValue(Kind.Long)); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
330 append(new AMD64HotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaFpOffset(), thread)); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
331 |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
332 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo(); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
333 assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
334 calleeSaveInfo.put(currentRuntimeCallInfo, saveRegisterOp); |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
335 |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
336 return result; |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
337 } |
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15412
diff
changeset
|
338 |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
339 protected AMD64ZapRegistersOp emitZapRegisters(Register[] zappedRegisters, Constant[] zapValues) { |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
340 AMD64ZapRegistersOp zap = new AMD64ZapRegistersOp(zappedRegisters, zapValues); |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
341 append(zap); |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
342 return zap; |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
343 } |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
344 |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
345 protected boolean zapRegisters() { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
346 Register[] zappedRegisters = getResult().getFrameMap().registerConfig.getAllocatableRegisters(); |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
347 Constant[] zapValues = new Constant[zappedRegisters.length]; |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
348 for (int i = 0; i < zappedRegisters.length; i++) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
349 PlatformKind kind = target().arch.getLargestStorableKind(zappedRegisters[i].getRegisterCategory()); |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
350 assert kind != Kind.Illegal; |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
351 zapValues[i] = zapValueForKind(kind); |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
352 } |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
353 ((AMD64HotSpotLIRGenerationResult) getResult()).getCalleeSaveInfo().put(currentRuntimeCallInfo, emitZapRegisters(zappedRegisters, zapValues)); |
9491
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
354 return true; |
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
355 } |
789cfd153265
a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents:
9471
diff
changeset
|
356 |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
357 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
358 public void emitTailcall(Value[] args, Value address) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
359 append(new AMD64TailcallOp(args, address)); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
360 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
361 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
362 @Override |
13837
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
363 public void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments) { |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
364 Value[] argLocations = new Value[args.length]; |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
365 getResult().getFrameMap().callsMethod(nativeCallingConvention); |
13839 | 366 // TODO(mg): in case a native function uses floating point varargs, the ABI requires that |
367 // RAX contains the length of the varargs | |
13837
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
368 AllocatableValue numberOfFloatingPointArgumentsRegister = AMD64.rax.asValue(); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
369 emitMove(numberOfFloatingPointArgumentsRegister, Constant.forInt(numberOfFloatingPointArguments)); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
370 for (int i = 0; i < args.length; i++) { |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
371 Value arg = args[i]; |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
372 AllocatableValue loc = nativeCallingConvention.getArgument(i); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
373 emitMove(loc, arg); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
374 argLocations[i] = loc; |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
375 } |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
376 Value ptr = emitMove(Constant.forLong(address)); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
377 append(new AMD64CCall(nativeCallingConvention.getReturn(), ptr, numberOfFloatingPointArgumentsRegister, argLocations)); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
378 } |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
379 |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13726
diff
changeset
|
380 @Override |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
381 public void emitUnwind(Value exception) { |
12363
78e5badf4b8e
moved lookupForeignCall() from CodeCacheProvider to ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12058
diff
changeset
|
382 ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER); |
10873
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
383 CallingConvention outgoingCc = linkage.getOutgoingCallingConvention(); |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
384 assert outgoingCc.getArgumentCount() == 2; |
de55425d3cf5
small cleanups and extra documentation around foreign call linkage
Doug Simon <doug.simon@oracle.com>
parents:
10870
diff
changeset
|
385 RegisterValue exceptionParameter = (RegisterValue) outgoingCc.getArgument(0); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
386 emitMove(exceptionParameter, exception); |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9560
diff
changeset
|
387 append(new AMD64HotSpotUnwindOp(exceptionParameter)); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
388 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
389 |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
390 private void moveDeoptValuesToThread(Value actionAndReason, Value speculation) { |
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
391 moveValueToThread(actionAndReason, runtime().getConfig().pendingDeoptimizationOffset); |
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
392 moveValueToThread(speculation, runtime().getConfig().pendingFailedSpeculationOffset); |
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
393 } |
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
394 |
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
395 private void moveValueToThread(Value v, int offset) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
396 Kind wordKind = getProviders().getCodeCache().getTarget().wordKind; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
397 RegisterValue thread = getProviders().getRegisters().getThreadRegister().asValue(wordKind); |
13667
076e233aec3f
Fix AMD64HotSpotLIRGenerator.moveValueToThread
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
398 AMD64AddressValue address = new AMD64AddressValue(v.getKind(), thread, offset); |
076e233aec3f
Fix AMD64HotSpotLIRGenerator.moveValueToThread
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
399 emitStore(v.getKind(), address, v, null); |
11832
97d6932a309b
CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11790
diff
changeset
|
400 } |
97d6932a309b
CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11790
diff
changeset
|
401 |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
402 @Override |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
403 public void emitDeoptimize(Value actionAndReason, Value speculation, LIRFrameState state) { |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
404 moveDeoptValuesToThread(actionAndReason, speculation); |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
405 append(new AMD64DeoptimizeOp(state)); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
406 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
407 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
408 @Override |
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:
9247
diff
changeset
|
409 public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) { |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13614
diff
changeset
|
410 moveDeoptValuesToThread(getMetaAccess().encodeDeoptActionAndReason(action, reason, 0), Constant.NULL_OBJECT); |
11832
97d6932a309b
CodeCacheProvider.encodeDeoptActionAndReason now returns a Constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11790
diff
changeset
|
411 append(new AMD64HotSpotDeoptimizeCallerOp()); |
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:
9247
diff
changeset
|
412 } |
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:
9247
diff
changeset
|
413 |
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:
9247
diff
changeset
|
414 @Override |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
415 public void beforeRegisterAllocation() { |
13313
6dd9a1455e64
renamed PlaceholderOp to NoOp
Doug Simon <doug.simon@oracle.com>
parents:
13291
diff
changeset
|
416 super.beforeRegisterAllocation(); |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
417 boolean hasDebugInfo = getResult().getLIR().hasDebugInfo(); |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
418 AllocatableValue savedRbp = saveRbp.finalize(hasDebugInfo); |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
419 if (hasDebugInfo) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14859
diff
changeset
|
420 ((AMD64HotSpotLIRGenerationResult) getResult()).setDeoptimizationRescueSlot(getResult().getFrameMap().allocateSpillSlot(Kind.Long)); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
421 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
422 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
423 for (AMD64HotSpotEpilogueOp op : epilogueOps) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
424 op.savedRbp = savedRbp; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
425 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
426 } |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
427 |
11453
1092208e4986
Add Javadoc
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11452
diff
changeset
|
428 /** |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
429 * @return a compressed version of the incoming constant |
11453
1092208e4986
Add Javadoc
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
11452
diff
changeset
|
430 */ |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
431 protected static Constant compress(Constant c, CompressEncoding encoding) { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
432 if (c.getKind() == Kind.Long) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
433 int compressedValue = (int) (((c.asLong() - encoding.base) >> encoding.shift) & 0xffffffffL); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
434 if (c instanceof HotSpotMetaspaceConstant) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
435 return HotSpotMetaspaceConstant.forMetaspaceObject(Kind.Int, compressedValue, HotSpotMetaspaceConstant.getMetaspaceObject(c)); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
436 } else { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
437 return Constant.forIntegerKind(Kind.Int, compressedValue); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14955
diff
changeset
|
438 } |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
439 } else { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
440 throw GraalInternalError.shouldNotReachHere(); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13313
diff
changeset
|
441 } |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
442 } |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
443 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
444 private static Kind getMemoryKind(PlatformKind kind) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
445 if (kind == NarrowOopStamp.NarrowOop) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
446 return Kind.Int; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
447 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
448 return (Kind) kind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
449 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
450 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
451 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
452 private static PlatformKind toStackKind(PlatformKind kind) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
453 if (kind instanceof Kind) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
454 return ((Kind) kind).getStackKind(); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
455 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
456 return kind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
457 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
458 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
459 |
15104 | 460 public void emitPushInterpreterFrame(Value frameSize, Value framePc, Value senderSp, Value initialInfo) { |
461 Variable frameSizeVariable = load(frameSize); | |
462 Variable framePcVariable = load(framePc); | |
463 Variable senderSpVariable = load(senderSp); | |
464 Variable initialInfoVariable = load(initialInfo); | |
465 append(new AMD64HotSpotPushInterpreterFrameOp(frameSizeVariable, framePcVariable, senderSpVariable, initialInfoVariable)); | |
466 } | |
467 | |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
468 @Override |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
469 public Variable emitLoad(PlatformKind kind, Value address, LIRFrameState state) { |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
470 AMD64AddressValue loadAddress = asAddressValue(address); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
471 Variable result = newVariable(toStackKind(kind)); |
15302
b3e4b32cb9f5
Remove deprecated isCompressed* checks from *HotSpotLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15301
diff
changeset
|
472 append(new LoadOp(getMemoryKind(kind), result, loadAddress, state)); |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
473 return result; |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
474 } |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
475 |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
476 @Override |
15301
468b2428c403
Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
477 public void emitStore(PlatformKind kind, Value address, Value inputVal, LIRFrameState state) { |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
478 AMD64AddressValue storeAddress = asAddressValue(address); |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
479 if (isConstant(inputVal)) { |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
480 Constant c = asConstant(inputVal); |
15947
3eedf7a653ea
Remove unused oop compression code from backends.
Roland Schatz <roland.schatz@oracle.com>
parents:
15926
diff
changeset
|
481 if (canStoreConstant(c)) { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
482 append(new HotSpotStoreConstantOp(getMemoryKind(kind), storeAddress, c, state)); |
15302
b3e4b32cb9f5
Remove deprecated isCompressed* checks from *HotSpotLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15301
diff
changeset
|
483 return; |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
484 } |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
485 } |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
486 Variable input = load(inputVal); |
15302
b3e4b32cb9f5
Remove deprecated isCompressed* checks from *HotSpotLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15301
diff
changeset
|
487 append(new StoreOp(getMemoryKind(kind), storeAddress, input, state)); |
9885
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
488 } |
ed86945795d5
Add Compressed Oops support in LIR
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9768
diff
changeset
|
489 |
14943
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
490 @Override |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
491 public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) { |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
492 if (pointer.getPlatformKind() == Kind.Object) { |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
493 Variable result = newVariable(NarrowOopStamp.NarrowOop); |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
494 append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
495 return result; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
496 } else { |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
497 assert pointer.getPlatformKind() == Kind.Long; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
498 Variable result = newVariable(Kind.Int); |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
499 AllocatableValue base = Value.ILLEGAL; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
500 if (encoding.base != 0) { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
501 base = emitMove(Constant.forLong(encoding.base)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
502 } |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
503 append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
504 return result; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
505 } |
14943
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
506 } |
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
507 |
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
508 @Override |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
509 public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) { |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
510 if (pointer.getPlatformKind() == NarrowOopStamp.NarrowOop) { |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
511 Variable result = newVariable(Kind.Object); |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
512 append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
513 return result; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
514 } else { |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
515 assert pointer.getPlatformKind() == Kind.Int; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
516 Variable result = newVariable(Kind.Long); |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
517 AllocatableValue base = Value.ILLEGAL; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
518 if (encoding.base != 0) { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
519 base = emitMove(Constant.forLong(encoding.base)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
520 } |
15058
895e9ecedfe8
Fix code generation for compressed metaspace pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15024
diff
changeset
|
521 append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
522 return result; |
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
523 } |
14943
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
524 } |
e5a55d280f24
Floating nodes for compressing and uncompressing pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
14921
diff
changeset
|
525 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
526 @Override |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
527 protected AMD64LIRInstruction createMove(AllocatableValue dst, Value src) { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
528 if (src instanceof Constant) { |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
529 return new AMD64HotSpotMove.HotSpotLoadConstantOp(dst, (Constant) src); |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
530 } else if (dst.getPlatformKind() == NarrowOopStamp.NarrowOop) { |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
531 if (isRegister(src) || isStackSlot(dst)) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
532 return new MoveFromRegOp(Kind.Int, dst, src); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
533 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
534 return new MoveToRegOp(Kind.Int, dst, src); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
535 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
536 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
537 return super.createMove(dst, src); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
538 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
539 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14943
diff
changeset
|
540 |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
541 public Value emitCompareAndSwap(Value address, Value expectedValue, Value newValue, Value trueValue, Value falseValue) { |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
542 PlatformKind kind = newValue.getPlatformKind(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
543 assert kind == expectedValue.getPlatformKind(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
544 Kind memKind = getMemoryKind(kind); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
545 |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
546 AMD64AddressValue addressValue = asAddressValue(address); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
547 RegisterValue raxRes = AMD64.rax.asValue(kind); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
548 emitMove(raxRes, expectedValue); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
549 append(new CompareAndSwapOp(memKind, raxRes, addressValue, raxRes, asAllocatable(newValue))); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
550 |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
551 assert trueValue.getPlatformKind() == falseValue.getPlatformKind(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
552 Variable result = newVariable(trueValue.getPlatformKind()); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
553 append(new CondMoveOp(result, Condition.EQ, asAllocatable(trueValue), falseValue)); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
554 return result; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
555 } |
15251 | 556 |
557 public Value emitAtomicReadAndAdd(Value address, Value delta) { | |
558 PlatformKind kind = delta.getPlatformKind(); | |
559 Kind memKind = getMemoryKind(kind); | |
560 Variable result = newVariable(kind); | |
561 AMD64AddressValue addressValue = asAddressValue(address); | |
562 append(new AMD64Move.AtomicReadAndAddOp(memKind, result, addressValue, asAllocatable(delta))); | |
563 return result; | |
564 } | |
565 | |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
566 public static Register asNarrowReg(Value value) { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
567 if (value.getPlatformKind() != NarrowOopStamp.NarrowOop) { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
568 throw new InternalError("needed NarrowOop got: " + value.getKind()); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
569 } else { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
570 return asRegister(value); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
571 } |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
572 } |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
573 |
15251 | 574 public Value emitAtomicReadAndWrite(Value address, Value newValue) { |
575 PlatformKind kind = newValue.getPlatformKind(); | |
576 Kind memKind = getMemoryKind(kind); | |
577 Variable result = newVariable(kind); | |
578 AMD64AddressValue addressValue = asAddressValue(address); | |
579 append(new AMD64Move.AtomicReadAndWriteOp(memKind, result, addressValue, asAllocatable(newValue))); | |
580 return result; | |
581 } | |
582 | |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
583 public static class CompareMemoryCompressedOp extends AMD64LIRInstruction { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
584 @Alive({COMPOSITE}) protected AMD64AddressValue x; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
585 @Use({CONST, REG}) protected Value y; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
586 @State protected LIRFrameState state; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
587 |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
588 public CompareMemoryCompressedOp(AMD64AddressValue x, Value y, LIRFrameState state) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
589 assert HotSpotGraalRuntime.runtime().getConfig().useCompressedOops; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
590 this.x = x; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
591 this.y = y; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
592 this.state = state; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
593 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
594 |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
595 @Override |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
596 protected void verify() { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
597 assert y instanceof Constant || y.getPlatformKind() == NarrowOopStamp.NarrowOop; |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
598 } |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
599 |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
600 @Override |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
601 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
602 if (state != null) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
603 crb.recordImplicitException(masm.position(), state); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
604 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
605 if (y instanceof Constant) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
606 Constant constant = (Constant) y; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
607 if (constant.isNull()) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
608 masm.cmpl(x.toAddress(), 0); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
609 } else { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
610 if (y.getKind() == Kind.Object) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
611 crb.recordInlineDataInCode(new OopData(0, HotSpotObjectConstant.asObject(constant), true)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
612 } else if (y.getKind() == Kind.Long) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
613 crb.recordInlineDataInCode(new MetaspaceData(0, constant.asLong(), HotSpotMetaspaceConstant.getMetaspaceObject(constant), true)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
614 } else { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
615 throw GraalInternalError.shouldNotReachHere(); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
616 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
617 masm.cmpl(x.toAddress(), 0xdeaddead); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
618 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
619 } else { |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15377
diff
changeset
|
620 masm.cmpl(asNarrowReg(y), x.toAddress()); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
621 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
622 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
623 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
624 |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
625 protected void emitCompareBranchMemoryCompressed(Value left, Value right, Condition cond, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability, LIRFrameState state) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
626 boolean mirrored = false; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
627 if (left instanceof AMD64AddressValue) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
628 append(new CompareMemoryCompressedOp((AMD64AddressValue) left, right, state)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
629 } else { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
630 assert right instanceof AMD64AddressValue; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
631 append(new CompareMemoryCompressedOp((AMD64AddressValue) right, left, state)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
632 mirrored = true; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
633 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
634 |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
635 Condition finalCondition = mirrored ? cond.mirror() : cond; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
636 append(new BranchOp(finalCondition, trueLabel, falseLabel, trueLabelProbability)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15302
diff
changeset
|
637 } |
15554
cf994cc23b54
Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15456
diff
changeset
|
638 |
cf994cc23b54
Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15456
diff
changeset
|
639 public void emitNullCheck(Value address, LIRFrameState state) { |
cf994cc23b54
Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15456
diff
changeset
|
640 assert address.getKind() == Kind.Object : address + " - " + address.getKind() + " not an object!"; |
cf994cc23b54
Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15456
diff
changeset
|
641 append(new AMD64Move.NullCheckOp(load(address), state)); |
cf994cc23b54
Move emitNullCheck from NodeLIRBuilderTool to LIRGeneratorTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15456
diff
changeset
|
642 } |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
643 |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
644 @Override |
15910
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
645 protected void emitCompareOp(PlatformKind cmpKind, Variable left, Value right) { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
646 if (right instanceof HotSpotConstant) { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
647 append(new AMD64HotSpotCompare.HotSpotCompareConstantOp(left, (Constant) right)); |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
648 } else if (cmpKind == NarrowOopStamp.NarrowOop) { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
649 append(new AMD64HotSpotCompare.HotSpotCompareNarrowOp(left, asAllocatable(right))); |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
650 } else { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
651 super.emitCompareOp(cmpKind, left, right); |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
652 } |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
653 } |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
654 |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
655 @Override |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
656 protected void emitCompareMemoryConOp(Kind kind, AMD64AddressValue address, Constant value, LIRFrameState state) { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
657 if (value instanceof HotSpotConstant) { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
658 append(new AMD64HotSpotCompare.HotSpotCompareMemoryConstantOp(kind, address, value, state)); |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
659 } else { |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
660 super.emitCompareMemoryConOp(kind, address, value, state); |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
661 } |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
662 } |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
663 |
79a0d9065849
Support direct comparison of compressed pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
664 @Override |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
665 public boolean canInlineConstant(Constant c) { |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
666 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) { |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
667 return true; |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
668 } else if (c instanceof HotSpotObjectConstant) { |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
669 return HotSpotObjectConstant.isCompressed(c); |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
670 } else { |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
671 return super.canInlineConstant(c); |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
672 } |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15554
diff
changeset
|
673 } |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
674 } |