FW: debugging interfaces
Actually meant to forward this one rather than the previous Brendan message...
From: es5-discuss-bounces at mozilla.org [mailto:es5-discuss-bounces at mozilla.org] On Behalf Of Brendan Eich Sent: Thursday, August 13, 2009 11:47 AM To: David-Sarah Hopwood Cc: es5-discuss at mozilla.org Subject: Re: debugging interfaces
On Aug 13, 2009, at 11:33 AM, David-Sarah Hopwood wrote:
Jordan Osete wrote:
Then, if we accept the idea of keeping only a reference to the objects until information about them is explicitly requested, couldn't we do the same things for the variables and arguments objects ?
Keeping a reference to these would interfere with the use of optimized calling conventions where arguments are only stored in machine registers and never reified (when 'arguments' is not referred to). Similarly for variable frames, which need not be reified unless they are captured by a closure.
Right. Or, even moreso, if possible -- there may be no variable object reified in an implementation that optimizes harder. ES1-5 take pains to avoid any reference to such an object escaping. Firefox 3.5 optimizes various closure cases including non-escaping Algol-like procedures (using a display) and closures capturing write-once variables whose initialisers dominate the closure ("flat closures", what Chez Scheme calls "display closures"). Assignment conversion (a la Chez Scheme) is being explored.
If we impose a model where you have to "compile with -g" to get first-class stack inspection, otherwise you get nothing, developers will always turn on the deoptimizing debugger-friendly option, after being burned by missing the chance to diagnose a bug in flagrante because they were running in optimized mode.
I like Christian's proposal, FWIW. We should see about other VMs implementing it.
This was sent to es5-discuss even though the original thread was on es
This was sent to es5-discuss even though the original thread was on es-discuss -----Original Message----- From: es5-discuss-bounces at mozilla.org [mailto:es5-discuss-bounces at mozilla.org] On Behalf Of David-Sarah Hopwood Sent: Thursday, August 13, 2009 11:34 AM To: es5-discuss at mozilla.org Subject: Re: debugging interfaces Jordan Osete wrote: > Then, if we accept the idea of keeping only a reference to the objects > until information about them is explicitly requested, couldn't we do the > same things for the variables and arguments objects ? Keeping a reference to these would interfere with the use of optimized calling conventions where arguments are only stored in machine registers and never reified (when 'arguments' is not referred to). Similarly for variable frames, which need not be reified unless they are captured by a closure. >> have an Error.captureStackTrace(error, cutoff_opt) function that >> allows you to attach a stack trace to any object, say: >> >> function MyError(message) { >> this.message = message; >> Error.captureStackTrace(this, MyError); >> } >> >> If you pass a function as the cutoff argument all stack frames above >> and include the topmost call to that function will not be included in >> the stack frame. This was intended to solve the getStackTrace problem >> you describe in the proposal but it turns out that it can also be >> useful to hide more of the stack trace, to avoid cluttering it with >> the internal mechanics of library code. >> > If I understand it well, Error.captureStackTrace only works with an > object that has been used with throw ? Christian will correct me if I'm wrong, but I would assume the stack trace is captured at the point where Error.captureStackTrace is called, and so there is no requirement for the object to have been thrown. -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com _______________________________________________ es5-discuss mailing list es5-discuss at mozilla.org https://mail.mozilla.org/listinfo/es5-discuss