* iseq.c (set_relation): parent_iseq need to be set regardless iseq
type. fix r37397.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
respond_to, just check if the argument is actually a file,
because by calling user-defined gets something weired can
happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861]
* parse.y (ripper_initialize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
use only a `ci' (rb_call_info_t) parameter instead of using
parameters such as `op_id', 'op_argc', `blockiseq' and flag.
These information are stored in rb_call_info_t at the compile
time.
This technique simplifies parameter passings at related
function calls (~10% speedups for simple mehtod invocation at
my machine).
`rb_call_info_t' also has new function pointer variable `call'.
This `call' variable enables to customize method (block)
invocation process for each place. However, it always call
`vm_call_general()' at this changes.
`rb_call_info_t' also has temporary variables for method
(block) invocation.
* vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP
VM_CALL macro. This flag indicates that this call can skip
caller_setup (block arg and splat arg).
* compile.c: catch up above changes.
* iseq.c: catch up above changes (especially for TS_CALLINFO).
* tool/instruction.rb: catch up above chagnes.
* vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions
parameters are changed.
* vm_eval.c (vm_call0): ditto (it will be rewriten soon).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
compare with iseq->callinfo_entries whose type is rb_call_info_t*.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hooks (old macro name is COLLECT_USAGE_ANALYSIS).
This feature is only for VM developers. (I'm not sure I can use
`VM developers' (the plural form) in this sentence).
If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
usage collection features:
(1) insntruction: collect intruction usages.
(2) operand: collect operand usages.
(3) register: collect register usages.
The results are stored in
RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
RubyVM::USAGE_ANALYSIS_REGS for (3).
You can stop collecting usages with
RubyVM::USAGE_ANALYSIS_INSN_STOP(),
RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
for (1), (2), (3) respectively.
You can also change the hook functions by setting
C level global variables
`ruby_vm_collect_usage_func_(insn|operand|register)'
for (1), (2), (3) respectively.
See codes for more details.
* tool/instruction.rb: fix macro names.
* iseq.c (insn_operand_intern): make it export (used in vm.c).
fix to skip several processes if not needed (pointer is 0).
* vm_dump.c: move codes for collection features to vm.c.
* vm_exec.h: rename macro and function names.
* vm_insnhelper.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove checkincludearray instruction and
add new instruction checkmatch.
This change is to solve
[Bug #4438] "rescue args type check omitted".
* iseq.c: increment ISEQ_MAJOR_VERSION because removal of
checkincludearray instruction.
* vm_core.h: add several definitions for
the checkmatch instruction.
* vm_insnhelper.c (check_match): added.
* bootstraptest/test_exception.rb: add a test.
* test/ruby/test_exception.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
th->base_block is information for (a) parsing, (b) compiling
and (c) setting up the frame to execute the program passed by
`eval' method. For example, (1) parser need to know up-level
variables to detect it is variable or method without paren.
Befor (a), (b) and (c), VM set th->base_block by passed bindng
(or previous frame information). After execute (a), (b) and (c),
VM should clear th->base_block. However, if (a), (b) or (c)
raises an exception, then th->base_block is not cleared.
Problem is that the uncleared value th->balo_block is used for
irrelevant iseq compilation. It causes SEGV or critical error.
I tried to solve this problem: to clear them before exception,
but finally I found out that it is difficult to do it (Ruby
program can be run in many places).
Because of this background, I set th->base_block before
compiling iseq and restore it after compiling.
Basically, th->base_block is dirty hack (similar to global
variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
set th->base_block before compation and restore it after
compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (iseq_load): type is a symbol, and invalid as ID in common.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35984 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
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
Patch by Google Inc. [ruby-core:45073].
* configure.in (RUBY_NACL): New M4 func to configure variables for
NaCl.
(RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
of Pepper interface types.
(BTESTRUBY): New variable to specify which ruby should be run on
"make btest". NaCl can run the built binary by sel_ldr, but it need
rbconfig.rb. So this variable is distinguished from $MINIRUBY.
* thread_pthread.c: Disabled some features on NaCl.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* file.c: ditto.
* missing/flock.c: ditto.
* nacl/pepper_main.c: An example implementation of Pepper application
that embeds Ruby.
* nacl/example.html: An example of web page that uses the Pepper
application.
* nacl/nacl-config.rb: Detects variants of NaCl SDK.
* nacl/GNUmakefile.in: Makefile template for NaCl specific build
process.
* nacl/package.rb: script for packaging a NaCl-Ruby embedding
application.
* nacl/reate_nmf.rb: Wrapper script of create_nmf.py
* dln.c (dln_load): Added a hack to call on NaCl.
* util.c (ruby_getcwd): Path to the current directort is not available
on NaCl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
number 0 means no line number info is needed. [ruby-dev:45130]
[Bug #5894]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217].
Before this fix, each instruction has an information including
line number (iseq::iseq_insn_info_table). Instead of this data
structure, recording only line number changing places
(iseq::iseq_line_info_table).
The order of entries in iseq_line_info_table is ascending order of
iseq_line_info_table_entry::position. You can get a line number
by an iseq and a program counter with this data structure.
This fix reduces memory consumption of iseq (bytecode).
On my measurement, a rails application consumes 21.8MB for
iseq with this fix on the 32bit CPU. Without this fix, it
consumes 24.7MB for iseq [ruby-dev:44415].
* proc.c: ditto.
* vm_insnhelper.c: ditto.
* vm_method.c: ditto.
* vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_method.rb (test_body): add a test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c, eval.c, iseq.c, object.c, parse.y, proc.c, process.c,
thread.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c: don't
declare internal functions.
Note that rb_method_entry_eq() is defined in vm_method.c but
there was a declaration in proc.c with different const-ness.
Now it is declared in method.h with same const-ness to the
definition.
* object.c (rb_mod_module_exec): don't declare functions declared in
include/ruby/intern.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e