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

119 Коммитов

Автор SHA1 Сообщение Дата
nobu 6cdc89332e * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, and
rb_progname.

* ruby.c (rb_argv0): no longer used.

* vm.c: getters/setters for ruby_{debug,verbose}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 05:18:03 +00:00
nobu 9fb521515d * vm_core.h (struct rb_vm_struct): moved src_encoding_index.
* ruby.c (struct cmdline_options): moved setids and req_list, and the
  latter is now an array, to prevent memory leak.

* ruby.c (cmdline_options_init): added.

* ruby.c (add_modules, require_libraries, init_ids, forbid_setid): use
  struct cmdline_options.

* vm.c (vm_init2): initialize src_encoding_index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 04:20:07 +00:00
nobu efe5422e6a * vm.c (rb_thread_recycle_stack_release): reduce redundant code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 02:58:23 +00:00
wanabe ddf83922a2 * vm_insnhelper.c, vm.c, proc.c : revert r17021. [ruby-dev:34997]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 23:16:46 +00:00
wanabe a5fdfa5884 * vm_insnhelper.c, vm.c, proc.c (proc_call): allow call method with
block that both is written in C. [ruby-dev:34273] [ruby-core:15551]

*  proc.c (curry): use proc_call instead of rb_proc_call.
  [ruby-dev:34273] [ruby-core:15551]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 13:24:13 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
mame 5e9b9ff9cb * gc.c (rb_objspace_alloc): this function is needed only when
ENABLE_VM_OBJSPACE macro is defined.

* vm.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-05 14:41:41 +00:00
nobu 7c5e3348f7 * suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 19:55:25 +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
ko1 a45cd8a01c * eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c, vm_core.h, vm_insnhelper.c: remove pointless "const".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 16:19:14 +00:00
nobu 6f04138f75 * vm.c (sdr, nsdr): define methods only if VMDEBUG is defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 10:01:32 +00:00
nobu 571883a217 * vm.c (vm_get_ruby_level_cfp): moved from eval_intern.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 09:55:36 +00:00
usa 477c0db2bd * eval_intern.h, vm_core.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c: need to add const to prototypes, of course.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 06:22:41 +00:00
ko1 559d021d20 * eval.c, vm.c, vm_core.h, vm_insnhelper.c: specify "const".
* vm_opts.h: add a OPT_TOKEN_THREADED_CODE macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 04:28:13 +00:00
ko1 b001dbad6e * vm.c (invoke_block_from_c): fix call flow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19 14:36:13 +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
yugui 9aceaa1129 * vm.c (Init_VM): removed the definition of Thread#initialize,
which is overwritten in Init_Thread and is never used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-17 09:14:24 +00:00
mame 18e46b81ff * vm.c (collect_local_variables_in_env): remove unnecessary check
which causes: x=1;proc{local_variables}.call #=> []

* test/ruby/test_variable.rb: add a test for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 14:42:17 +00:00
akr 332529d45a * vm.c (env_mark): mark env->block.self. prevent SEGV when GC occur
in prepare_iseq_build with gcc version 3.4.6 [FreeBSD] 20060305 on
  FreeBSD/amd64.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10 03:00:56 +00:00
nobu 6aa73e6cab * vm.c (rb_thread_mark): mark stat_insn_usage only when ptr is not
null.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 04:19:20 +00:00
nobu 42981462c9 * vm.c (vm_eval_body): initialize retval. [ruby-dev:34576]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 08:41:16 +00:00
nobu 01b773a093 * load.c (rb_load_path), vm_core.h (rb_vm_t): moved to VM.
* load.c (rb_get_load_path): returns absolute load path.

* load.c (load_path_getter): $LOAD_PATH getter.

* file.c (rb_find_file_ext, rb_find_file), ruby.c (push_include,
  ruby_init_loadpath): use the accessor.

* vm.c (rb_vm_mark): mark load_path.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-30 09:03:03 +00:00
nobu 09007ccbaa * vm_core.h (rb_vm_t), gc.c (rb_objspace, rb_newobj), vm.c
(Init_BareVM): per-VM object space support, which is disabled now.

* gc.c (rb_objspace_alloc), vm.c (Init_BareVM): should not use ruby
  malloc here.

* gc.c (garbage_collect, etc): performance improvement by passing the
  reference instead of refering the global variable in each functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-27 03:20:35 +00:00
matz a4d6f2265a * include/ruby/node.h: add new constants for rb_call()'s scope.
* eval.c (iterate_method): use CALL_* scope constant to specify
  proper scope value.

* eval.c (rb_each, rb_apply, rb_funcall, rb_funcall2, rb_funcall3):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-01 21:30:36 +00:00
matz eb1f89015e * eval.c (rb_f_local_variables): local_variables should return an
array of symbols.  [ruby-dev:34008]

