Interpreter

The interpreter: the one Evaluator this engine has. It runs the icode CodeGenerator emits, one call frame per script function, with the frames linked so an exception or a yield can unwind them without touching the host stack.

Upstream keeps a table of one object per opcode; this port dispatches with a when over the same opcodes, which is what older Rhino did. The cases are the same code.

Continuations (NativeContinuation, captureContinuation) are not ported.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun captureStackInfo(ex: RhinoException)

Records where in the script ex was thrown.

Link copied to clipboard
open override fun compile(compilerEnv: CompilerEnvirons, tree: ScriptNode, rawSource: String, returnFunction: Boolean): Any

Compiles tree into a runnable form.

Link copied to clipboard
open override fun createFunctionObject(cx: Context, scope: Scriptable, bytecode: Any, staticSecurityDomain: Any?): Function

Wraps compiled bytecode as a callable function living in scope.

Link copied to clipboard
open override fun createScriptObject(bytecode: Any, staticSecurityDomain: Any?): Script

Wraps compiled bytecode as a runnable script.

Link copied to clipboard
open override fun getPatchedStack(ex: RhinoException, nativeStackTrace: String): String

There is no host stack trace to patch off the JVM, so the trace comes back as given.

Link copied to clipboard
open override fun getScriptStack(ex: RhinoException): List<String>

The script-level stack for ex, one entry per frame.

Link copied to clipboard
open override fun getSourcePositionFromStack(cx: Context, linep: IntArray): String?

Reads the current source position off the interpreter stack. The line number is written to linep[0]; the return value is the source name.

Link copied to clipboard
open override fun setEvalScriptFlag(script: Script)

Marks script as having come from eval or the Function constructor.