-
-
Notifications
You must be signed in to change notification settings - Fork 672
Improve typed array sort #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve typed array sort #1040
Conversation
@dcodeIO It's actually workaround which also has less retains. But I guess problem with RC in similar situations not solved in general case |
Seems the related issue is #1039. Should probably fix the underlying problem, but wondering how that happens. |
…into fix-typed-array-sort
call $~lib/rt/pure/__retain | ||
local.tee $1 | ||
call $~lib/typedarray/Int64Array#get:length | ||
local.tee $2 | ||
i32.const 1 | ||
i32.le_s | ||
if | ||
local.get $1 | ||
call $~lib/rt/pure/__release | ||
br $~lib/typedarray/SORT<~lib/typedarray/Float64Array,f64>|inlined.0 | ||
end | ||
local.get $1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i32.load | ||
local.set $6 | ||
i32.const 2 | ||
global.set $~lib/argc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcodeIO could we avoid this somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's there because we can't tell whether we are calling a trampoline under the hood, so if we do, it needs to know how many args to fill. For instance:
function a(a: i32): i32 { return a; }
function b(a: i32, b?: i32 = 1) { return a + b; }
var c = someCond ? a : b;
c(2); // must indicate one arg is present so b|trampoline inserts b=1
Fix #1039