13#include "internal/gc.h"
17#define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])
18#define ISEQ_MINOR_VERSION ((unsigned int)ruby_api_version[1])
22#define rb_iseq_t rb_iseq_t
27#define ISEQ_COVERAGE(iseq) iseq->body->variable.coverage
28#define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &iseq->body->variable.coverage, cov)
29#define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES)
30#define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES)
32#define ISEQ_PC2BRANCHINDEX(iseq) iseq->body->variable.pc2branchindex
33#define ISEQ_PC2BRANCHINDEX_SET(iseq, h) RB_OBJ_WRITE(iseq, &iseq->body->variable.pc2branchindex, h)
35#define ISEQ_FLIP_CNT(iseq) (iseq)->body->variable.flip_count
38ISEQ_FLIP_CNT_INCREMENT(
const rb_iseq_t *iseq)
52ISEQ_ORIGINAL_ISEQ_CLEAR(
const rb_iseq_t *iseq)
68#define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \
74 RUBY_EVENT_B_RETURN| \
75 RUBY_EVENT_COVERAGE_LINE| \
76 RUBY_EVENT_COVERAGE_BRANCH)
78#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
79#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
80#define ISEQ_TRANSLATED IMEMO_FL_USER3
81#define ISEQ_MARKABLE_ISEQ IMEMO_FL_USER4
83#define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW(((VALUE)iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0)
139 iseq->
flags &= ~ISEQ_USE_COMPILE_DATA;
144iseq_imemo_alloc(
void)
159#if VM_INSN_INFO_TABLE_IMPL == 2
163RUBY_SYMBOL_EXPORT_BEGIN
254iseq_catch_table_bytes(
int n)
258 catch_table_entries_max = (INT_MAX -
offsetof(
struct iseq_catch_table, entries)) / catch_table_entry_size
260 if (n > catch_table_entries_max)
rb_fatal(
"too large iseq_catch_table - %d", n);
261 return (
int)(
offsetof(
struct iseq_catch_table, entries) +
262 n * catch_table_entry_size);
265#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
303RUBY_SYMBOL_EXPORT_END
#define offsetof(p_type, field)
#define PACKED_STRUCT_UNALIGNED(x)
char str[HTML_ESCAPE_MAX_LEN+1]
void ruby_xfree(void *x)
Deallocates a storage instance.
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
void rb_fatal(const char *fmt,...)
VALUE rb_iseqw_new(const rb_iseq_t *iseq)
void rb_iseq_remove_coverage_all(void)
void rb_iseq_init_trace(rb_iseq_t *iseq)
void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq)
const ID rb_iseq_shared_exc_local_tbl[]
void rb_ibf_load_iseq_complete(rb_iseq_t *iseq)
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos)
const int ruby_api_version[]
void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE args, VALUE exception, VALUE body)
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
const rb_iseq_t * rb_proc_get_iseq(VALUE proc, int *is_proc)
void rb_iseq_code_location(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column)
VALUE rb_iseq_label(const rb_iseq_t *iseq)
VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt)
VALUE rb_iseq_base_label(const rb_iseq_t *iseq)
const rb_iseq_t * rb_iseq_ibf_load_bytes(const char *cstr, size_t)
VALUE rb_iseq_ibf_load_extra_data(VALUE str)
VALUE rb_iseq_defined_string(enum defined_type type)
#define ISEQ_USE_COMPILE_DATA
const rb_iseq_t * rb_iseqw_to_iseq(VALUE iseqw)
VALUE rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
void rb_iseq_trace_set_all(rb_event_flag_t turnon_events)
VALUE rb_iseq_local_variables(const rb_iseq_t *iseq)
const rb_iseq_t * rb_iseq_ibf_load(VALUE str)
VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq)
void rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *arena)
void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events)
VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq)
const rb_iseq_t * rb_iseq_load_iseq(VALUE fname)
VALUE rb_iseq_compile_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_callback_callback_func *ifunc)
struct rb_iseq_constant_body * rb_iseq_constant_body_alloc(void)
const rb_iseq_t * rb_method_iseq(VALUE body)
VALUE rb_iseq_method_name(const rb_iseq_t *iseq)
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
VALUE * rb_iseq_original_iseq(const rb_iseq_t *iseq)
int rb_iseq_remove_local_tracepoint_recursively(const rb_iseq_t *iseq, VALUE tpval)
int rb_iseq_add_local_tracepoint_recursively(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line)
VALUE type(ANYARGS)
ANYARGS-ed function type.
rb_atomic_t cnt[RUBY_NSIG]
enum iseq_catch_table_entry::catch_type type
struct iseq_compile_data_storage * next
struct iseq_label_data * start_label
const rb_iseq_t * current_block
struct iseq_label_data * redo_label
const rb_compile_option_t * option
struct iseq_compile_data_ensure_node_stack * ensure_node_stack
struct iseq_compile_data::@122 insn
struct rb_id_table * ivar_cache_table
struct iseq_compile_data_storage * storage_current
struct iseq_compile_data_storage * storage_head
struct iseq_compile_data::@121 node
struct iseq_label_data * end_label
const struct rb_builtin_function * builtin_function_table
const VALUE catch_table_ary
unsigned int debug_frozen_string_literal
unsigned int operands_unification
unsigned int tailcall_optimization
unsigned int coverage_enabled
unsigned int peephole_optimization
unsigned int specialized_instruction
unsigned int stack_caching
unsigned int frozen_string_literal
unsigned int instructions_unification
unsigned int inline_const_cache
struct rb_iseq_constant_body::@189 variable
struct rb_iseq_constant_body * body
struct iseq_compile_data * compile_data
union rb_iseq_struct::@191 aux
#define ZALLOC(strm, items, size)