Hi John! I'm currently porting the interpreter to x86_64 and there is a problem that took me almost two days to find: it's the MethodHandle.vmentry field-type change.
For whatever reason on 64-bit it calculates the offset to 24, which actually should be 16, and that results to this: sun.dyn.DirectMethodHandle - klass: 'sun/dyn/DirectMethodHandle' - ---- fields (total size 6 words): - private 'vmentry' 'J' @24 4329412000 (20d95a0 1) - protected 'vmtarget' 'Ljava/lang/Object;' @24 ### BAD OOP 0x1020d95a0 ### (20d95a0 1) - private 'type' 'Ljava/dyn/MethodType;' @32 a 'java/dyn/MethodType' = (II)I (5040e38 1) - private final 'vmindex' 'I' @40 -2 (fffffffe) Nice, isn't it? :-) So, there is a problem somewhere in ClassFileParser::java_dyn_MethodHandle_fix_pre and the attached patch fix it. But I'm very sure this is not correct as the field should really be a double field and not a word field. What is the "correct" fix for this problem? -- Christian diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -2514,23 +2514,23 @@ fac_ptr->nonstatic_byte_count -= 1; (*fields_ptr)->ushort_at_put(i + instanceKlass::signature_index_offset, word_sig_index); - if (wordSize == jintSize) { +// if (wordSize == jintSize) { fac_ptr->nonstatic_word_count += 1; - } else { - fac_ptr->nonstatic_double_count += 1; - } - - FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i+4); +// } else { +// fac_ptr->nonstatic_double_count += 1; +// } + + FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i + instanceKlass::low_offset); assert(atype == NONSTATIC_BYTE, ""); FieldAllocationType new_atype = NONSTATIC_WORD; - if (wordSize > jintSize) { - if (Universe::field_type_should_be_aligned(T_LONG)) { - atype = NONSTATIC_ALIGNED_DOUBLE; - } else { - atype = NONSTATIC_DOUBLE; - } - } - (*fields_ptr)->ushort_at_put(i+4, new_atype); +// if (wordSize > jintSize) { +// if (Universe::field_type_should_be_aligned(T_LONG)) { +// atype = NONSTATIC_ALIGNED_DOUBLE; +// } else { +// atype = NONSTATIC_DOUBLE; +// } +// } + (*fields_ptr)->ushort_at_put(i + instanceKlass::low_offset, new_atype); found_vmentry = true; break; _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev