* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
iseq.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: 04/01/01 23:36:57 JST
|
|
|
|
|
|
|
|
Copyright (C) 2004-2008 Koichi Sasada
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
2015-09-18 21:48:48 -04:00
|
|
|
#ifndef RUBY_ISEQ_H
|
|
|
|
#define RUBY_ISEQ_H 1
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
|
2015-12-08 08:58:50 -05:00
|
|
|
#define ISEQ_MAJOR_VERSION 2
|
|
|
|
#define ISEQ_MINOR_VERSION 3
|
|
|
|
|
2015-09-18 21:53:34 -04:00
|
|
|
#ifndef rb_iseq_t
|
|
|
|
typedef struct rb_iseq_struct rb_iseq_t;
|
|
|
|
#define rb_iseq_t rb_iseq_t
|
|
|
|
#endif
|
|
|
|
|
2015-08-13 04:43:32 -04:00
|
|
|
static inline size_t
|
|
|
|
rb_call_info_kw_arg_bytes(int keyword_len)
|
|
|
|
{
|
2015-09-19 13:59:58 -04:00
|
|
|
return sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (keyword_len - 1);
|
2015-08-13 04:43:32 -04:00
|
|
|
}
|
|
|
|
|
2015-12-02 08:58:07 -05:00
|
|
|
enum iseq_mark_ary_index {
|
2016-02-23 02:59:17 -05:00
|
|
|
ISEQ_MARK_ARY_COVERAGE,
|
|
|
|
ISEQ_MARK_ARY_FLIP_CNT,
|
|
|
|
ISEQ_MARK_ARY_ORIGINAL_ISEQ,
|
|
|
|
ISEQ_MARK_ARY_INITIAL_SIZE
|
2015-12-02 08:58:07 -05:00
|
|
|
};
|
|
|
|
|
2015-12-08 08:58:50 -05:00
|
|
|
static inline VALUE
|
|
|
|
iseq_mark_ary_create(int flip_cnt)
|
|
|
|
{
|
2016-02-23 02:59:17 -05:00
|
|
|
VALUE ary = rb_ary_tmp_new(ISEQ_MARK_ARY_INITIAL_SIZE);
|
2015-12-08 08:58:50 -05:00
|
|
|
rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_COVERAGE */
|
|
|
|
rb_ary_push(ary, INT2FIX(flip_cnt)); /* ISEQ_MARK_ARY_FLIP_CNT */
|
|
|
|
rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_ORIGINAL_ISEQ */
|
|
|
|
return ary;
|
|
|
|
}
|
|
|
|
|
2015-12-02 08:58:07 -05:00
|
|
|
#define ISEQ_MARK_ARY(iseq) (iseq)->body->mark_ary
|
|
|
|
|
|
|
|
#define ISEQ_COVERAGE(iseq) RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE)
|
|
|
|
#define ISEQ_COVERAGE_SET(iseq, cov) RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE, cov)
|
|
|
|
|
2015-12-08 08:58:50 -05:00
|
|
|
#define ISEQ_FLIP_CNT(iseq) FIX2INT(RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT))
|
|
|
|
|
2015-12-02 08:58:07 -05:00
|
|
|
static inline int
|
|
|
|
ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
|
|
|
|
{
|
2015-12-08 08:58:50 -05:00
|
|
|
int cnt = ISEQ_FLIP_CNT(iseq);
|
2015-12-02 08:58:07 -05:00
|
|
|
RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT, INT2FIX(cnt+1));
|
|
|
|
return cnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VALUE *
|
|
|
|
ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
|
|
|
|
{
|
|
|
|
VALUE str = RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ);
|
|
|
|
if (RTEST(str)) return (VALUE *)RSTRING_PTR(str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VALUE *
|
|
|
|
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
|
|
|
|
{
|
|
|
|
VALUE str = rb_str_tmp_new(size * sizeof(VALUE));
|
|
|
|
RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, str);
|
|
|
|
return (VALUE *)RSTRING_PTR(str);
|
|
|
|
}
|
|
|
|
|
2015-12-08 08:58:50 -05:00
|
|
|
#define ISEQ_COMPILE_DATA(iseq) (iseq)->aux.compile_data
|
|
|
|
|
|
|
|
static inline rb_iseq_t *
|
|
|
|
iseq_imemo_alloc(void)
|
|
|
|
{
|
|
|
|
return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
|
|
|
|
|
|
|
|
VALUE iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
|
|
|
|
void ibf_load_iseq_complete(rb_iseq_t *iseq);
|
|
|
|
const rb_iseq_t *iseq_ibf_load(VALUE str);
|
|
|
|
VALUE iseq_ibf_load_extra_data(VALUE str);
|
2015-12-02 03:20:35 -05:00
|
|
|
|
2013-04-05 06:29:38 -04:00
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
2010-07-21 17:38:25 -04:00
|
|
|
|
2008-12-04 22:35:48 -05:00
|
|
|
/* compile.c */
|
2015-07-21 18:52:59 -04:00
|
|
|
VALUE rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node);
|
2009-01-18 20:06:56 -05:00
|
|
|
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
|
2015-07-21 18:52:59 -04:00
|
|
|
VALUE *rb_iseq_original_iseq(const rb_iseq_t *iseq);
|
|
|
|
void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
|
|
|
|
VALUE locals, VALUE args,
|
|
|
|
VALUE exception, VALUE body);
|
2008-12-04 22:35:48 -05:00
|
|
|
|
|
|
|
/* iseq.c */
|
2015-07-21 06:47:45 -04:00
|
|
|
void rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj);
|
* iseq.c (rb_iseq_load): renamed from ruby_iseq_load, since it is
for C extensions or the ruby core. [ruby-core:21407]
Index: compile.c
===================================================================
--- compile.c (revision 21649)
+++ compile.c (working copy)
@@ -5078,5 +5078,5 @@ iseq_build_exception(rb_iseq_t *iseq, st
}
else {
- eiseqval = ruby_iseq_load(ptr[1], iseq->self, Qnil);
+ eiseqval = rb_iseq_load(ptr[1], iseq->self, Qnil);
}
@@ -5162,5 +5162,5 @@ iseq_build_body(rb_iseq_t *iseq, LINK_AN
if (op != Qnil) {
if (TYPE(op) == T_ARRAY) {
- argv[j] = ruby_iseq_load(op, iseq->self, Qnil);
+ argv[j] = rb_iseq_load(op, iseq->self, Qnil);
}
else if (CLASS_OF(op) == rb_cISeq) {
Index: iseq.c
===================================================================
--- iseq.c (revision 21649)
+++ iseq.c (working copy)
@@ -448,5 +448,5 @@ iseq_s_load(int argc, VALUE *argv, VALUE
VALUE
-ruby_iseq_load(VALUE data, VALUE parent, VALUE opt)
+rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
{
return iseq_load(rb_cISeq, data, parent, opt);
Index: iseq.h
===================================================================
--- iseq.h (revision 21649)
+++ iseq.h (working copy)
@@ -21,5 +21,5 @@ VALUE ruby_iseq_build_from_ary(rb_iseq_t
/* iseq.c */
-VALUE ruby_iseq_load(VALUE data, VALUE parent, VALUE opt);
+VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
struct st_table *ruby_insn_make_insn_table(void);
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 14:05:15 -05:00
|
|
|
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
|
* internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.
* iseq.h: declare rb_iseq_t dependent internal functions here.
* vm_core.h: declare rb_thread_t dependent internal functions here.
* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
thread.c, time.c, transcode.c, variable.c, vm.c,
tool/compile_prelude.rb: don't declare internal functions declared
in above headers. include above headers if required.
Note that rb_thread_mark() was declared as
void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
void rb_thread_mark(void *ptr) in vm.c. Now it is declared as
the later in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 18:43:38 -04:00
|
|
|
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
|
2008-12-04 22:35:48 -05:00
|
|
|
struct st_table *ruby_insn_make_insn_table(void);
|
2011-08-24 02:31:15 -04:00
|
|
|
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
|
2015-07-21 18:52:59 -04:00
|
|
|
int rb_iseqw_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *events_ptr, void *d), void *data);
|
|
|
|
VALUE rb_iseqw_line_trace_all(VALUE iseqval);
|
|
|
|
VALUE rb_iseqw_line_trace_specify(VALUE iseqval, VALUE pos, VALUE set);
|
|
|
|
VALUE rb_iseqw_new(const rb_iseq_t *iseq);
|
|
|
|
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
|
|
|
|
|
2017-05-31 20:05:33 -04:00
|
|
|
VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq); /* obsolete */
|
2015-07-21 18:52:59 -04:00
|
|
|
VALUE rb_iseq_label(const rb_iseq_t *iseq);
|
|
|
|
VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
|
|
|
|
VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
|
|
|
|
VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
|
2012-11-30 12:00:30 -05:00
|
|
|
|
* internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.
* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
ruby.c, time.c, util.c, vm.c: don't declare internal functions.
* eval.c, parse.y, thread_pthread.c: non-existing function declarations
removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 21:54:57 -04:00
|
|
|
/* proc.c */
|
2015-05-21 05:01:44 -04:00
|
|
|
const rb_iseq_t *rb_method_iseq(VALUE body);
|
|
|
|
const rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
|
* internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.
* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
ruby.c, time.c, util.c, vm.c: don't declare internal functions.
* eval.c, parse.y, thread_pthread.c: non-existing function declarations
removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 21:54:57 -04:00
|
|
|
|
2010-10-30 21:42:54 -04:00
|
|
|
struct rb_compile_option_struct {
|
2016-03-10 02:06:39 -05:00
|
|
|
unsigned int inline_const_cache: 1;
|
|
|
|
unsigned int peephole_optimization: 1;
|
|
|
|
unsigned int tailcall_optimization: 1;
|
|
|
|
unsigned int specialized_instruction: 1;
|
|
|
|
unsigned int operands_unification: 1;
|
|
|
|
unsigned int instructions_unification: 1;
|
|
|
|
unsigned int stack_caching: 1;
|
|
|
|
unsigned int trace_instruction: 1;
|
|
|
|
unsigned int frozen_string_literal: 1;
|
|
|
|
unsigned int debug_frozen_string_literal: 1;
|
2016-03-10 03:34:18 -05:00
|
|
|
unsigned int coverage_enabled: 1;
|
2010-10-30 21:42:54 -04:00
|
|
|
int debug_level;
|
|
|
|
};
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
|
2011-08-24 02:31:15 -04:00
|
|
|
struct iseq_line_info_entry {
|
|
|
|
unsigned int position;
|
|
|
|
unsigned int line_no;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct iseq_catch_table_entry {
|
2010-10-30 21:42:54 -04:00
|
|
|
enum catch_type {
|
2012-12-03 05:03:25 -05:00
|
|
|
CATCH_TYPE_RESCUE = INT2FIX(1),
|
|
|
|
CATCH_TYPE_ENSURE = INT2FIX(2),
|
|
|
|
CATCH_TYPE_RETRY = INT2FIX(3),
|
|
|
|
CATCH_TYPE_BREAK = INT2FIX(4),
|
|
|
|
CATCH_TYPE_REDO = INT2FIX(5),
|
|
|
|
CATCH_TYPE_NEXT = INT2FIX(6)
|
2010-10-30 21:42:54 -04:00
|
|
|
} type;
|
2017-06-08 00:13:52 -04:00
|
|
|
|
2017-06-08 00:13:51 -04:00
|
|
|
/*
|
|
|
|
* iseq type:
|
|
|
|
* CATCH_TYPE_RESCUE, CATCH_TYPE_ENSURE:
|
|
|
|
* use iseq as continuation.
|
|
|
|
*
|
|
|
|
* CATCH_TYPE_BREAK (iter):
|
|
|
|
* use iseq as key.
|
|
|
|
*
|
|
|
|
* CATCH_TYPE_BREAK (while), CATCH_TYPE_RETRY,
|
|
|
|
* CATCH_TYPE_REDO, CATCH_TYPE_NEXT:
|
|
|
|
* NULL.
|
|
|
|
*/
|
2015-07-21 18:52:59 -04:00
|
|
|
const rb_iseq_t *iseq;
|
2017-06-08 00:13:51 -04:00
|
|
|
|
2014-07-14 03:08:55 -04:00
|
|
|
unsigned int start;
|
|
|
|
unsigned int end;
|
|
|
|
unsigned int cont;
|
|
|
|
unsigned int sp;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
};
|
|
|
|
|
2014-07-14 03:06:26 -04:00
|
|
|
PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
|
2015-07-24 17:44:14 -04:00
|
|
|
unsigned int size;
|
2014-07-14 03:06:26 -04:00
|
|
|
struct iseq_catch_table_entry entries[1]; /* flexible array */
|
|
|
|
});
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
iseq_catch_table_bytes(int n)
|
|
|
|
{
|
2014-07-17 12:54:59 -04:00
|
|
|
enum {
|
|
|
|
catch_table_entries_max = (INT_MAX - sizeof(struct iseq_catch_table)) / sizeof(struct iseq_catch_table_entry)
|
|
|
|
};
|
|
|
|
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
|
|
|
|
return (int)(sizeof(struct iseq_catch_table) +
|
|
|
|
(n - 1) * sizeof(struct iseq_catch_table_entry));
|
2014-07-14 03:06:26 -04:00
|
|
|
}
|
|
|
|
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
|
|
|
|
|
|
|
|
struct iseq_compile_data_storage {
|
|
|
|
struct iseq_compile_data_storage *next;
|
2014-07-26 03:57:44 -04:00
|
|
|
unsigned int pos;
|
|
|
|
unsigned int size;
|
|
|
|
char buff[1]; /* flexible array */
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
};
|
|
|
|
|
2014-07-26 03:57:44 -04:00
|
|
|
/* account for flexible array */
|
|
|
|
#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \
|
|
|
|
(sizeof(struct iseq_compile_data_storage) - 1)
|
|
|
|
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
struct iseq_compile_data {
|
|
|
|
/* GC is needed */
|
2013-06-19 02:26:01 -04:00
|
|
|
const VALUE err_info;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
VALUE mark_ary;
|
2013-06-19 02:26:01 -04:00
|
|
|
const VALUE catch_table_ary; /* Array */
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
|
|
|
|
/* GC is not needed */
|
|
|
|
struct iseq_label_data *start_label;
|
|
|
|
struct iseq_label_data *end_label;
|
|
|
|
struct iseq_label_data *redo_label;
|
2015-07-21 18:52:59 -04:00
|
|
|
const rb_iseq_t *current_block;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
VALUE ensure_node;
|
|
|
|
VALUE for_iseq;
|
|
|
|
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
int loopval_popped; /* used by NODE_BREAK */
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
int cached_const;
|
|
|
|
struct iseq_compile_data_storage *storage_head;
|
|
|
|
struct iseq_compile_data_storage *storage_current;
|
|
|
|
int last_line;
|
2009-10-08 12:11:30 -04:00
|
|
|
int last_coverable_line;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
int label_no;
|
|
|
|
int node_level;
|
2015-09-19 13:59:58 -04:00
|
|
|
unsigned int ci_index;
|
|
|
|
unsigned int ci_kw_index;
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
const rb_compile_option_t *option;
|
2016-05-14 14:43:11 -04:00
|
|
|
struct rb_id_table *ivar_cache_table;
|
2010-12-12 09:45:30 -05:00
|
|
|
#if SUPPORT_JOKE
|
|
|
|
st_table *labels_table;
|
|
|
|
#endif
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* defined? */
|
2010-10-30 21:42:54 -04:00
|
|
|
|
|
|
|
enum defined_type {
|
2012-09-24 04:36:53 -04:00
|
|
|
DEFINED_NIL = 1,
|
|
|
|
DEFINED_IVAR,
|
|
|
|
DEFINED_LVAR,
|
2010-10-30 21:42:54 -04:00
|
|
|
DEFINED_GVAR,
|
|
|
|
DEFINED_CVAR,
|
|
|
|
DEFINED_CONST,
|
|
|
|
DEFINED_METHOD,
|
|
|
|
DEFINED_YIELD,
|
|
|
|
DEFINED_ZSUPER,
|
2012-09-24 04:36:53 -04:00
|
|
|
DEFINED_SELF,
|
|
|
|
DEFINED_TRUE,
|
|
|
|
DEFINED_FALSE,
|
|
|
|
DEFINED_ASGN,
|
|
|
|
DEFINED_EXPR,
|
|
|
|
DEFINED_IVAR2,
|
|
|
|
DEFINED_REF,
|
2010-12-09 21:42:06 -05:00
|
|
|
DEFINED_FUNC
|
2010-10-30 21:42:54 -04:00
|
|
|
};
|
* include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
iseq structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 03:49:45 -04:00
|
|
|
|
2012-09-24 04:36:53 -04:00
|
|
|
VALUE rb_iseq_defined_string(enum defined_type type);
|
2015-09-27 02:44:02 -04:00
|
|
|
void rb_iseq_make_compile_option(struct rb_compile_option_struct *option, VALUE opt);
|
2012-09-24 04:36:53 -04:00
|
|
|
|
2015-12-08 00:27:10 -05:00
|
|
|
/* vm.c */
|
|
|
|
VALUE rb_iseq_local_variables(const rb_iseq_t *iseq);
|
|
|
|
|
2013-04-05 06:29:38 -04:00
|
|
|
RUBY_SYMBOL_EXPORT_END
|
2010-07-21 17:38:25 -04:00
|
|
|
|
2015-09-18 21:48:48 -04:00
|
|
|
#endif /* RUBY_ISEQ_H */
|