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

96 Коммитов

Автор SHA1 Сообщение Дата
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
ko1 c330876d7c * method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
method management.  This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto.  and make some
  refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
  VM_CALL_SEND_BIT.  use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
  rb_define_notimplement_method_id().  nobody can use it
  because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 14:59:41 +00:00
yugui 76e3005431 * proc.c (Kernel#define_singleton_method): rdoc. based on a patch by
Marc-Andre Lafortune <ruby-core-mailing-list AT marc-andre.ca>.
  [ruby-core:23944].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 12:41:24 +00:00
nobu abbd115cae * proc.c ({proc,binding,method}_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 09:28:09 +00:00
nobu ebd13e3eed * proc.c ({proc,method}_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 08:13:41 +00:00
nobu 06b9094f96 * proc.c (make_curry_proc): should propagate lambda-ness.
[ruby-core:24127]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 00:31:55 +00:00
nobu 4256968488 * proc.c (proc_hash): use long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 00:23:36 +00:00
akr 8b27d153d2 * class.c (rb_define_method_id): use rb_define_notimplement_method_id
if rb_f_notimplement is given.
  (rb_define_protected_method): ditto.
  (rb_define_private_method): ditto.
  (rb_define_method): use rb_define_method_id.

* include/ruby/intern.h (rb_f_notimplement): declared.
  (rb_define_notimplement_method_id): declared.

* proc.c (method_inspect): show not-implemented.

* vm_method.c (notimplement_body): new variable.
  (rb_notimplement_body_p): new function.
  (rb_method_boundp): return false if not implemented.
  (rb_f_notimplement): new function.
  (rb_define_notimplement_method_id): new function.

* process.c (rb_f_fork): use rb_f_notimplement if not implemented.

* file.c (rb_file_s_lchmod): use rb_f_notimplement if not implemented.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16 14:17:14 +00:00
nobu f621b32e58 * proc.c (bmcall): should not uninitialized variable. a patch from
pegacorn at [ruby-dev:38169].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 17:09:33 +00:00
nobu eca77cc85c * proc.c (rb_proc_call, bmcall): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:19:55 +00:00
nobu 4fc5c89700 * proc.c (rb_proc_call, rb_node_arity, bmcall, curry): checks
overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:18:09 +00:00
nobu 886214bc01 * proc.c (rb_proc_call): checks overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:05:09 +00:00
nobu eb89ad23cb * proc.c (rb_proc_arity): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:03:48 +00:00
nobu 07167378cb * proc.c (rb_proc_parameters): unnamed_parameters() expects int
not VALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 08:59:12 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
ko1 0cb68b619e * vm_eval.c (eval_string_with_cref): use rb_vm_get_ruby_level_next_cfp()
instead of vm_get_ruby_level_caller_cfp().  checking a upper frame
  is not enough.  [ruby-dev:37984]
* proc.c, vm_core.h: declare rb_vm_get_ruby_level_next_cfp()
  on vm_core.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 06:25:59 +00:00
ko1 cf23d0f0f0 * vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
  vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
  vm_get_sourceline(), vm_cref(), vm_localjump_error(),
  vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
  This changes may affect only core because most of renamed functions
  require a pointer of not-exposed struct such as rb_thread_t or NODE.
  In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
  vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 02:38:11 +00:00
ko1 7c982059ea * proc.c (proc_new): should use proc_dup() if block has Proc.
* vm.c (vm_make_proc_from_block): should use rb_cProc for block.
* vm.c (vm_make_proc): add an assertion.
* bootstraptest/test_proc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 03:51:35 +00:00
ko1 f23e8d87c0 * vm.c (invoke_block_from_c): fix to point right cfp.
* vm.c (vm_make_proc, vm_make_proc_from_block), vm_core.h:
  remove unused parameter cfp.
* vm_insnhelper.c, proc.c (proc_new): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 12:56:58 +00:00
nobu 541915b239 * compile.c (iseq_compile_each), gc.c (assign_heap_slot),
(gc_mark_children), parse.y (vtable_alloc, vtable_free, vtable_add),
  proc.c (proc_to_s), thread.c (terminate_i, rb_thread_terminate_all),
  (thread_start_func_2, blocking_region_begin, blocking_region_end),
  (rb_thread_kill), thread_pthread.c (native_thread_create),
  (ubf_pthread_cond_signal), vm.c (check_env, thread_free), vm_dump.c
  (vm_env_dump_raw, vm_stack_dump_each, vm_thread_dump_state),
  (vm_call0): use void pointer for %p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-09 04:33:55 +00:00
nobu f6d18c3f2a * iseq.c (rb_iseq_parameters): proc arguments are always optional.
* proc.c (get_proc_iseq, rb_proc_parameters): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 04:05:48 +00:00
nobu 46e3b0fe7b * iseq.c (simple_default_value): extracts simplest default
argument value.

* iseq.c (rb_iseq_parameters): returns parameter list.

* proc.c (get_proc_iseq, get_method_iseq): handles ifunc and
  bmethod.

* proc.c (rb_proc_parameters, rb_method_parameters): added
  Proc#parameters and Method#parameters.  [ruby-core:19759]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-28 04:19:37 +00:00
matz 256e8b9afc * proc.c (proc_eq): equivalence check should not done by pointer
comparison, but should be based on iseq contents.   [ruby-dev:37101]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-18 14:31:15 +00:00
yugui c86ce094e2 * include/ruby/ruby.h: embeds the elements of an array into its
struct RArray for # of elements <= 3.

	* array.c: ditto.

	* gc.c (gc_mark_children): following the change of struct RArray.

	* ext/tk/tcltklib.c (ip_ruby_cmp): ditto.

	* parse.y (coverage): ditto.

	* proc.c (curry): ditto.

	* .gdbinit: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 05:47:04 +00:00
nobu 77a9d7c32f * parse.y (primary, brace_block): fix for line number.
* proc.c (rb_proc_location, rb_method_location): new methods
  {Proc,Method,UnboundMethod}#source_location.  [ruby-core:18452]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 13:47:01 +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 dd27b8f457 * proc.c (Init_Proc): add '===' operator to use procs in when
clause of the case statement.  inspired by <http://www.aimred.com/news/developers/2008/08/14/unlocking_the_power_of_case_equality_proc/>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-06 14:58:11 +00:00
nobu 9286180079 * proc.c (proc_new): use the given class.
* vm.c (vm_make_proc): added an argument for the class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 13:28:18 +00:00
mame f3730b8260 * proc.c (rb_proc_call_with_block): reduce comparison.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-31 16:02:18 +00:00
mame 85da6ca572 * proc.c (rb_proc_call_with_block): prevent null reference.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30 15:11:09 +00:00
nobu bb350b04e5 * eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freeze
messages of preallocated special exceptions also.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 22:02:58 +00:00
ko1 ab109c36f1 * proc.c, vm.c: fix to refer next ruby level cfp to make binding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 17:11:35 +00:00
ko1 e7dac48a91 * proc.c (proc_new): fix to return Proc object if block is already
in heap.  [ruby-core:15711]
* bootstraptest/test_proc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 15:43:25 +00:00
nobu 9b45b336ee * vm_core.h (rb_vm_t), vm.c (rb_vm_mark): moved preallocated special
exceptions.

* eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freeze
  preallocated special exceptions.

* eval.c (rb_longjmp): duplicate the thrown exception to set backtrace
  if it was frozen.

* gc.c (rb_memerror): raise nomem_error without backtrace if failed to
  make backtrace.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-15 09:17:06 +00:00
ko1 9e324fdd3e * vm.c, eval_intern.h (PASS_PASSED_BLOCK):
set a VM_FRAME_FLAG_PASSED flag to skip this frame when
  searching ruby-level-cfp.
* eval.c, eval_intern.h, proc.c: fix to check cfp.  if there is
  no valid ruby-level-cfp, cause RuntimeError exception.
  [ruby-dev:34128]
* vm_core.h, vm_evalbody.c, vm.c, vm_dump.c, vm_insnhelper.c,
  insns.def: rename FRAME_MAGIC_* to VM_FRAME_MAGIC_*.
* KNOWNBUGS.rb, bootstraptest/test*.rb: move solved bugs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 21:46:43 +00:00
ko1 ed4139e39b * include/ruby/intern.h, proc.c: revert rb_proc_call() and
create rb_proc_call_with_block() instaed.
* include/ruby/ruby.h, eval_jump.c, thread.c, vm_insnhelper.c:
  rb_blockptr should not be exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:33:51 +00:00
mame f2400eca0b * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.
* vm_insnhelper.c (vm_yield_with_cfunc): vm_yield_with_cfunc receives
  blockptr and passes it to iterating block.

* proc.c (rb_proc_call), include/ruby/intern.h: rb_proc_call receives
  blockptr.  "rb_proc_call(self, args, blockptr)" in C corresponds to
  "self.call(*args, &block)" in Ruby.

* proc.c (proc_call): pass blockptr to block that is written in C.

* proc.c (curry): receive blockptr and pass it to original proc.
  [ruby-core:15551]

* vm.c (invoke_block_from_c): fix for change of vm_yield_with_cfunc.

* thread.c (call_trace_proc), eval_jump.c (rb_call_end_proc): fix for
  change of rb_proc_call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 15:52:51 +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
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
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
matz 989c8ed00a * proc.c (proc_dup): should copy safe_level from src proc
properly.  a patch from Keita Yamaguchi
  <keita.yamaguchi at gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 20:47:26 +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
matz 3d751cde0f * proc.c (method_name): should return symbols instead of strings.
[ruby-dev:34531]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-28 02:12:21 +00:00
matz 3730710d79 * proc.c (proc_dup): should copy is_lambda attribute as well.
[ruby-talk:296244]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-30 14:50:55 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
mame cd6dcfb05b * proc.c (proc_curry): new method. [ruby-dev:33676]
* test/ruby/test_proc.rb: add tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13 12:51:31 +00:00
akr 87ea50380d fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-09 09:49:31 +00:00
nobu 857b3018dd * proc.c (proc_mark): needs to mark the receiver too. a patch from
Chris Heath <chris AT heathens.co.nz> in [ruby-core:14983].
  [ruby-core:14885]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 11:20:18 +00:00