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

189 Коммитов

Автор SHA1 Сообщение Дата
Samuel Williams d17344cfc5 Remove IA64 support. 2019-06-19 23:30:04 +12:00
nobu a67788b2f3 Split procstat_vm.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-07 08:53:13 +00:00
svn fc14c408aa * expand tabs. [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 12:48:39 +00:00
nobu d99d8cc868 Add cast to suppress warnings on Solaris [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 12:48:36 +00:00
naruse 595056135f Support Mach-O on backtrace with DWARF
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 06:35:25 +00:00
nobu 55c7b8541a Fix for old names of mcontext registers
c.f. https://github.com/mistydemeo/tigerbrew/issues/473

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-22 20:13:08 +00:00
ktsj a343f6609e vm_core.h, vm_dump.c: fix cast
Revert r63968 and cast at caller side to prevent unintentional casting.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-15 11:42:15 +00:00
ktsj 99b6ef932f vm_dump.c: fix warning about constness
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-15 09:47:12 +00:00
shyouhei 96d19b6cbc delete extra #undef [ci skip]
Sorry, this was a garbage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-03 01:43:17 +00:00
shyouhei 76091d4388 "%z" printf format specifier is a C99ism
PRIxSIZE is also.  But shimmed in ruby.h

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:43 +00:00
shyouhei b6a2d63eb3 explicit cast to void* required for %p
These functions take variadic arguments so no automatic type
promotion is expected.  You have to do it by hand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:40 +00:00
stomar 995fd6d720 vm_dump.c: [DOC] fix grammar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 20:11:44 +00:00
ko1 d51de2bd61 * vm_dump.c (vm_stack_dump_each): accepts `ec`.
* vm_dump.c (vm_base_ptr): constify.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 16:12:06 +00:00
ko1 b0d79e1072 use `GET_VM()` directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:33:23 +00:00
ko1 8702a33dd2 `th` -> `ec` for VM dump related functions.
* vm_dump.c: `th` -> `ec` (and constify) for:
  * control_frame_dump
  * rb_vmdebug_stack_dump_raw
  * rb_vmdebug_debug_print_register
  * rb_vmdebug_debug_print_pre
  * rb_vmdebug_debug_print_post


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:31:01 +00:00
ko1 837fd5e494 Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038]

* vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer.
  There are many code using `th` to represent execution context
  (such as cfp, VM stack and so on). To access `ec`, they need to
  use `th->ec->...` (adding one indirection) so that we need to
  replace them by passing `ec` instead of `th`.

* vm_core.h (GET_EC()): introduced to access current ec. Also
  remove `ruby_current_thread` global variable.

* cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of
  rb_context_t::thread_value.

* cont.c (ec_set_vm_stack): added to update vm_stack explicitly.

* cont.c (ec_switch): added to switch ec explicitly.

* cont.c (rb_fiber_close): added to terminate fibers explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:32:49 +00:00
kazu 743ab3c783 Fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15 12:03:42 +00:00
naruse fff6809b30 fix the case High Sierra's mincore(2) may return -128 [Bug #13895]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 09:21:48 +00:00
hsbt ee0b1b20a3 Fixed compilationn error with VMDEBUG=3.
[fix GH-1690] Patch from @musaprg(Kotaro Inoue)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-06 03:53:25 +00:00
naruse 3bd01f99f0 Fix C level backtrace on Darwin
SEGV caused by invalid instruction call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-01 01:13:53 +00:00
ko1 6881279149 rename rb_execution_context_t::stack(_size) to vm_stack(_size).
* vm_core.h: Ruby processes run with two stacks, a machine stack and a
  VM stack. To make it clear, this fix renames
  rb_execution_context_t::stack(_size) to vm_stack(_size).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 04:55:12 +00:00
ko1 249790802d introduce rb_thread_ptr() to replace GetThreadPtr().
* vm_core.h (rb_thread_ptr): added to replace GetThreadPtr() macro.

* thread.c (in some functions: use "target_th" instead of "th" to make clear
  that it is not a current thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 04:49:30 +00:00
ko1 26864584d2 * vm_core.h: remove VM_FRAME_MAGIC_LAMBDA and introduce
VM_FRAME_FLAG_LAMBDA. So that lambda block frame is
  VM_FRAME_MAGIC_BLOCK | VM_FRAME_FLAG_LAMBDA.

* vm_core.h: remvoe VM_FRAME_MAGIC_PROC because nobody uses it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 10:07:44 +00:00
ko1 478003f6df rename absolute_path to realpath internally and introduce pathobj.
* vm_core.h: rename absolute_path to realpath because it is expected name.
  external APIs (#absolute_path methods) are remained.

* vm_core.h: remove rb_iseq_location_struct::path and
  rb_iseq_location_struct::absolute_path and introduce pathobj.
  if given path equals to given absolute_path (and most of case
  it is true), pathobj is simply given path String. If it is not same,
  pathobj is Array and pathobj[0] is path and pathobj[1] is realpath.

  This size optimization reduce 8 bytes and
  sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes
  on 64bit CPU.

  To support this change, the following functions are introduced:
    * pathobj_path() (defined in vm_core.h)
    * pathobj_realpath() (ditto)
    * rb_iseq_path() (decl. in vm_core.h)
    * rb_iseq_realpath() (ditto)
    * rb_iseq_pathobj_new() (ditto)
    * rb_iseq_pathobj_set() (ditto)

* vm_core.h (rb_binding_t): use pathobj instead of path. If binding
  is given at eval methods, realpath (absolute_path) was caller's
  realpath. However, they should use binding's realpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 00:05:33 +00:00
naruse 0c0f75b798 Treat NULL reference case [Bug #13566]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 07:13:47 +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 5651313b85 vm_dump.c: non-scalar thread_id
* vm_dump.c (rb_vmdebug_stack_dump_all_threads): fix for
  non-scalar thread_id platforms.  c.f. [Bug #9884]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 00:53:26 +00:00
ko1 8934082ec4 * vm_dump.c (rb_vmdebug_stack_dump_all_threads): cast to `void*`.
Pointed out at
  <fbc1deca89 (commitcomment-21839826)>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 15:58:35 +00:00
ko1 fbc1deca89 add a debug function.
* vm_dump.c (rb_vmdebug_stack_dump_all_threads): dump stack dump
  for all living threads.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 04:50:53 +00:00
ko1 7519688ed8 introduce imemo_type_p(v, imemo_type)
* internal.h: introduce imemo_type_p() which checks the given value is
  T_IMEMO and imemo_type() == given imemo_type.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-07 06:41:32 +00:00
ko1 8fa99e6458 skip T_IMEMO for VMDEBUG
* vm_dump.c (vm_stack_dump_each): skip T_IMEMO object to display
  for VMDEBUG=3. [Bug #13030]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-26 09:57:41 +00:00
ko1 a4bc6c277a * vm_dump.c: enable to compile with VMDEBUG == 3.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-26 09:40:25 +00:00
nobu 81cb9aa574 error.c: moved
* error.c (preface_dump, postscript_dump): moved from
  rb_vm_bugreport to place the last important message at the very
  last after [NOTE].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13 02:57:45 +00:00
nobu d569c0c546 vm_dump.c: postscript_dump
* vm_dump.c (postscript_dump): mention crash report log twice
  because important.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13 01:46:45 +00:00
nobu 1407e52ba4 constify
* vm_dump.c (rb_vmdebug_debug_print_pre): constify pc argument for
  VMDEBUG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-14 08:06:55 +00:00
naruse 8a1c7babec fix r56030 [Bug #12711]
check whether it was syscall or not by getting previous instruction.
syscall instruction is 0x0f 0x05.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 04:49:26 +00:00
naruse 1d3665fd0d * vm_dump.c (backtrace): use rip in the saved context for the case
the SIGSEGV is received when the process is in userland.
  Note that ip in the stack should be used if the signal is received
  when it is in kernel (when it is calling syscall) [Bug #12711]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 18:43:17 +00:00
ko1 03cad83593 * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()
and VM_FRAME_CFRAME_P().
  Most of case, RUBY_VM_NORMAL_ISEQ_P() is no
  longer needed.

* vm_core.h: introduce rb_obj_is_iseq().

* cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with
  VM_FRAME_FLAG_CFRAME.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03 01:50:50 +00:00
ko1 0cd7f5fe87 * vm_core.h: rename macros and make them inline functions.
* rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P().
  * rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03 00:28:12 +00:00
ko1 e06698d257 * vm.c, internal.h: remove RubyVM::Env class and all of env objects
are imemo objects (imemo_env).

* NEWS: describe this change. I believe nobody touch these objects
  because there are no method defined.

* vm_core.h: remove the following definitions.
  * rb_cEnv decl.
  * GetEnvPtr() because Env is no longer T_DATA object.

* vm_core.h (rb_env_t): fix layout for imemo values.

* vm_core.h (vm_assert_env): added.

* vm_core.h (vm_env_new): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 19:13:26 +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
naruse 17e5dff210 * vm_dump.c (rb_print_backtrace): our addr2line doesn't work on sparc.
http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20151027T043311Z.log.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-27 07:13:39 +00:00
nobu 6291c6ad77 vm_args.c: symbol proc
* vm_args.c (vm_caller_setup_arg_block): store symbols instead of
  ifuncs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16 03:21:10 +00:00
nobu 278ca4dbe8 vm_dump.c: unused variable
* vm_dump.c (vm_stack_dump_each): remove never-used variable and
  dead code for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15 06:51:17 +00:00
nobu 5c7f36a1b8 configure.in: libunwind.h check
* configure.in: check for libunwind.h, which is not available in
  very old OS X SDK.  [ruby-core:71080] [Bug #11591]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-14 07:56:53 +00:00
ko1 e4198a73d4 * make rb_iseq_t T_IMEMO object (type is imemo_iseq).
All contents of previous rb_iseq_t is in rb_iseq_t::body.
  Remove rb_iseq_t::self because rb_iseq_t is an object.
  RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
  So RubyVM::ISeq.of(something) method returns different wrapper
  objects but they point the same T_IMEMO/iseq object.
  This patch is big, but most of difference is replacement of
  iseq->xxx to iseq->body->xxx.
  (previous) rb_iseq_t::compile_data is also located to
  rb_iseq_t::compile_data.
  It was moved from rb_iseq_body::compile_data.
  Now rb_iseq_t has empty two pointers.
  I will split rb_iseq_body data into static data and dynamic data.
* compile.c: rename some functions/macros.
  Now, we don't need to separate iseq and iseqval (only VALUE).
* eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
* ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
* gc.c: check T_IMEMO/iseq.
* internal.h: add imemo_type::imemo_iseq.
* iseq.c: define RubyVM::InstructionSequnce as T_OBJECT.
  Methods are implemented by functions named iseqw_....
* load.c (rb_load_internal0): rb_iseq_new_top() returns
  rb_iseq_t (T_IMEMO/iesq).
* method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
* vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
* vm_core.h (struct rb_iseq_body): remove padding for
  [Bug #10037][ruby-core:63721].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 22:52:59 +00:00
ko1 331fb4a2b3 * vm_core.h: constify rb_call_info_t::kw_arg,
rb_control_frame_t::iseq and rb_control_frame_t::block_iseq.
* iseq.c (iseq_free): catch up this fix.
* vm.c: ditto.
* vm_dump.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 21:41:04 +00:00
ko1 994460c4db * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it via
rb_proc_t::block::ep.
  rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which
  the Proc object use.
* proc.c: catch up this fix.
* vm_dump.c (rb_vmdebug_proc_dump_raw): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 17:59:03 +00:00
ko1 e07dad00ee * vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know it
via env->ep.
  rb_vm_env_prev_envval(env) returns prev_envval via env->ep.
* vm_core.h (rb_vm_env_local_variables): change parameter type
  from VALUE (T_DATA/env) to `const rb_env_t *' to make same as
  rb_vm_env_prev_envval().
* proc.c: catch up these changes.
* vm_dump.c: ditto.
* vm.c: rename macros.
  * ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep.
  * ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 17:36:36 +00:00
ko1 a82ce7c556 * vm.c: refactoring Proc/Env related code.
* vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t.
  Instead of this field, mark given block in Proc at rb_env_t::env.
* vm.c (vm_make_env_each): make an Env object with this layout.
  And also simplify parameters.
* proc.c: catch up this fix.
* vm_core.h: remove rb_env_t::local_size because it is not used.
* vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix.
* vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object()
  because it is only refered from vm.c.
* vm_eval.c (eval_string_with_cref): catch up this fix.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 16:23:17 +00:00