org.jruby.runtime
Class ThreadContext

java.lang.Object
  extended by org.jruby.runtime.ThreadContext

public class ThreadContext
extends java.lang.Object

Author:
jpetersen

Method Summary
 Frame[] createBacktrace(int level, boolean nativeException)
          Create an Array with backtrace information.
static IRubyObject createBacktraceFromFrames(Ruby runtime, Frame[] backtraceFrames)
          Create an Array with backtrace information.
 java.lang.String[] getActiveCatches()
           
 IRubyObject getBackref()
           
 RubyModule getBindingRubyClass()
           
 IRubyObject getConstant(java.lang.String name)
          Used by the evaluator and the compiler to look up a constant by name
 IRubyObject getConstant(java.lang.String name, RubyModule module)
           
 boolean getConstantDefined(java.lang.String name)
           
 Frame getCurrentFrame()
           
 DynamicScope getCurrentScope()
           
 Visibility getCurrentVisibility()
           
 IRubyObject getErrorInfo()
           
 IRubyObject[] getFrameArgs()
           
 Block getFrameBlock()
           
 int getFrameCount()
           
 java.lang.Object getFrameJumpTarget()
           
 RubyModule getFrameKlazz()
           
 java.lang.String getFrameName()
           
 ISourcePosition getFramePosition()
           
 IRubyObject getFrameSelf()
           
 CallType getLastCallType()
           
 IRubyObject getLastExitStatus()
           
 IRubyObject getLastline()
           
 Visibility getLastVisibility()
           
 ISourcePosition getPosition()
           
 Frame getPreviousFrame()
           
 ISourcePosition getPreviousFramePosition()
           
 DynamicScope getPreviousScope()
           
 Visibility getPreviousVisibility()
           
 RubyModule getRubyClass()
           
 Ruby getRuntime()
           
 java.lang.String getSourceFile()
           
 int getSourceLine()
           
 RubyThread getThread()
           
 boolean isTopLevel()
           
 boolean isWithinDefined()
          Is this thread actively in defined? at the moment.
 boolean isWithinTrace()
          Is this thread actively tracing at this moment.
static ThreadContext newContext(Ruby runtime)
           
 SinglyLinkedList peekCRef()
           
 void pollThreadEvents()
           
 void popCatch()
           
 RubyModule popCRef()
           
 RubyModule popRubyClass()
           
 void popScope()
           
 void postBsfApply()
           
 void postClassEval()
           
 void postCompiledClass()
           
 void postCompiledMethod()
           
 void postDefMethodInternalCall()
           
 void postEvalWithBinding(Block block)
           
 void postExecuteUnder()
           
 void postMethodCall()
           
 void postMproc()
           
 void postNodeEval()
           
 void postReflectedMethodInternalCall()
           
 void postRootNode()
           
 void postTrace()
           
 void postYield()
           
 void preAdoptThread()
           
 void preBsfApply(java.lang.String[] names)
           
 void preClassEval(StaticScope staticScope, RubyModule type)
           
 void preCompiledClass(RubyModule type)
           
 void preCompiledMethod(RubyModule implementationClass, SinglyLinkedList cref)
           
 void preDefMethodInternalCall(RubyModule clazz, java.lang.String name, IRubyObject self, IRubyObject[] args, int req, Block block, boolean noSuper, SinglyLinkedList cref, StaticScope staticScope, java.lang.Object jumpTarget)
           
 void preEvalWithBinding(Block block)
           
 void preExecuteUnder(RubyModule executeUnderClass, Block block)
           
 void preForBlock(Block block, RubyModule klass)
           
 void preInitBuiltinClasses(RubyClass objectClass, IRubyObject topSelf)
           
 void preInitCoreClasses()
           
 void preMethodCall(RubyModule implementationClass, RubyModule clazz, IRubyObject self, java.lang.String name, IRubyObject[] args, int req, Block block, boolean noSuper, java.lang.Object jumpTarget)
           
 void preMproc()
           
 void preNodeEval(RubyModule rubyClass, IRubyObject self)
           
 JumpException prepareJumpException(JumpException.JumpType jumpType, java.lang.Object target, java.lang.Object value)
           
 void preReflectedMethodInternalCall(RubyModule implementationClass, RubyModule klazz, IRubyObject self, java.lang.String name, IRubyObject[] args, int req, boolean noSuper, Block block, java.lang.Object jumpTarget)
           
 void preRootNode(DynamicScope scope)
           
 void preRunThread(Frame currentFrame)
           
 void preTrace()
           
 void preYieldSpecificBlock(Block block, RubyModule klass)
           
 void printScope()
           
 void pushCatch(java.lang.String catchSymbol)
           
 SinglyLinkedList pushCRef(RubyModule newModule)
           
 void pushRubyClass(RubyModule currentModule)
           
 void pushScope(DynamicScope scope)
           
 void setBackref(IRubyObject backref)
           
 IRubyObject setConstantInCurrent(java.lang.String name, IRubyObject result)
          Used by the evaluator and the compiler to set a constant by name This is for a null const decl
 IRubyObject setConstantInModule(java.lang.String name, RubyModule module, IRubyObject result)
          Used by the evaluator and the compiler to set a constant by name.
 IRubyObject setConstantInObject(java.lang.String name, IRubyObject result)
          Used by the evaluator and the compiler to set a constant by name This is for a Colon2 const decl
 void setCRef(SinglyLinkedList newCRef)
           
 void setCurrentVisibility(Visibility visibility)
           
 IRubyObject setErrorInfo(IRubyObject errorInfo)
           
 void setFrameArgs(IRubyObject[] args)
           
 void setFrameJumpTarget(java.lang.Object target)
           
 void setLastCallStatus(CallType callType)
          Returns the lastCallStatus.
 void setLastExitStatus(IRubyObject lastExitStatus)
           
 void setLastline(IRubyObject value)
           
 void setLastVisibility(Visibility visibility)
           
 void setPosition(ISourcePosition position)
           
 void setThread(RubyThread thread)
           
 void setWithinDefined(boolean isWithinDefined)
          Set whether we are actively within defined? or not.
 void setWithinTrace(boolean isWithinTrace)
          Set whether we are actively tracing or not on this thread.
 void unsetCRef()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newContext

