Revision: 5784
Author: [email protected]
Date: Thu Jul 23 14:21:00 2009
Log: Edited wiki page through web user interface.
http://code.google.com/p/google-web-toolkit/source/detail?r=5784

Modified:
  /wiki/WebModeExceptions.wiki

=======================================
--- /wiki/WebModeExceptions.wiki        Fri Feb 27 07:32:06 2009
+++ /wiki/WebModeExceptions.wiki        Thu Jul 23 14:21:00 2009
@@ -61,6 +61,16 @@
    * `collect()` raises an exception and passes it to `infer()`.
    * `infer()` is implemented and uses the browser's `e.stack` or  
`e.message` property to read activation records to produce a reasonably  
complete stack trace.

+= Emulated Stack Data =
+
+The GWT compiler can optionally emit JavaScript code to maintain a  
meta-stack that emulates standard JS dispatch semantics.  This meta-stack  
can be used to provide stack trace data on browsers that do not provide  
stack data for all exception types.  This is implemented as an additional  
compiler pass that is conditionalized on the presence of  
`StackTraceCreator.CollectorEmulated` within the compilation.  Full  
documentation on the transforms performed is located in the javadoc for  
[http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java
  
JsStackEmulator], but the basic transformation is as follows:
+  * The execution stack is modeled as an array that contains references to  
the JavaScript functions being executed.  There is a global variable that  
maintains the current stack depth and an optional co-array that provides  
current file and line number data.
+  * A stack frame is pushed on every function entrance.  This involves  
incrementing the stack depth counter and assigning the current function  
into the meta-stack array.  The stack depth for the function's invocation  
is saved in a local variable.
+  * Before every last statement in normal flow control, the stack is  
popped simply by decrementing the stack depth variable.  The last statement  
is any return statement not in a try/finally block, conditionally the last  
statement in a finally block whose associated try contains a return  
statement, and the last statement in the function.
+    * A return statement inside of a try block with an associated finally  
block simply sets a function-local variable indicating that the stack  
should be popped at the end of the finally block.
+  * When any exception is thrown (Java-derived or a native browser  
exception), the stack depth is reset after the call to `Exceptions.caught`  
to the function's local stack index variable.
+    * In order to ensure that a native exception's stack data is recorded  
properly and any subsequent finally block is executed with the correct  
global stack depth, any try/finally statement without a catch block has a  
trivial catch block added to ensure the currently-propagating exception has  
been correctly wrapped, to reset the global stack depth to the local stack  
index, and then to re-throw the exception.
+
  = Resymbolization =

  Method names in deployed code will have been obfuscated and will not be  
particularly useful as encoded in the module permutations.  To that end, a  
means for resymbolizing a stack trace has been implemented.


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to