Step 27A: remove EVAL_STMT
This commit is contained in:
parent
6efdfc1964
commit
ac680ceb6c
@ -126,8 +126,8 @@ Goal: migrate the compiler so all values live in frames/bytecode, keeping JVM te
|
||||
- [x] Remove `forceScopeSlots` branches once no bytecode paths depend on scope slots.
|
||||
- [x] Add JVM tests for captured locals and delegated locals inside lambdas on the bytecode path.
|
||||
- [ ] Step 27: Remove interpreter opcodes and constants from bytecode runtime.
|
||||
- [ ] Delete `BytecodeConst.ValueFn`, `CmdMakeValueFn`, and `MAKE_VALUE_FN`.
|
||||
- [ ] Delete `BytecodeConst.StatementVal`, `CmdEvalStmt`, and `EVAL_STMT`.
|
||||
- [ ] Delete `BytecodeConst.ValueFn`, `CmdMakeValueFn`, and `MAKE_VALUE_FN` (blocked: some lambdas still fall back to non-bytecode bodies).
|
||||
- [x] Delete `BytecodeConst.StatementVal`, `CmdEvalStmt`, and `EVAL_STMT`.
|
||||
- [ ] Remove `emitStatementCall`/`emitStatementEval` once unused.
|
||||
- [ ] Step 28: Scope as facade only.
|
||||
- [ ] Audit bytecode execution paths for `Statement.execute` usage and remove remaining calls.
|
||||
|
||||
@ -641,7 +641,6 @@ class BytecodeCompiler(
|
||||
updateSlotType(slot, SlotType.OBJ)
|
||||
return CompiledValue(slot, SlotType.OBJ)
|
||||
}
|
||||
|
||||
val captureTableId = lambdaCaptureEntriesByRef[ref]?.let { captures ->
|
||||
if (captures.isEmpty()) return@let null
|
||||
val resolved = captures.map { entry ->
|
||||
|
||||
@ -32,7 +32,6 @@ sealed class BytecodeConst {
|
||||
data class PosVal(val pos: Pos) : BytecodeConst()
|
||||
data class ObjRef(val value: Obj) : BytecodeConst()
|
||||
data class Ref(val value: net.sergeych.lyng.obj.ObjRef) : BytecodeConst()
|
||||
data class StatementVal(val statement: net.sergeych.lyng.Statement) : BytecodeConst()
|
||||
data class ListLiteralPlan(val spreads: List<Boolean>) : BytecodeConst()
|
||||
data class ValueFn(
|
||||
val fn: suspend (net.sergeych.lyng.Scope) -> net.sergeych.lyng.obj.ObjRecord,
|
||||
|
||||
@ -1861,22 +1861,6 @@ class CmdEvalRef(internal val id: Int, internal val dst: Int) : Cmd() {
|
||||
}
|
||||
}
|
||||
|
||||
class CmdEvalStmt(internal val id: Int, internal val dst: Int) : Cmd() {
|
||||
override suspend fun perform(frame: CmdFrame) {
|
||||
if (frame.fn.localSlotNames.isNotEmpty()) {
|
||||
frame.syncFrameToScope(useRefs = true)
|
||||
}
|
||||
val stmt = frame.fn.constants.getOrNull(id) as? BytecodeConst.StatementVal
|
||||
?: error("EVAL_STMT expects StatementVal at $id")
|
||||
val result = stmt.statement.execute(frame.ensureScope())
|
||||
if (frame.fn.localSlotNames.isNotEmpty()) {
|
||||
frame.syncScopeToFrame()
|
||||
}
|
||||
frame.storeObjResult(dst, result)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
class CmdMakeValueFn(internal val id: Int, internal val dst: Int) : Cmd() {
|
||||
override suspend fun perform(frame: CmdFrame) {
|
||||
val valueFn = frame.fn.constants.getOrNull(id) as? BytecodeConst.ValueFn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user