* vm.c (collect_local_variables_in_env): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-10 15:48:35 +00:00
mame 03a4a0f1d2 * vm.c (rb_call_super): pass a passed block when super is called via
rb_call_super.  [ruby-dev:33598]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-05 12:58:50 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
ko1 36df55c6e4 * iseq.c: all methods need $SAFE < 1.
vm.c: comment out debug functions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 09:43:23 +00:00
shugo 8e4c6d8482 * vm.c (rb_frame_method_id_and_class): new function to get the
method id and class of the current frame.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 08:49:09 +00:00
ko1 b90e7414ce * vm.c (Init_VM): remove unused code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 03:44:53 +00:00
ko1 b40dbc304e * vm.c: check frame is FINAL when creating env.
[ruby-core:14395]
* bootstraptest/test_block.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 02:14:36 +00:00
ko1 a79ce52e08 * vm.c: add dummy toplevel frame.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 21:18:47 +00:00
ko1 95ca3f72a8 * compile.c (iseq_compile): clear local table if node == 0.
a patch from Yusuke ENDOH <mame AT tsg.ne.jp>
* vm.c: clear VM stack.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 20:27:10 +00:00
matz 6ca558d6ab * proc.c (method_name): preserve Symbol's encoding.
* numeric.c (fix_id2name): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 16:38:44 +00:00
nobu 4542f21a42 * proc.c (rb_proc_new), vm.c (invoke_block): removed u3.state magic.
[ruby-core:14310]

* test/ruby/test_symbol.rb (test_to_proc): a test from Frederick
  Cheung <frederick.cheung AT gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 04:55:37 +00:00
ko1 2a564dfb94 * vm.c, vm_dump.c: fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:48:14 +00:00
akr 4cf437519f * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
  ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
  ext/openssl/ossl_bn.c, numeric.c, vm.c,
  benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
  for non law violation context.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:31:11 +00:00
ko1 c334a09f7a * common.mk, *.ci: renamed to *.c.
* eval_laod.c: renamed to load.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 09:29:46 +00:00
ko1 314bef7ef1 * insnhelper.ci, vm.c, vm_core.h: change interface of
vm_invoke_block() to specify block ptr.  [ruby-talk:266422]
* cont.c, eval_jump.ci, insns.def, proc.c, signal.c, thread.c:
  apply above change.
* bootstraptest/test_knownbug.rb: move fixed bug.
* bootstraptest/test_block.rb: ditto. and add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 07:07:35 +00:00
ko1 192ec21adf * insnhelper.ci, vm.c: rewrite sp manipulation around method/block
invocation.  [ruby-dev:32547]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 13:14:32 +00:00
ko1 8394de7bfc * vm.c (invoke_block): merge 2 stack overflow checks.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 12:11:38 +00:00
akr 4f13113945 * vm_core.h (rb_thread_t): new member machine_stack_maxsize and
machine_register_stack_maxsize.

* gc.c (rb_gc_stack_maxsize): new global variable for the thread size
  of the main thread.
  (STACK_LEVEL_MAX): use machine_stack_maxsize of current thread.
  (ruby_stack_check): check IA64 register stack.
  (ruby_set_stack_size): set rb_gc_stack_maxsize.
  (Init_stack): set rb_gc_stack_maxsize.

* thread_pthread.ci (native_thread_create): initialize
  th->machine_stack_maxsize and th->machine_register_stack_maxsize.

* vm.c (Init_BareVM): initialize th->machine_stack_maxsize and
  th->machine_register_stack_maxsize.

* thread_win32.ci (native_thread_create): initialize
  th->machine_stack_maxsize.  not tested.  just a guess at all.

[ruby-dev:32604]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-15 04:09:24 +00:00
ko1 3923d7f420 * vm.c (rb_thread_mark): use rb_gc_mark_maybe() for
VM stack specified by mark_stack_len.
* insnhelper.ci: clear vm stack extended by opt value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 05:56:00 +00:00
nobu 430f5a1d61 * proc.c (rb_proc_s_new): call initialize. [ruby-core:13824]
* proc.c (rb_proc_location): return file name and line number where
  the proc is defined.

* thread.c (thread_s_new): call initialize.  [ruby-core:13835]

* thread.c (thread_initialize): split initialize method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-05 07:18:52 +00:00
ko1 2a2e4bbbc3 * vm.c: fix comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 08:34:34 +00:00
matz c227d3feb3 * insnhelper.ci (vm_search_normal_superclass): rename function.
* insnhelper.ci (vm_search_superclass): ditto.

* proc.c (struct METHOD): rename rklass -> rclass.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-22 01:17:52 +00:00
ko1 c79ab68d37 * vm.c: fix to recycle thread data (VM stack).
* thread.c: ditto.
* benchmark/bm_vm3_thread_create_join.rb: add loop count.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-21 09:06:06 +00:00
shugo 577eaa60a7 * insnhelper.ci (vm_call_method): pass mn->nd_clss to
vm_call_cfunc() instead of klass.
* vm.c (rb_thread_method_id_and_klass): traverse parent_iseq.
* thread.c (call_trace_proc): use rb_thread_method_id_and_klass().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-11 08:42:13 +00:00
nobu 4c040861c8 * eval.c (rb_invoke_method): check if invoked in function style.
[ruby-core:13245]

* insnhelper.ci (vm_call_cfunc, vm_cfunc_flags): stores and returns VM
  calling flags.

* vm.c (rb_vm_cfunc_funcall_p): returns if the current method is
  invoked in function style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 01:29:24 +00:00