Request for review: 7046490 - Preallocated OOME objects should obey Throwable stack trace protocol
David Holmes
David.Holmes at oracle.com
Mon Jul 18 21:02:45 PDT 2011
Paul Hohensee said the following on 07/19/11 13:32:
> Looks good, except, could you use obj_field() in unassigned_stacktrace()
> instead of checking UseCompressedOops there?
Thanks Paul.
I don't think I can use obj_field() as it is for accessing instances and
this is a static field. I copied the code for reading the static field
from the java.lang.ref functions:
2286 // Support for java_lang_ref_Reference
2287 oop java_lang_ref_Reference::pending_list_lock() {
2288 instanceKlass* ik =
instanceKlass::cast(SystemDictionary::Reference_klass());
2289 address addr = ik->static_field_addr(static_lock_offset);
2290 if (UseCompressedOops) {
2291 return oopDesc::load_decode_heap_oop((narrowOop *)addr);
2292 } else {
2293 return oopDesc::load_decode_heap_oop((oop*)addr);
2294 }
2295 }
2296
2297 HeapWord *java_lang_ref_Reference::pending_list_addr() {
2298 instanceKlass* ik =
instanceKlass::cast(SystemDictionary::Reference_klass());
2299 address addr = ik->static_field_addr(static_pending_offset);
2300 // XXX This might not be HeapWord aligned, almost rather be char *.
2301 return (HeapWord*)addr;
2302 }
2303
2304 oop java_lang_ref_Reference::pending_list() {
2305 char *addr = (char *)pending_list_addr();
2306 if (UseCompressedOops) {
2307 return oopDesc::load_decode_heap_oop((narrowOop *)addr);
2308 } else {
2309 return oopDesc::load_decode_heap_oop((oop*)addr);
2310 }
2311 }
David
-----
>
> Paul
>
> On 7/7/11 1:25 AM, David Holmes wrote:
>> http://cr.openjdk.java.net/~dholmes/7046490/webrev/
>>
>> This is a simple fix in the VM to honour the Throwable immutability
>> protocol that was defined for Java 7. Pre-allocated Throwable
>> instances are normally immutable, but that is not the case for a group
>> of pre-allocated OutOfMemoryError instances. To conform to the
>> protocol, when we set the backtrace (VM representation of the
>> stackTrace) we have to set the stackTrace field to the sentinel value
>> stored in the static Throwable.UNASSIGNED_STACK field.
>>
>> With this fix in place the workaround in Throwable.java, under
>> 7045138, can be backed out.
>>
>> Thanks,
>> David
>>
>>
>>
More information about the hotspot-runtime-dev
mailing list