org.jruby.runtime
Class ThreadContext

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

public final class ThreadContext
extends java.lang.Object

Author:
jpetersen

Method Summary
 void callThreadPoll()
           
 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.
protected  void finalize()
           
 RubyKernel.CatchTarget[] getActiveCatches()
           
 RubyModule getBindingRubyClass()
           
 IRubyObject getConstant(java.lang.String internedName)
          Used by the evaluator and the compiler to look up a constant by name
 boolean getConstantDefined(java.lang.String internedName)
           
 Frame getCurrentFrame()
           
 DynamicScope getCurrentScope()
           
 Visibility getCurrentVisibility()
           
 IRubyObject getErrorInfo()
           
 FiberLibrary.Fiber getFiber()
           
 java.lang.String getFile()
           
 Block getFrameBlock()
           
 int getFrameCount()
           
 JumpTarget getFrameJumpTarget()
           
 RubyModule getFrameKlazz()
           
 java.lang.String getFrameName()
           
 IRubyObject getFrameSelf()
           
 CallType getLastCallType()
           
 IRubyObject getLastExitStatus()
           
 Visibility getLastVisibility()
           
 int getLine()
           
 Frame getNextFrame()
           
 Frame getPreviousFrame()
           
 DynamicScope getPreviousScope()
           
 Visibility getPreviousVisibility()
           
 RubyModule getRubyClass()
           
 Ruby getRuntime()
           
 RubyThread getThread()
           
 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)
           
 void pollThreadEvents()
           
 void popCatch()
           
 RubyModule popRubyClass()
           
 void popScope()
           
 void postBsfApply()
           
 void postClassEval()
           
 void postCompiledClass()
           
 void postEvalWithBinding(Binding binding)
           
 void postExecuteUnder()
           
 void postMethodBacktraceAndScope()
           
 void postMethodBacktraceOnly()
           
 void postMethodFrameAndScope()
           
 void postMethodFrameOnly()
           
 void postMethodScopeOnly()
           
 void postMproc()
           
 void postNodeEval()
           
 void postScopedBody()
           
 void postScopeNode()
           
 void postTrace()
           
 void postYield(Binding binding)
           
 void postYieldLight(Binding binding)
           
 void postYieldNoScope()
           
 void preAdoptThread()
           
 void preBsfApply(java.lang.String[] names)
           
 void preClassEval(StaticScope staticScope, RubyModule type)
           
 void preCompiledClass(RubyModule type, java.lang.String[] scopeNames)
           
 void preEvalWithBinding(Binding binding)
           
 void preExecuteUnder(RubyModule executeUnderClass, Block block)
           
 void preForBlock(Binding binding, RubyModule klass)
           
 void preMethodBacktraceAndScope(java.lang.String name, RubyModule clazz, StaticScope staticScope)
           
 void preMethodBacktraceOnly(java.lang.String name)
           
 void preMethodFrameAndScope(RubyModule clazz, java.lang.String name, IRubyObject self, Block block, StaticScope staticScope, JumpTarget jumpTarget)
           
 void preMethodFrameOnly(RubyModule clazz, java.lang.String name, IRubyObject self, Block block, JumpTarget jumpTarget)
           
 void preMethodScopeOnly(RubyModule clazz, StaticScope staticScope)
           
 void preMproc()
           
 void preNodeEval(RubyModule rubyClass, IRubyObject self)
           
 void preNodeEval(RubyModule rubyClass, IRubyObject self, java.lang.String name)
           
 void prepareTopLevel(RubyClass objectClass, IRubyObject topSelf)
           
 void preRunThread(Frame currentFrame)
           
 void preScopedBody(DynamicScope scope)
           
 void preScopeNode(StaticScope staticScope)
           
 void preTrace()
           
 void preYieldLightBlock(Binding binding, DynamicScope emptyScope, RubyModule klass)
           
 void preYieldNoScope(Binding binding, RubyModule klass)
           
 void preYieldSpecificBlock(Binding binding, StaticScope scope, RubyModule klass)
           
 void printScope()
           
 void pushCatch(RubyKernel.CatchTarget catchTarget)
           
 void pushRubyClass(RubyModule currentModule)
           
 void pushScope(DynamicScope scope)
           
 IRubyObject setConstantInCurrent(java.lang.String internedName, 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 internedName, IRubyObject target, IRubyObject result)
          Used by the evaluator and the compiler to set a constant by name.
 IRubyObject setConstantInObject(java.lang.String internedName, IRubyObject result)
          Used by the evaluator and the compiler to set a constant by name This is for a Colon2 const decl
 void setCurrentVisibility(Visibility visibility)
           
 IRubyObject setErrorInfo(IRubyObject errorInfo)
           
 void setFiber(FiberLibrary.Fiber fiber)
           
 void setFile(java.lang.String file)
           
 void setFrameJumpTarget(JumpTarget target)
           
 void setLastCallStatus(CallType callType)
          Returns the lastCallStatus.
 void setLastExitStatus(IRubyObject lastExitStatus)
           
 void setLastVisibility(Visibility visibility)
           
 void setLine(int line)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newContext

