docs/runtime: externcall + println normalization; NyRT silent result flag; PyVM console warn/error/trace routing\nselfhost(M2): add MirEmitterBox (Return(Int)->const+ret) and --emit-mir switch; initial selfhost smoke\nrunner: child args/env hardening for selfhost (NYASH_NY_COMPILER_CHILD_ARGS under --; NYASH_JSON_ONLY=1, NYASH_VM_USE_PY=1, NYASH_DISABLE_PLUGINS=1); VM path strips using lines when NYASH_ENABLE_USING=1\nmeta: clarify PyVM/llvmlite as primary (vm/interpreter legacy OFF) in CURRENT_TASK.md; README links to externcall docs
This commit is contained in:
@ -458,15 +458,26 @@ class PyVM:
|
||||
func = inst.get("func")
|
||||
args = [self._read(regs, a) for a in inst.get("args", [])]
|
||||
out: Any = None
|
||||
if func == "nyash.console.println":
|
||||
s = args[0] if args else ""
|
||||
if s is None:
|
||||
s = ""
|
||||
print(str(s))
|
||||
out = 0
|
||||
else:
|
||||
# Unknown extern
|
||||
out = None
|
||||
# Normalize known console/debug externs
|
||||
if isinstance(func, str):
|
||||
if func in ("nyash.console.println", "nyash.console.log", "env.console.log"):
|
||||
s = args[0] if args else ""
|
||||
if s is None:
|
||||
s = ""
|
||||
print(str(s))
|
||||
out = 0
|
||||
elif func in ("nyash.console.warn", "env.console.warn", "nyash.console.error", "env.console.error", "nyash.debug.trace", "env.debug.trace"):
|
||||
s = args[0] if args else ""
|
||||
if s is None:
|
||||
s = ""
|
||||
# Write to stderr for warn/error/trace to approximate real consoles
|
||||
try:
|
||||
import sys as _sys
|
||||
print(str(s), file=_sys.stderr)
|
||||
except Exception:
|
||||
print(str(s))
|
||||
out = 0
|
||||
# Unknown extern -> no-op with 0/None
|
||||
self._set(regs, inst.get("dst"), out)
|
||||
i += 1
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user