comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotRegisterConfig.java @ 1433:efba53f86c4f

various fixes and enhancements * correct refmap->oopmap conversion (register numbering, stack slot numbering) * fixes for inlining (correct scoping in exception handler lookup, NPE in scope conversion) * support for "jump to runtime stub" (patching code needs to be aware of jmp instruction) * provide more information about methods (to allow inlining: has_balanced_monitors, etc.) * fixes to signature type lookup * isSubTypeOf: correct handling of array classes * RiType: componentType/arrayOf * prologue: inline cache check, icmiss stub * klass state check (resolved but not initialized) in newinstance * card table write barriers * c1x classes are optional (to allow running c1 without them) * correct for stored frame pointer in calling conventions (methods with arguments on stack) * getType(Class<?>) for some basic types, used for optimizations and folding * RiMethod/RiType: throw exception instead of silent failure on unsupported operations * RiType: resolved/unresolved array type support * refactoring: new on-demand template generation mechanism * optimizations: template specialization for no_null_check, given length, etc.
author Lukas Stadler <lukas.stadler@oracle.com>
date Thu, 16 Sep 2010 19:42:20 -0700
parents abc670a709dc
children 72cfb36c6bb2
comparison
equal deleted inserted replaced
1432:b61a43cd1255 1433:efba53f86c4f
1 /* 1 /*
2 * Copyright (c) 2009-2010 Sun Microsystems, Inc. All rights reserved. 2 * Copyright (c) 2009-2010 Sun Microsystems, Inc. All rights reserved.
3 * 3 *
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is 4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is
5 * described in this document. In particular, and without limitation, these intellectual property rights may include one 5 * described in this document. In particular, and without limitation, these intellectual property rights may include one
6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent 6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent
7 * applications in the U.S. and in other countries. 7 * applications in the U.S. and in other countries.
8 * 8 *
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard 9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard
10 * license agreement and applicable provisions of the FAR and its supplements. 10 * license agreement and applicable provisions of the FAR and its supplements.
11 * 11 *
12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered 12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered
13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and 13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and
14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. 14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries.
15 * 15 *
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. 16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
17 */ 17 */
18 package com.sun.hotspot.c1x; 18 package com.sun.hotspot.c1x;
19 19
20 import com.sun.c1x.target.amd64.AMD64; 20 import com.sun.c1x.target.amd64.AMD64;
27 import com.sun.cri.ci.CiValue; 27 import com.sun.cri.ci.CiValue;
28 import com.sun.cri.ri.RiRegisterConfig; 28 import com.sun.cri.ri.RiRegisterConfig;
29 29
30 /** 30 /**
31 * @author Thomas Wuerthinger 31 * @author Thomas Wuerthinger
32 * 32 *
33 */ 33 */
34 public class HotSpotRegisterConfig implements RiRegisterConfig { 34 public class HotSpotRegisterConfig implements RiRegisterConfig {
35 35
36 @Override 36 @Override
37 public CiRegister[] getAllocatableRegisters() { 37 public CiRegister[] getAllocatableRegisters() {
38 return new CiRegister[] { AMD64.rax, AMD64.rbx, AMD64.rcx, AMD64.rdx, AMD64.rsi, AMD64.rdi, /*AMD64.r10, */AMD64.r11, AMD64.r12, AMD64.r13, AMD64.r14, AMD64.xmm0, AMD64.xmm1, AMD64.xmm2, AMD64.xmm3, AMD64.xmm4, AMD64.xmm5, 38 return new CiRegister[] { AMD64.rax, AMD64.rbx, AMD64.rcx, AMD64.rdx, AMD64.rsi, AMD64.rdi, /* AMD64.r10, */AMD64.r11, AMD64.r12, AMD64.r13, AMD64.r14, AMD64.xmm0, AMD64.xmm1, AMD64.xmm2,
39 AMD64.xmm6, AMD64.xmm7, AMD64.xmm8, AMD64.xmm9, AMD64.xmm10, AMD64.xmm11, AMD64.xmm12, AMD64.xmm13, AMD64.xmm14, AMD64.xmm15}; 39 AMD64.xmm3, AMD64.xmm4, AMD64.xmm5, AMD64.xmm6, AMD64.xmm7, AMD64.xmm8, AMD64.xmm9, AMD64.xmm10, AMD64.xmm11, AMD64.xmm12, AMD64.xmm13, AMD64.xmm14, AMD64.xmm15};
40 } 40 }
41 41
42 private final CiRegister[] generalParameterRegisters; 42 private final CiRegister[] generalParameterRegisters;
43 private final CiRegister[] xmmParameterRegisters = new CiRegister[] { AMD64.xmm0, AMD64.xmm1, AMD64.xmm2, AMD64.xmm3, AMD64.xmm4, AMD64.xmm5, AMD64.xmm6, AMD64.xmm7}; 43 private final CiRegister[] xmmParameterRegisters = new CiRegister[] { AMD64.xmm0, AMD64.xmm1, AMD64.xmm2, AMD64.xmm3, AMD64.xmm4, AMD64.xmm5, AMD64.xmm6, AMD64.xmm7};
44 44
97 if (currentGeneral < generalParameterRegisters.length) { 97 if (currentGeneral < generalParameterRegisters.length) {
98 CiRegister register = generalParameterRegisters[currentGeneral++]; 98 CiRegister register = generalParameterRegisters[currentGeneral++];
99 locations[i] = register.asValue(kind); 99 locations[i] = register.asValue(kind);
100 } 100 }
101 break; 101 break;
102
103 case Float: 102 case Float:
104 case Double: 103 case Double:
105 if (currentXMM < xmmParameterRegisters.length) { 104 if (currentXMM < xmmParameterRegisters.length) {
106 CiRegister register = xmmParameterRegisters[currentXMM++]; 105 CiRegister register = xmmParameterRegisters[currentXMM++];
107 locations[i] = register.asValue(kind); 106 locations[i] = register.asValue(kind);
108 } 107 }
109 break; 108 break;
110
111 default: 109 default:
112 throw Util.shouldNotReachHere(); 110 throw Util.shouldNotReachHere();
113 } 111 }
114 112
115 if (locations[i] == null) { 113 if (locations[i] == null) {
116 locations[i] = CiStackSlot.get(kind.stackKind(), currentStackIndex, !outgoing); 114 // we need to adjust for the frame pointer stored on the stack, which shifts incoming arguments by one slot
115 locations[i] = CiStackSlot.get(kind.stackKind(), currentStackIndex + (outgoing ? 0 : 1), !outgoing);
117 currentStackIndex += target.spillSlots(kind); 116 currentStackIndex += target.spillSlots(kind);
118 } 117 }
119 } 118 }
120 119
121 return new CiCallingConvention(locations, currentStackIndex * target.spillSlotSize); 120 return new CiCallingConvention(locations, currentStackIndex * target.spillSlotSize);