public static ThreadContext newContext(Ruby runtime)

prepareJumpException

public JumpException prepareJumpException(JumpException.JumpType jumpType,
                                          java.lang.Object target,
                                          java.lang.Object value)

getRuntime

public Ruby getRuntime()

getErrorInfo

public IRubyObject getErrorInfo()

setErrorInfo

public IRubyObject setErrorInfo(IRubyObject errorInfo)

setLastCallStatus

public void setLastCallStatus(CallType callType)
Returns the lastCallStatus.


getLastCallType

public CallType getLastCallType()

setLastVisibility

public void setLastVisibility(Visibility visibility)

getLastVisibility

public Visibility getLastVisibility()

getLastExitStatus

public IRubyObject getLastExitStatus()

setLastExitStatus

public void setLastExitStatus(IRubyObject lastExitStatus)

printScope

public void printScope()

getCurrentScope

public DynamicScope getCurrentScope()

getPreviousScope

public DynamicScope getPreviousScope()

pushScope

public void pushScope(DynamicScope scope)

popScope

public void popScope()

getThread

public RubyThread getThread()

setThread

public void setThread(RubyThread thread)

getLastline

public IRubyObject getLastline()

setLastline

public void setLastline(IRubyObject value)

pushCatch

public void pushCatch(java.lang.String catchSymbol)

popCatch

public void popCatch()

getActiveCatches

public java.lang.String[] getActiveCatches()

getCurrentFrame

public Frame getCurrentFrame()

getPreviousFrame

public Frame getPreviousFrame()

getFrameCount

public int getFrameCount()

getFrameName

public java.lang.String getFrameName()

getFrameArgs

public IRubyObject[] getFrameArgs()

setFrameArgs

public void setFrameArgs(IRubyObject[] args)

getFrameSelf

public IRubyObject getFrameSelf()

getFrameJumpTarget

public java.lang.Object getFrameJumpTarget()

setFrameJumpTarget

public void setFrameJumpTarget(java.lang.Object target)

getFrameKlazz

public RubyModule getFrameKlazz()

getFrameBlock

public Block getFrameBlock()

getFramePosition

public ISourcePosition getFramePosition()

getPreviousFramePosition

public ISourcePosition getPreviousFramePosition()

getPosition

public ISourcePosition getPosition()

getSourceFile

public java.lang.String getSourceFile()

getSourceLine

public int getSourceLine()

setPosition

public void setPosition(ISourcePosition position)

getBackref

public IRubyObject getBackref()

setBackref

public void setBackref(IRubyObject backref)

getCurrentVisibility

public Visibility getCurrentVisibility()

getPreviousVisibility

public Visibility getPreviousVisibility()

setCurrentVisibility

public void setCurrentVisibility(Visibility visibility)

pollThreadEvents

public void pollThreadEvents()

peekCRef

public SinglyLinkedList peekCRef()

setCRef

public void setCRef(SinglyLinkedList newCRef)

unsetCRef

public void unsetCRef()

pushCRef

public SinglyLinkedList pushCRef(RubyModule newModule)

popCRef

public RubyModule popCRef()

pushRubyClass

public void pushRubyClass(RubyModule currentModule)

popRubyClass

public RubyModule popRubyClass()

getRubyClass

public RubyModule getRubyClass()

getBindingRubyClass

public RubyModule getBindingRubyClass()

isTopLevel

public boolean isTopLevel()

getConstantDefined

public boolean getConstantDefined(java.lang.String name)

getConstant

public IRubyObject getConstant(java.lang.String name)
Used by the evaluator and the compiler to look up a constant by name


setConstantInCurrent

