Skip to content

[hl] optimize closure null check - #13045

Merged
yuxiaomao merged 5 commits into
HaxeFoundation:developmentfrom
yuxiaomao:dev-hl-opt-closure
Sep 29, 2026
Merged

yuxiaomao merged 5 commits into
HaxeFoundation:developmentfrom
yuxiaomao:dev-hl-opt-closure

Conversation

@yuxiaomao

Copy link
Copy Markdown
Contributor

The goal was to remove some null check when we know that the closure is valid, when working on #13043:

.14    @5 staticclosure 2, fun$34
.14    @6 jnotnull 2,2                   ; <- not necessary
.14    @7 null 3
.14    @8 jalways 1
.14    @9 instanceclosure 3, fun$32(2)
.14    @A setfield 0[0],3

and becomes

.14    @5 staticclosure 2, fun$34
.14    @6 instanceclosure 3, fun$32(2)
.14    @7 setfield 0[0],3

I'll probably test it a little bit more and write some hlcode tests later

@yuxiaomao

Copy link
Copy Markdown
Contributor Author

In summary:

  • new / staticclosure / instanceclosure => never null
  • null => always null
  • remove unused null r, similar to unused mov
  • backward loop for unused register removal for better cleanup

@yuxiaomao
yuxiaomao merged commit c085cf3 into HaxeFoundation:development Sep 29, 2026
98 of 99 checks passed
@yuxiaomao
yuxiaomao deleted the dev-hl-opt-closure branch September 29, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant