Throwable types handled specially in the VM?
David Holmes
David.Holmes at oracle.com
Thu Aug 19 19:24:56 PDT 2010
Hi Joe,
Joe Darcy said the following on 08/20/10 12:03:
> As part of Project Coin, try-with-resources/ARM blocks have recently
> been integrated into JDK 7. Part of this feature is changes to
> java.lang.Throwable to support recording of suppressed exception
> information (6911258 "Project Coin: Add essential API support for
> Automatic Resource Management (ARM) blocks"). Subsequently, some more
> changes in Throwable were necessary to fix a regression in the ability
> to print the stack traces of specially handled OutOfMemoryErrors
> (6973831 "NPE when printing stack trace of OOME").
>
> Are there any other Throwable types which receive special handling or
> creation by the VM? If there are any, I'd like to examine them to find
> and correct and additional issues.
All the preallocation of exceptions occurs in universe_post_init in
universe.cpp. These are as follows
// Setup preallocated OutOfMemoryError errors
Universe::_out_of_memory_error_java_heap =
k_h->allocate_permanent_instance(CHECK_false);
Universe::_out_of_memory_error_perm_gen =
k_h->allocate_permanent_instance(CHECK_false);
Universe::_out_of_memory_error_array_size =
k_h->allocate_permanent_instance(CHECK_false);
Universe::_out_of_memory_error_gc_overhead_limit =
k_h->allocate_permanent_instance(CHECK_false);
// Setup preallocated NullPointerException
// (this is currently used for a cheap & dirty solution in compiler
exception handling)
Universe::_null_ptr_exception_instance =
instanceKlass::cast(k)->allocate_permanent_instance(CHECK_false);
// Setup preallocated ArithmeticException
// (this is currently used for a cheap & dirty solution in compiler
exception handling)
Universe::_arithmetic_exception_instance =
instanceKlass::cast(k)->allocate_permanent_instance(CHECK_false);
// Virtual Machine Error for when we get into a situation we can't
resolve
Universe::_virtual_machine_error_instance =
instanceKlass::cast(k)->allocate_permanent_instance(CHECK_false);
As you're aware from 6973831 these are raw allocations that invoke no
constructor, so all fields are implicitly set to their default (null, 0)
values.
I can't think of any other specialized exception handling.
David
More information about the hotspot-dev
mailing list