public IRubyObject setConstantInCurrent(java.lang.String name,
                                        IRubyObject result)
Used by the evaluator and the compiler to set a constant by name This is for a null const decl


setConstantInModule

public IRubyObject setConstantInModule(java.lang.String name,
                                       RubyModule module,
                                       IRubyObject result)
Used by the evaluator and the compiler to set a constant by name. This is for a Colon2 const decl


setConstantInObject

public IRubyObject setConstantInObject(java.lang.String name,
                                       IRubyObject result)
Used by the evaluator and the compiler to set a constant by name This is for a Colon2 const decl


getConstant

public IRubyObject getConstant(java.lang.String name,
                               RubyModule module)

createBacktraceFromFrames

public static IRubyObject createBacktraceFromFrames(Ruby runtime,
                                                    Frame[] backtraceFrames)
Create an Array with backtrace information.

Parameters:
runtime -
level -
nativeException -
Returns:
an Array with the backtrace

createBacktrace

public Frame[] createBacktrace(int level,
                               boolean nativeException)
Create an Array with backtrace information.

Parameters:
runtime -
level -
nativeException -
Returns:
an Array with the backtrace

preAdoptThread

public void preAdoptThread()

preCompiledClass

public void preCompiledClass(RubyModule type)

postCompiledClass

public void postCompiledClass()

preClassEval

public void preClassEval(StaticScope staticScope,
                         RubyModule type)

postClassEval

public void postClassEval()

preBsfApply

public void preBsfApply(java.lang.String[] names)

postBsfApply

public void postBsfApply()

preMethodCall

public void preMethodCall(RubyModule implementationClass,
                          RubyModule clazz,
                          IRubyObject self,
                          java.lang.String name,
                          IRubyObject[] args,
                          int req,
                          Block block,
                          boolean noSuper,
                          java.lang.Object jumpTarget)

postMethodCall

public void postMethodCall()

preDefMethodInternalCall

public void preDefMethodInternalCall(RubyModule clazz,
                                     java.lang.String name,
                                     IRubyObject self,
                                     IRubyObject[] args,
                                     int req,
                                     Block block,
                                     boolean noSuper,
                                     SinglyLinkedList cref,
                                     StaticScope staticScope,
                                     java.lang.Object jumpTarget)

postDefMethodInternalCall

public void postDefMethodInternalCall()

preCompiledMethod

public void preCompiledMethod(RubyModule implementationClass,
                              SinglyLinkedList cref)

postCompiledMethod

public void postCompiledMethod()

preReflectedMethodInternalCall

public void preReflectedMethodInternalCall(RubyModule implementationClass,
                                           RubyModule klazz,
                                           IRubyObject self,
                                           java.lang.String name,
                                           IRubyObject[] args,
                                           int req,
                                           boolean noSuper,
                                           Block block,
                                           java.lang.Object jumpTarget)

postReflectedMethodInternalCall

public void postReflectedMethodInternalCall()

preInitCoreClasses

public void preInitCoreClasses()

preInitBuiltinClasses

public void preInitBuiltinClasses(RubyClass objectClass,
                                  IRubyObject topSelf)

preNodeEval

public void preNodeEval(RubyModule rubyClass,
                        IRubyObject self)

postNodeEval

public void postNodeEval()

preExecuteUnder

public void preExecuteUnder(RubyModule executeUnderClass,
                            Block block)

postExecuteUnder

public void postExecuteUnder()

preMproc

public void preMproc()

postMproc

public void postMproc()

preRunThread

public void preRunThread(Frame currentFrame)

preTrace

public void preTrace()

postTrace

public void postTrace()

preForBlock

public void preForBlock(Block block,
                        RubyModule klass)

preYieldSpecificBlock

public void preYieldSpecificBlock(Block block,
                                  RubyModule klass)

preEvalWithBinding

public void preEvalWithBinding(Block block)

postEvalWithBinding

public void postEvalWithBinding(Block block)

postYield

public void postYield()

preRootNode

public void preRootNode(DynamicScope scope)

postRootNode

public void postRootNode()

isWithinTrace

public boolean isWithinTrace()
Is this thread actively tracing at this moment.

Returns:
true if so
See Also:
org.jruby.Ruby#callTraceFunction(String, ISourcePosition, IRubyObject, String, IRubyObject)

setWithinTrace

public void setWithinTrace(boolean isWithinTrace)
Set whether we are actively tracing or not on this thread.

Parameters:
isWithinTrace - true is so
See Also:
org.jruby.Ruby#callTraceFunction(String, ISourcePosition, IRubyObject, String, IRubyObject)

isWithinDefined

public boolean isWithinDefined()
Is this thread actively in defined? at the moment.

Returns:
true if within defined?

setWithinDefined

public void setWithinDefined(boolean isWithinDefined)
Set whether we are actively within defined? or not.

Parameters:
isWithinDefined - true if so


Copyright © 2002-2007 JRuby Team. All Rights Reserved.