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

124 Коммитов

Автор SHA1 Сообщение Дата
ko1 1939d097e6 move several fields from rb_thread_t to rb_execution_context_t.
* vm_core.h (rb_thread_t): move several fields which are copied at cont.c
  to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-26 07:56:44 +00:00
ko1 4a4627fb0d move "state" to rb_vm_tag.
* vm_core.h (rb_thread_t::tag_state): move to "rb_vm_tag::state".
  Lifetime of "state" should be same as current tag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 09:43:52 +00:00
ko1 a64801c1e9 rename th->state to th->tag_state.
* vm_core.h (rb_thread_t): rename rb_thread_t::state to tag_state
  to make it clear.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 08:48:41 +00:00
ko1 2108e55c0b use "enum ruby_tag_type" and TAG_NONE.
Return value of EXEC_TAG() is saved by "int state".
Instead of "int", use "enum ruby_tag_type". First EXEC_TAG()
value should be 0, so that define TAG_NONE (= 0) and use it.

Some code used "status" instead of "state". To make them clear,
rename them to state.

We can change variable name from "state" to "tag_state", but this
ticket doesn't contain it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 07:25:52 +00:00
ko1 269b795556 vm_block_handler_verify() should not return any value.
* vm_core.h (vm_block_handler_verify): this function only checks
  the given block handler with VM_ASSERT(). No need to return any value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-08 05:22:49 +00:00
normal 9d09240d9e rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t
The goal is to reduce rb_context_t and rb_fiber_t size
by removing the need to store the entire rb_thread_t in
there.

[ruby-core:81045] Work-in-progress: soon, we will move more fields here.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 05:06:41 +00:00
nobu 269421084e vm_backtrace.c: backtrace functions per threads
* vm_backtrace.c (rb_threadptr_backtrace_object): rename and
  extern.

* vm_backtrace.c (rb_threadptr_backtrace_str_ary): rename as
  threadptr since the parameter is rb_thread_t*.

* vm_backtrace.c (rb_threadptr_backtrace_location_ary): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 01:23:50 +00:00
nobu 61d9da258d gc.c: rb_threadptr_stack_check
* gc.c (rb_threadptr_stack_check): check probability of stack
  overflow for the given thread, not the current thread.

* vm_eval.c (stack_check): check the given thread, not the current
  thread.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 00:10:47 +00:00
rhe ed5a926b13 eval_intern.h: make TH_PUSH_TAG() initialize rb_vm_tag::tag with Qundef
* eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with
  Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj)
  searches a tag with rb_vm_tag::tag == obj, throw(false) can
  accidentally find an unrelated tag which is not created by
  Kernel#catch.  [ruby-core:77229] [Bug #12743]

* test/ruby/test_exception.rb (test_throw_false): Add a test case for
  this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 06:43:51 +00:00
