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
(1) rename rb_location_t to rb_iseq_location_t.
(2) rename field names of rb_iseq_location_t to adjust
RubyVM::Backtrace::Location methods.
(2-1) filename -> path
(2-2) filepath -> absolute_path
(2-3) basename -> base_label
(2-4) name -> label
(3) rename filed name rb_iseq_location_t#line_no to
rb_iseq_location_t#first_lineno to clear purpose of this field.
(4) The field names rb_binding_t#(filename|line_no) are also renamed
to rb_binding_t#(path|first_lineno).
* compile.c: apply above changes.
* iseq.c: ditto.
* proc.c: ditto.
* vm*.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
is no longer included from vm.c). I hope this separation reduce
compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) unify similar functions (rb_backtrace_each() and
backtrace_object()). backtrace_each() is a unified function.
variation:
a) backtrace_object(): create backtrace object.
b) vm_backtrace_str_ary(): create bt as an array of string.
c) vm_backtrace_print(): print backtrace to specified file.
d) rb_backtrace_print_as_bugreport(): print backtrace on
bugreport style.
(2) remove rb_backtrace_each(). Use backtrace_each() instead.
(3) chang the type of lev parameter to size_t.
a) lev == 0 means current frame (exception, etc use it).
b) lev == 1 means upper frame (caller(0) use it).
* vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
correct size of caller(lev) array.
Let n be a "caller(0).size" then ln as caller(lev).size should be
(n - lev). However, the previous implementation returns a wrong
size array (ln > n - lev). [ruby-dev:45673]
* test/ruby/test_backtrace.rb: add tests for backtrace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
information.
rb_location_t#filename, filepath, name and line_no was moved from
rb_iseq_t. rb_location_t#basename is a new field which is
similar to `name' field without any decoration.
`name' field contains some decoration such as `block in foo'.
`basename' only contains `foo'.
rb_iseq_t contains memory object of rb_location_t.
* iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
* compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
vm_method.c: support about it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_dump.c (rb_vm_bugreport): show "Other runtime information"
header only when available.
* vm_dump.c (rb_vm_bugreport): get rid of modifying the content of
VM directly.
* vm_dump.c (rb_vm_bugreport): check if vm is non-null.
Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
Thank you.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on Mac. It should be placed after "-- C level backtrace" line.
Suggested by Endoh-san.
<before>
-- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
-- /Library/Logs/CrashReporter, for the more detail of ---------------------
-- C level backtrace information -------------------------------------------
<after>
-- C level backtrace information -------------------------------------------
See Crash Report log file under ~/Library/Logs/CrashReporter or
/Library/Logs/CrashReporter, for the more detail of.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
words backtrace() is libexecinfo) and it is optimized.
This temporary hack should be also applied to other libexecinfo
environments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
functions in backtrace. [ruby-dev:42625]
a patch from shinichiro.h <shinichiro.hamaji AT gmail.com>
* addr2line.h: ditto.
* common.mk: add addr2line.$(OBJEXT).
* configure.in: check dl_iterate_phdr.
* vm_dump.c (rb_vm_bugreport): use rb_dump_backtrace_with_lines in
addr2line.c when the binary is ELF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread because THREAD_ALL_ACCESS causes an access error on XP.
reported by Masaya TARUI via IRC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
SymGetLineFromAddr64(), even though MSDN says it can be zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
function, since headers may have declarations.
c.f. [ruby-core:23095]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_make_backtrace, rb_backtrace_each): added
prototypes.
* vm_dump.c (rb_vm_bugreport), vm_eval.c (rb_backtrace): gets rid
of allocating objects.
* vm_eval.c (rb_backtrace_each): new function which iterates over
each backtrace info.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
vm_stack_dump_raw(), vm_stack_dump_raw_current(),
vm_env_dump_raw(), vm_proc_dump_raw(), vm_stack_dump_th(),
vm_debug_print_register(), vm_thread_dump_regs(),
vm_debug_print_pre(), vm_debug_print_post(),
vm_thread_dump_state().
This change also may affect core (in fact, user of
above functions may be only ko1).
* vm_core.h: ditto.
* vm_exec.h (SDR2): remove duplicate definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This change stop to install node.h beacuase of saving ABI
(node.h will be changed. Extensions should not depends on
this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e