public final class ThreadContext
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ThreadContext.RecursiveFunctionEx<T> |
Modifier and Type | Field and Description |
---|---|
int |
callNumber |
boolean |
exceptionRequiresBacktrace |
RubyBoolean |
fals |
IRubyObject |
nil |
Ruby |
runtime |
RuntimeCache |
runtimeCache |
java.security.SecureRandom |
secureRandom
Deprecated.
|
JavaSites |
sites |
RubyBoolean |
tru |
static com.headius.backport9.stack.StackWalker |
WALKER |
static com.headius.backport9.stack.StackWalker |
WALKER8 |
Modifier and Type | Method and Description |
---|---|
void |
callThreadPoll() |
static void |
callThreadPoll(ThreadContext context) |
IRubyObject |
createCallerBacktrace(int level,
int length,
java.util.stream.Stream<com.headius.backport9.stack.StackWalker.StackFrame> stackStream)
Create an Array with backtrace information for Kernel#caller
|
IRubyObject |
createCallerLocations(int level,
java.lang.Integer length,
java.util.stream.Stream<com.headius.backport9.stack.StackWalker.StackFrame> stackStream)
Create an array containing Thread::Backtrace::Location objects for the
requested caller trace level and length.
|
static java.lang.String |
createRawBacktraceStringFromThrowable(java.lang.Throwable ex,
boolean color) |
Binding |
currentBinding()
Return a binding representing the current call's state
|
Binding |
currentBinding(IRubyObject self)
Return a binding representing the current call's state but with a specified self
|
Binding |
currentBinding(IRubyObject self,
DynamicScope scope)
Return a binding representing the current call's state but with the
specified scope and self.
|
Binding |
currentBinding(IRubyObject self,
Visibility visibility)
Return a binding representing the current call's state but with the
specified visibility and self.
|
Binding |
currentBinding(IRubyObject self,
Visibility visibility,
DynamicScope scope)
Return a binding representing the current call's state but with the
specified visibility, scope, and self.
|
org.jcodings.Encoding[] |
encodingHolder() |
void |
exceptionBacktraceOff() |
void |
exceptionBacktraceOn() |
protected void |
finalize() |
CatchThrow |
getActiveCatch(java.lang.Object tag)
Find the active Continuation for the given tag.
|
IRubyObject |
getBackRef()
Get the value of the $~ (backref) "global".
|
java.util.stream.Stream<BacktraceElement> |
getBacktrace()
Create a snapshot Array with current backtrace information.
|
java.util.stream.Stream<BacktraceElement> |
getBacktrace(int level) |
IRubyObject |
getConstant(java.lang.String internedName)
Deprecated.
|
Frame |
getCurrentFrame() |
DynamicScope |
getCurrentScope() |
StaticScope |
getCurrentStaticScope() |
int |
getCurrentTarget() |
Visibility |
getCurrentVisibility() |
IRubyObject |
getErrorInfo() |
ThreadFiber |
getFiber() |
RubyThread |
getFiberCurrentThread() |
java.lang.String |
getFile() |
Block |
getFrameBlock() |
RubyModule |
getFrameKlazz() |
java.lang.String |
getFrameName() |
IRubyObject |
getFrameSelf() |
CallType |
getLastCallType() |
IRubyObject |
getLastExitStatus() |
IRubyObject |
getLastLine()
Get the value of the $_ (lastline) "global".
|
Visibility |
getLastVisibility() |
int |
getLine() |
Frame |
getNextFrame() |
Frame |
getPreviousFrame() |
ProfileCollection |
getProfileCollection()
Get the profile collection for this thread (ThreadContext).
|
java.util.Set<RecursiveComparator.Pair> |
getRecursiveSet() |
RubyDateFormat |
getRubyDateFormat()
Deprecated.
|
RubyDateFormatter |
getRubyDateFormatter() |
Ruby |
getRuntime()
Retrieve the runtime associated with this context.
|
java.lang.Throwable |
getSavedExceptionInLambda() |
java.security.SecureRandom |
getSecureRandom() |
RubyStackTraceElement |
getSingleBacktrace()
Same as calling getSingleBacktrace(0);
|
RubyStackTraceElement |
getSingleBacktrace(int level)
Return a single RubyStackTraceElement representing the nearest Ruby stack trace element.
|
RubyThread |
getThread() |
boolean |
hasAnyScopes() |
boolean |
isEventHooksEnabled() |
boolean |
isProfiling() |
boolean |
isWithinTrace()
Is this thread actively tracing at this moment.
|
IRubyObject |
last_match()
MRI: rb_reg_last_match
|
IRubyObject |
match_last()
MRI: rb_reg_match_last
|
IRubyObject |
match_post()
MRI: rb_reg_match_post
|
IRubyObject |
match_pre()
MRI: rb_reg_match_pre
|
static ThreadContext |
newContext(Ruby runtime) |
void |
pollThreadEvents() |
static void |
popBacktrace(ThreadContext context) |
void |
popCatch() |
void |
popFrame() |
void |
popScope() |
void |
postBackrefMethod() |
void |
postBsfApply() |
void |
postEvalScriptlet() |
void |
postEvalWithBinding(Binding binding,
Frame lastFrame) |
void |
postExecuteUnder() |
void |
postMethodBacktraceAndScope() |
void |
postMethodBacktraceDummyScope() |
void |
postMethodBacktraceOnly() |
void |
postMethodFrameAndScope() |
void |
postMethodFrameOnly() |
void |
postMethodScopeOnly() |
void |
postNodeEval() |
void |
postScopedBody() |
void |
postTrace() |
void |
postYield(Binding binding,
Frame lastFrame) |
void |
postYieldNoScope(Frame lastFrame) |
void |
preAdoptThread() |
void |
preBackrefMethod() |
void |
preBsfApply(java.lang.String[] names) |
void |
preEvalScriptlet(DynamicScope scope) |
Frame |
preEvalWithBinding(Binding binding) |
void |
preExecuteUnder(IRubyObject executeUnderObj,
RubyModule executeUnderClass,
Block block) |
void |
preExtensionLoad(IRubyObject self) |
void |
preMethodBacktraceAndScope(java.lang.String name,
StaticScope staticScope) |
void |
preMethodBacktraceDummyScope(java.lang.String name,
StaticScope staticScope) |
void |
preMethodBacktraceOnly(java.lang.String name) |
void |
preMethodFrameAndDummyScope(RubyModule clazz,
java.lang.String name,
IRubyObject self,
Block block,
StaticScope staticScope) |
void |
preMethodFrameAndScope(RubyModule clazz,
java.lang.String name,
IRubyObject self,
Block block,
StaticScope staticScope) |
void |
preMethodFrameOnly(RubyModule clazz,
java.lang.String name,
IRubyObject self) |
void |
preMethodFrameOnly(RubyModule clazz,
java.lang.String name,
IRubyObject self,
Block block) |
void |
preMethodFrameOnly(RubyModule clazz,
java.lang.String name,
IRubyObject self,
Visibility visiblity,
Block block) |
void |
preMethodNoFrameAndDummyScope(StaticScope staticScope) |
void |
preMethodScopeOnly(StaticScope staticScope) |
void |
preNodeEval(IRubyObject self) |
void |
prepareTopLevel(RubyClass objectClass,
IRubyObject topSelf) |
void |
preScopedBody(DynamicScope scope) |
void |
preTrace() |
Frame |
preYieldNoScope(Binding binding) |
Frame |
preYieldNoScope(Block block) |
Frame |
preYieldSpecificBlock(Binding binding,
StaticScope scope) |
void |
printScope() |
int |
profileEnter(int nextMethod) |
int |
profileEnter(java.lang.String name,
DynamicMethod nextMethod) |
int |
profileExit(int nextMethod,
long startTime) |
static void |
pushBacktrace(ThreadContext context,
java.lang.String method,
java.lang.String file,
int line) |
void |
pushCatch(CatchThrow catchTarget) |
void |
pushCatch(RubyContinuation.Continuation catchTarget)
Deprecated.
|
void |
pushEvalSimpleFrame(IRubyObject executeObject) |
void |
pushFrame() |
DynamicScope |
pushNewScope(StaticScope staticScope) |
void |
pushScope(DynamicScope scope) |
void |
renderCurrentBacktrace(java.lang.StringBuilder sb)
Render the current backtrace as a string to the given StringBuilder.
|
<T> IRubyObject |
safeRecurse(ThreadContext.RecursiveFunctionEx<T> func,
T state,
IRubyObject obj,
java.lang.String name,
boolean outer) |
boolean |
scopeExistsOnCallStack(DynamicScope scope)
Check if a scope is present on the call stack.
|
IRubyObject |
setBackRef(IRubyObject match)
Set the $~ (backref) "global" to the given value.
|
void |
setCurrentVisibility(Visibility visibility) |
IRubyObject |
setErrorInfo(IRubyObject errorInfo) |
void |
setEventHooksEnabled(boolean flag) |
void |
setExceptionRequiresBacktrace(boolean exceptionRequiresBacktrace) |
void |
setFiber(ThreadFiber fiber) |
void |
setFile(java.lang.String file)
Deprecated.
|
void |
setFileAndLine(ISourcePosition position) |
void |
setFileAndLine(java.lang.String file,
int line) |
void |
setLastCallStatusAndVisibility(CallType callType,
Visibility visibility) |
void |
setLastExitStatus(IRubyObject lastExitStatus) |
IRubyObject |
setLastLine(IRubyObject last)
Set the $_ (lastlne) "global" to the given value.
|
void |
setLine(int line) |
void |
setRecursiveSet(java.util.Set<RecursiveComparator.Pair> recursiveSet) |
void |
setRootFiber(ThreadFiber rootFiber) |
void |
setSavedExceptionInLambda(java.lang.Throwable e) |
void |
setThread(RubyThread thread) |
void |
setWithinTrace(boolean isWithinTrace)
Set whether we are actively tracing or not on this thread.
|
void |
startProfiling() |
void |
stopProfiling() |
void |
trace(RubyEvent event,
java.lang.String name,
RubyModule implClass) |
void |
trace(RubyEvent event,
java.lang.String name,
RubyModule implClass,
java.lang.String file,
int line) |
void |
useRecursionGuardsFrom(ThreadContext context)
Fibers must use the same recursion guards as their parent thread.
|
public final Ruby runtime
public final IRubyObject nil
public final RubyBoolean tru
public final RubyBoolean fals
public final RuntimeCache runtimeCache
@Deprecated public transient java.security.SecureRandom secureRandom
getSecureRandom()
instead.public final JavaSites sites
public int callNumber
public static final com.headius.backport9.stack.StackWalker WALKER
public static final com.headius.backport9.stack.StackWalker WALKER8
public boolean exceptionRequiresBacktrace
public static ThreadContext newContext(Ruby runtime)
public java.security.SecureRandom getSecureRandom()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public final Ruby getRuntime()
runtime
public IRubyObject getErrorInfo()
public IRubyObject setErrorInfo(IRubyObject errorInfo)
public java.lang.Throwable getSavedExceptionInLambda()
public void setSavedExceptionInLambda(java.lang.Throwable e)
public CallType getLastCallType()
public Visibility getLastVisibility()
public void setLastCallStatusAndVisibility(CallType callType, Visibility visibility)
public IRubyObject getLastExitStatus()
public void setLastExitStatus(IRubyObject lastExitStatus)
public void printScope()
public DynamicScope getCurrentScope()
public StaticScope getCurrentStaticScope()
public void pushScope(DynamicScope scope)
public DynamicScope pushNewScope(StaticScope staticScope)
public void popScope()
public RubyThread getThread()
public RubyThread getFiberCurrentThread()
public RubyDateFormatter getRubyDateFormatter()
public void setThread(RubyThread thread)
public ThreadFiber getFiber()
public void setFiber(ThreadFiber fiber)
public void useRecursionGuardsFrom(ThreadContext context)
public void setRootFiber(ThreadFiber rootFiber)
@Deprecated public void pushCatch(RubyContinuation.Continuation catchTarget)
public void pushCatch(CatchThrow catchTarget)
public void popCatch()
public CatchThrow getActiveCatch(java.lang.Object tag)
tag
- The interned string to search forpublic void pushEvalSimpleFrame(IRubyObject executeObject)
public void pushFrame()
public void popFrame()
public Frame getCurrentFrame()
public Frame getNextFrame()
public Frame getPreviousFrame()
public IRubyObject setBackRef(IRubyObject match)
match
- the value to setpublic IRubyObject getBackRef()
public IRubyObject last_match()
public IRubyObject match_pre()
public IRubyObject match_post()
public IRubyObject match_last()
public IRubyObject setLastLine(IRubyObject last)
last
- the value to setpublic IRubyObject getLastLine()
public static void pushBacktrace(ThreadContext context, java.lang.String method, java.lang.String file, int line)
public static void popBacktrace(ThreadContext context)
public boolean hasAnyScopes()
public boolean scopeExistsOnCallStack(DynamicScope scope)
scope
- the scope to look forpublic java.lang.String getFrameName()
public IRubyObject getFrameSelf()
public RubyModule getFrameKlazz()
public Block getFrameBlock()
public java.lang.String getFile()
public int getLine()
public void setLine(int line)
public void setFileAndLine(java.lang.String file, int line)
public void setFileAndLine(ISourcePosition position)
public Visibility getCurrentVisibility()
public void setCurrentVisibility(Visibility visibility)
public void pollThreadEvents()
public int getCurrentTarget()
public void callThreadPoll()
public static void callThreadPoll(ThreadContext context)
public void trace(RubyEvent event, java.lang.String name, RubyModule implClass)
public void trace(RubyEvent event, java.lang.String name, RubyModule implClass, java.lang.String file, int line)
@Deprecated public IRubyObject getConstant(java.lang.String internedName)
public void renderCurrentBacktrace(java.lang.StringBuilder sb)
sb
- the StringBuilder to which to render the backtracepublic IRubyObject createCallerBacktrace(int level, int length, java.util.stream.Stream<com.headius.backport9.stack.StackWalker.StackFrame> stackStream)
level
- length
- public IRubyObject createCallerLocations(int level, java.lang.Integer length, java.util.stream.Stream<com.headius.backport9.stack.StackWalker.StackFrame> stackStream)
level
- the level at which the trace should startlength
- the length of the tracepublic RubyStackTraceElement getSingleBacktrace(int level)
public RubyStackTraceElement getSingleBacktrace()
getSingleBacktrace(int)
public boolean isEventHooksEnabled()
public void setEventHooksEnabled(boolean flag)
public java.util.stream.Stream<BacktraceElement> getBacktrace()
public final java.util.stream.Stream<BacktraceElement> getBacktrace(int level)
public static java.lang.String createRawBacktraceStringFromThrowable(java.lang.Throwable ex, boolean color)
public void preAdoptThread()
public void preExtensionLoad(IRubyObject self)
public void preBsfApply(java.lang.String[] names)
public void postBsfApply()
public void preMethodFrameAndScope(RubyModule clazz, java.lang.String name, IRubyObject self, Block block, StaticScope staticScope)
public void preMethodFrameAndDummyScope(RubyModule clazz, java.lang.String name, IRubyObject self, Block block, StaticScope staticScope)
public void preMethodNoFrameAndDummyScope(StaticScope staticScope)
public void postMethodFrameAndScope()
public void preMethodFrameOnly(RubyModule clazz, java.lang.String name, IRubyObject self, Block block)
public void preMethodFrameOnly(RubyModule clazz, java.lang.String name, IRubyObject self, Visibility visiblity, Block block)
public void preMethodFrameOnly(RubyModule clazz, java.lang.String name, IRubyObject self)
public void preBackrefMethod()
public void postMethodFrameOnly()
public void postBackrefMethod()
public void preMethodScopeOnly(StaticScope staticScope)
public void postMethodScopeOnly()
public void preMethodBacktraceAndScope(java.lang.String name, StaticScope staticScope)
public void postMethodBacktraceAndScope()
public void preMethodBacktraceOnly(java.lang.String name)
public void preMethodBacktraceDummyScope(java.lang.String name, StaticScope staticScope)
public void postMethodBacktraceOnly()
public void postMethodBacktraceDummyScope()
public void prepareTopLevel(RubyClass objectClass, IRubyObject topSelf)
public void preNodeEval(IRubyObject self)
public void postNodeEval()
public void preExecuteUnder(IRubyObject executeUnderObj, RubyModule executeUnderClass, Block block)
public void postExecuteUnder()
public void preTrace()
public void postTrace()
public Frame preYieldSpecificBlock(Binding binding, StaticScope scope)
public void preEvalScriptlet(DynamicScope scope)
public void postEvalScriptlet()
public void postYieldNoScope(Frame lastFrame)
public void preScopedBody(DynamicScope scope)
public void postScopedBody()
public boolean isWithinTrace()
Ruby.callEventHooks(ThreadContext, RubyEvent, String, int, String, org.jruby.runtime.builtin.IRubyObject)
public void setWithinTrace(boolean isWithinTrace)
isWithinTrace
- true is soRuby.callEventHooks(ThreadContext, RubyEvent, String, int, String, org.jruby.runtime.builtin.IRubyObject)
public Binding currentBinding()
public Binding currentBinding(IRubyObject self)
self
- the self object to usepublic Binding currentBinding(IRubyObject self, Visibility visibility)
self
- the self object to usevisibility
- the visibility to usepublic Binding currentBinding(IRubyObject self, DynamicScope scope)
self
- the self object to usescope
- the scope to usepublic Binding currentBinding(IRubyObject self, Visibility visibility, DynamicScope scope)
self
- the self object to usevisibility
- the visibility to usescope
- the scope to usepublic ProfileCollection getProfileCollection()
public void startProfiling()
public void stopProfiling()
public boolean isProfiling()
public int profileEnter(int nextMethod)
public int profileEnter(java.lang.String name, DynamicMethod nextMethod)
public int profileExit(int nextMethod, long startTime)
public java.util.Set<RecursiveComparator.Pair> getRecursiveSet()
public void setRecursiveSet(java.util.Set<RecursiveComparator.Pair> recursiveSet)
public void setExceptionRequiresBacktrace(boolean exceptionRequiresBacktrace)
public void exceptionBacktraceOn()
public void exceptionBacktraceOff()
public <T> IRubyObject safeRecurse(ThreadContext.RecursiveFunctionEx<T> func, T state, IRubyObject obj, java.lang.String name, boolean outer)
public org.jcodings.Encoding[] encodingHolder()
@Deprecated public void setFile(java.lang.String file)
@Deprecated public RubyDateFormat getRubyDateFormat()
Copyright © 2001-2019 JRuby. All Rights Reserved.