From 04ea282ed23e7490a11eba71384583ba46c97d21 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Tue, 18 Jun 2024 15:44:16 +0200 Subject: [PATCH] Fix single captured detection, and when r0 is also alias of local var --- hld/CodeGraph.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hld/CodeGraph.hx b/hld/CodeGraph.hx index 5f93aac..aa0a54b 100644 --- a/hld/CodeGraph.hx +++ b/hld/CodeGraph.hx @@ -83,7 +83,7 @@ class CodeGraph { } var r = -a.position - 2; var vars; - if( r != reg ) { + if( r != reg && a.position != -1) { reg = r; vars = []; args.unshift({ hasIndex : true, vars : vars }); @@ -94,7 +94,7 @@ class CodeGraph { } // single captured pointer => passed directly - if( args.length >= 1 && args[0].hasIndex && args[0].vars.length == 1 && !f.regs[0].match(HEnum({name:""})) ) + if( args.length >= 1 && args[0].hasIndex && !f.regs[0].match(HEnum({name:null})) ) args[0].hasIndex = false; if( args.length == nargs - 1 )