mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
Fixed is-object check in opt_send_without_block
This commit is contained in:
parent
7c9fdb5dc9
commit
e677ca4af0
1 changed files with 8 additions and 3 deletions
|
@ -541,12 +541,17 @@ gen_opt_send_without_block(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx)
|
||||||
//print_str(cb, rb_id2name(mid));
|
//print_str(cb, rb_id2name(mid));
|
||||||
//print_ptr(cb, RCX);
|
//print_ptr(cb, RCX);
|
||||||
|
|
||||||
|
// IDEA: may be able to eliminate this in some cases if we know the previous instruction?
|
||||||
// TODO: guard_is_object() helper function?
|
// TODO: guard_is_object() helper function?
|
||||||
|
// FIXME: an object can have QNil bit 1000 set
|
||||||
|
// need to check for immediate mask, Qnil and Qfalse
|
||||||
// Check that the receiver is an object
|
// Check that the receiver is an object
|
||||||
cmp(cb, RCX, imm_opnd(0));
|
test(cb, RCX, imm_opnd(RUBY_IMMEDIATE_MASK));
|
||||||
je_ptr(cb, side_exit);
|
|
||||||
test(cb, RCX, imm_opnd(RUBY_IMMEDIATE_MASK | RUBY_Qnil));
|
|
||||||
jnz_ptr(cb, side_exit);
|
jnz_ptr(cb, side_exit);
|
||||||
|
cmp(cb, RCX, imm_opnd(Qfalse));
|
||||||
|
je_ptr(cb, side_exit);
|
||||||
|
cmp(cb, RCX, imm_opnd(Qnil));
|
||||||
|
je_ptr(cb, side_exit);
|
||||||
|
|
||||||
// Pointer to the klass field of the receiver &(recv->klass)
|
// Pointer to the klass field of the receiver &(recv->klass)
|
||||||
x86opnd_t klass_opnd = mem_opnd(64, RCX, offsetof(struct RBasic, klass));
|
x86opnd_t klass_opnd = mem_opnd(64, RCX, offsetof(struct RBasic, klass));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue