llvm-harness: add optional NYASH_LLVM_TRACE_CALLS to print mir_call callee (includes Method.certainty) for diagnostics; no behavior change

This commit is contained in:
nyash-codex
2025-09-28 02:11:12 +09:00
parent 3768063b1e
commit fe0578a2fb

View File

@ -35,6 +35,25 @@ def lower_mir_call(owner, builder: ir.IRBuilder, mir_call: Dict[str, Any], dst_v
# Parse callee type # Parse callee type
callee_type = callee.get("type") callee_type = callee.get("type")
# Optional trace: dump callee info (including certainty for Method)
if os.getenv('NYASH_LLVM_TRACE_CALLS') == '1':
try:
evt = { 'type': callee_type }
if callee_type == 'Global':
evt.update({'name': callee.get('name')})
elif callee_type == 'Method':
evt.update({
'box_name': callee.get('box_name'),
'method': callee.get('method'),
'receiver': callee.get('receiver'),
'certainty': callee.get('certainty'),
})
elif callee_type == 'Extern':
evt.update({'name': callee.get('name')})
print(json.dumps({'phase':'llvm','cat':'mir_call','event':evt}))
except Exception:
pass
if callee_type == "Global": if callee_type == "Global":
# Global function call (e.g., print, panic) # Global function call (e.g., print, panic)
func_name = callee.get("name") func_name = callee.get("name")