# HG changeset patch # User twisti # Date 1396655286 25200 # Node ID a00b26a700114cdb6be5ed0f788966ec2856a840 # Parent 5dfaaa91be37f41a2138afcc5c7c1c8ad234c3b9 use JDK 8 features for some TODOs diff -r 5dfaaa91be37 -r a00b26a70011 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Fri Apr 04 16:40:24 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Fri Apr 04 16:48:06 2014 -0700 @@ -611,10 +611,9 @@ nameOffset = vmStructs.get("Flag::_name").getOffset(); addrOffset = vmStructs.get("Flag::_addr").getOffset(); - // TODO use the following after we switched to JDK 8 - assert vmTypes.get("bool").getSize() == Byte.SIZE / Byte.SIZE; // TODO Byte.BYTES; - assert vmTypes.get("intx").getSize() == Long.SIZE / Byte.SIZE; // TODO Long.BYTES; - assert vmTypes.get("uintx").getSize() == Long.SIZE / Byte.SIZE; // TODO Long.BYTES; + assert vmTypes.get("bool").getSize() == Byte.BYTES; + assert vmTypes.get("intx").getSize() == Long.BYTES; + assert vmTypes.get("uintx").getSize() == Long.BYTES; } public Iterator iterator() { diff -r 5dfaaa91be37 -r a00b26a70011 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Apr 04 16:40:24 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Apr 04 16:48:06 2014 -0700 @@ -62,7 +62,7 @@ /** * Gets the Graal mirror from a HotSpot metaspace Klass native object. - * + * * @param metaspaceKlass a metaspace Klass object boxed in a {@link Constant} * @return the {@link ResolvedJavaType} corresponding to {@code klassConstant} */ @@ -73,7 +73,7 @@ /** * Gets the Graal mirror from a HotSpot metaspace Klass native object. - * + * * @param metaspaceKlass a metaspace Klass object * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass} */ @@ -86,13 +86,13 @@ /** * Creates the Graal mirror for a {@link Class} object. - * + * *

* NOTE: Creating an instance of this class does not install the mirror for the * {@link Class} type. Use {@link #fromClass(Class)}, {@link #fromMetaspaceKlass(Constant)} or * {@link #fromMetaspaceKlass(long)} instead. *

- * + * * @param javaClass the Class to create the mirror for */ public HotSpotResolvedObjectType(Class javaClass) { @@ -185,7 +185,7 @@ /** * Returns if type {@code type} is a leaf class. This is the case if the * {@code Klass::_subklass} field of the underlying class is zero. - * + * * @return true if the type is a leaf class */ private boolean isLeafClass() { @@ -195,7 +195,7 @@ /** * Returns the {@code Klass::_subklass} field of the underlying metaspace klass for the given * type {@code type}. - * + * * @return value of the subklass field as metaspace klass pointer */ private long getSubklass() { @@ -312,7 +312,7 @@ /** * Returns the value of the state field {@code InstanceKlass::_init_state} of the metaspace * klass. - * + * * @return state field value of this type */ private int getState() { @@ -476,7 +476,7 @@ /** * Creates a field info for the field in the fields array at index {@code index}. - * + * * @param index index to the fields array */ public FieldInfo(int index) { @@ -484,8 +484,7 @@ // Get Klass::_fields final long metaspaceFields = unsafe.getAddress(metaspaceKlass() + config.instanceKlassFieldsOffset); assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code"; - metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * 2 * index; // TODO - // Short.BYTES + metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index; } private int getAccessFlags() { @@ -513,7 +512,7 @@ * on top an array of Java shorts. */ private int readFieldSlot(int index) { - return unsafe.getChar(metaspaceData + 2 * index); // TODO Short.BYTES + return unsafe.getChar(metaspaceData + Short.BYTES * index); } /** @@ -578,8 +577,7 @@ } } - // TODO use in 1.8: fieldsArray.sort(new OffsetComparator()); - Collections.sort(fieldsArray, new OffsetComparator()); + fieldsArray.sort(new OffsetComparator()); HotSpotResolvedJavaField[] myFields = fieldsArray.toArray(new HotSpotResolvedJavaField[0]); @@ -614,7 +612,7 @@ /** * Returns the actual field count of this class's internal {@code InstanceKlass::_fields} array * by walking the array and discounting the generic signature slots at the end of the array. - * + * *

* See {@code FieldStreamBase::init_generic_signature_start_slot} */