changeset 18153:1c4a1a46e891

Introduce FrameMapBuilderImpl.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 22 Oct 2014 17:28:05 +0200
parents ff694c40bdee
children 448be95baef8
files graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/FrameMapBuilderImpl.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java
diffstat 4 files changed, 71 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java	Wed Oct 22 16:54:51 2014 +0200
+++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineBytecodeParser.java	Wed Oct 22 17:28:05 2014 +0200
@@ -133,10 +133,11 @@
             List<? extends AbstractBlock<?>> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blockMap.blocks.size(), blockMap.startBlock);
             LIR lir = new LIR(cfg, linearScanOrder, codeEmittingOrder);
 
-            FrameMap frameMap = backend.newFrameMap(null);
+            RegisterConfig registerConfig = null;
+            FrameMapBuilder frameMapBuilder = new FrameMapBuilderImpl(backend, registerConfig);
             TargetDescription target = backend.getTarget();
             CallingConvention cc = CodeUtil.getCallingConvention(backend.getProviders().getCodeCache(), CallingConvention.Type.JavaCallee, method, false);
-            this.lirGenRes = backend.newLIRGenerationResult(lir, frameMap, method, null);
+            this.lirGenRes = backend.newLIRGenerationResult(lir, frameMapBuilder, method, null);
             this.gen = backend.newLIRGenerator(cc, lirGenRes);
             this.lirBuilder = backend.newBytecodeLIRBuilder(gen, this);
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Oct 22 16:54:51 2014 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Oct 22 17:28:05 2014 +0200
@@ -36,6 +36,7 @@
 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
 import com.oracle.graal.compiler.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
+import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
@@ -242,7 +243,7 @@
             throw Debug.handle(e);
         }
         try (Scope ds = Debug.scope("BackEnd", lir)) {
-            FrameMapBuilder frameMapBuilder = backend.newFrameMap(registerConfig);
+            FrameMapBuilder frameMapBuilder = new FrameMapBuilderImpl(backend, registerConfig);
             LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMapBuilder, graph.method(), stub);
             LIRGeneratorTool lirGen = backend.newLIRGenerator(cc, lirGenRes);
             NodeLIRBuilderTool nodeLirGen = backend.newNodeLIRBuilder(graph, lirGen);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/FrameMapBuilderImpl.java	Wed Oct 22 17:28:05 2014 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 2014, 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.compiler.gen;
+
+import java.util.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.target.*;
+import com.oracle.graal.lir.*;
+
+public class FrameMapBuilderImpl implements FrameMapBuilder {
+
+    private final FrameMap frameMap;
+
+    public FrameMapBuilderImpl(Backend backend, RegisterConfig registerConfig) {
+        this.frameMap = backend.newFrameMap(registerConfig);
+    }
+
+    public StackSlot allocateSpillSlot(LIRKind kind) {
+        return frameMap.allocateSpillSlot(kind);
+    }
+
+    public StackSlot allocateStackSlots(int slots, BitSet objects, List<StackSlot> outObjectStackSlots) {
+        return frameMap.allocateStackSlots(slots, objects, outObjectStackSlots);
+    }
+
+    public RegisterConfig getRegisterConfig() {
+        return frameMap.getRegisterConfig();
+    }
+
+    public void freeSpillSlot(StackSlot slot) {
+        frameMap.freeSpillSlot(slot);
+    }
+
+    public void callsMethod(CallingConvention cc) {
+        frameMap.callsMethod(cc);
+    }
+
+    public FrameMap buildFrameMap() {
+        frameMap.finish();
+        return frameMap;
+    }
+
+}
\ No newline at end of file
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Wed Oct 22 16:54:51 2014 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Wed Oct 22 17:28:05 2014 +0200
@@ -38,7 +38,7 @@
  * stack pointer, while spill slots are indexed from the beginning of the frame (and the total frame
  * size has to be added to get the actual offset from the stack pointer).
  */
-public abstract class FrameMap implements FrameMapBuilder {
+public abstract class FrameMap {
 
     private final TargetDescription target;
     private final RegisterConfig registerConfig;
@@ -378,10 +378,4 @@
             assert isConstant(location);
         }
     }
-
-    @Override
-    public FrameMap buildFrameMap() {
-        finish();
-        return this;
-    }
 }