Java Doc for StackFrame.java in  » Scripting » oscript-2.10.4 » oscript » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » oscript 2.10.4 » oscript.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   oscript.util.StackFrame

StackFrame
abstract public class StackFrame (Code)
The "chain" of stack frames is used to track execution context of a particular thread and, when debugging is enabled, give the debugger a chance to run breakpoints.

Where possible, the head of the chain of stack frames is passed on the stack, but in cases where it cannot be, such as when control passes to java code and back, a hashtable is used to map the current thread to a StackFrame. To access the current stack frame, or create one if needed, use StackFrame.currentStackFrame .

While on the interface, the stack frame behaves as a chain of StackFrame objects, behind the scenes an array is used for the stack, and a fly-weight pattern is used for the stack frame objects. This way we (1) avoid extra memory allocations, and (2) can have different implementations of StackFrame.setLineNumber depending on whether debugging is enabled or not. (Debugging is automatically enabled when a breakpoint is set.)

In order to maintain this allusion, calls to NodeEvaluator.evalNode must go through the StackFrame.evalNode call-gate.

The stack frame object is intentionally not thread safe, since it is only accessed from a single thread context. Because of the use of the fly- weight pattern, a stack frame object no longer validly represents a stack frame that has exited, either by normally or via an exception. Because of this, any code that wishes to save a reference to a stack frame object must StackFrame.clone it.

Because the StackFrame is only accessed from a single thread context, it can provide a lightweight mechanism to allocate storage for BasicScope objects. This can be used in cases where the scope object only exists on the stack, and is not held after the program enclosed by the scope has finished execution, ie. there is no function enclosed by the scope. For cases of an enclosed function, the scope storage must be allocated from the heap so that it can be valid at some point in the future when the enclosed function is potentially called.
author:
   Rob Clark (rob@ti.com)
version:
   1



Field Summary
protected  StackFramedebugStackFrame
     StackFrame to use whe debugging.
final protected  short[]idx
    
final protected  int[]lines
     The current line number at each stack frame.
final protected  NodeEvaluator[]nes
     The node evaluator, which has file, and id info needed when filling in stack trace.
protected  StackFrameregularStackFrame
     StackFrame to use when not debugging.
final protected  StackFrameBasicScope[]scopeLists
     The list of scopes allocated at the current frame, which should be recycled once the stack frame is released.
final protected  Scope[]scopes
     The current scopes at each stack frame.


Method Summary
final public  BasicScopeallocateBasicScope(Scope prev, SymbolTable smit)
     Allocate a scope from the stack.
final public  FunctionScopeallocateFunctionScope(Function fxn, Scope prev, SymbolTable smit, MemberTable members)
     Allocate a fxn-scope from the stack.
final public  MemberTableallocateMemberTable(short sz)
     Allocate from the stack.
