Re: [rvm-research] Compilation error when trying to install Jikes 3.0.0

Erik Brangs <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi,

On 20.01.2015 18:51, xeonmailinglist wrote:
> thank you for the reply, but I still have a problem applying the patch.
> I have downloaded the patch from http://jira.codehaus.org/browse/RVM-1004
> I have tried with |patch -p1| and |patch -p2| and I get the error below. Am I applying the patch wrong?
You're not applying the patch wrong. The problen is that the patch on the issue tracker is intended for the 3.1.x series. The patch needs to be adjusted to cleanly apply to Jikes RVM 3.0.0.

I've attached a version of the patch for 3.0.0 to this mail.

On 19.01.2015 18:24, xeonmailinglist wrote:
> The problem is that when I compile Jikes I have the error below. This error is independent of the patch because I have also tried without applying the patch, and I get the same error.
> 
> I don’t understand why I get this error, [...]
Your build environment differs from the build environment that was used to build Jikes RVM 3.0.0 back then. More specifically, you're using a newer JDK to build Jikes RVM.

The newer JDK has exposed a bug in the Jikes RVM that was not exposed by older JDKs. You can either use a JDK that was available when Jikes RVM 3.0.0 was current or apply appropriate changes to your modified Jikes RVM to fix up any issues that come up.


Kind regards,

Erik Brangs

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet

_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
RVM-1004-backport-3.0.0.patch (text/x-patch, 2.7 KB)
diff --git a/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java b/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java
--- a/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java
+++ b/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java
@@ -1597,23 +1597,38 @@
             }
 
             // optimization: if the field is final and either
-            // initialized or we're writing the bootimage and in an
-            // RVM bootimage class, then get the value at compile
-            // time.
+            // initialized or we're writing the bootimage and the field
+            // is from a suitable class, then get the value at compile time
             if (field.isFinal()) {
               RVMClass declaringClass = field.getDeclaringClass();
-              if (declaringClass.isInitialized() || declaringClass.isInBootImage()) {
+
+              boolean initializedClassAtRuntime = VM.runningVM & declaringClass.isInitialized();
+              boolean fieldFromRVMInternalClassInBootImage = declaringClass.isInBootImage() &&
+                  declaringClass.getDescriptor().isRVMDescriptor();
+              // We cannot assume that non-public fields from the host JVM's class library are present in
+              // the class library used by Jikes RVM: only public fields are part of the API.
+              boolean publicFieldInBootImage = declaringClass.isInBootImage() &&
+                  field.isPublic();
+
+              if (initializedClassAtRuntime || fieldFromRVMInternalClassInBootImage ||
+                  publicFieldInBootImage) {
                 try {
                   ConstantOperand rhs = StaticFieldReader.getStaticFieldValue(field);
                   // VM.sysWrite("Replaced getstatic of "+field+" with "+rhs+"\n");
                   push(rhs, fieldType);
                   break;
                 } catch (NoSuchFieldException e) {
-                  if (VM.runningVM) { // this is unexpected
+                  if (VM.runningVM) {
                     throw new Error("Unexpected exception", e);
                   } else {
                     // Field not found during bootstrap due to chasing a field
-                    // only valid in the bootstrap JVM
+                    // only valid in the bootstrap JVM.
+                    
+                    // Although we try to avoid most cases where this could happen, we cannot
+                    // avoid all. For example, a NoSuchFieldException can occur when we're trying
+                    // to optimize a public field from Jikes RVM's class library that's not present
+                    // in the host JVM's class library (example: a field from an internal
+                    // helper class).
                   }
                 }
               }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.