mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Pass self type through method calls
This commit is contained in:
parent
ef5cfcae0d
commit
60496b6666
3 changed files with 8 additions and 8 deletions
|
@ -35,13 +35,12 @@ Start by cloning the `yjit` branch of the `Shopify/ruby` repository:
|
|||
```
|
||||
git clone https://github.com/Shopify/ruby.git yjit
|
||||
cd yjit
|
||||
git checkout yjit
|
||||
```
|
||||
|
||||
The YJIT `ruby` binary can be built with either GCC or Clang. We recommend enabling debug symbols so that assertions are enabled during development as this makes debugging easier. More detailed build instructions are provided in the [Ruby README](https://github.com/ruby/ruby#how-to-compile-and-install).
|
||||
|
||||
```
|
||||
autoconf
|
||||
./autogen.sh
|
||||
./configure cppflags=-DRUBY_DEBUG --prefix=$HOME/.rubies/ruby-yjit
|
||||
make -j16 install
|
||||
```
|
||||
|
|
|
@ -525,11 +525,11 @@ static codegen_status_t
|
|||
gen_putself(jitstate_t* jit, ctx_t* ctx)
|
||||
{
|
||||
// Load self from CFP
|
||||
mov(cb, RAX, member_opnd(REG_CFP, rb_control_frame_t, self));
|
||||
mov(cb, REG0, member_opnd(REG_CFP, rb_control_frame_t, self));
|
||||
|
||||
// Write it on the stack
|
||||
x86opnd_t stack_top = ctx_stack_push_self(ctx);
|
||||
mov(cb, stack_top, RAX);
|
||||
mov(cb, stack_top, REG0);
|
||||
|
||||
return YJIT_KEEP_COMPILING;
|
||||
}
|
||||
|
@ -1792,11 +1792,13 @@ gen_oswb_iseq(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const r
|
|||
// Create a context for the callee
|
||||
ctx_t callee_ctx = DEFAULT_CTX;
|
||||
|
||||
// Set the argument type in the callee's context
|
||||
// Set the argument types in the callee's context
|
||||
for (int32_t arg_idx = 0; arg_idx < argc; ++arg_idx) {
|
||||
val_type_t arg_type = ctx_get_opnd_type(ctx, OPND_STACK(argc - arg_idx - 1));
|
||||
ctx_set_local_type(&callee_ctx, arg_idx, arg_type);
|
||||
}
|
||||
val_type_t recv_type = ctx_get_opnd_type(ctx, OPND_STACK(argc));
|
||||
ctx_set_opnd_type(&callee_ctx, OPND_SELF, recv_type);
|
||||
|
||||
// Pop arguments and receiver in return context, push the return value
|
||||
// After the return, the JIT and interpreter SP will match up
|
||||
|
|
|
@ -160,8 +160,6 @@ Set the type of an instruction operand
|
|||
*/
|
||||
void ctx_set_opnd_type(ctx_t* ctx, insn_opnd_t opnd, val_type_t type)
|
||||
{
|
||||
RUBY_ASSERT(opnd.idx < ctx->stack_size);
|
||||
|
||||
if (opnd.is_self) {
|
||||
ctx->self_type = type;
|
||||
return;
|
||||
|
@ -170,6 +168,7 @@ void ctx_set_opnd_type(ctx_t* ctx, insn_opnd_t opnd, val_type_t type)
|
|||
if (ctx->stack_size > MAX_TEMP_TYPES)
|
||||
return;
|
||||
|
||||
RUBY_ASSERT(opnd.idx < ctx->stack_size);
|
||||
temp_mapping_t mapping = ctx->temp_mapping[ctx->stack_size - 1 - opnd.idx];
|
||||
|
||||
switch (mapping.kind)
|
||||
|
|
Loading…
Add table
Reference in a new issue