final public  Objectclone()
     Clone the stack frame, which is necessary in cases where you need to keep a reference to the stack frame (and it's parents) after the original stack frame has exited, such as to store in an exception.
public static synchronized  StackFramecurrentStackFrame()
     Get the stack frame for the current thread.
final public static  voiddumpStack(java.io.OutputStream out)
    
final public static  voiddumpStack(java.io.Writer out)
    
public  booleanequals(Object obj)
    
final public  ObjectevalNode(NodeEvaluator ne, Scope scope)
     Push a new stack frame onto the stack, and pass it to ne's StackFrame.evalNode method, returning the result.
final public  AbstractFilegetFile()
     The file corresponding to the current stack frame.
final public  intgetId()
     The function name for the current stack frame, if there is one, otherwise -1.
final public  intgetLineNumber()
     The current line number in the current stack frame.
public  oscript.data.ValuegetName()
     Convenience wrapper for StackFrame.getId , mainly provided for the benefit of script code that probably doesn't want to know about ids, and just wants to think in terms of names.
public  StackFramegetSafeCopy()
    
final public  ScopegetScope()
     The current scope in the current line number.
public  inthashCode()
    
public  Iteratoriterator()
     Return an iterator of stack frames, starting with the top of the stack, and iterating to root of stack.
final public static  voidlog(String str)
    
public  voidsetLineNumber(Scope scope, int line)
     Called by node evaluator to store line number info, and to give the debugger a chance to see if we've hit a breakpoint.
public  voidsetLineNumber(int line)
     Called by node evaluator to store line number info, and to give the debugger a chance to see if we've hit a breakpoint.
public  StringtoString()
     Convert to string, to print out a line in the stack-trace.

Field Detail
debugStackFrame
protected StackFrame debugStackFrame(Code)
StackFrame to use whe debugging. This one's StackFrame.setLineNumber does have extra checks for breakpoints, so breakpoints can work properly. This should be treated as final.



idx
final protected short[] idx(Code)
The current index, boxed in array so it can be shared between the two stack-frame instances (regular & debug)



lines
final protected int[] lines(Code)
The current line number at each stack frame.



nes
final protected NodeEvaluator[] nes(Code)
The node evaluator, which has file, and id info needed when filling in stack trace.



regularStackFrame
protected StackFrame regularStackFrame(Code)
StackFrame to use when not debugging. This one's StackFrame.setLineNumber does not have extra checks for breakpoints for better performance. This should be treated as final.



scopeLists
final protected StackFrameBasicScope[] scopeLists(Code)
The list of scopes allocated at the current frame, which should be recycled once the stack frame is released.



scopes
final protected Scope[] scopes(Code)
The current scopes at each stack frame.





Method Detail
allocateBasicScope
final public BasicScope allocateBasicScope(Scope prev, SymbolTable smit)(Code)
Allocate a scope from the stack. The basic-scope is freed automatically when the stack-frame is disposed



allocateFunctionScope
final public FunctionScope allocateFunctionScope(Function fxn, Scope prev, SymbolTable smit, MemberTable members)(Code)
Allocate a fxn-scope from the stack. The fxn-scope must be freed by the caller.



allocateMemberTable
final public MemberTable allocateMemberTable(short sz)(Code)
Allocate from the stack.



clone
final public Object clone()(Code)
Clone the stack frame, which is necessary in cases where you need to keep a reference to the stack frame (and it's parents) after the original stack frame has exited, such as to store in an exception.



currentStackFrame
public static synchronized StackFrame currentStackFrame()(Code)
Get the stack frame for the current thread. If one does not already exist, this will create a new one, otherwise it will return the current top of the stack.



dumpStack
final public static void dumpStack(java.io.OutputStream out)(Code)
For debugging



dumpStack
final public static void dumpStack(java.io.Writer out)(Code)



equals
public boolean equals(Object obj)(Code)



evalNode
final public Object evalNode(NodeEvaluator ne, Scope scope)(Code)
Push a new stack frame onto the stack, and pass it to ne's StackFrame.evalNode method, returning the result.
Parameters:
  ne - the node-evaluator for the node to evaluate
Parameters:
  scope - the scope to evalute in the result



getFile
final public AbstractFile getFile()(Code)
The file corresponding to the current stack frame.



getId
final public int getId()(Code)
The function name for the current stack frame, if there is one, otherwise -1.



getLineNumber
final public int getLineNumber()(Code)
The current line number in the current stack frame.



getName
public oscript.data.Value getName()(Code)
Convenience wrapper for StackFrame.getId , mainly provided for the benefit of script code that probably doesn't want to know about ids, and just wants to think in terms of names.



getSafeCopy
public StackFrame getSafeCopy()(Code)



getScope
final public Scope getScope()(Code)
The current scope in the current line number.



hashCode
public int hashCode()(Code)



iterator
public Iterator iterator()(Code)
Return an iterator of stack frames, starting with the top of the stack, and iterating to root of stack.



log
final public static void log(String str)(Code)



setLineNumber
public void setLineNumber(Scope scope, int line)(Code)
Called by node evaluator to store line number info, and to give the debugger a chance to see if we've hit a breakpoint.
Parameters:
  scope - the current scope
Parameters:
  line - the current line number



setLineNumber
public void setLineNumber(int line)(Code)
Called by node evaluator to store line number info, and to give the debugger a chance to see if we've hit a breakpoint. This method is used by the compiler in cases where the scope hasn't changed sinced last line number, to save a few instructions.
Parameters:
  scope - the current scope
Parameters:
  line - the current line number



toString
public String toString()(Code)
Convert to string, to print out a line in the stack-trace.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.