annotate graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLIRGenerator.java @ 14723:4c5ed5a670ed

HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator Contributed-by: Eric Caspole <eric.caspole@amd.com>
author Doug Simon <doug.simon@oracle.com>
date Mon, 24 Mar 2014 14:41:28 +0100
parents da2431cc1506
children 3e9a960f0da1 fbae9be45c95
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
24 package com.oracle.graal.hotspot.hsail;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
26 import sun.misc.*;
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
27
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.code.*;
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
29 import static com.oracle.graal.api.code.ValueUtil.asConstant;
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
30 import static com.oracle.graal.api.code.ValueUtil.isConstant;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.api.meta.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
32 import com.oracle.graal.compiler.hsail.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
33 import com.oracle.graal.hotspot.*;
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
34 import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
35 import com.oracle.graal.hotspot.meta.*;
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
36 import com.oracle.graal.hotspot.nodes.*;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 import com.oracle.graal.lir.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 import com.oracle.graal.lir.hsail.*;
12664
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
39 import com.oracle.graal.lir.hsail.HSAILControlFlow.*;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
40 import com.oracle.graal.lir.hsail.HSAILMove.*;
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
41 import com.oracle.graal.phases.util.*;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 import com.oracle.graal.nodes.*;
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
43 import com.oracle.graal.nodes.calc.*;
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
44 import com.oracle.graal.nodes.extended.*;
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
45 import com.oracle.graal.nodes.java.*;
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
46 import com.oracle.graal.graph.*;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 /**
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
49 * The HotSpot specific portion of the HSAIL LIR generator.
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 */
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
51 public class HSAILHotSpotLIRGenerator extends HSAILLIRGenerator implements HotSpotLIRGenerator {
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
53 private final HotSpotVMConfig config;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
55 public HSAILHotSpotLIRGenerator(StructuredGraph graph, Providers providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) {
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
56 super(graph, providers, frameMap, cc, lir);
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
57 this.config = config;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
60 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
61 public HotSpotProviders getProviders() {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
62 return (HotSpotProviders) super.getProviders();
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
63 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
64
12698
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
65 private int getLogMinObjectAlignment() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
66 return config.logMinObjAlignment();
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
67 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
68
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
69 private int getNarrowOopShift() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
70 return config.narrowOopShift;
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
71 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
72
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
73 private long getNarrowOopBase() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
74 return config.narrowOopBase;
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
75 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
76
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
77 private int getLogKlassAlignment() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
78 return config.logKlassAlignment;
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
79 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
80
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
81 private int getNarrowKlassShift() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
82 return config.narrowKlassShift;
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
83 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
84
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
85 private long getNarrowKlassBase() {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
86 return config.narrowKlassBase;
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
87 }
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
88
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
89 private static boolean isCompressCandidate(Access access) {
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
90 return access != null && access.isCompressible();
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
92
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
93 @Override
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
94 public boolean canStoreConstant(Constant c, boolean isCompressed) {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
95 return true;
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
96 }
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
97
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
98 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
99 public StackSlot getLockSlot(int lockDepth) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
100 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
101 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
102
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
103 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
104 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
105 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
106 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
107
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
108 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
109 public void emitPrefetchAllocate(ValueNode address, ValueNode distance) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
110 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
111 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
112
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
113 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
114 public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
115 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
116 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
117
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
118 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
119 public void emitPatchReturnAddress(ValueNode address) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
120 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
121 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
122
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
123 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
124 public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
125 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
126 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
127
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
128 @Override
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
129 public void emitTailcall(Value[] args, Value address) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
130 throw GraalInternalError.shouldNotReachHere("NYI");
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
131 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
132
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
133 /**
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
134 * Appends either a {@link CompareAndSwapOp} or a {@link CompareAndSwapCompressedOp} depending
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
135 * on whether the memory location of a given {@link LoweredCompareAndSwapNode} contains a
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
136 * compressed oop. For the {@link CompareAndSwapCompressedOp} case, allocates a number of
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
137 * scratch registers. The result {@link #operand(ValueNode) operand} for {@code node} complies
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
138 * with the API for {@link Unsafe#compareAndSwapInt(Object, long, int, int)}.
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
139 *
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
140 * @param address the memory location targeted by the operation
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
141 */
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
142 @Override
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
143 public void visitCompareAndSwap(LoweredCompareAndSwapNode node, Value address) {
14633
da2431cc1506 Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents: 14563
diff changeset
144 Kind kind = node.getNewValue().getKind();
da2431cc1506 Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents: 14563
diff changeset
145 assert kind == node.getExpectedValue().getKind();
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
146 Variable expected = load(operand(node.getExpectedValue()));
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
147 Variable newValue = load(operand(node.getNewValue()));
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
148 HSAILAddressValue addressValue = asAddressValue(address);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
149 Variable casResult = newVariable(kind);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
150 if (config.useCompressedOops && node.isCompressible()) {
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
151 // make 64-bit scratch variables for expected and new
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
152 Variable scratchExpected64 = newVariable(Kind.Long);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
153 Variable scratchNewValue64 = newVariable(Kind.Long);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
154 // make 32-bit scratch variables for expected and new and result
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
155 Variable scratchExpected32 = newVariable(Kind.Int);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
156 Variable scratchNewValue32 = newVariable(Kind.Int);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
157 Variable scratchCasResult32 = newVariable(Kind.Int);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
158 append(new CompareAndSwapCompressedOp(casResult, addressValue, expected, newValue, scratchExpected64, scratchNewValue64, scratchExpected32, scratchNewValue32, scratchCasResult32,
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
159 getNarrowOopBase(), getNarrowOopShift(), getLogMinObjectAlignment()));
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
160 } else {
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
161 append(new CompareAndSwapOp(casResult, addressValue, expected, newValue));
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
162 }
14633
da2431cc1506 Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents: 14563
diff changeset
163 Variable nodeResult = newVariable(node.getKind());
12742
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
164 append(new CondMoveOp(mapKindToCompareOp(kind), casResult, expected, nodeResult, Condition.EQ, Constant.INT_1, Constant.INT_0));
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
165 setResult(node, nodeResult);
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
166 }
40924dbc623b HSAIL support for compare-and-swap and volatile load/store operations
Doug Simon <doug.simon@oracle.com>
parents: 12698
diff changeset
167
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
168 /**
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
169 * Returns whether or not the input access should be (de)compressed.
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
170 */
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
171 private boolean isCompressedOperation(Kind kind, Access access) {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
172 return access != null && access.isCompressible() && ((kind == Kind.Long && config.useCompressedClassPointers) || (kind == Kind.Object && config.useCompressedOops));
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
173 }
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
174
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
175 @Override
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
176 public Variable emitLoad(Kind kind, Value address, Access access) {
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
177 HSAILAddressValue loadAddress = asAddressValue(address);
14003
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 13891
diff changeset
178 Variable result = newVariable(kind.getStackKind());
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
179 LIRFrameState state = null;
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
180 if (access instanceof DeoptimizingNode) {
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
181 state = state((DeoptimizingNode) access);
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
182 }
12698
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
183 if (isCompressCandidate(access) && config.useCompressedOops && kind == Kind.Object) {
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
184 Variable scratch = newVariable(Kind.Long);
12698
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
185 append(new LoadCompressedPointer(kind, result, scratch, loadAddress, state, getNarrowOopBase(), getNarrowOopShift(), getLogMinObjectAlignment()));
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
186 } else if (isCompressCandidate(access) && config.useCompressedClassPointers && kind == Kind.Long) {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
187 Variable scratch = newVariable(Kind.Long);
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
188 append(new LoadCompressedPointer(kind, result, scratch, loadAddress, state, getNarrowKlassBase(), getNarrowKlassShift(), getLogKlassAlignment()));
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
189 } else {
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
190 append(new LoadOp(kind, result, loadAddress, state));
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
191 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
192 return result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
193 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
194
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
195 @Override
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
196 public void emitStore(Kind kind, Value address, Value inputVal, Access access) {
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
197 HSAILAddressValue storeAddress = asAddressValue(address);
13291
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
198 LIRFrameState state = null;
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
199 if (access instanceof DeoptimizingNode) {
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
200 state = state((DeoptimizingNode) access);
01fd11e44f73 Access is not necessarily a DeoptimizingNode. In particular, FloatingAccessNodes are not DeoptimizingNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12742
diff changeset
201 }
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
202 boolean isCompressed = isCompressedOperation(kind, access);
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
203 if (isConstant(inputVal)) {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
204 Constant c = asConstant(inputVal);
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
205 if (canStoreConstant(c, isCompressed)) {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
206 if (isCompressed) {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
207 if ((c.getKind() == Kind.Object) && c.isNull()) {
14563
82e4fe6fa525 Remove all references to NarrowOop from VM independent code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
208 append(new StoreConstantOp(Kind.Int, storeAddress, Constant.forInt(0), state));
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
209 } else if (c.getKind() == Kind.Long) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
210 Constant value = compress(c, config.getKlassEncoding());
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
211 append(new StoreConstantOp(Kind.Int, storeAddress, value, state));
13891
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
212 } else {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
213 throw GraalInternalError.shouldNotReachHere("can't handle: " + access);
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
214 }
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
215 return;
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
216 } else {
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
217 append(new StoreConstantOp(kind, storeAddress, c, state));
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
218 return;
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
219 }
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
220 }
bc471f405eb8 HSAIL: support for storing immediates
Doug Simon <doug.simon@oracle.com>
parents: 13291
diff changeset
221 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
222 Variable input = load(inputVal);
12698
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
223 if (isCompressCandidate(access) && config.useCompressedOops && kind == Kind.Object) {
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
224 Variable scratch = newVariable(Kind.Long);
12698
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
225 append(new StoreCompressedPointer(kind, storeAddress, input, scratch, state, getNarrowOopBase(), getNarrowOopShift(), getLogMinObjectAlignment()));
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
226 } else if (isCompressCandidate(access) && config.useCompressedClassPointers && kind == Kind.Long) {
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
227 Variable scratch = newVariable(Kind.Long);
d59a65c11feb HSAIL support for difference between compression of oops and class pointers
Doug Simon <doug.simon@oracle.com>
parents: 12664
diff changeset
228 append(new StoreCompressedPointer(kind, storeAddress, input, scratch, state, getNarrowKlassBase(), getNarrowKlassShift(), getLogKlassAlignment()));
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
229 } else {
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
230 append(new StoreOp(kind, storeAddress, input, state));
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
231 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
232 }
12664
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
233
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
234 /***
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
235 * This is a very temporary solution to emitForeignCall. We don't really support foreign calls
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
236 * yet, but we do want to generate dummy code for them. The ForeignCallXXXOps just end up
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
237 * emitting a comment as to what Foreign call they would have made.
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
238 **/
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
239 @Override
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
240 public Variable emitForeignCall(ForeignCallLinkage linkage, DeoptimizingNode info, Value... args) {
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
241 Variable result = newVariable(Kind.Object); // linkage.getDescriptor().getResultType());
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
242
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
243 // to make the LIRVerifier happy, we move any constants into registers
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
244 Value[] argLocations = new Value[args.length];
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
245 for (int i = 0; i < args.length; i++) {
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
246 Value arg = args[i];
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
247 AllocatableValue loc = newVariable(arg.getKind());
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
248 emitMove(loc, arg);
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
249 argLocations[i] = loc;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
250 }
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
251
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
252 // here we could check the callName if we wanted to only handle certain callnames
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
253 String callName = linkage.getDescriptor().getName();
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
254 switch (argLocations.length) {
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
255 case 0:
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
256 append(new ForeignCallNoArgOp(callName, result));
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
257 break;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
258 case 1:
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
259 append(new ForeignCall1ArgOp(callName, result, argLocations[0]));
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
260 break;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
261 case 2:
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
262 append(new ForeignCall2ArgOp(callName, result, argLocations[0], argLocations[1]));
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
263 break;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
264 default:
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
265 throw new InternalError("NYI emitForeignCall " + callName + ", " + argLocations.length + ", " + linkage);
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
266 }
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
267 return result;
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
268 }
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
269
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
270 @Override
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
271 protected void emitForeignCall(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
272 // this version of emitForeignCall not used for now
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
273 }
1fdecc36c8ac HSAIL updates to integrate recent changes to the providers infrastructure.
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
274
14723
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
275 /**
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
276 * @return a compressed version of the incoming constant lifted from AMD64HotSpotLIRGenerator
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
277 */
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
278 protected static Constant compress(Constant c, CompressEncoding encoding) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
279 if (c.getKind() == Kind.Long) {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
280 return Constant.forIntegerKind(Kind.Int, (int) (((c.asLong() - encoding.base) >> encoding.shift) & 0xffffffffL), c.getPrimitiveAnnotation());
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
281 } else {
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
282 throw GraalInternalError.shouldNotReachHere();
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
283 }
4c5ed5a670ed HSAIL: implemented storing compressed constants and made HSAILHotSpotLIRGenerator implement HotSpotLIRGenerator
Doug Simon <doug.simon@oracle.com>
parents: 14633
diff changeset
284 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
285 }