ko1 9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[Bug #12628]

  This patch introduce many changes.

  * Introduce concept of "Block Handler (BH)" to represent
    passed blocks.

  * move rb_control_frame_t::flag to ep[0] (as a special local
    variable). This flags represents not only frame type, but also
    env flags such as escaped.

  * rename `rb_block_t` to `struct rb_block`.

  * Make Proc, Binding and RubyVM::Env objects wb-protected.

  Check [Bug #12628] for more details.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 11:02:30 +00:00
nobu d8db69e683 Suppress false warnings
* vm_eval.c (rb_eval_cmd): refactor to share common code, and
  suppress false maybe-uninitialized warnings by old gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 01:50:49 +00:00
naruse 28f5e12c24 * configure.in: check function attirbute const and pure,
and define CONSTFUNC and PUREFUNC if available.
  Note that I don't add those options as default because
  it still shows many false-positive (it seems not to consider
  longjmp).

* vm_eval.c (stack_check): get rb_thread_t* as an argument
  to avoid duplicate call of GET_THREAD().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 17:44:51 +00:00
yui-knk 5cf9b65aa3 Use `rb_method_visibility_t` instead of `int` in `rb_print_undef`
* eval_error.c (rb_print_undef): Use `rb_method_visibility_t`
  instead of `int`.
* eval_intern.h (rb_print_undef): ditto
* proc.c (mnew_internal): ditto
* vm_method.c (rb_export_method): ditto
  [Misc #11649] [ruby-core:71311] [fix GH-1078]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-03 04:59:54 +00:00
ko1 c267d24ef0 * vm.c (rb_vm_cref_replace_with_duplicated_cref): added.
CREFs should not be shared by methods between `using'.
  [Bug #11247]

* vm_insnhelper.c (vm_cref_replace_with_duplicated_cref): ditto.

* vm.c (vm_cref_dup): should copy refinements correctly.

* eval.c: use rb_vm_cref_replace_with_duplicated_cref().

* eval_intern.h: add a decl. of
  rb_vm_cref_replace_with_duplicated_cref().

* vm_eval.c (eval_string_with_cref): do not need to pass
  scope's CREF because VM can find out CREF from stack frames.

* test/ruby/test_refinement.rb: add a test.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-20 00:17:25 +00:00
ko1 32a9647264 * refactoring CREF related code.
* eval_intern.h: remove unused setter functions.
  CREF_CLASS_SET()
  CREF_NEXT_SET()
  CREF_SCOPE_VISI_COPY()

* eval_intern.h: rename flags:
  * NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL
  * NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED
  and use IMEMO_FL_USER1/2.

* vm.c (vm_cref_new): accept push_by_eval parameter.

* vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref().

* vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter.

* vm_insnhelper.h: remove unused macros:
  COPY_CREF_OMOD() and COPY_CREF().

* vm_eval.c, insns.def: catch up this fix.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 20:02:19 +00:00
ko1 dd4cec36ca * method.h: constify rb_cref_t::scope_visi;
* eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix.

* vm_method.c: ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 17:20:11 +00:00
nobu 8b4cf7b708 eval_intern.h: pass_passed_block
* eval_intern.h (pass_passed_block): make helper inline function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05 07:10:21 +00:00
nobu 67f5f9477c compile.c: use ruby_tag_type
* compile.c (iseq_compile_each): use enum ruby_tag_type names.
* vm_core.h (ruby_tag_type): move from eval_intern.h for compiling
  break/next/redo/return.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-17 13:18:12 +00:00
ko1 b6b76e3a85 * internal.h: move definition of rb_cref_t to method.h.
* eval_intern.h: move definition of rb_scope_visibility_t
  to method.h.
* method.h: change rb_cref_t::scope_visi from VALUE to
  rb_scope_visibility_t.
  [Bug #11219]
* vm.c (vm_cref_new): accept rb_method_visibility_t directly.
* vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0,
  but METHOD_VISI_UNDEF.
* vm_method.c (rb_scope_visibility_set): don't need to use cast.
* vm_method.c (rb_scope_module_func_set): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05 11:42:34 +00:00
ko1 4ab762de21 * vm_method.c: rename `rb_frame_...' to `rb_scope_...'.
* eval_intern.h: move decl. of rb_scope_visibility_set() to method.h.
* load.c: catch up this fix.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03 14:07:24 +00:00
ko1 18bbd05709 * method.h: split rb_method_definition_t::flag to several flags.
`flag' contains several categories of attributes and it makes us
  confusion (at least, I had confused).
  * rb_method_visibility_t (flags::visi)
    * NOEX_UNDEF     -> METHOD_VISI_UNDEF     = 0
    * NOEX_PUBLIC    -> METHOD_VISI_PUBLIC    = 1
    * NOEX_PRIVATE   -> METHOD_VISI_PRIVATE   = 2
    * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3
  * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits)
  * NOEX_BASIC       -> basic (flags::basic, 1 bit)
  * NOEX_MODFUNC     -> rb_scope_visibility_t in CREF
  * NOEX_SUPER       -> MISSING_SUPER (enum missing_reason)
  * NOEX_VCALL       -> MISSING_VCALL (enum missing_reason)
  * NOEX_RESPONDS    -> BOUND_RESPONDS (macro)
  Now, NOEX_NOREDEF is not supported (I'm not sure it is needed).
  Background:
    I did not know what "NOEX" stands for.
    I asked Matz (who made this name) and his answer was "Nothing".
    "At first, it meant NO EXport (private), but the original
    meaning was gone."
    This is why I remove the mysterious word "NOEX" from MRI.
* vm_core.h: introduce `enum missing_reason' to represent
  method_missing (NoMethodError) reason.
* eval_intern.h: introduce rb_scope_visibility_t to represent
  scope visibility.
  It has 3 method visibilities (public/private/protected)
  and `module_function`.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03 01:39:16 +00:00
ko1 1611735b29 * eval_intern.h, vm_method.c: move macros to functions.
* SCOPE_TEST(f)  -> rb_frame_visibility_test(flag).
  * SCOPE_CHECK(f) -> rb_frame_visibility_check(flag).
  * SCOPE_SET(f)   -> rb_frame_visibility_set(flag).
* load.c (load_ext): use it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31 20:44:56 +00:00
ko1 48cb739119 * internal.h, eval_intern.h: move CREF accessors.
List IMEMO supported types in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11 12:55:32 +00:00
ko1 ce179b3d04 * vm_insnhelper.h: use T_IMEMO to create THROW_DATA.
Add THROW_DATA_NEW().
* internal.h: move defnition of `struct THROW_DATA'
  from vm_insnhelper.h to internal.h.
  Rename `THROW_DATA' to `vm_throw_data'.
* eval_intern.h (THROW_DATA_P): move to internal.h.
  THROW_DATA is no longer T_NODE, so check T_IMEMO.
* gc.c (gc_mark_children): mark THROW_DATA.
* vm.c: catch up these changes.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11 12:49:27 +00:00
ko1 e2c5094698 * eval_intern.h (THROW_DATA_P): use RB_TYPE_P() instead of
BUILTIN_TYPE().
* thread.c (thread_join): use THROW_DATA_P().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10 18:53:28 +00:00
ko1 46cdb8f187 * vm_insnhelper.h: define struct THROW_DATA to represent
throwing data. Also define accessor functions.
* eval_intern.h: move related changes into vm_insnhelper.h.
  Now these MACROs (functions) are only used in vm*.c.
  There is only THROW_DATA_P(err) to check this data type or not.
* vm.c: catch up these changes.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10 18:39:46 +00:00
ko1 8dced4d2c0 * internal.h: define rb_cref_t and change to use it.
rb_cref_t is data type of CREF. Now, the body is still NODE.
  It is easy to understand what is CREF and what is pure NODE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08 21:22:43 +00:00
ko1 ae166317a4 * internal.h: define CREF accessor macros.
* CREF_CLASS(cref)
  * CREF_NEXT(cref)
  * CREF_VISI(cref)
  * CREF_VISI_SET(cref, v)
  * CREF_REFINEMENTS(cref)
  * CREF_PUSHED_BY_EVAL(cref)
  * CREF_PUSHED_BY_EVAL_SET(cref)
  * CREF_OMOD_SHARED(cref)
  * CREF_OMOD_SHARED_SET(cref)
  * CREF_OMOD_SHARED_UNSET(cref)
  This is process to change CREF data type from NODE.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08 19:50:37 +00:00
ktsj e62a99b924 * eval_intern.h, vm.c, vm_eval.c, vm_insnhelper.c:
change throw mechanism (not save target ep, but save target cfp).
  It fixes `unexpected break' bug that occurs when
  TracePoint#binding is called.
  [ruby-dev:48797] [Bug #10689]

* test/ruby/test_settracefunc.rb: add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-16 02:54:22 +00:00
nobu c56b3d1418 eval_error.c: rb_print_inaccessible
* eval_error.c (rb_print_inaccessible): exract from mnew_from_me()
  in proc.c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-26 16:13:21 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
nobu ea9e8fedb3 eval_intern.h: suppress warning by gcc 4.6
* eval_intern.h (VAR_FROM_MEMORY, VAR_INITIALIZED): gcc 4.6 also
  seems to warn false maybe-uninitialized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28 05:39:45 +00:00
nobu 3343feeebf Handle machine stack overflow on mingw
* thread_win32.c (rb_w32_stack_overflow_handler): use Structured
  Exception Handling by Addvectoredexceptionhandler() for machine
  stack overflow on mingw.
  This would be equivalent to the handling using __try and __exept
  on mswin introduced by r43748.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-15 08:32:55 +00:00
nobu e18259424e eval_intern.h: VAR_INITIALIZED
* eval_intern.h (VAR_INITIALIZED): macro to suppress
  maybe-uninitialized warnings by gcc 4.7 and 4.8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-04 08:34:12 +00:00
nobu b230d20ec4 eval_intern.h: __builtin_longjmp requires literal 1 on gcc 4.9
* eval_intern.h (rb_threadptr_tag_jump): gcc 4.9 disallows other than
  literal 1 as the second argument of __builtin_longjmp().
  [ruby-core:61800] [Bug #9692]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-02 10:57:45 +00:00
nobu 8a2621ddc2 eval_intern.h: use TH_TMPPOP_TAG and TH_REPUSH_TAG
* eval_intern.h (TH_TMPPOP_TAG, TH_REPUSH_TAG): instead of TAG2 names.

* eval_intern.h (TH_REPUSH_TAG): suppress unused-value warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 15:32:35 +00:00
usa 1df5ebf450 * eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
test/ruby/test_exception.rb on Windows.
  wrap by __try and __exception statements on mswin to raise SIGSEGV
  when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
  handle the exception.
  however, (1) mingw-gcc doesn't support __try and __exception
  statements, and (2) we cannot retry SystemStackError after this
  change yet (maybe crashed) because SEH and longjmp() are too
  uncongenial.

* signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
  Windows, too.

* thread_win32.c (ruby_stack_overflowed_p): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 06:33:41 +00:00
nobu 9d740ddebe eval_jump.c: reuse same tag
* eval_jump.c (rb_exec_end_proc): reduce number of pushing/popping
  and reuse same tag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-19 17:01:10 +00:00
nobu 340390093b eval_intern.h: refine stack overflow detection
* eval_intern.h (TH_PUSH_TAG, TH_EXEC_TAG): refine stack overflow
  detection.  chain local tag after setjmp() successed on it, because
  calling setjmp() also can overflow the stack.
  [ruby-dev:47804] [Bug #9109]
* vm_eval.c (rb_catch_obj): now th->tag points previous tag until
  TH_EXEC_TAG().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-18 13:47:56 +00:00
nobu 9d2c2c2b46 eval_intern.h: rename prefix
* eval_intern.h (rb_threadptr_tag_state, rb_threadptr_tag_jump):
  rename prefix ruby as rb, same as other rb_threadptr functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05 07:56:51 +00:00
nobu 2c101190e8 eval_intern.h: avoid undefined behavior of setjmp
* eval_intern.h (TH_EXEC_TAG, TH_JUMP_TAG): get rid of undefined
  behavior of setjmp() in rhs of assignment expression.
  [ISO/IEC 9899:1999] 7.13.1.1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-04 01:08:21 +00:00
nobu 3e8bba2fc1 vm_core.h: move jmpbuf between tag and prev
* vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
  be accessible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 06:49:19 +00:00
nobu f7624d984b eval_intern.h: jmpbuf must be accessible
* eval_intern.h (TH_PUSH_TAG): ensure jmpbuf to be accessible before
  pushing tag to get rid of unaccessible tag by stack overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-17 02:07:00 +00:00
akr 4ddce7a68b * configure.in: Check mblen().
* eval_intern.h (CharNext): Don't use mblen() is not available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24 12:52:26 +00:00
charliesome af35f2a61d * configure.in: check for the whether crt_externs.h is present when compiling
for darwin (this header is missing in the iOS SDK)
* eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if
  not defined, include missing/crt_externs.h instead
* hash.c: ditto
* missing/setproctitle.c: ditto
* missing/crt_externs.h: declare _NSGetEnviron() function and define environ
  for iOS

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-28 14:23:25 +00:00
ko1 270fbd9c05 * vm_core.h, eval_intern.h (CHECK_STACK_OVERFLOW): move
CHECK_STACK_OVERFLOW() to vm_core.h and rename to
  CHECK_VM_STACK_OVERFLOW().
  This change is only move and rename.
* tool/instruction.rb: catch up above changes.
* vm.c, vm_insnhelper.c: ditto.
* vm_insnhelper.c (vm_stackoverflow): add a function to unify
  raising vm stackoverflow exception.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 09:57:07 +00:00
nagachika 26221584a9 * vm.c (rb_vm_jump_tag_but_local_jump): remove unnessesary 2nd
argument.

* load.c (rb_load_internal): ditto.

* eval_intern.h (rb_vm_jump_tag_but_local_jump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18 17:04:05 +00:00
knu 1c0323adbc Fix build when gcc is used and the platform's libc lacks alloca().
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
  (alloca): Make alloca() globally available by moving the
  ultimate ifdef's to ruby/ruby.h.  Gcc hides its builtin alloca()
  when compiling with -ansi, and linking thus fails on platforms
  that lack their own alloca() implementation in libc, which
  include OpenBSD and some ports of NetBSD.  We use alloca()
  everywhere including from within third party C extentions, so
  alloca() must be made globally available. [Bug #7307]

* addr2line.c (alloca): Replace the alloca() part with the
  ultimate ifdef's. [Bug #7307]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 03:34:08 +00:00
ko1 0a71db8a74 * vm_core.h: remove lfp (local frame pointer) and rename
dfp (dynamic frame pointer) to ep (environment pointer).
  This change make VM `normal' (similar to other interpreters).
  Before this commit:
  Each frame has two env pointers lfp and dfp.  lfp points
  local environment which is method/class/toplevel frame.
  lfp[0] is block pointer.
  dfp is block local frame. dfp[0] points previous (parent)
  environment pointer.
  lfp == dfp when frame is method/class/toplevel.
  You can get lfp from dfp by traversing previous environment
  pointers.
  After this commit:
  Each frame has only `ep' to point respective enviornoment.
  If there is parent environment, then ep[0] points parent
  envioenment (as dfp).  If there are no more environment,
  then ep[0] points block pointer (as lfp).  We call such ep
  as `LEP' (local EP).  We add some macros to get LEP and to
  detect LEP or not.
  In short, we replace dfp and lfp with ep and LEP.
  rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
  and member `ep' is added.
  rename rb_thread_t's member `local_lfp' and `local_svar' to
  `root_lep' and `root_svar'.
  (VM_EP_PREV_EP(ep)): get previous environment pointer.  This macro
  assume that ep is not LEP.
  (VM_EP_BLOCK_PTR(ep)): get block pointer.  This macro assume
  that ep is LEP.
  (VM_EP_LEP_P(ep)): detect ep is LEP or not.
  (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
  (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
  (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
  (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
* vm.c: apply above changes.
  (VM_EP_LEP(ep)): get LEP.
  (VM_CF_LEP(cfp)): get LEP of cfp->ep.
  (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
  (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
* vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
  apply above changes.
* cont.c: ditto.
* eval.c, eval_intern.h: ditto.
* proc.c: ditto.
* thread.c: ditto.
* vm_dump.c: ditto.
* vm_exec.h: fix function name (on vm debug mode).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 03:14:59 +00:00
nobu 8603c5934a * eval_error.c (rb_print_undef_str): new function to raise
NameError for undefined method.
* load.c (rb_mod_autoload_p), object.c (rb_mod_const_get),
  variable.c (rb_f_untrace_var, set_const_visibility), vm_method.c
  (rb_mod_{remove,undef,alias}_method, set_method_visibility):
  remove inadvertent symbol creation.  based on the first patch by
  Jeremy Evans at [ruby-core:38447].  [Feature #5089]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26 16:05:35 +00:00