# HG changeset patch # User Doug Simon # Date 1349182987 -7200 # Node ID e11b2c8f374b17aa9c35547b0fdb4f6e610f8b16 # Parent f0db2c717f6e0feeb6f5844a0b82cd12f359ca27 modified NewInstanceStubCall to use information provided by the (platform independent) backend instead of AMD64 specific nodes for linking the stub call diff -r f0db2c717f6e -r e11b2c8f374b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Tue Oct 02 14:58:13 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Tue Oct 02 15:03:07 2012 +0200 @@ -22,22 +22,16 @@ */ package com.oracle.graal.hotspot.nodes; -import static com.oracle.graal.hotspot.target.amd64.AMD64NewInstanceStubCallOp.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.target.amd64.*; +import com.oracle.graal.hotspot.target.*; import com.oracle.graal.lir.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.type.*; /** * Node implementing a call to HotSpot's {@code new_instance} stub. - * - * @see AMD64NewInstanceStubCallOp */ public class NewInstanceStubCall extends FixedWithNextNode implements LIRGenLowerable { @@ -62,12 +56,9 @@ @Override public void generate(LIRGenerator gen) { - RegisterValue hubFixed = HUB.asValue(Kind.Object); - RegisterValue resultFixed = RESULT.asValue(Kind.Object); - gen.emitMove(gen.operand(hub), hubFixed); - LIRFrameState info = gen.state(); - gen.append(new AMD64NewInstanceStubCallOp(resultFixed, hubFixed, info)); - Variable result = gen.emitMove(resultFixed); + HotSpotBackend backend = (HotSpotBackend) HotSpotGraalRuntime.getInstance().getCompiler().backend; + HotSpotStub stub = backend.getStub("new_instance"); + Variable result = gen.emitCall(stub.address, stub.cc, true, gen.operand(hub)); gen.setResult(this, result); } diff -r f0db2c717f6e -r e11b2c8f374b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewInstanceStubCallOp.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewInstanceStubCallOp.java Tue Oct 02 14:58:13 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.target.amd64; - -import static com.oracle.graal.api.code.ValueUtil.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.Opcode; -import com.oracle.graal.lir.amd64.*; -import com.oracle.graal.lir.asm.*; -import com.oracle.max.asm.target.amd64.*; - -/** - * LIR instruction for calling HotSpot's {@code new_instance} stub. This stub is declared in c1_Runtime1.hpp - * and implemented in Runtime1::generate_code_for() which is located in c1_Runtime1_x86.cpp. - */ -@Opcode("NEW_INSTANCE_STUB") -public class AMD64NewInstanceStubCallOp extends AMD64LIRInstruction { - - /** - * The stub expects the hub in RDX. - */ - public static final Register HUB = AMD64.rdx; - - /** - * The stub places the result in RAX. - */ - public static final Register RESULT = AMD64.rax; - - @Def protected Value result; - @Use protected Value hub; - @State protected LIRFrameState state; - - public AMD64NewInstanceStubCallOp(Value result, Value hub, LIRFrameState state) { - this.hub = hub; - this.result = result; - this.state = state; - } - - @Override - public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - AMD64Call.directCall(tasm, masm, HotSpotGraalRuntime.getInstance().getConfig().newInstanceStub, state); - } - - @Override - protected void verify() { - super.verify(); - assert asRegister(hub) == HUB : "expects hub in " + HUB; - assert asRegister(result) == RESULT : "expects result in " + RESULT; - } -} diff -r f0db2c717f6e -r e11b2c8f374b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Tue Oct 02 14:58:13 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java Tue Oct 02 15:03:07 2012 +0200 @@ -84,7 +84,12 @@ /* ret */ rax.asValue(Kind.Object), /* arg0: hub */ rdx.asValue(Kind.Object), /* arg1: length */ rbx.asValue(Kind.Int)); -} + + addStub("new_instance", c.newInstanceStub, + /* temps */ null, + /* ret */ rax.asValue(Kind.Object), + /* arg0: hub */ rdx.asValue(Kind.Object)); + } @Override public LIRGenerator newLIRGenerator(Graph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {