Revision: 15775
http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15775&view=revAuthor: dgrove-oss
Date: 2009-09-03 04:19:27 +0000 (Thu, 03 Sep 2009)
Log Message:
-----------
Minor cleanup to add same level of error checking to the "knownStaticField"
logic for the Harmony class libaries as we have for the GNU Classpath
libraries.
Also rename copyKnownClasspathFOO to copyKnownFOO since we call the code
for all class libs (not just Classpath).
Modified Paths:
--------------
rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java
Modified: rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java
===================================================================
--- rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java 2009-09-02 23:44:39 UTC (rev 15774)
+++ rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java 2009-09-03 04:19:27 UTC (rev 15775)
@@ -1630,11 +1630,10 @@
// we failed to get a reflective field accessors
if (jdkType != null) {
// we know the type - probably a private field of a java.lang class
- if(!copyKnownClasspathStaticField(jdkType,
- rvmFieldName,
- rvmFieldType,
- rvmFieldOffset
- )) {
+ if(!copyKnownStaticField(jdkType,
+ rvmFieldName,
+ rvmFieldType,
+ rvmFieldOffset)) {
// we didn't know the field so nullify
if (verbose >= 2) {
traceContext.push(rvmFieldType.toString(),
@@ -1823,7 +1822,7 @@
} else {
BootImageMap.Entry mapEntry = BootImageMap.findOrCreateEntry(referencedObject);
if (mapEntry.imageAddress.EQ(OBJECT_NOT_PRESENT)) {
- if (rvmFieldName == null || !copyKnownClasspathInstanceField(parentObject, rvmFieldName, rvmFieldType, fieldLocation)) {
+ if (rvmFieldName == null || !copyKnownInstanceField(parentObject, rvmFieldName, rvmFieldType, fieldLocation)) {
// object not part of bootimage: install null reference
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
bootImage.setNullAddressWord(fieldLocation, objField, root, false);
@@ -1846,7 +1845,7 @@
}
if (imageAddress.EQ(OBJECT_NOT_PRESENT)) {
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
- if (!copyKnownClasspathInstanceField(parentObject, rvmFieldName, rvmFieldType, fieldLocation)) {
+ if (!copyKnownInstanceField(parentObject, rvmFieldName, rvmFieldType, fieldLocation)) {
// object not part of bootimage: install null reference
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
bootImage.setNullAddressWord(fieldLocation, objField, root, false);
@@ -1886,7 +1885,7 @@
BootImageMap.Entry.LinkInfo info = mapEntry.removeLinkingAddress();
while(info != null) {
if (mapEntry.imageAddress.EQ(OBJECT_NOT_PRESENT)) {
- if (info.rvmFieldName == null || !copyKnownClasspathInstanceField(info.parent, info.rvmFieldName, info.rvmFieldType, info.addressToFixup)) {
+ if (info.rvmFieldName == null || !copyKnownInstanceField(info.parent, info.rvmFieldName, info.rvmFieldType, info.addressToFixup)) {
// object not part of bootimage: install null reference
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
bootImage.setNullAddressWord(info.addressToFixup, info.objField, info.root, false);
@@ -2072,7 +2071,7 @@
if (jdkFieldAcc == null) {
// Field not found via reflection
- if (!copyKnownClasspathInstanceField(jdkObject, rvmFieldName, rvmFieldType, rvmFieldAddress)) {
+ if (!copyKnownInstanceField(jdkObject, rvmFieldName, rvmFieldType, rvmFieldAddress)) {
// Field wasn't a known Classpath field so write null
if (verbose >= 2) traceContext.push(rvmFieldType.toString(),
jdkType.getName(), rvmFieldName);
@@ -2384,19 +2383,25 @@
* @param rvmFieldName the name of the field
* @param rvmFieldType the type reference of the field
*/
- private static boolean copyKnownClasspathStaticField(Class<?> jdkType, String rvmFieldName,
- TypeReference rvmFieldType,
- Offset rvmFieldOffset) {
+ private static boolean copyKnownStaticField(Class<?> jdkType, String rvmFieldName,
+ TypeReference rvmFieldType,
+ Offset rvmFieldOffset) {
if (classLibrary == "harmony") {
- if (jdkType.equals(java.lang.ref.ReferenceQueue.class) &&
- rvmFieldName.equals("DEFAULT_QUEUE_SIZE") &&
- rvmFieldType.isIntType()) {
- Statics.setSlotContents(rvmFieldOffset, 128);
- return true;
- } else if (jdkType.equals(java.lang.Byte.class) &&
- rvmFieldName.equals("CACHE") && rvmFieldType.isArrayType()) {
- Statics.setSlotContents(rvmFieldOffset, new Byte[256]);
- return true;
+ if (jdkType.equals(java.lang.Number.class)) {
+ throw new Error("Unknown field in java.lang.Number " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.lang.Boolean.class)) {
+ throw new Error("Unknown field in java.lang.Boolean "+ rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.lang.Byte.class)) {
+ if (rvmFieldName.equals("CACHE") && rvmFieldType.isArrayType()) {
+ Statics.setSlotContents(rvmFieldOffset, new Byte[256]);
+ return true;
+ } else {
+ throw new Error("Unknown field in java.lang.Byte " + rvmFieldName + " " + rvmFieldType);
+ }
+ } else if (jdkType.equals(java.lang.Double.class)) {
+ throw new Error("Unknown field in java.lang.Double " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.lang.Float.class)) {
+ throw new Error("Unknown field in java.lang.Float " + rvmFieldName + " " + rvmFieldType);
} else if (jdkType.equals(java.lang.Integer.class)) {
if (rvmFieldName.equals("decimalScale") && rvmFieldType.isArrayType()) {
int[] java_lang_Integer_decimalScale = new int[] { 1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1 };
@@ -2405,12 +2410,29 @@
} else {
throw new Error("Unknown field in java.lang.Integer " + rvmFieldName + " " + rvmFieldType);
}
- } else if (jdkType.equals(java.lang.Throwable.class) &&
- rvmFieldName.equals("zeroLengthStackTrace") && rvmFieldType.isArrayType()) {
- Statics.setSlotContents(rvmFieldOffset, new StackTraceElement[0]);
- return true;
+ } else if (jdkType.equals(java.lang.Long.class)) {
+ throw new Error("Unknown field in java.lang.Long " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.lang.Short.class)) {
+ throw new Error("Unknown field in java.lang.Short " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.util.HashMap.class)) {
+ throw new Error("Unknown field in java.util.HashMap " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.util.AbstractMap.class)) {
+ throw new Error("Unknown field in java.util.AbstractMap " + rvmFieldName + " " + rvmFieldType);
+ } else if (jdkType.equals(java.lang.ref.ReferenceQueue.class)) {
+ if (rvmFieldName.equals("DEFAULT_QUEUE_SIZE") && rvmFieldType.isIntType()) {
+ Statics.setSlotContents(rvmFieldOffset, 128);
+ return true;
+ } else {
+ throw new Error("Unknown field in java.lang.ref.ReferenceQueue " + rvmFieldName + " " + rvmFieldType);
+ }
+ } else if (jdkType.equals(java.lang.Throwable.class)) {
+ if (rvmFieldName.equals("zeroLengthStackTrace") && rvmFieldType.isArrayType()) {
+ Statics.setSlotContents(rvmFieldOffset, new StackTraceElement[0]);
+ return true;
+ } else {
+ throw new Error("Unknown field in java.lang.Throwable " + rvmFieldName + " " + rvmFieldType);
+ }
} else {
- // unknown static field
return false;
}
} else if (classLibrary == "classpath") {
@@ -2585,7 +2607,7 @@
* @param rvmFieldType the type reference of the field
* @param rvmFieldAddress the address that the field is being written to
*/
- private static boolean copyKnownClasspathInstanceField(Object jdkObject, String rvmFieldName, TypeReference rvmFieldType, Address rvmFieldAddress)
+ private static boolean copyKnownInstanceField(Object jdkObject, String rvmFieldName, TypeReference rvmFieldType, Address rvmFieldAddress)
throws IllegalAccessException {
// Class library independent objects
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits