mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* iseq.h, iseq.c, compile.c: Change the line number data structure
to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217]. Before this fix, each instruction has an information including line number (iseq::iseq_insn_info_table). Instead of this data structure, recording only line number changing places (iseq::iseq_line_info_table). The order of entries in iseq_line_info_table is ascending order of iseq_line_info_table_entry::position. You can get a line number by an iseq and a program counter with this data structure. This fix reduces memory consumption of iseq (bytecode). On my measurement, a rails application consumes 21.8MB for iseq with this fix on the 32bit CPU. Without this fix, it consumes 24.7MB for iseq [ruby-dev:44415]. * proc.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. * vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4f03f0cb67
commit
7049d9c80d
9 changed files with 110 additions and 84 deletions
8
iseq.h
8
iseq.h
|
|
@ -26,6 +26,7 @@ VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
|
|||
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
|
||||
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
|
||||
struct st_table *ruby_insn_make_insn_table(void);
|
||||
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
|
||||
|
||||
/* proc.c */
|
||||
rb_iseq_t *rb_method_get_iseq(VALUE body);
|
||||
|
|
@ -43,10 +44,9 @@ struct rb_compile_option_struct {
|
|||
int debug_level;
|
||||
};
|
||||
|
||||
struct iseq_insn_info_entry {
|
||||
unsigned short position;
|
||||
unsigned short line_no;
|
||||
unsigned short sp;
|
||||
struct iseq_line_info_entry {
|
||||
unsigned int position;
|
||||
unsigned int line_no;
|
||||
};
|
||||
|
||||
struct iseq_catch_table_entry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue