Mercurial > hg > graal-compiler
changeset 6364:07da50ea3275
thread register is now retrieved from HotSpotVMConfig instead of being hard coded
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 12 Sep 2012 12:51:54 +0200 |
parents | a73fcf1639fc |
children | 75199c01d2b3 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java |
diffstat | 6 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Sep 12 12:51:54 2012 +0200 @@ -22,6 +22,9 @@ */ package com.oracle.graal.hotspot; +import com.oracle.graal.api.code.*; +import com.oracle.max.asm.target.amd64.*; + /** * Used to communicate configuration details, runtime offsets, etc. to graal upon compileMethod. @@ -148,6 +151,9 @@ public long fastMonitorExitStub; public long verifyOopStub; + // special registers + public final Register threadRegister = AMD64.r15; + public void check() { assert vmPageSize >= 16; assert codeEntryAlignment > 0;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java Wed Sep 12 12:51:54 2012 +0200 @@ -22,9 +22,9 @@ */ package com.oracle.graal.hotspot.nodes; -import com.oracle.max.asm.target.amd64.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.hotspot.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -39,8 +39,9 @@ } @Override - public void generate(LIRGeneratorTool generator) { - generator.setResult(this, generator.emitLoad(new Address(Kind.Object, AMD64.r15.asValue(generator.target().wordKind), threadObjectOffset), false)); + public void generate(LIRGeneratorTool gen) { + Register thread = HotSpotGraalRuntime.getInstance().getConfig().threadRegister; + gen.setResult(this, gen.emitLoad(new Address(Kind.Object, thread.asValue(gen.target().wordKind), threadObjectOffset), false)); } @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Wed Sep 12 12:51:54 2012 +0200 @@ -62,6 +62,11 @@ } @Fold + static Register threadReg() { + return HotSpotGraalRuntime.getInstance().getConfig().threadRegister; + } + + @Fold static Register stackPointerReg() { return AMD64.rsp; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Sep 12 12:51:54 2012 +0200 @@ -55,7 +55,7 @@ @Snippet public static Word allocate(@Parameter("size") int size) { - Word thread = asWord(register(r15, wordKind())); + Word thread = asWord(register(threadReg(), wordKind())); Word top = loadWord(thread, threadTlabTopOffset()); Word end = loadWord(thread, threadTlabEndOffset()); Word newTop = top.plus(size);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Wed Sep 12 12:51:54 2012 +0200 @@ -110,7 +110,7 @@ @Override public void visitExceptionObject(ExceptionObjectNode x) { HotSpotVMConfig config = ((HotSpotRuntime) runtime).config; - RegisterValue thread = r15.asValue(); + RegisterValue thread = config.threadRegister.asValue(); Address exceptionAddress = new Address(Kind.Object, thread, config.threadExceptionOopOffset); Address pcAddress = new Address(Kind.Long, thread, config.threadExceptionPcOffset); Value exception = emitLoad(exceptionAddress, false);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java Wed Sep 12 12:45:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java Wed Sep 12 12:51:54 2012 +0200 @@ -284,7 +284,7 @@ asm.pload(Kind.Int, temp2i, hub, asm.i(config.klassStateOffset), false); asm.jneq(tlabFull, temp2i, asm.i(config.klassStateFullyInitialized)); - XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, AMD64.r15); + XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, config.threadRegister); asm.pload(target.wordKind, result, thread, asm.i(config.threadTlabTopOffset), false); asm.add(temp1, result, wordConst(asm, size)); asm.pload(target.wordKind, temp2, thread, asm.i(config.threadTlabEndOffset), false); @@ -372,7 +372,7 @@ asm.and(size, size, asm.i((int) mask)); // Try tlab allocation - XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, AMD64.r15); + XirOperand thread = asm.createRegisterTemp("thread", target.wordKind, config.threadRegister); asm.pload(target.wordKind, result, thread, asm.i(config.threadTlabTopOffset), false); asm.add(temp1, result, size); asm.pload(target.wordKind, temp2, thread, asm.i(config.threadTlabEndOffset), false); @@ -426,7 +426,7 @@ XirOperand hub = asm.createRegisterTemp("hub", Kind.Object, AMD64.rax); XirOperand rank = asm.createRegisterTemp("rank", Kind.Int, AMD64.rbx); XirOperand sizes = asm.createRegisterTemp("sizes", Kind.Long, AMD64.rcx); - XirOperand thread = asm.createRegisterTemp("thread", Kind.Long, AMD64.r15); + XirOperand thread = asm.createRegisterTemp("thread", Kind.Long, config.threadRegister); asm.add(sizes, thread, asm.l(config.threadMultiNewArrayStorageOffset)); for (int i = 0; i < dimensions; i++) { XirParameter length = asm.createInputParameter("length" + i, Kind.Int, true);