1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move function to static inline so we don't have leaked globals

This function shouldn't leak and is only needed during instruction
assembly
This commit is contained in:
Aaron Patterson 2022-06-27 16:30:32 -07:00 committed by Aaron Patterson
parent e3ab525f69
commit 8d157bc806
Notes: git 2022-06-30 08:22:11 +09:00
3 changed files with 16 additions and 21 deletions

20
iseq.c
View file

@ -2943,26 +2943,6 @@ iseq_type_id(enum iseq_type type)
rb_bug("unsupported iseq type: %d", (int)type);
}
union iseq_inline_storage_entry *
ISEQ_IS_ENTRY_START(const struct rb_iseq_constant_body *body, char op_type)
{
unsigned int relative_ic_offset = 0;
switch(op_type) {
case TS_IC:
relative_ic_offset += body->ise_size;
case TS_ISE:
relative_ic_offset += body->ivc_size;
case TS_IVC:
case TS_ICVARC:
break;
default:
rb_bug("Wrong op type");
}
return &body->is_entries[relative_ic_offset];
}
static VALUE
iseq_data_to_ary(const rb_iseq_t *iseq)
{

1
iseq.h
View file

@ -169,7 +169,6 @@ void rb_iseq_init_trace(rb_iseq_t *iseq);
int rb_iseq_add_local_tracepoint_recursively(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line, bool target_bmethod);
int rb_iseq_remove_local_tracepoint_recursively(const rb_iseq_t *iseq, VALUE tpval);
const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
union iseq_inline_storage_entry *ISEQ_IS_ENTRY_START(const struct rb_iseq_constant_body *body, char op_type);
#if VM_INSN_INFO_TABLE_IMPL == 2
unsigned int *rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body);

View file

@ -11,3 +11,19 @@ enum ruby_insn_type_chars {
<%= t %> = '<%= c %>',
% end
};
static inline union iseq_inline_storage_entry * ISEQ_IS_ENTRY_START(const struct rb_iseq_constant_body *body, char op_type) {
unsigned int relative_ic_offset = 0;
switch(op_type) {
case TS_IC:
relative_ic_offset += body->ise_size;
case TS_ISE:
relative_ic_offset += body->ivc_size;
case TS_IVC:
case TS_ICVARC:
break;
default:
rb_bug("Wrong op type");
}
return &body->is_entries[relative_ic_offset];
}