Revision: 12375
http://svn.sourceforge.net/jikesrvm/?rev=12375&view=rev
Author: dgrove-oss
Date: 2007-05-29 10:39:13 -0700 (Tue, 29 May 2007)
Log Message:
-----------
Probable fix for 1725306 (header corruption on Eclipse).
As reported by Daniel & Steve, the problem is that the
code in OPT_ExpandRuntimeServices in the opt compiler was
improperly getting a default value (null === 0) for the offset
of the thin lock word when the compile time type of the object
being synchronized on was an interface.
In the default object model, all objects have thin locks
and they are always at the same fixed offset. However, the
code still has some support for other object models (in particular
the ECOOP'02 paper by Bacon, Fink, and Grove) where the thin lock
may be at different offsets for different types.
The real fix is in the VM_Class changes:
(1) in resolve we set thinLockOffset to Offset.max() for interfaces
(2) assert(isResolved()) in getThinLockOffset to catch us trying
to look at thinLockOffset before it has a valid value.
I also did a minor cleanup by removing setThinLockOffset as an
abstract method of VM_Type and left it only as a method on VM_Class and
made it more explicit that arrays always have a thinlock word,
and it is always at the default offset.
Modified Paths:
--------------
rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Array.java
rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Class.java
rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Primitive.java
rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Type.java
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Array.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Array.java 2007-05-29 14:03:49 UTC (rev 12374)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Array.java 2007-05-29 17:39:13 UTC (rev 12375)
@@ -107,13 +107,6 @@
private boolean inBootImage;
/**
- * At what offset is the thin lock word to be found in instances of
- * objects of this type? A value of -1 indicates that the instances of
- * this type do not have inline thin locks.
- */
- private Offset thinLockOffset;
-
- /**
* The memory manager's notion of this type created after the
* resolving
*/
@@ -372,22 +365,14 @@
/**
* Get the offset in instances of this type assigned to the thin lock word.
- * -1 if instances of this type do not have thin lock words.
+ * Offset.max() if instances of this type do not have thin lock words.
*/
@Uninterruptible
public Offset getThinLockOffset() {
- return thinLockOffset;
+ return VM_ObjectModel.defaultThinLockOffset();
}
/**
- * Set the thin lock offset for instances of this type
- */
- public void setThinLockOffset(Offset offset) {
- if (VM.VerifyAssertions) VM._assert(thinLockOffset.isMax());
- thinLockOffset = offset;
- }
-
- /**
* Whether or not this is an instance of VM_Class?
* @return false
*/
@@ -431,7 +416,6 @@
super(typeRef, typeRef.getDimensionality(), null);
this.elementType = elementType;
this.logElementSize = computeLogElementSize();
- thinLockOffset = VM_ObjectModel.defaultThinLockOffset();
depth = 1;
if (elementType.isArrayType()) {
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Class.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Class.java 2007-05-29 14:03:49 UTC (rev 12374)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Class.java 2007-05-29 17:39:13 UTC (rev 12375)
@@ -1468,7 +1468,8 @@
if (isInterface()) {
if (VM.VerifyAssertions) VM._assert(superClass == null);
depth = 1;
- } else if (superClass == null) {
+ thinLockOffset = Offset.max();
+ } else if (superClass == null) {
if (VM.VerifyAssertions) VM._assert(isJavaLangObjectType());
instanceSize = VM_ObjectModel.computeScalarHeaderSize(this);
alignment = BYTES_IN_ADDRESS;
@@ -2314,18 +2315,23 @@
/**
* Get the offset in instances of this type assigned to the thin lock word.
- * -1 if instances of this type do not have thin lock words.
+ * Offset.max() if instances of this type do not have thin lock words.
+ * Is only known after class has been resolved.
*/
@Uninterruptible
public Offset getThinLockOffset() {
+ if (VM.VerifyAssertions) VM._assert(isResolved());
return thinLockOffset;
}
- /**
- * Set the thin lock offset for instances of this type
+ /**
+ * Set the thin lock offset for instances of this type. Can be called at most once.
+ * and is invoked from VM_ObjectModel.allocateThinLock (in object models which
+ * do not allocate thin locks for all scalar object types).
*/
public void setThinLockOffset(Offset offset) {
if (VM.VerifyAssertions) VM._assert(thinLockOffset.isMax());
+ if (VM.VerifyAssertions) VM._assert(!offset.isMax());
thinLockOffset = offset;
}
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Primitive.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Primitive.java 2007-05-29 14:03:49 UTC (rev 12374)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Primitive.java 2007-05-29 17:39:13 UTC (rev 12375)
@@ -241,24 +241,17 @@
/**
* Get the offset in instances of this type assigned to the thin
- * lock word. -1 if instances of this type do not have thin lock
+ * lock word. Offset.max() if instances of this type do not have thin lock
* words.
- * @return -1
+ * @return Offset.max();
*/
@Uninterruptible
public Offset getThinLockOffset() {
if (VM.VerifyAssertions) VM._assert(NOT_REACHED);
- return Offset.fromIntSignExtend(-1);
+ return Offset.max();
}
/**
- * Set the thin lock offset for instances of this type
- */
- public void setThinLockOffset(Offset offset) {
- if (VM.VerifyAssertions) VM._assert(NOT_REACHED);
- }
-
- /**
* Whether or not this is an instance of VM_Class?
* @return false
*/
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Type.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Type.java 2007-05-29 14:03:49 UTC (rev 12374)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/VM_Type.java 2007-05-29 17:39:13 UTC (rev 12375)
@@ -616,13 +616,11 @@
/**
* Get the offset in instances of this type assigned to the thin lock word.
- * -1 if instances of this type do not have thin lock words.
+ * Offset.max() if instances of this type do not have thin lock words.
*/
@Uninterruptible
public abstract Offset getThinLockOffset();
- public abstract void setThinLockOffset(Offset offset);
-
/**
* @return whether or not this is an instance of VM_Class?
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.