[rvm-research] [patch] conditionally insert emitMFENCE into unresolved putstatic and putfield

Lingyu Zhu <[email protected]> Sun, 26 Nov 2017 23:23:14 +0800
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CACFGcbbKQxu+hCbbvX2-X6+jGaaycMQdzh-38RpJwxtDqbJAJQ@mail.gmail.com>
BTW, In the emitMFENCE implementation, the true MFENCE instruction is
commented out. I don't see any discussion about it in JIRA. I will test the
true MFENCE version. Is there any volatile store test in RVM?

------------------------------------------------------------------------------
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
0001-make-emitMFENCE-conditional-in-emit_unresolved_putst.patch (application/octet-stream, 1.3 KB)
From 38bdd9349e4e20571929e5ca8efe4e920fdcc9f0 Mon Sep 17 00:00:00 2001
From: Lingyu Zhu <[email protected]>
Date: Sun, 26 Nov 2017 22:14:18 +0800
Subject: [PATCH] make emitMFENCE conditional in emit_unresolved_putstatic()
 and emit_unresolved_putfield(). mfence instruction is expensive opcode, we
 should be serious about it.

---
 .../jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java b/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
index 36e7efa..a70248c 100644
--- a/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
+++ b/rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompilerImpl.java
@@ -2434,7 +2434,9 @@ public final class BaselineCompilerImpl extends BaselineCompiler {
       }
     }
     // The field may be volatile
-    asm.emitMFENCE();
+    if (fieldRef.peekResolvedField().isVolatile()) {
+      asm.emitMFENCE();
+    }
   }
 
   @Override
@@ -2808,7 +2810,9 @@ public final class BaselineCompilerImpl extends BaselineCompiler {
       }
     }
     // The field may be volatile.
-    asm.emitMFENCE();
+    if (fieldRef.peekResolvedField().isVolatile()) {
+      asm.emitMFENCE();
+    }
   }
 
   @Override
-- 
2.7.4