Throwable types handled specially in the VM?

David Holmes David.Holmes at oracle.com
Mon Aug 23 03:36:47 PDT 2010


Corrections and continued discussion in the "Re: Updated ARM Spec" thread.

David

David Holmes said the following on 08/23/10 19:48:
> Hi Joe,
> 
> Joe Darcy said the following on 08/21/10 07:01:
>>  From the name "allocate_permanent_instance," I assume that these 
>> exception objects are saved and reused for the lifetime of the JVM, 
>> correct?  For better or worse, Throwable and its subclasses are 
>> mutable; the suppressed warning information is a new possible 
>> mutation, setting the stack trace is an existing mutability avenue.
>>
>> If so, as Remi has recently pointed out, perhaps these fields should 
>> be cleared when the exceptions are resued?
> 
> As I have outlined in detail in the thread "Updated ARM Spec" the 
> pre-allocated instances that can be thrown more than once do not have 
> any mutable state (prior to suppressed exceptions) and so there is 
> nothing to clear.
> 
> I just realized however that clearing the suppressed-exception state is 
> simply not an option as the same exception instance could be thrown 
> concurrently in multiple threads. In short these shared immutable 
> exception instances must remain immutable if they are to be shared.
> 
>>  From an API perspective, perhaps the suppression feature should be 
>> modified so that self-suppression is interpreted as not allowing a 
>> particular exception instance to record addition suppressed exceptions...
> 
> If you are suggesting this as a way of making the suppression state 
> immutable, then I'd suggest that it might be preferable to model this 
> the same way that stacktraces are handled - they only need to be 
> optionally present. The same thing could be said for suppressed-exceptions.
> 
> David
> 


More information about the hotspot-dev mailing list