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

615 Коммитов

Автор SHA1 Сообщение Дата
rhe 2f551849c4 Use PRIuSIZE format specifier for size_t values
Use PRIuSIZE instead of PRIdSIZE. This fixes the exception message shown
on too large xmalloc2. This commit also fixes other incorrect use of
PRIdSIZE in other functions; though most of them are debug print.

* gc.c (heap_extend_pages, get_envparam_size, ruby_malloc_size_overflow,
  gc_profile_dump_on): Use PRIuSIZE instead of PRIdSIZE as the passed
  value is size_t, not ssize_t.

* iseq.c (get_line_info, rb_iseq_disasm_insn): Ditto.

* sprintf.c (rb_str_format): Ditto.

* thread_win32.c (native_thread_create): Ditto.

* vm.c (get_param): Ditto.

* ext/objspace/objspace_dump.c (dump_append_string_content,
  dump_object): Ditto.

* ext/socket/raddrinfo.c (host_str, port_str): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 12:33:13 +00:00
nobu f9e75e1a82 vm.c: unnecessary condition
* vm.c (vm_stat): remove unnecessary condition, when argc != 1 arg
  is always Qnil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 07:29:59 +00:00
nobu 6f22777fcf vm.c: check TOPLEVEL_BINDING
* vm.c (vm_set_main_stack): TOPLEVEL_BINDING must be built.
  http://www.viva64.com/en/b/0414/#ID0EQ1CI  [ruby-core:76973]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-19 00:12:47 +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 78c1041a82 * vm_core.h (VM_ENV_LOCAL_P): return truthy (0 or not) value.
* vm.c (rb_vm_make_proc_lambda): use VM_ENV_ESCAPED_P() macro.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 19:27:52 +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
svn c3ceb1bff2 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 11:02:32 +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
ko1 be5564a178 * vm_insnhelper.c: introduce rb_vm_pop_frame() and use it
instead of setting rb_thread_t::cfp directly.

* vm_insnhelper.c (vm_pop_frame): return the result of
  finish frame or not.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 10:28:21 +00:00
