Re: [rvm-research] Bytecode merge is disabled for aload in Baseline compiler

Lingyu Zhu <[email protected]> Mon, 20 Nov 2017 23:56:52 +0800
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CACFGcbY2DoHfp+C+wSbpfVGbDUhrRGpg4ndSkxnrPZbwWgGa4w@mail.gmail.com>
I fixed the assertion by referencing emit_resolved_getfield(). Prototype
now can build and I ran dacapo bench, it also pass.

On Mon, Nov 20, 2017 at 12:48 AM, Erik Brangs <[email protected]> wrote:

> Hi,
>
> On 19.11.2017 15:41, Lingyu Zhu wrote:
> > During digging the baseline compiler codes for ia32, I cannot understand
> the following quetion:
> >
> > In org.jikesrvm.compilers.baseline.BaselineCompiler, emit_aload()
> method comments out bcodes.peekNextOpcode(), which technically disables the
> possibility to merge with getfield. Meanwhile emit_iload(), emit_lcmp()
> allows merges. Is there any consideration for this regression?
>
> Technically, this isn't a regression because bytecode merging for aload
> was never enabled for Jikes RVM. If you enable bytecode merging (e.g. using
> the attached patch), you'll see that prototype will fail to build.
>
>
> Kind regards,
>
> Erik Brangs
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
enable_merging_and_fix_assertion.diff (text/plain, 2.7 KB)
diff --git a/rvm/src/org/jikesrvm/compilers/baseline/BaselineCompiler.java b/rvm/src/org/jikesrvm/compilers/baseline/BaselineCompiler.java
index f9fcc0e..4152e78 100644
--- a/rvm/src/org/jikesrvm/compilers/baseline/BaselineCompiler.java
+++ b/rvm/src/org/jikesrvm/compilers/baseline/BaselineCompiler.java
@@ -431,7 +431,8 @@ public abstract class BaselineCompiler extends TemplateCompilerFramework {
     if (!mergeBytecodes || basicBlockBoundary()) {
       emit_regular_aload(index);
     } else {
-      int nextBC = JBC_nop; // bcodes.peekNextOpcode();
+      //int nextBC = JBC_nop;
+      int nextBC =  bcodes.peekNextOpcode();
       switch (nextBC) {
       case JBC_getfield: {
         int gfIndex = bcodes.index();
diff --git a/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java b/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
index a92c14e..23b9258 100644
--- a/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
+++ b/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
@@ -2629,7 +2629,7 @@ public final class BaselineCompilerImpl extends BaselineCompiler {
         asm.emitMOVZX_Reg_RegDisp_Word(T0, S0, fieldOffset); // T0 is field value
         asm.emitPUSH_Reg(T0);                                // place value on stack
       } else if (fieldType.isIntType() || fieldType.isFloatType() ||
-                 (VM.BuildFor32Addr && fieldType.isWordType())) {
+                 (VM.BuildFor32Addr && fieldType.isWordLikeType())) {
         // 32bit load
         stackMoveHelper(S0, offset);                         // S0 is object reference
         if (VM.BuildFor32Addr) {
@@ -2642,7 +2642,7 @@ public final class BaselineCompilerImpl extends BaselineCompiler {
         // 64bit load
         if (VM.VerifyAssertions) {
           VM._assert(fieldType.isLongType() || fieldType.isDoubleType() ||
-                     (VM.BuildFor64Addr && fieldType.isWordType()));
+                     (VM.BuildFor64Addr && fieldType.isWordLikeType()));
         }
         stackMoveHelper(S0, offset);                  // S0 is object reference
         if (VM.BuildFor32Addr && field.isVolatile()) {
@@ -2661,7 +2661,7 @@ public final class BaselineCompilerImpl extends BaselineCompiler {
           asm.emitPUSH_RegDisp(S0, fieldOffset.plus(ONE_SLOT)); // place high half on stack
           asm.emitPUSH_RegDisp(S0, fieldOffset);                // place low half on stack
         } else {
-          if (!fieldType.isWordType()) {
+          if (!fieldType.isWordLikeType()) {
             adjustStack(-WORDSIZE, true); // add empty slot
           }
           asm.emitPUSH_RegDisp(S0, fieldOffset); // place value on stack