summaryrefslogtreecommitdiffstats
path: root/proc.c
Commit message (Collapse)AuthorAgeFilesLines
* stripped trailing spaces.nobu2009-02-221-68/+68
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (eval_string_with_cref): use rb_vm_get_ruby_level_next_cfp()ko12009-02-131-2/+0
| | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@22275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: add a prefix "rb_" to exposed functionsko12009-01-191-10/+10
| | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_new): should use proc_dup() if block has Proc.ko12008-12-251-12/+10
| | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@20980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (invoke_block_from_c): fix to point right cfp.ko12008-12-241-1/+1
| | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@20969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (iseq_compile_each), gc.c (assign_heap_slot),nobu2008-12-091-1/+1
| | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@20593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (rb_iseq_parameters): proc arguments are always optional.nobu2008-12-051-7/+10
| | | | | | | * proc.c (get_proc_iseq, rb_proc_parameters): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (simple_default_value): extracts simplest defaultnobu2008-11-281-2/+69
| | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@20384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_eq): equivalence check should not done by pointermatz2008-11-181-3/+6
| | | | | | comparison, but should be based on iseq contents. [ruby-dev:37101] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: embeds the elements of an array into itsyugui2008-10-091-5/+1
| | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (primary, brace_block): fix for line number.nobu2008-09-261-6/+55
| | | | | | | | * proc.c (rb_proc_location, rb_method_location): new methods {Proc,Method,UnboundMethod}#source_location. [ruby-core:18452] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/node.h, vm_core.h: move definition ofko12008-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (Init_Proc): add '===' operator to use procs in whenmatz2008-09-061-1/+12
| | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@19192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_new): use the given class.nobu2008-08-201-3/+4
| | | | | | | * vm.c (vm_make_proc): added an argument for the class. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_proc_call_with_block): reduce comparison.mame2008-07-311-2/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_proc_call_with_block): prevent null reference.mame2008-07-301-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (Init_eval), gc.c (Init_GC), proc.c (Init_Proc): freezenobu2008-07-021-1/+2
| | | | | | | messages of preallocated special exceptions also. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c, vm.c: fix to refer next ruby level cfp to make binding.ko12008-07-011-1/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_new): fix to return Proc object if block is alreadyko12008-06-191-0/+4
| | | | | | | | | in heap. [ruby-core:15711] * bootstraptest/test_proc.rb: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_vm_t), vm.c (rb_vm_mark): moved preallocated specialnobu2008-06-151-1/+1
| | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c, eval_intern.h (PASS_PASSED_BLOCK):ko12008-06-101-3/+8
| | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, proc.c: revert rb_proc_call() andko12008-06-101-7/+23
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.mame2008-06-091-6/+9
| | | | | | | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c, vm.c, proc.c : revert r17021. [ruby-dev:34997]wanabe2008-06-081-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c, vm.c, proc.c (proc_call): allow call method withwanabe2008-06-081-2/+2
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-7/+4
| | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_method.c: renamed from vm_method.c. "vm_method.c" is includedko12008-05-241-3/+5
| | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_dup): should copy safe_level from src procmatz2008-05-211-1/+1
| | | | | | | properly. a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com> git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c, insns.def, eval.c, vm_insnhelper.c: fix CREF handling.ko12008-05-191-6/+0
| | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@16468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (method_name): should return symbols instead of strings.matz2008-04-281-2/+2
| | | | | | [ruby-dev:34531] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_dup): should copy is_lambda attribute as well.matz2008-03-301-0/+1
| | | | | | [ruby-talk:296244] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-18/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_curry): new method. [ruby-dev:33676]mame2008-02-131-0/+101
| | | | | | | * test/ruby/test_proc.rb: add tests for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2008-02-091-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_mark): needs to mark the receiver too. a patch fromnobu2008-01-111-0/+1
| | | | | | | | Chris Heath <chris AT heathens.co.nz> in [ruby-core:14983]. [ruby-core:14885] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-01-051-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update lambda? doc.akr2007-12-261-7/+76
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (method_inspect): preserve encoding of the method name.matz2007-12-251-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update Proc#lambda? doc.akr2007-12-241-0/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (method_name): preserve Symbol's encoding.matz2007-12-241-1/+1
| | | | | | * numeric.c (fix_id2name): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * iseq.c (Init_ISeq): disable ISeq.load() because there is no verifier.ko12007-12-241-1/+16
| | | | | | | | * iseq.c, proc.c: add ISeq.disasm(method). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update Proc#lambda? doc.akr2007-12-241-2/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_proc_new), vm.c (invoke_block): removed u3.state magic.nobu2007-12-241-5/+2
| | | | | | | | | | [ruby-core:14310] * test/ruby/test_symbol.rb (test_to_proc): a test from Frederick Cheung <frederick.cheung AT gmail.com>. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Proc#lambda? documented.akr2007-12-231-0/+24
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: support Proc#binding.ko12007-12-201-0/+35
| | | | | | | | * sample/test.rb: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insnhelper.ci, vm.c, vm_core.h: change interface ofko12007-12-201-22/+20
| | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@14356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_obj_public_method): Object#public_method to retrievematz2007-12-171-6/+23
| | | | | | | | | | | | | | | | public method object. * proc.c (rb_mod_public_instance_method): Module#public_instance_method to retrieve public instance method from class / module. * proc.c (mnew): visibility check added. * eval_error.ci (rb_print_undef): add rb_ prefix. * eval_error.ci (rb_print_undef): add visibility in the error message. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_proc_s_new): call initialize. [ruby-core:13824]nobu2007-12-051-3/+36
| | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@14109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e