Skip to content

Comments

Promote big constants for arithmetic operations.#119

Draft
ptersilie wants to merge 1 commit intoykjit:mainfrom
ptersilie:promote-big-consts
Draft

Promote big constants for arithmetic operations.#119
ptersilie wants to merge 1 commit intoykjit:mainfrom
ptersilie:promote-big-consts

Conversation

@ptersilie
Copy link
Contributor

@ptersilie ptersilie commented Apr 23, 2025

This PR adds promotion for big constants in Lua's arithmetic operations. For this we change op_arithK by inlining op_arith_aux and adding yk_promote to the second operand.

Using the following lua program I can confirm that this indeed promotes big constants:

local sum = 0
for _ = 1,100000 do
    sum = sum + 420000
end
print(sum)

However, when running yk-benchmarks I cannot see any significant performance improvements. On the contrary bigloop and permute take a 10% performance hit. Looking into bigloop I cannot figure out where this performance hit comes from as the jit-asm of both traces is nearly identical, and YKD_STATS tells us that it is indeed trace execution that takes the hit. I've attached the output for a normal run of bigloop and a run with the new promote code, printing out jit-pre-op, jit-asm, and YKD_STATS.

NORMAL.txt
PROMOTEK.txt

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.

2 participants