Commit graph

554 commits

Author SHA1 Message Date
usa
a04a5fc18b merge revision(s) 64745: [Backport #15118]
Use opt_{aref,aset} over opt_{aref,aset}_with

	* compile.c (iseq_compile_each0): Use `opt_aref`/`opt_aset` over
	  `opt_aref_with`/`opt_aset_with` when frozen_string_literal: true,
	  not to resurrect the index string on non-Hash receiver.

	[Fix GH-1957]

	From: chopraanmol1 <chopraanmol1@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 09:10:26 +00:00
nagachika
1e18982210 merge revision(s) 61603: [Backport #14279]
check array for zsuper. [Bug #14279]

	* compile.c (iseq_compile_each0): for zsuper (NODE_ZSUPER), we need to check
	  given argument is Array or not.

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 18:07:27 +00:00
nagachika
4828fe38d9 merge revision(s) 57733,57734: [Backport #13782]
kwrest arg name

	* compile.c (iseq_set_arguments_keywords): make keyword rest
	  argument name nd_vid consistently, regardless of whether other
	  keyword arguments are present.  [Fix GH-1529]

	* parse.y (new_args_tail_gen): ditto.

	fix nd_ainfo->kw_rest_arg

	[Fix GH-5129]
	Author:    fate0 <fate0@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 16:40:57 +00:00
nagachika
1a3bca1dd6 merge revision(s) 60099,60100: [Backport #13964]
compile.c: fix stack consitency error

	* compile.c (iseq_compile_each0): fix stack consitency error on
	  attr-assign with safe navigation operator when the receiver is
	  nil, should pop it too.  [ruby-core:83078] [Bug #13964]

	test_call.rb: refine test_safe_call

	* test/ruby/test_call.rb (test_safe_call): rhs should not be
	  evaluated when the receiver is nil.  simplified the assertion
	  for  [Bug #13964].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-24 02:45:07 +00:00
nagachika
6f1dc851e0 merge revision(s) 57971: [Backport #13305]
Fix a consistency bug of ISEQ_COVERAGE [Bug #13305]

	There is an invariant that ISEQ_COVERAGE(iseq) must be Qnil if and only
	if option->coverage_enabled is false.  This invariant was broken by
	NODE_PRELUDE which updates option->coverage_enabled but not
	ISEQ_COVERAGE(iseq).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22 11:43:00 +00:00
nagachika
1069d3f18b merge revision(s) 59708: [Backport #13844]
compile.c: ensure after toplevel return

	* compile.c (iseq_compile_each0): toplevel returns should fire
	  ensures.  [ruby-core:82492] [Bug #13844]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 04:53:58 +00:00
nagachika
5cf3632475 merge revision(s) 58810,58894: [Backport #13578]
compile.c: fix catch-table labels optimization

	* compile.c (remove_unreachable_chunk): do not eliminate chunks
	  followed by labels in catch-table entries.
	compile.c: fix possible use of uninitialized value

	LABEL::unremovable added by r58810 is not initialized by
	new_label_body(), making the optimization unstable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-05 02:43:08 +00:00
nagachika
f7bd8a08ec merge revision(s) 59374: [Backport #13755]
compile.c: restore stack at return

	* compile.c (iseq_compile_each0): restore the stack depth after
	  return to the previous depth, to fix the stack depth at
	  returning from rescue iseq.  [ruby-core:82108] [Bug #13755]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-04 16:13:13 +00:00
nagachika
91b51140d7 merge revision(s) 59183,59184: [Backport #13682]
fix return in toplevel rescue/ensure

	* compile.c (iseq_compile_each0): throw TAG_RETURN at return in
	  toplevel rescue/ensure to adjust VM stack properly.
	  [ruby-core:81777] [Bug #13682]

	* vm_insnhelper.c (vm_throw_start): allow return in toplevel
	  rescue/ensure.
	fix return in toplevel ensure

	* compile.c (iseq_compile_each0): adjust stack after return in
	  toplevel ensure, when the value is used.
	  [ruby-core:81777] [Bug #13682]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03 16:00:34 +00:00
nagachika
b17da78105 merge revision(s) 59202: [Backport #13690]
compile.c: disallow next in once

	* compile.c (iseq_compile_each0): turned dregx context in "once"
	  into "guarded" type from "block" type, to disallow `next`,
	  `break`, `redo` as well as outside "once".
	  [ruby-core:81805] [Bug #13690]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03 15:41:24 +00:00
nagachika
9b58668807 merge revision(s) 59169: [Backport #13678]
compile.c: toplevel return in argument

	* compile.c (iseq_compile_each0): adjust the stack before return
	  in an evstr/argument (reported by Balazs <balazs@kutilovi.cz>)
	  to fix stack consistency error.  [ruby-core:81761] [Bug #13678]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03 14:00:41 +00:00
nagachika
c4a34e5cee merge revision(s) 58398: [Backport #13444]
compile.c: wrong optimization

	* compile.c (compile_branch_condition): expression which has side
	  effects should not be eliminated.
	  [ruby-core:80740] [Bug #13444]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 15:13:55 +00:00
naruse
2ba797d362 merge revision(s) 57300,57368: [Backport #12613]
compile.c: check compile

	* compile.c (iseq_compile_each): check if sub nodes succeeded.
	  [ruby-core:76531] [Bug #12613]
	compile.c: check err_info

	* compile.c (iseq_setup): bail out if any errors found.
	  [ruby-core:76531] [Bug #12613]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11 16:29:51 +00:00
naruse
b5154b0eb7 merge revision(s) 57173-57175: [Backport #13068]
------------------------------------------------------------------------
	r57173 | nobu | 2016-12-24 22:19:50 +0900 (Sat, 24 Dec 2016) | 4 lines

	compile.c: constify

	* compile.c (method_for_self): constify an argument of build
  function for VC6.
	------------------------------------------------------------------------
	r57174 | nobu | 2016-12-24 22:21:30 +0900 (Sat, 24 Dec 2016) | 4 lines

	hash.c: split long long literals

	* hash.c (prime1, prime2): split long long literals for platforms
  where LL suffix is not supported, e.g., VC6.
	------------------------------------------------------------------------
	r57175 | nobu | 2016-12-24 22:22:53 +0900 (Sat, 24 Dec 2016) | 4 lines

	regint.h: version for secure functions

	* regint.h (xvsnprintf): secure version functions are not
  supported on old VC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11 10:28:14 +00:00
nobu
342f10b9b3 compile.c: toplevel return
* compile.c (iseq_compile_each): stop execution of the current source
  by toplevel return.  [ruby-core:36785] [Feature #4840]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 01:58:32 +00:00
rhe
451e0a6ee1 compile.c: do not emit numeric literal range in void context
A fix-up for r56316. Fix stack consistency error on '1..3; nil'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-17 08:25:34 +00:00
nobu
e9a8e8ab4a remove core#hash_merge_ary
* compile.c (compile_array_): remove m_core_hash_merge_ary which
  seems unreachable, and wrong number of arguments.

* vm.c (m_core_hash_merge_ary): removed because it is never used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-09 02:57:57 +00:00
nobu
761653db90 compile.c: static_literal_value
* compile.c (static_literal_value): separate getter from predicate
  function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08 13:51:34 +00:00
nobu
ea07884a41 compile.c: optimize literal nodes
* compile.c (static_literal_node_p): optimize literal nodes for
  true, false, and nil, which are static literals in specific
  nodes but not in NODE_LIT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-08 07:54:58 +00:00
nobu
8d879ca305 compile.c: remove dead code
* compile.c (DECL_ANCHOR, INIT_ANCHOR): make anchor name an array
  and unassignable.

* compile.c (iseq_compile_each): ret is never 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07 08:44:34 +00:00
kazu
a560add68a Fix typos
Patch by: Koichi ITO <koic.ito@gmail.com>
[Fix GH-1498]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 12:49:46 +00:00
nobu
d6fdd1c330 compile.c: splatarray peephole opt
* compile.c (iseq_peephole_optimize): remove splatarray following
  always-array insn.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-28 02:02:40 +00:00
shugo
11c37ed390 * compile.c (tailcallable_p): disable tail call optimization for
toplevel, eval, and load to avoid SEGV when interrupted by SIGINT.
  [ruby-core:76327] [Bug #12576]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 16:42:27 +00:00
nobu
af1b9db40b compile.c: not flip-flop
* compile.c (iseq_compile_each): turn flip-flop in a not-operator
  into a boolean value.  fix up r56315

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29 01:09:40 +00:00
nobu
d506a3521c compile.c: order with splatting
* compile.c (setup_args): duplicate splatting array if more
  arguments present to obey left-to-right execution order.
  [ruby-core:77701] [Bug# 12860]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22 00:52:59 +00:00
nobu
1b94420174 compile.c: literal range
* compile.c (iseq_compile_each): move numeric literal range
  optimization from fixup_nodes() in parse.y.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01 13:17:51 +00:00
nobu
8c401de5d9 compile.c: optimize flip-flop
* compile.c (compile_flip_flop): simplify generated code.
* compile.c (compile_branch_condition): flip-flop can appear only
  in coditional expressions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01 10:19:36 +00:00
nobu
7382eb7e38 compile.c: tailcall in conditinal block
* compile.c (iseq_peephole_optimize): enable tail call
  optimization inside a conditional block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-23 03:15:31 +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
f540475134 Coverage on non-positive lines
* compile.c (ADD_TRACE): ignore trace instruction on non-positive
  line.
* parse.y (coverage): get rid of ArgumentError when the starting
  line number is not positive.  [ruby-core:76141] [Bug #12517]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-26 23:56:57 +00:00
naruse
3b4e68cfab * iseq.h (struct iseq_compile_data): use struct rb_id_table
instead of st_table.

* iseq.c (prepare_iseq_build): don't allocate ivar_cache_table
  until it has at least one element.

* iseq.c (compile_data_free): free ivar_cache_table only if it
  is allocated.

* compile.c (get_ivar_ic_value): allocate if the table is not
  allocated yet.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-14 18:43:11 +00:00
tarui
44916ec448 * compile.c (iseq_compile_each): share InlineCache during same
instance variable accesses. Reducing memory consumption,
	  rasing cache hit rate and rasing branch prediction hit rate
	  are expected. A part of [Bug #12274].

	* iseq.h (struct iseq_compile_data): introduce instance
	  variable IC table for sharing.

	* iseq.c (prepare_iseq_build, compile_data_free):
	  construct/destruct above table.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-11 12:50:38 +00:00
nobu
a170b76906 compile.c: true conditions
* compile.c (compile_branch_condition): add more always-true
  conditions to optimize away unreachable branch.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 08:38:20 +00:00
nobu
2ede24a8f1 compile.c: remove redundant trace insn
* compile.c (iseq_peephole_optimize): remove successive line trace
  instructions except for the last.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 14:12:27 +00:00
nobu
12ef609f5e compile.c: instruction ID predicate
* compile.c (IS_INSN_ID): add instruction ID predicate macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 11:43:52 +00:00
nobu
6871d400eb compile.c: ISeq element type predicates
* compile.c (IS_INSN, IS_LABEL, IS_ADJUST): add ISeq element type
  predicate macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 11:39:41 +00:00
nobu
9e8dfaa8b0 compile.c: make SyntaxError after formatting
* compile.c (append_compile_error): make SyntaxError instance by
  rb_syntax_error_append on demand after formatting the message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20 02:52:07 +00:00
nobu
97177a2d99 refactor syntax error
* compile.c (append_compile_error): use rb_syntax_error_append.
* error.c (rb_syntax_error_append): append messages into a
  SyntaxError exception instance.
* parse.y (yycompile0): make new SyntaxError instance in main
  mode, otherwize error_buffer should be a SyntaxError if error
  has occurred.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20 01:25:55 +00:00
nobu
51612505f7 appending compile error without rb_errinfo
* compile.c (append_compile_error, compile_bug): pass iseq and get
  error info and file from it, not by the thread error info.
* error.c (rb_report_bug_valist): take va_list instead of variadic
  arguments, and just report the bug but not abort.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19 04:46:20 +00:00
nobu
6ee3a2cd15 compile.c: fix dangling link
* compile.c (iseq_peephole_optimize): should not replace the
  current target INSN, not to follow the replaced dangling link in
  the caller.  [ruby-core:74993] [Bug #11816]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 07:07:03 +00:00
nobu
6648d61578 compile.c: initialize LABEL fields
* compile.c (new_label_body): initialize bit fields, since
  compile_data_alloc does not clear the memory.  [Bug #12082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-12 02:51:20 +00:00
nobu
f0226f0a3c compile.c: disable tco with rescue
* compile.c (iseq_optimize): disable tail call optimization in
  rescued, rescue, and ensure blocks.
  [ruby-core:73871] [Bug #12082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:43:06 +00:00
nobu
d7935475fc remove rb_thread_t::parse_in_eval
* parse.y (struct parser_params): move parse_in_eval flag from
  rb_thread_t.
* parse.y (rb_parser_set_context): set parsing context, not only
  mild error flag.
* iseq.c (rb_iseq_compile_with_option): the parser now refers no
  thread local states to be restored.
* vm_eval.c (eval_string_with_cref): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-28 21:39:24 +00:00
nobu
3f519a7bfa compile.c: explicit address
* compile.c (prepare_compile_error): add & to explicit address of
  functions to suppress warnings by old VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-26 01:34:35 +00:00
nobu
e1ee61bfbd compile.c: strict condition
* compile.c (iseq_specialized_instruction): specialize only
  concatenated newarray and send, no labels and no adjusts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:19:02 +00:00
nobu
8472c15440 compile.c: move newarray specialization
* compile.c (iseq_specialized_instruction): move specialization
  for opt_newarray_max/min from translation phase.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 13:08:35 +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
6555077aa0 compile.c: bit flag
* compile.c (LABEL): turn `set` flag a bit field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 05:47:44 +00:00
nobu
ea5e885a95 optimize named capture assignment
* compile.c (compile_named_capture_assign): optimize named capture
  assignments, by replacing repeating global variable accesses
  with `dup`, and by returning the matched result instead of
  re-getting it from the MatchData.

* parse.y (reg_named_capture_assign_gen): build just assignment
  nodes for the optimization.

ex. `/(?<x>.)/ =~ "bar"`

- old
  ```
  0000 putstring        "bar"
  0002 opt_regexpmatch1 /(?<x>.)/
  0004 pop
  0005 getglobal        $~
  0007 branchunless     25
  0009 getglobal        $~
  0011 putobject        :x
  0013 opt_aref         <callinfo!mid:[], argc:1, ARGS_SIMPLE>
  0016 setlocal_OP__WC__0 2
  0018 getglobal        $~
  0020 putobject_OP_INT2FIX_O_0_C_
  0021 opt_send_without_block <callinfo!mid:begin, argc:1, ARGS_SIMPLE>
  0024 leave
  0025 putobject        nil
  0027 setlocal_OP__WC__0 2
  0029 putobject        nil
  0031 leave
  ```

- new
  ```
  0000 putstring        "bar"
  0002 opt_regexpmatch1 /(?<x>.)/
  0004 getglobal        $~
  0006 dup
  0007 branchunless     14
  0009 putobject        :x
  0011 opt_aref         <callinfo!mid:[], argc:1, ARGS_SIMPLE>
  0014 setlocal_OP__WC__0 2
  0016 leave
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14 07:53:39 +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