SF.net SVN: jikesrvm:[15738] rvmroot/trunk/rvm/src/org/jikesrvm

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: jikesrvm:[15738] rvmroot/trunk/rvm/src/org/jikesrvm

by dframpton-oss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 15738
          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15738&view=rev
Author:   dframpton-oss
Date:     2009-07-23 02:15:57 +0000 (Thu, 23 Jul 2009)

Log Message:
-----------
RVM-841

Modified Paths:
--------------
    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineMagic.java
    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/BaselineCompilerImpl.java
    rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/GenerateMagic.java
    rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Magic.java
    rvmroot/trunk/rvm/src/org/jikesrvm/runtime/MagicNames.java

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineMagic.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineMagic.java 2009-07-23 01:48:35 UTC (rev 15737)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineMagic.java 2009-07-23 02:15:57 UTC (rev 15738)
@@ -2094,4 +2094,33 @@
     MagicGenerator g = new Dsqrt();
     generators.put(getMethodReference(Magic.class, MagicNames.sqrt, double.class, double.class), g);
   }
+
+  /**
+   * Return the current inlining depth (always 0 for baseline)
+   */
+  private static final class GetInlineDepth extends MagicGenerator {
+    @Override
+    void generateMagic(Assembler asm, MethodReference m, RVMMethod cm, Offset sd) {
+      asm.emitPUSH_Imm(0);
+    }
+  }
+  static {
+    MagicGenerator g = new GetInlineDepth();
+    generators.put(getMethodReference(Magic.class, MagicNames.getInlineDepth, int.class), g);
+  }
+
+  /**
+   * Is the requested parameter a constant? Always false for baseline.
+   */
+  private static final class IsConstantParameter extends MagicGenerator {
+    @Override
+    void generateMagic(Assembler asm, MethodReference m, RVMMethod cm, Offset sd) {
+      asm.emitPOP_Reg(T0);
+      asm.emitPUSH_Imm(0);
+    }
+  }
+  static {
+    MagicGenerator g = new IsConstantParameter();
+    generators.put(getMethodReference(Magic.class, MagicNames.isConstantParameter, int.class, boolean.class), g);
+  }
 }

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/BaselineCompilerImpl.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/BaselineCompilerImpl.java 2009-07-23 01:48:35 UTC (rev 15737)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/ppc/BaselineCompilerImpl.java 2009-07-23 02:15:57 UTC (rev 15738)
@@ -4881,6 +4881,9 @@
         asm.emitFSQRT(F0, F0);
         pushDouble(F0);
       }
+    } else if (methodName == MagicNames.getInlineDepth ||
+               methodName == MagicNames.isConstantParameter) {
+      emit_iconst(0);
     } else if (methodName == MagicNames.wordToInt ||
                methodName == MagicNames.wordToAddress ||
                methodName == MagicNames.wordToOffset ||

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/GenerateMagic.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/GenerateMagic.java 2009-07-23 01:48:35 UTC (rev 15737)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/GenerateMagic.java 2009-07-23 02:15:57 UTC (rev 15738)
@@ -75,6 +75,7 @@
 import org.jikesrvm.classloader.MethodReference;
 import org.jikesrvm.classloader.TypeReference;
 import org.jikesrvm.compilers.opt.MagicNotImplementedException;
+import org.jikesrvm.compilers.opt.OptimizingCompilerException;
 import org.jikesrvm.compilers.opt.ir.Attempt;
 import org.jikesrvm.compilers.opt.ir.Binary;
 import org.jikesrvm.compilers.opt.ir.BooleanCmp;
@@ -733,6 +734,16 @@
       RegisterOperand op0 = gc.temps.makeTempLong();
       bc2ir.appendInstruction(Nullary.create(GET_TIME_BASE, op0));
       bc2ir.pushDual(op0.copyD2U());
+    } else if (methodName == MagicNames.getInlineDepth) {
+      bc2ir.push(new IntConstantOperand(gc.inlineSequence.getInlineDepth()));
+    } else if (methodName == MagicNames.isConstantParameter) {
+      Operand requestedOperand = bc2ir.pop();
+      if (!(requestedOperand instanceof IntConstantOperand)) {
+        throw new OptimizingCompilerException("Must supply constant to Magic.isConstantParameter");
+      }
+      int requested = ((IntConstantOperand)(requestedOperand)).value;
+      boolean isConstant = gc.arguments[requested].isConstant();
+      bc2ir.push(new IntConstantOperand(isConstant ? 1 : 0));
     } else {
       // Wasn't machine-independent, so try the machine-dependent magics next.
       return GenerateMachineSpecificMagic.generateMagic(bc2ir, gc, meth);

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Magic.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Magic.java 2009-07-23 01:48:35 UTC (rev 15737)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Magic.java 2009-07-23 02:15:57 UTC (rev 15738)
@@ -896,5 +896,25 @@
     }
     return -1.0d; // which should upset them even if assertions aren't enabled ...
   }
+
+  /**
+   * How deeply inlined is this method (0 means no inlining).
+   */
+  public static int getInlineDepth() {
+    if (VM.runningVM && VM.VerifyAssertions) {
+      VM._assert(VM.NOT_REACHED);  // call site should have been hijacked by magic in compiler
+    }
+    return 0;
+  }
+
+  /**
+   * Is the specified parameter constant (due to either inlining or specialization).
+   * Count starts at zero and includes the 'this' parameter for instance methods.
+   */
+  public static boolean isConstantParameter(int index) {
+    if (VM.runningVM && VM.VerifyAssertions) {
+      VM._assert(VM.NOT_REACHED);  // call site should have been hijacked by magic in compiler
+    }
+    return false;
+  }
 }
-

Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/MagicNames.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/MagicNames.java 2009-07-23 01:48:35 UTC (rev 15737)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/MagicNames.java 2009-07-23 02:15:57 UTC (rev 15738)
@@ -64,6 +64,9 @@
   public static final Atom pause = Atom.findOrCreateAsciiAtom("pause");
   public static final Atom sqrt  = Atom.findOrCreateAsciiAtom("sqrt");
 
+  public static final Atom getInlineDepth = Atom.findOrCreateAsciiAtom("getInlineDepth");
+  public static final Atom isConstantParameter = Atom.findOrCreateAsciiAtom("isConstantParameter");
+
   public static final Atom getUnsignedByteAtOffset = Atom.findOrCreateAsciiAtom("getUnsignedByteAtOffset");
   public static final Atom getByteAtOffset = Atom.findOrCreateAsciiAtom("getByteAtOffset");
   public static final Atom getShortAtOffset = Atom.findOrCreateAsciiAtom("getShortAtOffset");


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits