Граф коммитов

161 Коммитов

Автор SHA1 Сообщение Дата
nobu ed19ff6bdb * compile.c (iseq_set_sequence): uses rb_compile_warning() for
warning at compilation time.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 03:38:50 +00:00
nobu 794eb7bc49 * compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code),
(ruby_insns_name_array, ruby_iseq_build_from_ary): prefixed with
  ruby_.

* iseq.c (ruby_iseq_load, ruby_insn_make_insn_table): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 03:35:48 +00:00
mame 01cdeb8da7 * compile.c (iseq_set_sequence): fix memory leak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 14:38:08 +00:00
nobu c809aaa5e1 * compile.c (iseq_compile_each): fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-12 01:18:49 +00:00
mame f2aabd1802 * compile.c (iseq_set_sequence): check duplicated when clauses.
[ruby-dev:36616]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-28 13:15:34 +00:00
ko1 2e311f6bd5 * include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
  (node.h will be changed. Extensions should not depends on
  this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
  gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
  vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
ko1 7f7834abf7 * 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 07:49:45 +00:00
matz 9839d737c2 * compile.c (defined_expr): default defined? should return
"expression" without evaluating the expression.  [ruby-dev:35967]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-25 14:04:09 +00:00
matz cc3cbd2965 * compile.c (defined_expr): should handle NODE_{AND,OR} as
"expression".  [ruby-dev:35951]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-25 10:06:12 +00:00
nobu 74cd315a50 * compile.c (iseq_build_body): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23 07:01:57 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
nobu 0acca9a826 * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect),
iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm),
  process.c (pst_message), re.c (match_inspect): use rb_str_catf.

* dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use
  rb_sprintf.

* error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use
  rb_vsprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 08:53:34 +00:00
