summaryrefslogtreecommitdiff
path: root/iseq.h
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-04-30 18:54:46 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-05-07 17:02:15 +0900
commitff69ef27b06eed1ba750e7d9cab8322f351ed245 (patch)
tree84af4f4f8d99cc6a2af030230cf520e14862982b /iseq.h
parent578e6416e71bcd5401bba63e9f3ef25a28258d9a (diff)
downloadruby-ff69ef27b06eed1ba750e7d9cab8322f351ed245.tar.gz
compile.c: Pass node instead of nd_line(node) to ADD_INSN* functions
... then, new_insn_core extracts nd_line(node). Also, if a macro "EXPERIMENTAL_ISEQ_NODE_ID" is defined, this changeset keeps nd_node_id(node) for each instruction. This is intended for TypeProf to identify what AST::Node corresponds to each instruction. This patch is originally authored by @yui-knk for showing which column a NoMethodError occurred. https://github.com/ruby/ruby/compare/master...yui-knk:feature/node_id Co-Authored-By: Yuichiro Kaneko <yui-knk@ruby-lang.org>
Diffstat (limited to 'iseq.h')
-rw-r--r--iseq.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/iseq.h b/iseq.h
index 904b891427..d3130a42af 100644
--- a/iseq.h
+++ b/iseq.h
@@ -17,6 +17,8 @@ RUBY_EXTERN const int ruby_api_version[];
#define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])
#define ISEQ_MINOR_VERSION ((unsigned int)ruby_api_version[1])
+//#define EXPERIMENTAL_ISEQ_NODE_ID
+
#ifndef rb_iseq_t
typedef struct rb_iseq_struct rb_iseq_t;
#define rb_iseq_t rb_iseq_t
@@ -176,6 +178,9 @@ void rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *arena);
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
+#ifdef EXPERIMENTAL_ISEQ_NODE_ID
+int rb_iseq_node_id(const rb_iseq_t *iseq, size_t pos);
+#endif
void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events);
void rb_iseq_trace_set_all(rb_event_flag_t turnon_events);
void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq);
@@ -213,6 +218,9 @@ struct rb_compile_option_struct {
struct iseq_insn_info_entry {
int line_no;
+#ifdef EXPERIMENTAL_ISEQ_NODE_ID
+ int node_id;
+#endif
rb_event_flag_t events;
};