public static ThreadContext newContext(Ruby runtime)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

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)

getFiber

public FiberLibrary.Fiber getFiber()

setFiber

public void setFiber(FiberLibrary.Fiber fiber)

pushCatch

public void pushCatch(RubyKernel.CatchTarget catchTarget)

popCatch

public void popCatch()

getActiveCatches

public RubyKernel.CatchTarget[] getActiveCatches()

getCurrentFrame

public Frame getCurrentFrame()

getNextFrame

public Frame getNextFrame()

getPreviousFrame

public Frame getPreviousFrame()

getFrameCount

public int getFrameCount()

getFrameName

public java.lang.String getFrameName()

getFrameSelf

public IRubyObject getFrameSelf()

getFrameJumpTarget

public JumpTarget getFrameJumpTarget()

setFrameJumpTarget

public void setFrameJumpTarget(JumpTarget target)

getFrameKlazz

public RubyModule getFrameKlazz()

getFrameBlock

public Block getFrameBlock()

getFile

public java.lang.String getFile()

getLine

public int getLine()

setFile

public void setFile(java.lang.String file)

setLine

public void setLine(int line)

getCurrentVisibility

public Visibility getCurrentVisibility()

getPreviousVisibility

public Visibility getPreviousVisibility()

setCurrentVisibility

public void setCurrentVisibility(Visibility visibility)

pollThreadEvents

public void pollThreadEvents()

callThreadPoll

public void callThreadPoll()

pushRubyClass

public void pushRubyClass(RubyModule currentModule)

popRubyClass

public RubyModule popRubyClass()

getRubyClass

public RubyModule getRubyClass()

getBindingRubyClass

public RubyModule getBindingRubyClass()

getConstantDefined

public boolean getConstantDefined(java.lang.String internedName)

getConstant

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


setConstantInCurrent

public IRubyObject setConstantInCurrent(java.lang.String internedName,
                                        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 internedName,
                                       IRubyObject target,
                                       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 internedName,
                                       IRubyObject result)
Used by the evaluator and the compiler to set a constant by name This is for a Colon2 const decl


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,
                             java.lang.String[] scopeNames)

postCompiledClass

public void postCompiledClass()

preScopeNode

public void preScopeNode(StaticScope staticScope)

postScopeNode

public void postScopeNode()

preClassEval

public void preClassEval(StaticScope staticScope,
                         RubyModule type)

postClassEval

public void postClassEval()

preBsfApply

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

postBsfApply

public void postBsfApply()

preMethodFrameAndScope

public void preMethodFrameAndScope(RubyModule clazz,
                                   java.lang.String name,
                                   IRubyObject self,
                                   Block block,
                                   StaticScope staticScope,
                                   JumpTarget jumpTarget)

postMethodFrameAndScope

public void postMethodFrameAndScope()

preMethodFrameOnly

public void preMethodFrameOnly(RubyModule clazz,
                               java.lang.String name,
                               IRubyObject self,
                               Block block,
                               JumpTarget jumpTarget)

postMethodFrameOnly

public void postMethodFrameOnly()

preMethodScopeOnly

public void preMethodScopeOnly(RubyModule clazz,
                               StaticScope staticScope)

postMethodScopeOnly

public void postMethodScopeOnly()

preMethodBacktraceAndScope

public void preMethodBacktraceAndScope(java.lang.String name,
                                       RubyModule clazz,
                                       StaticScope staticScope)

postMethodBacktraceAndScope

public void postMethodBacktraceAndScope()

preMethodBacktraceOnly

public void preMethodBacktraceOnly(java.lang.String name)

postMethodBacktraceOnly

public void postMethodBacktraceOnly()

prepareTopLevel

public void prepareTopLevel(RubyClass objectClass,
                            IRubyObject topSelf)

preNodeEval

public void preNodeEval(RubyModule rubyClass,
                        IRubyObject self,
                        java.lang.String name)

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(Binding binding,
                        RubyModule klass)

preYieldSpecificBlock

public void preYieldSpecificBlock(Binding binding,
                                  StaticScope scope,
                                  RubyModule klass)

preYieldLightBlock

public void preYieldLightBlock(Binding binding,
                               DynamicScope emptyScope,
                               RubyModule klass)

preYieldNoScope

public void preYieldNoScope(Binding binding,
                            RubyModule klass)

preEvalWithBinding

public void preEvalWithBinding(Binding binding)

postEvalWithBinding

public void postEvalWithBinding(Binding binding)

postYield

public void postYield(Binding binding)

postYieldLight

public void postYieldLight(Binding binding)

postYieldNoScope

public void postYieldNoScope()

preScopedBody

public void preScopedBody(DynamicScope scope)

postScopedBody

public void postScopedBody()

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.