nobu 16ab763b1f * compile.c (iseq_compile_each): NODE_POSTEXE should set each end
procs only once.  [ruby-dev:35596]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-20 13:50:14 +00:00
ko1 807fbd6940 * compile.c, vm.c, insns.def: call FrozenCore.set_postexe method
instead to use "postexe" insn.
* id.c, id.h: add a prepared id for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 12:19:00 +00:00
shyouhei 3e69e83a62 * include/ruby/ruby.h (enum ruby_special_consts): ISO C forbids
comma at end of enumerator list

 	* include/ruby/ruby.h (enum ruby_value_type): ditto.

	* eval_intern.h (enum): ditto.

	* vm_core.h (enum rb_thread_status): ditto.

	* parse.y (enum lex_state_e): ditto.

	* parse.y (enum string_type): ditto.

	* process.c (enum): ditto.

	* ruby.c (enum dump_flag_bits): ditto.

	* ruby.c (enum disable_flag_bits): ditto.

	* compile.c (iseq_link_element): ditto

	* debug.c (union): ditto.

	* cont.c (enum context_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 08:27:58 +00:00
ko1 eb33f91cb7 * compile.c, insns.def, vm.c, vm_core.h: remove some insns
(undef, alias, definemethod).
  Call RubyVM::FrozenCore's singleton method instead.
  Add "putiseq" and "putspecialobject" instructions.
* id.c, id.h: add ids for above.
* tool/parse.rb: "VM" no longer exists.  Use RubyVM instead.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 03:05:58 +00:00
mame 59e103794e * compile.c (iseq_build_from_ary): initialize arg_opts, a patch from
Adam Strzelecki <ono@java.pl> in [ruby-core:17220].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-23 15:23:12 +00:00
wanabe 266a84c904 * compile.c (iseq_build_from_ary): fix expression to obtain
iseq->local_size and iseq->local_table_size.  [ruby-dev:35205]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-23 15:12:29 +00:00
wanabe 62b6a462d7 * compile.c : treat []&&= in virtually the same way as []||=.
[ruby-dev:34679]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 13:49:16 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
mame e0a264a9ef * compile.c (defined_expr): fix SEGV by defined?([1]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-30 13:15:03 +00:00
mame a93136879e * compile.c (iseq_compile): set local_table for
ISEQ_TYPE_DEFINED_GUARD.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-25 08:55:09 +00:00
mame 8742de6f10 * compile.c (iseq_build_body): remove side effect from
VM::InstructionSequence.load.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-25 08:52:57 +00:00
ko1 59c061235f * eval_method.c: renamed from vm_method.c. "vm_method.c" is included
by "vm.c".
* vm_eval.c: added.  Some codes are moved from "eval.c"
* common.mk: fix for above changes.
* compile.c: make a vm_eval(0)
* eval.c, eval_error.c, eval_intern.h, eval_jump.c, proc.c, vm.c,
  id.c, id.h, vm_core.h, vm_dump.c, vm_evalbody.c, vm_insnhelper.c,
  blockinlining.c: fix for above changes.  and do some refactoring.
  this changes improve rb_yield() performance.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 17:50:17 +00:00
mame 956dead480 * compile.c (iseq_set_exception_table, NODE_WHILE, NODE_NEXT): remove
special handling that decrements sp in CATCH_TYPE_NEXT for NODE_WHILE.

* vm.c (vm_eval_body), vm_insnhelper.c (vm_throw): remove unused code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 06:29:48 +00:00
mame 846ea1727f * compile.c (get_destination_insn, get_next_insn, get_prev_insn):
peephole optimization should not ignore ISEQ_ELEMENT_ADJUST.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 14:45:54 +00:00
ko1 385f0e8af6 * vm.c, insns.def, eval.c, vm_insnhelper.c: fix CREF handling.
VM value stack frame of block contains cref information.
  (dfp[-1] points CREF)
* compile.c, eval_intern.h, eval_method.c, load.c, proc.c,
  vm_dump.h, vm_core.h: ditto.
* include/ruby/ruby.h, gc.c: remove T_VALUES because of above
  changes.
* bootstraptest/test_eval.rb, test_knownbug.rb: move solved test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 03:08:50 +00:00
ko1 5e4edb43a2 * insns.def: add a "putcbase" instruction.
* compile.c, insns.def: fix to use putcbase instruction for
  class search.  Qundef should not be used.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-14 02:31:28 +00:00
matz b15fe02d19 * eval.c (is_defined): add NODE_OP_ASGN_{OR,AND}. "defined?(a||=1)"
should not operate assignment.  [ruby-dev:34645]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 05:05:50 +00:00
matz 837c76bd7b * compile.c (iseq_compile_each): should call compile_cpath() for
modules as well.  [ruby-dev:34585]

* insns.def (defineclass): add undef handling.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 15:01:42 +00:00
matz 58967f4fcd * compile.c (defined_expr): protect some expression from
segmentation fault.  a patch from wanabe <s.wanabe at gmail.com>
  in [ruby-dev:34593].

* compile.c (defined_expr):

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 11:01:10 +00:00
matz a823fc5d8b * compile.c (compile_cpath): use Qundef to denote cbase lookup.
* insns.def (defineclass): Qudef is passed for cbase.

* insns.def (setconstant): ditto.

* vm_insnhelper.c (vm_check_if_namespace): use rb_inspect()
  instead of rb_obj_as_string() for better description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 02:27:29 +00:00
matz 7243069d29 * compile.c (defined_expr): capture exception during defined?
evaluation.  a patch from wanabe <s.wanabe at gmail.com> in
  [ruby-dev:34461].  [ruby-core:16010]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-21 02:02:26 +00:00
nobu 64a16b9ede * vm_core.h (struct iseq_compile_data): moved label_no from
new_label_body().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 06:01:28 +00:00
nobu 36f984b65e * compile.c (iseq_set_exception_table): allocates catch_table only
when entries exist.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 06:00:51 +00:00
nobu 9ddb37f071 * compile.c (struct iseq_link_element, struct iseq_insn_data): made
enum for debuggers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 05:58:59 +00:00
nobu f4f95b98d4 * compile.c (iseq_compile_each): fix for splat in when and rescue.
a patch from wanabe <s.wanabe AT gmail.com> in [ruby-dev:34429].
  [ruby-core:14537]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-20 05:44:47 +00:00
mame 0a2053713b * enc/trans/utf_16_32.c (fun_so_to_utf_16be, fun_so_to_utf_16le): add
parentheses to remove warnings of gcc.

* io.c (rb_io_getc): remove unused variables.

* compile.c (NODE_NEXT, NODE_REDO): remove unused labels.

* ext/nkf/nkf.c (rb_nkf_convert): remove unused variables.

* ext/syck/rubyext.c (syck_resolver_initialize,
  syck_resolver_detect_implicit, syck_emitter_emit): remove unused
  variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-17 13:22:40 +00:00
nobu 6866bce757 * compile.c, compile.h (compile_debug): made runtime option.
* debug.c (ruby_debug_print_indent): returns if debug_level exceeds
  the threashold.

* debug.c (ruby_debug_printf): printf to stderr.

* iseq.c (make_compile_option, make_compile_option_value): added
  debug_level option.

* vm_core.h (rb_compile_option_t): added debug_level.

* vm_core.h (struct iseq_compile_data): added node_level.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 05:34:04 +00:00
nobu 7b4a171158 * eval.c (ruby_exec_node, ruby_run_node), ruby.c (process_options):
use iseq instead of NODE.

* gc.c (source_filenames): removed.

* include/ruby/intern.h, parse.y (yycompile, parser_mark, parser_free,
  ripper_initialize): rb_source_filename() is no longer used.

* compile.c, compile.h (ERROR_ARGS), parse.y (node_newnode, fixpos,
  parser_warn, e_option_supplied, warn_unless_e_option, range_op,
  cond0): nd_file is no longer used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-12 03:41:51 +00:00
nobu 5c1926ac82 * compile.c (iseq_set_sequence, iseq_insns_unification,
insn_data_to_s_detail): constified.

* iseq.c (insn_operand_intern, ruby_iseq_disasm_insn): ditto.

* template/{insns_info,opt_sc,optunifs}.inc.tmpl: ditto.

* tool/instruction.rb (OptUnifsIncGenerator): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-03 00:00:48 +00:00
nobu 708e5ddde6 * compile.c (defined_expr): false short-circuit destination label may
be needed.  [ruby-talk:295296]

* compile.c (iseq_compile_each): put nil if false short-circuit is
  created.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 06:26:32 +00:00
nobu f2025c33ff * compile.c (compile_massign_opt): no need to use alloca.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 06:09:38 +00:00
matz 588d870234 * include/ruby/node.h (NODE_FL_NEWLINE): renamed from NODE_NEWLINE
to denote its a flag.  [ruby-core:15529]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-18 05:33:01 +00:00
akr d5c8ad5359 * insns.def (toregexp): generate a regexp from strings instead of one
string.

* re.c (rb_reg_new_ary): defined for toregexp.  it concatenates
  strings after each string is preprocessed. 

* compile.c (compile_dstr_fragments): split from compile_dstr.
  (compile_dstr): call compile_dstr_fragments.
  (compile_dregx): defined for dynamic regexp.
  (iseq_compile_each): use compile_dregx for dynamic regexp.

  [ruby-dev:33400]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 08:03:51 +00:00
ko1 51ea2cf4e4 * compile.c (iseq_compile_each): validate argument expr of "next"
statement.
* bootstraptest/test_syntax.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 08:44:43 +00:00
ko1 3b1c663ed9 * compile.c, compile.h: fix to calculate correct stack depth
at each instruction.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 08:27:00 +00:00
ko1 13b5b22ae6 * compile.c, compile.h: fix stack pointer issues.
calculate correct stack depth at compile time.
* insns.def (emptstack): remove it and add a new insn "adjuststack".
* bootstraptest/test_knownbug.rb: move/remove fixed test.
* bootstraptest/test_syntax.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 18:02:01 +00:00
nobu 893ee30978 * compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 04:05:59 +00:00