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

32 Коммитов

Автор SHA1 Сообщение Дата
ko1 57062d91b9 * cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
  At this time, only Fiber#pass is supported to change context.
  I want to know more suitable method name/API for Fiber (... do you
  know more suitable class name instead of Fiber?) as "suspend/resume",
  "call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 19:12:43 +00:00
ko1 e4aa7208e5 * cont.c: check across trap violation.
* eval.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-24 03:08:13 +00:00
ko1 7d200b94f9 * gc.c, yarvcore.c: fix to mark VM structure on startup.
* yarvcore.h: disable USE_CACHED_VALUE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-24 02:47:22 +00:00
ko1 affa7430b7 * compile.c, vm_macro.def: support tail call optimization
(on default, this feature is not enabled).
* iseq.c, compile.c, vm_opts.h: add "tailcall_optimization"
  option.
* sample/test.rb (test_ok): fix to adjust tailcall stack layout.
* insns.def, vm.c, compile.c, yarvcore.c, yarvcore.h:
  add opt_gt, opt_le instructions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-21 04:46:51 +00:00
nobu 1a89cc308d * configure.in, defines.h, eval_load.c (rb_feature_p, rb_provided,
search_required, rb_require_safe), ext/extmk.rb: Fix
  a bug where a statically linked extension cannot be autoloaded.
  [ruby-dev:30023] / [ruby-dev:30239]

* thread.c: added an internal class, Barrier.

* yarvcore.h (struct rb_vm_struct): moved loading_table from global.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-03 13:19:11 +00:00
ko1 fba2420be4 * vm.c, yarvcore.h, yarvcore.c, insns.def: fix to mark VM stack
in correct range.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-02 09:59:38 +00:00
ko1 75d28f8870 * yarvcore.h, compile.c (set_arguments): support post arguments.
* test/ruby/test_method.rb: add tests for above.
* test/ruby/test_proc.rb: ditto.
* proc.c: fix an arity bug ([ruby-core:11029]).
* vm.c, vm.h, insns.def, vm_dump.h: fix bmethod process.
* vm.c: support block argument on block parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 04:35:58 +00:00
ko1 abcbd7ea38 * yarvcore.h: remove rb_control_frame_t#callee_id.
* vm_macro.def: ditto.
* eval_intern.h (exec_event_hooks): fix to check event flags
* eval_intern.h (EXEC_EVENT_HOOK): fix to re-check event flags.
* ext/probeprofiler : added.  this profiler is sampling based
  profiler.
* vm.c: add rb_thread_current_status() API for probeprofiler.
* thread.c (rb_thread_execute_interrupts): add comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-25 03:50:00 +00:00
nobu 3fc37d71c4 * eval.c (ruby_cleanup): re-send signal. [ruby-dev:30516]
* eval_error.h (error_handle): no message when exiting by signal.

* intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes.

* signal.c (esignal_init): takes a signal number and an optional
  signal name.

* signal.c (interrupt_init): pass SIGINT always.

* signal.c (ruby_default_signal): invoke system default signal
  handler.

* signal.c (rb_f_kill): use NUM2PIDT instead of NUM2INT.

* signal.c (rb_signal_exec, trap): handle SIGTERM.  [ruby-dev:30505]

* thread.c (rb_thread_signal_raise): now takes signal number instead
  of signal name.

* thread.c (rb_thread_signal_exit): since rb_make_exception() calls
  #exception method, rb_class_new_instance() is not needed here.

* yarvcore.h (struct rb_vm_struct), eval_jump.h (terminate_process):
  exit_code is no longer stored in VM.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-19 17:37:03 +00:00
