changeset 6416:2e2a6418d45d

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 17 Sep 2012 18:36:03 +0200
parents 033f95af9cd7 (current diff) 258d3e0b5a65 (diff)
children 6fed95768f8f
files
diffstat 5 files changed, 122 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegisterConfig.java	Mon Sep 17 18:35:06 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegisterConfig.java	Mon Sep 17 18:36:03 2012 +0200
@@ -119,15 +119,15 @@
         return allParameterRegisters;
     }
 
-    private CallingConvention callingConvention(Kind[] types, Type type, TargetDescription target, boolean stackOnly) {
-        Value[] locations = new Value[types.length];
+    private CallingConvention callingConvention(Kind[] kinds, Type type, TargetDescription target, boolean stackOnly) {
+        Value[] locations = new Value[kinds.length];
 
         int currentGeneral = 0;
         int currentXMM = 0;
         int currentStackOffset = 0;
 
-        for (int i = 0; i < types.length; i++) {
-            final Kind kind = types[i];
+        for (int i = 0; i < kinds.length; i++) {
+            final Kind kind = kinds[i];
 
             switch (kind) {
                 case Byte:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64BreakpointOp.java	Mon Sep 17 18:36:03 2012 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011, 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.lir.LIRInstruction.OperandFlag.*;
+
+import com.oracle.graal.api.meta.*;
+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.*;
+
+/**
+ * Emits a breakpoint.
+ */
+@Opcode("BREAKPOINT")
+public class AMD64BreakpointOp extends AMD64LIRInstruction {
+
+    /**
+     * A set of values loaded into the Java ABI parameter locations (for inspection by a debugger).
+     */
+    @Use({REG, STACK}) protected Value[] parameters;
+
+    public AMD64BreakpointOp(Value[] parameters) {
+        this.parameters = parameters;
+    }
+
+    @Override
+    public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler asm) {
+        asm.int3();
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Mon Sep 17 18:35:06 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Mon Sep 17 18:36:03 2012 +0200
@@ -27,6 +27,7 @@
 import static com.oracle.max.asm.target.amd64.AMD64.*;
 
 import java.lang.reflect.*;
+import java.util.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
@@ -106,6 +107,20 @@
         }
 
         @Override
+        public void visitBreakpointNode(BreakpointNode i) {
+            Kind[] sig = new Kind[i.arguments.size()];
+            int pos = 0;
+            for (ValueNode arg : i.arguments) {
+                sig[pos++] = arg.kind();
+            }
+
+            CallingConvention cc = frameMap.registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, sig, target(), false);
+            List<Value> argList = visitInvokeArguments(cc, i.arguments);
+            Value[] parameters = argList.toArray(new Value[argList.size()]);
+            append(new AMD64BreakpointOp(parameters));
+        }
+
+        @Override
         public void visitExceptionObject(ExceptionObjectNode x) {
             HotSpotVMConfig config = ((HotSpotRuntime) runtime).config;
             RegisterValue thread = config.threadRegister.asValue();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Mon Sep 17 18:36:03 2012 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011, 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.nodes;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
+
+/**
+ * A node that results in a platform dependent breakpoint instruction being emitted.
+ * A number of arguments can be associated with such a node for placing values of
+ * interest in the Java ABI specified parameter locations corresponding to the
+ * kinds of the values. That is, the arguments are set up as if the breakpoint instruction
+ * was a call to a compiled Java method.
+ */
+public final class BreakpointNode extends FixedWithNextNode implements LIRLowerable {
+
+    @Input
+    public final NodeInputList<ValueNode> arguments;
+
+    public BreakpointNode(ValueNode... arguments) {
+        super(StampFactory.forVoid());
+        this.arguments = new NodeInputList<>(this, arguments);
+    }
+
+    @Override
+    public void generate(LIRGeneratorTool gen) {
+        gen.visitBreakpointNode(this);
+    }
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Mon Sep 17 18:35:06 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Mon Sep 17 18:36:03 2012 +0200
@@ -102,6 +102,7 @@
     public abstract void visitEndNode(EndNode i);
     public abstract void visitLoopEnd(LoopEndNode i);
     public abstract void visitSafepointNode(SafepointNode i);
+    public abstract void visitBreakpointNode(BreakpointNode i);
 
     public abstract void visitCompareAndSwap(CompareAndSwapNode i);