harness(llvm/py): fix PHI/dominance via Resolver-only; per-pred localization and constant GEPs; stabilize Main.esc_json/1, dirname/1, node_json/3; docs: add NYASH_LLVM_TRACE_FINAL and Resolver-only invariants
- Resolver-only reads across BBs; remove vmap fallbacks - Create PHIs at block start; insert casts in preds before terminators - Re-materialize int in preds to satisfy dominance (add/zext/trunc) - Use constant GEP for method strings to avoid order dependency - Order non-PHI lowering to preserve producer→consumer dominance - Update docs: RESOLVER_API.md, LLVM_HARNESS.md - compare_harness_on_off: ON/OFF exits match; linking green
This commit is contained in:
@ -87,7 +87,25 @@ def lower_call(
|
||||
|
||||
# Make the call
|
||||
result = builder.call(func, call_args, name=f"call_{func_name}")
|
||||
# Optional trace for final debugging
|
||||
try:
|
||||
import os
|
||||
if os.environ.get('NYASH_LLVM_TRACE_FINAL') == '1' and isinstance(actual_name, str):
|
||||
if actual_name in ("Main.node_json/3", "Main.esc_json/1", "main"):
|
||||
print(f"[TRACE] call {actual_name} args={len(call_args)}", flush=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Store result if needed
|
||||
if dst_vid is not None:
|
||||
vmap[dst_vid] = result
|
||||
# Heuristic: mark known string-producing functions as string handles
|
||||
try:
|
||||
name_for_tag = actual_name if isinstance(actual_name, str) else str(actual_name)
|
||||
if resolver is not None and hasattr(resolver, 'mark_string'):
|
||||
if any(key in name_for_tag for key in [
|
||||
'esc_json', 'node_json', 'dirname', 'join', 'read_all', 'toJson'
|
||||
]):
|
||||
resolver.mark_string(dst_vid)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user