Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotXirGenerator.java @ 2217:2a36994d0967
Fixed an issue where parameter registers were hard coded to Linux values.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Mon, 21 Feb 2011 21:16:29 +0100 |
parents | eed52202caea |
children | 569d3fe7d65c |
comparison
equal
deleted
inserted
replaced
2216:b966d9b66bf9 | 2217:2a36994d0967 |
---|---|
27 import java.util.*; | 27 import java.util.*; |
28 import java.util.concurrent.*; | 28 import java.util.concurrent.*; |
29 | 29 |
30 import com.sun.c1x.target.amd64.*; | 30 import com.sun.c1x.target.amd64.*; |
31 import com.sun.cri.ci.CiAddress.Scale; | 31 import com.sun.cri.ci.CiAddress.Scale; |
32 import com.sun.cri.ci.CiRegister.*; | |
32 import com.sun.cri.ci.*; | 33 import com.sun.cri.ci.*; |
33 import com.sun.cri.ri.*; | 34 import com.sun.cri.ri.*; |
34 import com.sun.cri.ri.RiType.Representation; | 35 import com.sun.cri.ri.RiType.Representation; |
35 import com.sun.cri.xir.*; | 36 import com.sun.cri.xir.*; |
36 import com.sun.cri.xir.CiXirAssembler.XirLabel; | 37 import com.sun.cri.xir.CiXirAssembler.XirLabel; |
318 // (tw) It is important to use for this runtime call the debug info AFTER the monitor enter. Otherwise the monitor object | 319 // (tw) It is important to use for this runtime call the debug info AFTER the monitor enter. Otherwise the monitor object |
319 // is not correctly garbage collected. | 320 // is not correctly garbage collected. |
320 final boolean useInfoAfter = true; | 321 final boolean useInfoAfter = true; |
321 | 322 |
322 if (config.useFastLocking) { | 323 if (config.useFastLocking) { |
323 useRegisters(asm, AMD64.rbx, AMD64.rsi, AMD64.rdx, AMD64.rax); | 324 useRegisters(asm, AMD64.rax, AMD64.rbx); |
325 useRegisters(asm, getGeneralParameterRegister(0)); | |
326 useRegisters(asm, getGeneralParameterRegister(1)); | |
324 asm.callRuntime(config.fastMonitorEnterStub, null, useInfoAfter, object, lock); | 327 asm.callRuntime(config.fastMonitorEnterStub, null, useInfoAfter, object, lock); |
325 } else { | 328 } else { |
326 asm.reserveOutgoingStack(target.wordSize * 2); | 329 asm.reserveOutgoingStack(target.wordSize * 2); |
327 asm.pstore(CiKind.Object, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(target.wordSize), object, false); | 330 asm.pstore(CiKind.Object, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(target.wordSize), object, false); |
328 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); | 331 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); |
331 | 334 |
332 return asm.finishTemplate("monitorEnter"); | 335 return asm.finishTemplate("monitorEnter"); |
333 } | 336 } |
334 }; | 337 }; |
335 | 338 |
339 private static CiRegister getGeneralParameterRegister(int index) { | |
340 return Compiler.getInstance().getRegisterConfig().getCallingConventionRegisters(CiCallingConvention.Type.RuntimeCall, RegisterFlag.CPU)[index]; | |
341 } | |
342 | |
336 private SimpleTemplates monitorExitTemplates = new SimpleTemplates(NULL_CHECK) { | 343 private SimpleTemplates monitorExitTemplates = new SimpleTemplates(NULL_CHECK) { |
337 | 344 |
338 @Override | 345 @Override |
339 protected XirTemplate create(CiXirAssembler asm, long flags) { | 346 protected XirTemplate create(CiXirAssembler asm, long flags) { |
340 asm.restart(CiKind.Void); | 347 asm.restart(CiKind.Void); |
341 XirParameter object = asm.createInputParameter("object", CiKind.Object); | 348 XirParameter object = asm.createInputParameter("object", CiKind.Object); |
342 XirParameter lock = asm.createInputParameter("lock", CiKind.Word); | 349 XirParameter lock = asm.createInputParameter("lock", CiKind.Word); |
343 | 350 |
344 if (config.useFastLocking) { | 351 if (config.useFastLocking) { |
345 useRegisters(asm, AMD64.rbx, AMD64.rsi, AMD64.rdx, AMD64.rax); | 352 useRegisters(asm, AMD64.rax, AMD64.rbx); |
353 useRegisters(asm, getGeneralParameterRegister(0)); | |
354 useRegisters(asm, getGeneralParameterRegister(1)); | |
346 asm.callRuntime(config.fastMonitorExitStub, null, object, lock); | 355 asm.callRuntime(config.fastMonitorExitStub, null, object, lock); |
347 } else { | 356 } else { |
348 asm.reserveOutgoingStack(target.wordSize); | 357 asm.reserveOutgoingStack(target.wordSize); |
349 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); | 358 asm.pstore(CiKind.Word, asm.createRegister("rsp", CiKind.Word, AMD64.RSP.asRegister()), asm.i(0), lock, false); |
350 asm.callRuntime(config.monitorExitStub, null); | 359 asm.callRuntime(config.monitorExitStub, null); |