ext/cached/ruby-1.9.1/internal/vm/iseq/iseq_load.inc in ruby-internal-0.7.3 vs ext/cached/ruby-1.9.1/internal/vm/iseq/iseq_load.inc in ruby-internal-0.8.0

- old
+ new

@@ -1,11 +1,30 @@ #ifndef ruby_internal_iseq_load__inc_ #define ruby_internal_iseq_load__inc_ -#include "internal/yarv-headers/gc.h" -#include "internal/yarv-headers/iseq.h" +#ifdef HAVE_TYPE_STRUCT_RTYPEDDATA + static rb_data_type_t const * p_iseq_data_type; + + static void init_iseq_data_type() + { + rb_proc_t * p; + VALUE body; + + VALUE binding = rb_binding_new(); + VALUE new_proc = rb_funcall( + rb_cObject, rb_intern("eval"), 2, rb_str_new2("proc { }"), binding); + GetProcPtr(new_proc, p); + body = p->block.iseq->self; + + p_iseq_data_type = RTYPEDDATA_TYPE(body); + } + +#else + +#endif +# static void compile_data_free(struct iseq_compile_data *compile_data) { if (compile_data) { struct iseq_compile_data_storage *cur, *next; @@ -122,19 +141,20 @@ iseq->parent_iseq = piseq; } } static VALUE prepare_iseq_build(rb_iseq_t *iseq, - VALUE name, VALUE filename, + VALUE name, VALUE filename, VALUE line_no, VALUE parent, VALUE type, VALUE block_opt, const rb_compile_option_t *option) { OBJ_FREEZE(name); OBJ_FREEZE(filename); iseq->name = name; iseq->filename = filename; + iseq->line_no = line_no; iseq->defined_method_id = 0; iseq->mark_ary = rb_ary_new(); RBASIC(iseq->mark_ary)->klass = 0; iseq->type = type; @@ -164,10 +184,11 @@ iseq->compile_data->storage_head->size = INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE; iseq->compile_data->storage_head->buff = (char *)(&iseq->compile_data->storage_head->buff + 1); iseq->compile_data->option = option; + iseq->compile_data->last_coverable_line = -1; set_relation(iseq, parent); iseq->coverage = Qfalse; if (!GET_THREAD()->parse_in_eval) { @@ -276,21 +297,21 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt) { VALUE iseqval = iseq_alloc(self); VALUE magic, version1, version2, format_type, misc; - VALUE name, filename; + VALUE name, filename, line_no; VALUE type, body, locals, args, exception; VALUE iseq_type; struct st_table *type_map = 0; rb_iseq_t *iseq; rb_compile_option_t option; int i = 0; /* [magic, major_version, minor_version, format_type, misc, - * name, filename, + * name, filename, line_no, * type, locals, args, exception_table, body] */ data = CHECK_ARRAY(data); @@ -300,10 +321,11 @@ format_type = CHECK_INTEGER(rb_ary_entry(data, i++)); misc = rb_ary_entry(data, i++); /* TODO */ name = CHECK_STRING(rb_ary_entry(data, i++)); filename = CHECK_STRING(rb_ary_entry(data, i++)); + line_no = CHECK_INTEGER(rb_ary_entry(data, i++)); type = CHECK_SYMBOL(rb_ary_entry(data, i++)); locals = CHECK_ARRAY(rb_ary_entry(data, i++)); args = rb_ary_entry(data, i++); @@ -341,10 +363,10 @@ if (parent == Qnil) { parent = 0; } make_compile_option(&option, opt); - prepare_iseq_build(iseq, name, filename, + prepare_iseq_build(iseq, name, filename, line_no, parent, iseq_type, 0, &option); rb_iseq_build_from_ary(iseq, locals, args, exception, body); cleanup_iseq_build(iseq);