Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRegisterConfig.java @ 1440:4d1d3bd140f9
Updated for changes in CRI.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 01 Nov 2010 23:50:37 +0100 |
parents | d0c8d3a2a7e8 |
children | 9196a2b32950 |
comparison
equal
deleted
inserted
replaced
1439:d0c8d3a2a7e8 | 1440:4d1d3bd140f9 |
---|---|
22 | 22 |
23 import static com.sun.c1x.target.amd64.AMD64.*; | 23 import static com.sun.c1x.target.amd64.AMD64.*; |
24 | 24 |
25 import java.util.*; | 25 import java.util.*; |
26 | 26 |
27 import com.sun.c1x.target.amd64.AMD64; | 27 import com.sun.c1x.target.amd64.*; |
28 import com.sun.c1x.util.Util; | 28 import com.sun.c1x.util.*; |
29 import com.sun.cri.ci.CiCallingConvention; | 29 import com.sun.cri.ci.*; |
30 import com.sun.cri.ci.CiKind; | 30 import com.sun.cri.ci.CiCallingConvention.Type; |
31 import com.sun.cri.ci.CiRegister; | 31 import com.sun.cri.ci.CiRegister.RegisterFlag; |
32 import com.sun.cri.ci.CiStackSlot; | |
33 import com.sun.cri.ci.CiTarget; | |
34 import com.sun.cri.ci.CiValue; | |
35 import com.sun.cri.ci.CiRegister.*; | |
36 import com.sun.cri.ri.*; | 32 import com.sun.cri.ri.*; |
37 | 33 |
38 /** | 34 /** |
39 * @author Thomas Wuerthinger | 35 * @author Thomas Wuerthinger |
40 * | 36 * |
67 return attributesMap; | 63 return attributesMap; |
68 } | 64 } |
69 | 65 |
70 private final CiRegister[] generalParameterRegisters; | 66 private final CiRegister[] generalParameterRegisters; |
71 private final CiRegister[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7}; | 67 private final CiRegister[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7}; |
68 private final CiRegister[] allParameterRegisters; | |
72 | 69 |
73 public HotSpotRegisterConfig(HotSpotVMConfig config) { | 70 public HotSpotRegisterConfig(HotSpotVMConfig config) { |
74 if (config.windowsOs) { | 71 if (config.windowsOs) { |
75 generalParameterRegisters = new CiRegister[] {rdx, r8, r9, rdi, rsi, rcx}; | 72 generalParameterRegisters = new CiRegister[] {rdx, r8, r9, rdi, rsi, rcx}; |
76 } else { | 73 } else { |
77 generalParameterRegisters = new CiRegister[] {rsi, rdx, rcx, r8, r9, rdi}; | 74 generalParameterRegisters = new CiRegister[] {rsi, rdx, rcx, r8, r9, rdi}; |
78 } | 75 } |
79 attributesMap = RiRegisterAttributes.createMap(this, AMD64.allRegisters); | 76 attributesMap = RiRegisterAttributes.createMap(this, AMD64.allRegisters); |
77 allParameterRegisters = Arrays.copyOf(generalParameterRegisters, generalParameterRegisters.length + xmmParameterRegisters.length); | |
78 System.arraycopy(xmmParameterRegisters, 0, allParameterRegisters, generalParameterRegisters.length, xmmParameterRegisters.length); | |
80 } | 79 } |
81 | 80 |
82 @Override | 81 @Override |
83 public CiRegister[] getCallerSaveRegisters() { | 82 public CiRegister[] getCallerSaveRegisters() { |
84 return getAllocatableRegisters(); | 83 return getAllocatableRegisters(); |
95 public CiRegister getRegister(int index) { | 94 public CiRegister getRegister(int index) { |
96 throw new UnsupportedOperationException(); | 95 throw new UnsupportedOperationException(); |
97 } | 96 } |
98 | 97 |
99 @Override | 98 @Override |
100 public CiCallingConvention getJavaCallingConvention(CiKind[] parameters, boolean outgoing, CiTarget target) { | 99 public CiCallingConvention getCallingConvention(Type type, CiKind[] parameters, boolean outgoing, CiTarget target) { |
101 return callingConvention(parameters, outgoing, target); | 100 if (type == Type.Native) { |
101 throw new UnsupportedOperationException(); | |
102 } | |
103 return callingConvention(parameters, type == Type.Runtime ? true : outgoing, target); | |
104 } | |
105 | |
106 public CiRegister[] getCallingConventionRegisters(Type type) { | |
107 return allParameterRegisters; | |
102 } | 108 } |
103 | 109 |
104 private CiCallingConvention callingConvention(CiKind[] types, boolean outgoing, CiTarget target) { | 110 private CiCallingConvention callingConvention(CiKind[] types, boolean outgoing, CiTarget target) { |
105 CiValue[] locations = new CiValue[types.length]; | 111 CiValue[] locations = new CiValue[types.length]; |
106 | 112 |
145 | 151 |
146 return new CiCallingConvention(locations, currentStackIndex * target.spillSlotSize); | 152 return new CiCallingConvention(locations, currentStackIndex * target.spillSlotSize); |
147 } | 153 } |
148 | 154 |
149 @Override | 155 @Override |
150 public CiCallingConvention getNativeCallingConvention(CiKind[] parameters, boolean outgoing, CiTarget target) { | |
151 throw new UnsupportedOperationException(); | |
152 } | |
153 | |
154 @Override | |
155 public CiRegister getReturnRegister(CiKind kind) { | 156 public CiRegister getReturnRegister(CiKind kind) { |
156 switch (kind) { | 157 switch (kind) { |
157 case Boolean: | 158 case Boolean: |
158 case Byte: | 159 case Byte: |
159 case Char: | 160 case Char: |
173 throw new UnsupportedOperationException("no return register for type " + kind); | 174 throw new UnsupportedOperationException("no return register for type " + kind); |
174 } | 175 } |
175 } | 176 } |
176 | 177 |
177 @Override | 178 @Override |
178 public CiCallingConvention getRuntimeCallingConvention(CiKind[] parameters, CiTarget target) { | |
179 return callingConvention(parameters, true, target); | |
180 } | |
181 | |
182 @Override | |
183 public CiRegister getScratchRegister() { | 179 public CiRegister getScratchRegister() { |
184 return r10; | 180 return r10; |
185 } | 181 } |
186 | 182 |
187 @Override | 183 @Override |