ko1 a73894337a * eval.c, node.h, thread.c, yarvcore.[ch], eval_intern.h:
support set_trace_func (incomplete.  id and klass
  don't be passed).  And support Thread#set_trace_func
  which hook only specified thread and Thread#add_trace_func
  which add new trace func instead of replace old one.
  C level API was modified.  See thread.c (logic) and
  yarvcore.h (data structures).
* vm.c, vm_macro.def: add hook points.
* compile.c, insns.def: fix "trace" instruction.
* iseq.c, vm_macro.h: add compile option "trace_instruction".
* test/ruby/test_settracefunc.rb: hook "c-return" of set_trace_func.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-19 10:37:08 +00:00
nobu 790999028d * insns.def (throw), thread.c, yarvcore.h (throwed_errinfo): fixed
typo.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-02 12:54:42 +00:00
ko1 bb7a2d40ff * compile.c, parse.y, eval.c, intern.h, iseq.c, lex.c, node.h,
proc.c, vm.c, vm_macro.def, vm_macro.def, yarvcore.c, yarvcore.h,
  debug.c, debug.h: merge half-baked-1.9 changes.  The biggest change
  is to change node structure around NODE_SCOPE, NODE_ARGS.  Every
  scope (method/class/block) has own NODE_SCOPE node and NODE_ARGS
  represents more details of arguments information.  I'll write a
  document about detail of node structure.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-21 11:15:15 +00:00
matz 33163ad123 * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
Huehner <stefan at huehner.org>.  [ruby-core:10543]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-19 03:58:57 +00:00
ko1 8a1b1c2b41 * yarvcore.h, vm.h: rename th_invoke_yield() to th_yield().
* blockinlining.c: ditto.
* eval.c: ditto.
* vm.c, insns.def: rename th_invoke_yield_cfunc()
  to th_yield_with_cfunc().
* yarvcore.h, yarvcore.c: rename theYarvVM to ruby_current_vm and
  yarvCurrentThread to ruby_current_thread.  remove yarvVMArray.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-26 22:51:33 +00:00
ko1 9987d53e51 * yarvcore.h: add rb_thread_t#top_wrapper, top_self.
* eval_load.c (rb_load): support eval in wrapper module
  (load(file, true)).
* eval.c: ditto.
* eval_jump.h: ditto.
* iseq.c: ditto.
* vm.c: ditto.
* yarvcore.c: ditto.
* insns.def: add a empty line.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-25 16:29:26 +00:00
ko1 71986ef6bc * yarvcore.h:
rename:
  rb_iseq_t#file_name -> filename
  rb_iseq_t#local_tbl -> local_table
  add:
  rb_iseq_t#local_table_size
* compile.c: separate local_table_size and local_size
  (local variable size)
* blockinlining.c: apply above rename.
* compile.h: ditto.
* eval.c: ditto.
* iseq.c: ditto.
* proc.c: ditto.
* vm.c: ditto.
* vm_dump.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-25 01:34:33 +00:00
nobu f425798fda * intern.h (rb_thread_blocking_region): add prototype.
* thread.c (BLOCKING_REGION): restore previous UBF.

* thread.c (rb_thread_blocking_region): default UBF to interrupt
  in system dependent way by RB_UBF_DFL.
  + ubf_select() on posix system
  + ubf_handle() on Win32
  + none on cygwin



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 09:41:41 +00:00
ko1 90a192865a * eval.c, vm.c, yarvcore.h: move definition of rb_call_super() to
vm.c from eval.c.  change th_call_super() to static function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-20 06:16:04 +00:00
ko1 5e4e71a348 * vm.(c|h), yarvcore.(c|h) (yarvGlobalStateVersion): rename to
ruby_vm_global_state_version.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-14 18:08:10 +00:00
ko1 9895ce9f77 * eval_load.c, yarvcore.h: use rb_vm_t#loaded_features instead of
rb_features (global variable).
* yarvcore.c: mark rb_vm_t#loaded_features.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-14 02:19:02 +00:00
nobu d274cf524a * common.mk: targets which depend on yarvcore.h now depend on
rubysig.h too.

* yarvcore.h (rb_vm_t): use rb_atomic_t instead of int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-10 08:47:05 +00:00
ko1 ae317b518c * yarvcore.h, thread.c: fix to use pthread on cygwin.
* yarvcore.h, thread.c: move GVL_UNLOCK_BEGIN() and GVL_UNLOCK_END()
  from yarvcore.h to thread.c.
* thread.c: change GVL_UNLOCK_RANGE() arguments
  (adding ubf as 2nd argument).
* thread.c: fix to use polling in select on cygwin and mswin32.
* thread.c, thread_pthread.ci, thread_win32.ci, yarvcore.h:
  rename:
* rb_thread_t#interrupt_function -> unblock_function
* rb_interrupt_function_t -> rb_unblock_function
* some interrupt function name -> ubf_*
* yarv_* -> *



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 11:51:40 +00:00
ko1 9c574383a4 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
  thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
  vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fix typo (rb_thead_t -> rb_thread_t).

* eval_intern.h: remove unused definitions.

* common.mk: fix around vm_opts.h path
  and remove harmful argument passed to insns2vm.rb.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 06:37:46 +00:00
ko1 0b91bd56c2 * eval_intern.h, yarvcore.h: remove unused macro definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 13:38:29 +00:00
ko1 44aef0b53f * this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting
  unused variables and removing yarv.h.
  This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
  * debug.[ch]: debug_*() -> ruby_debug_*()
  * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
  * iseq.c: node_name() -> ruby_node_name()
  * vm.c: yarv_check_redefinition_opt_method() ->
    rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
  local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
  mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
  rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
  yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 01:25:05 +00:00
ko1 8ee7d0767f * blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
  eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
  process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
  yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
  * yarv_*_t -> rb_*_t
  * yarv_*_struct -> rb_*_struct
  * yarv_tag -> rb_vm_tag
  * YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
  from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
  from proc.c to ruby.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 19:00:03 +00:00
ko1 025cfde57d * eval_thread.c, common.mk: remove eval_thread.c.
* yarvcore.c: rename cYarvThread to rb_cThread.
* gc.c: remove YARV_* prefix.
* gc.h: add an include guard and prototype of rb_gc_set_stack_end().
* inits.c: fix to ANSI prototype style and reorder Init_*().
* io.c (pipe_finalize): TODO: comment out last_status.
* process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of
  rb_last_status and make last_status_get() to access $?.
* yarvcore.c (vm_mark): mark yarv_vm_t#last_status.
* ruby.h: add declarations of rb_cISeq and rb_cVM.
* thread.c: move eval_thread.c codes to thread.c and remove yarv_*
  function prefix.
* thread.c (thread_start_func_2): use yarv_thread_t#first_func if
  it is not null.
* vm.c: fix copyright year.
* yarvcore.c (Init_vm): rename to Init_VM().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-05 12:21:01 +00:00
matz 72f2d2a00d * parse.y (rb_compose_ivar2): function to create a new ivar2
symbol from a symbol and a class.  back-ported from matzruby.

* parse.y (rb_decompose_ivar2): reverse function of
  rb_compose_ivar2(). 

* marshal.c (w_symbol): support class local instance variables.

* marshal.c (r_object0): ditto.

* compile.c (defined_expr): ditto.

* compile.c (iseq_compile_each): ditto.

* insns.def: add two new instructions: getinstancevariable2 and
  setinstancevariable2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-04 19:17:33 +00:00
nobu 205f310c29 * call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
  insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
  range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fixed indents and non-C90 comments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 16:26:04 +00:00
ko1 dbee678630 * some refactoring around yarvcore and proc.
* eval_proc.c: renamed to proc.c.
* common.mk: ditto.
* yarvcore.h, yarvcore.c: rename or remove some global variables
  removed: mYarvCore, mYarvInsns
  renamed: cYarvISeq -> rb_cISeq,
           cYarvProc -> rb_cProc, cYarvBinding -> rb_cBinding
  ::YarvCore module is removed and ::YarvCore::VM class becomes ::VM.
  And change/remove some functions which added with YARV.
* compile.c: ditto.
* eval.c: ditto.
* iseq.c: ditto.
* vm.c: ditto.
* inits.c: rename Init_yarvcore to Init_vm.
* yarvcore.c, proc.c: move some functions and initialization
  from yarvcore.c to proc.c.
* intern.h, proc.c: add global function rb_binding_new(void).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-17 08:48:52 +00:00
ko1 ce55b4c0e0 * insns.def : support direct method dispatch with "send" or "funcall".
This means that "obj.send :m" skips "BasicObject#send" invocation
(method frame creation, etc) and "obj.m" invokes directly.
If you make backtrace, there are no enties of "send" method.
* compile.c (iseq_specialized_instruction) : fix to support above
* eval.c : ditto (remove "static" from rb_f_send and rb_f_funcall
* yarvcore.c : ditto (add a external IDs for compiler)
* yarvcore.h : ditto (add a VM_CALL_SEND_BIT macro)
* yarvtest/test_method.rb : add tests for above changes
* eval.c : remove unused "Kernel#send" declaration



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-06 00:24:59 +00:00
ko1 a3e1b1ce7e * Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00