Skip to content
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

Make it possible to call instance_exec with rb_block_call #1802

Merged
merged 2 commits into from
Nov 7, 2019

Conversation

XrXr
Copy link
Contributor

@XrXr XrXr commented Nov 6, 2019

instance_exec switches self, which breaks the RARRAY_PTR call we were
making inside the block where we are unsure about what self is. While
we are at it, add a spec for the last argument of rb_block_call.

Shopify#1

instance_exec switches self, which breaks the `RARRAY_PTR` call we were
making inside the block where we are unsure about what `self` is.  While
we are at it, add a spec for the last argument of rb_block_call.
Copy link
Contributor

@aardvark179 aardvark179 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Could you add a change log entry?

object.__send__(method, *args) do |*block_args|
TrufflePrimitive.cext_unwrap(TrufflePrimitive.call_with_c_mutex(func, [
TrufflePrimitive.cext_wrap(block_args.first),
data,
block_args.size, # argc
RARRAY_PTR(block_args), # argv
outer_self.RARRAY_PTR(block_args), # argv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use an explicit Truffle::CExt.RARRAY_PTR(block_args) here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make that change as it's a minor thing.

@eregon eregon added this to the 20.0.0 milestone Nov 7, 2019
@eregon eregon added the in-ci The PR is being tested in CI. Do not push new commits. label Nov 7, 2019
graalvmbot pushed a commit that referenced this pull request Nov 7, 2019
@graalvmbot graalvmbot merged commit 1a83e60 into oracle:master Nov 7, 2019
@XrXr XrXr deleted the rb_blcok_call_self branch November 7, 2019 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. oca-signed shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants