Skip to content

Allow calling variadic cfuncs with many args#201

Merged
maximecb merged 4 commits intoShopify:mainfrom
jhawthorn:variadic_many_args
Sep 8, 2021
Merged

Allow calling variadic cfuncs with many args#201
maximecb merged 4 commits intoShopify:mainfrom
jhawthorn:variadic_many_args

Conversation

@jhawthorn
Copy link
Copy Markdown
Member

We have a check to ensure we don't have to push args on the stack to call a cfunc with many args (we probably could support this, but will save that for a future PR). However we never need to use the stack for variadic cfuncs, so we shouldn't care about the number of arguments.

Found this side exit from one of the parsers in main in ruby/ruby-bench#40

We have a check to ensure we don't have to push args on the stack to
call a cfunc with many args. However we never need to use the stack for
variadic cfuncs, so we shouldn't care about the number of arguments.
@maximecb
Copy link
Copy Markdown
Contributor

maximecb commented Sep 7, 2021

So it uses the Ruby stack for variadic C functions?

@jhawthorn
Copy link
Copy Markdown
Member Author

jhawthorn commented Sep 7, 2021

Yes, we pass a pointer to the arguments, which are from the Ruby stack if calling from Ruby

https://github.com/Shopify/yjit/blob/main/yjit_codegen.c#L3005-L3011

@maximecb maximecb enabled auto-merge September 8, 2021 17:29
@maximecb maximecb merged commit 7b8fc81 into Shopify:main Sep 8, 2021
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