NullPointerException / threads

Godmar Back
Tue Mar 14 10:21:00 GMT 2000

> Some VMs create the stack trace lazily.  I don't know how they do
> this.  Could we do it somehow?

My understanding is that the stacktrace is associated with the
exception object, not the throw site.  In other words, an exception
can be created in a callee, returned to and thrown by a caller, and the
stacktrace would have to include the callee's frame.

What we've implemented in kaffe is the following: the stacktrace is filled
in when the exception is created; but it's only an array of pc/fp pairs.
What is done lazily (only when the exception is dispatched or when someone 
tries to print the backtrace), however, is mapping the pc to the corresponding 
method to extract its name/line numbers for printing or exception handlers
for dispatch.

I don't know if that's what you mean by "lazily", but I'd be interested in
learning how you could do it even more lazily.

	- Godmar

More information about the Java mailing list