nobu 9662ee0584 internal.h: inline Check_Type
* internal.h (Check_Type): inline check for the object type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23 13:43:44 +00:00
nobu a325876ad3 Fix Issues reported by PVS-Studio static analyzer
* vm.c (vm_set_main_stack): remove unnecessary check.  toplevel
  binding must be initialized.  [Bug #12611] (N1)
* win32/win32.c (w32_symlink): fix return type.  [Bug #12611] (N3)
* string.c (rb_str_split_m): simplify the condition.
  [Bug #12611](N4)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-22 10:55:22 +00:00
shugo 76941e5f54 * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104
partially to avoid "self has wrong type to call super in this
  context" errors.
  [ruby-core:72724] [Bug #11954]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 04:37:19 +00:00
akr f9727c12cc [Feature #12005] Unify Fixnum and Bignum into Integer
* [Feature #12005] Unify Fixnum and Bignum into Integer

* include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums.

* insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from
  FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG.

* vm_core.h: Ditto.

* vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead
  of FIXNUM_REDEFINED_OP_FLAG.

* vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of
  rb_cFixnum and rb_cBignum.
  (C): Use Integer instead of Fixnum and Bignum.

* numeric.c (fix_succ): Removed.
  (Init_Numeric): Define Fixnum as Integer.

* bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum.
  (rb_int_coerce): replaced from rb_big_coerce and return fixnums
  as-is.
  (Init_Bignum): Define Bignum as Integer.
  Don't define ===.

* error.c (builtin_class_name): Return "Integer" for fixnums.

* sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum.

* ext/-test-/testutil: New directory to test.
  Currently it provides utilities for fixnum and bignum.

* ext/json/generator/generator.c: Define mInteger_to_json.

* lib/mathn.rb (Fixnum#/): Redefinition removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 06:53:48 +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
nobu 84f94652b0 use TH_JUMP_TAG
* vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the
  same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with
  the current thread global variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05 03:22:20 +00:00
nobu d226ce8dec internal.h: ONLY_FOR_INTERNAL_USE
* error.c (ruby_only_for_internal_use): raise fatal error when
  deprecated function only for internal use is called, not just a
  warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 05:29:49 +00:00
nobu a491508753 string.c: rb_str_concat_literals
* string.c (rb_str_concat_literals): concatenate literal string
  fragments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05 08:15:22 +00:00
nobu 990d709eeb at_exit list
* vm_core.h (rb_vm_struct): make at_exit a single linked list but
  not RArray, not to mark the registered functions by the write
  barrier.  based on the patches by Evan Phoenix.
  [ruby-core:73908] [Bug #12095]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 14:37:07 +00:00
ko1 eddbebcb19 * vm.c (Init_VM): should pass tokens.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 07:42:51 +00:00
mame 3c7c983300 * compile.c (NODE_CALL): add optimization shortcut for Array#max/min.
Now `[x, y].max` is optimized so that a temporal array object is not
  created in some condition.

* insns.def (opt_newarray_max, opt_newarray_min): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 12:47:31 +00:00
nobu f66f998241 vm.c (vm_cref_new0): adjust indent [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-21 10:42:40 +00:00
normal 1282a4a895 fstring early for internal iseq
All of the strings created here eventually get converted to
fstrings when they are frozen into the iseq.  Prepare the
fstring early so we may reduce a one or two objects.

This is a very minor change, mainly for the '<main>' dedupe.

* compile.c (caller_location): use rb_fstring_cstr for "<compiled>"
  (it is converted to fstring anyways inside rb_iseq_new_with_opt)
* iseq.c (iseqw_s_compile): ditto
* iseq.c (rb_iseq_new_main): use rb_fstring_cstr for "<main>"
* vm.c (Init_VM): ditto, share with with above
* iseq.c (iseqw_s_compile_file): rb_fstring before rb_io_t->pathv
  share "<main>" with above
* vm.c (rb_binding_add_dynavars): fstring "<temp>" immediately

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-26 06:23:47 +00:00
kosaki 68bac3cca4 * vm.c (vm_exec): call RUBY_DTRACE_CMETHOD_RETURN_HOOK instead of
RUBY_DTRACE_METHOD_RETURN_HOOK.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 02:09:38 +00:00
shugo 0c659e26cb * vm.c (rb_vm_check_redefinition_opt_method): should check the real
class instead of the origin iclass.
  [ruby-core:72188] [Bug #11826]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-17 22:43:35 +00:00
ko1 70dea9ef28 * vm.c (vm_make_env_each): should not compare with Qfalse and FALSE.
Pointed at http://d.hatena.ne.jp/nagachika/20151216/ruby_trunk_changes_53128_53163




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 18:56:05 +00:00
shugo ed57f299b2 * vm.c (vm_make_proc_from_block): should convert a Symbol to a Proc.
[ruby-core:72083] [Bug #11811]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 10:35:34 +00:00
ko1 5dc676a5cf * vm.c: fix mark miss for proc given as passed block.
[Bug #11750]

* vm.c (vm_make_proc_from_block): should return a Proc object
  if block is given. Previous implementation returns
  a Proc object only when corresponding Proc object is not
  available.

* vm.c (vm_make_env_each): ditto.

* test/ruby/test_proc.rb: add a test for this bug.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 06:38:52 +00:00
nobu 8e5595b5ee vm.c: free tables at destruction
* vm.c (ruby_vm_destruct): free loading_table and fronzen_strings
  tables at destruction.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-12 09:00:27 +00:00
ko1 303cd88d40 * vm.c (rb_vm_cref_in_context): Module#define_method in non-class
expression should be public.
  [Bug #11754]

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




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 07:15:48 +00:00
ko1 2f5b8f0529 * *.c (*_memsize): do not check ptr.
NULL checking is finished Before call of memsize functions.
  See r52979.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 00:38:32 +00:00
ko1 3dbb390180 * introduce new ISeq binary format serializer/de-serializer
and a pre-compilation/runtime loader sample.
  [Feature #11788]

* iseq.c: add new methods:
  * RubyVM::InstructionSequence#to_binary_format(extra_data = nil)
  * RubyVM::InstructionSequence.from_binary_format(binary)
  * RubyVM::InstructionSequence.from_binary_format_extra_data(binary)

* compile.c: implement body of this new feature.

* load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq):
  call RubyVM::InstructionSequence.load_iseq(fname) with
  loading script name if this method is defined.

  We can return any ISeq object as a result value.
  Otherwise loading will be continue as usual.

  This interface is not matured and is not extensible.
  So that we don't guarantee the future compatibility of this method.
  Basically, you should'nt use this method.

* iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions)
  from iseq.c.

* encoding.c (rb_data_is_encoding), internal.h: added.

* vm_core.h: add several supports for lazy load.
  * add USE_LAZY_LOAD macro to specify enable or disable of
    this feature.
  * add several fields to rb_iseq_t.
  * introduce new macro rb_iseq_check().

* insns.def: some check for lazy loading feature.

* vm_insnhelper.c: ditto.

* proc.c: ditto.

* vm.c: ditto.

* test/lib/iseq_loader_checker.rb: enabled iff suitable
  environment variables are provided.

* test/runner.rb: enable lib/iseq_loader_checker.rb.

* sample/iseq_loader.rb: add sample compiler and loader.

    $ ruby sample/iseq_loader.rb [dir]

  will compile all ruby scripts in [dir].
  With default setting, this compile creates *.rb.yarb files
  in same directory of target .rb scripts.

    $ ruby -r sample/iseq_loader.rb [app]

  will run with enable to load compiled binary data.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 13:58:50 +00:00
nobu 506b25aabf error.c: name_err_local_variables
* error.c (name_err_local_variables): new method
  NameError#local_variables for internal use only.
  [Feature #11777]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 05:27:10 +00:00
normal 4ebab10bf5 compile optimized case dispatch for nil/true/false
nil/true/false are special literals just like floats, integers,
literal strings, and symbols.  Optimize when statements with
them by using a jump table, too.

target 0: a (ruby 2.3.0dev (2015-12-08 trunk 52928) [x86_64-linux]) at "/home/ew/rrrr/b/ruby"
target 1: b (ruby 2.3.0dev (2015-12-08 master 52928) [x86_64-linux]) at "/home/ew/ruby/b/ruby"

benchmark results:
minimum results in each 5 measurements.
Execution time (sec)
name	a	b
loop_whileloop2	0.102	0.103
vm2_case_lit*	1.657	0.549

Speedup ratio: compare with the result of `a' (greater is better)
name	b
loop_whileloop2	0.988
vm2_case_lit*	3.017

* benchmark/bm_vm2_case_lit.rb: new benchmark
* compile.c (case_when_optimizable_literal): add nil/true/false
* insns.def (opt_case_dispatch): ditto
* vm.c (vm_redefinition_check_flag): ditto
* vm.c (vm_init_redefined_flag): ditto
* vm_core.h: ditto
* object.c (InitVM_Object): define === explicitly for nil/true/false
* test/ruby/test_case.rb (test_deoptimize_nil): new test
* test/ruby/test_optimization.rb (test_opt_case_dispatch): update
  (test_eqq): new test
  [ruby-core:71923] [Feature #11769]
  Original patch by Aaron Patterson <tenderlove@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 01:46:45 +00:00
normal 1e2a457574 vm.c: make ruby_vm_*_ptr static
No point in wasting space until we get MVM (if ever).

* vm.c (ruby_vm_verbose_ptr): make static
  (ruby_vm_debug_ptr): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-04 21:08:47 +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 b73e900f50 * vm.c (vm_define_method): refactoring.
* get CREF in this function.
  * cbase is no longer needed (CREF_CLASS(cref) is enough).

* compile.c: RubyVM::FrozenCore.define_method only accept 2 args.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 18:01:59 +00:00
ko1 25f5dd6799 * vm.c (vm_define_method): do not use current CREF immediately,
but check CREF in environment or methods. Methods defined in methods
  should be public.
  [Bug #11571]

* vm_method.c (rb_scope_module_func_check): check CREF in env or me.
  if CREF is contained by `me', then return FALSE.

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




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 17:38:12 +00:00
nobu 1546ffed49 use rb_source_loc and rb_source_location
* error.c, eval.c, eval_error.c, gc.c, variable.c, vm.c,
  vm_eval.c, vm_trace.c: use rb_source_loc/rb_source_location
  instead of combination of rb_sourcefile/rb_sourcefilename and
  rb_sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31 01:02:26 +00:00
nobu 954224f3c5 vm.c: initialize line always
* vm.c (rb_source_location): reset line to 0 if no location is
  found.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31 00:17:41 +00:00
ko1 8da9e6d549 use NULL instead of 0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 21:45:07 +00:00
ko1 b08d139cc5 * vm.c: add ifndef guard for VM_CHECK_MODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 21:16:19 +00:00
nobu 645116ff25 RUBY_DTRACE_CREATE_HOOK
* internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at
  object creation.

* vm.c (rb_source_location, rb_source_loc): retrieve source path
  and line number at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 05:32:57 +00:00
nobu 38094dd7f4 vm.c: ruby_th_dtrace_setup
* vm.c (ruby_th_dtrace_setup): extract setup for calling dtrace
  hook from RUBY_DTRACE_HOOK macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29 05:32:19 +00:00
ko1 f9697c5637 * vm_insnhelper.c: introduce new call handler for simple ISeqs.
vm_call_iseq_setup_normal_0start() is simple, however it has
  some loops/conditions depends on ISeq::param.size and
  ISeq::local_size (in vm_push_frame(), inlined into this function).

  There are many simple methods which has a few parameters and local
  variables. So that this patch introduces several special functions
  generated in vm_call_iseq_optimized.inc by
  tool/mk_call_iseq_optimized.rb.

  This script makes
    vm_call_iseq_setup_normal_0start_Xparams_Ylocals()
  where X is 0 to 3 and Y is 1 to 6 (as current setting).
  In this case, X * Y = 24 functions are created.

  These functions creates fast method dispatch by inlining
  vm_push_frame() with immediate params/locals sizes.

  On my laptop, we can have the following results.

  vm2_method*       1.083 (8.3% faster)
  vm2_poly_method*  0.961 (3.4% slower)

  It shows 8.3% faster for inner loop method dispatch (hit inline
  cache), but 3.4% slower when inline cache miss because we need
  to find a suitable call handler.

* common.mk: add a rule for vm_call_iseq_optimized.inc.

* tool/mk_call_iseq_optimized.rb: added.

* vm.c: include vm_call_iseq_optimized.inc.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 17:53:35 +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 7c4b03e775 vm.c: simplify
* vm.c (env_mark): remove redundant conditions and mark block.iseq
  simply unless null.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15 04:44:58 +00:00
ko1 cb223b7533 * vm.c (invoke_block_from_c): split this function into several
functions.
* vm_insnhelper.c (vm_yield_callee_setup_arg): remove this function
  beacuse it is only delegation function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10 20:32:07 +00:00
nobu ed8b452e37 compile.c: fix performance of strconcat
* compile.c (compile_dstr_fragments): fix performance by omitting
  the first empty string only for keeping literal encoding if
  other literals are too.  [ruby-core:70930] [Bug #11556]
* string.c (rb_str_append_literal): append but keep encoding non
  US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-29 07:37:40 +00:00