Commit graph

730 commits

Author SHA1 Message Date
usa
235e64c247 merge revision(s) a6a26e42b1: [Backport #15906]
compile.c: Partially revert r63870 which caused wrong optimization
	[Bug #15906]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-08-26 14:45:41 +00:00
usa
6610b77ea8 merge revision(s) 66324: [Backport #15385]
Modify insn list only when compiling

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-05-02 21:16:27 +00:00
usa
bcdcee4738 merge revision(s) 66326,66649: [Backport #15385]
Fix infinite loop by ensure

* compile.c (iseq_insert_nop_between_end_and_cont): insert nop so that the end of rescue and continuing points are not same, to get rid of infinite loop. [Bug #15385]

test_optimization.rb: increase timeout for RubyCI

20181230T040002Z.fail.html.gz



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-30 12:40:20 +00:00
nagachika
6473d94df7 merge revision(s) 62621: [Backport #15396]
compile.c: do not truncate VALUE to long

	* compile.c (ibf_dump_object_regexp): do not truncate VALUE to
	  long.  it makes invalid VALUE on IL32LLP64 platforms where long
	  is shorter than VALUE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@66309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-10 12:31:18 +00:00
nagachika
aba207b762 merge revision(s) 64736,65567: [Backport #15270]
iseq.c: prefix rb_ to non-static iseq functions

	I assume we always prefix rb_ to non-static functions to avoid conflict.
	These functions are not exported and safe to be renamed.

	iseq.h: ditto
	compile.c: ditto

	Fix TracePoint for nested iseq loaded from binary [Bug#14702]

	When loading iseq from binary while a TracePoint is on, we need to
	recompile instructions to their "trace_" variant. Before this commit
	we only recompiled instructions in the top level iseq, which meant
	that TracePoint was malfunctioning for code inside module/class/method
	definitions.

	* compile.c: Move rb_iseq_init_trace to rb_ibf_load_iseq_complete.
	  It is called on all iseqs during loading.

	* test_iseq.rb: Test that tracepoints fire within children iseq when
	  using load_from_binary.

	This patch is from: Alan Wu <XrXr@users.noreply.github.com>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@66225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-05 14:35:07 +00:00
nagachika
0812ab5fec merge revision(s) 63040: [Backport #14553]
compile.c: do not dump unused callinfos

	* compile.c (compile_if): rewind callinfo indexes used in
	  unreachable paths, to get rid of dumping unused callinfos.
	  [ruby-core:86399] [Bug #14553]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@66130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-02 07:13:22 +00:00
nagachika
b1944e41f5 merge revision(s) 62772: [Backport #14738]
compile.c: fix load_from_binary

	* compile.c (ibf_load_iseq_each): realpath may be nil.  follow up
	  r59709.  [fix https://github.com/Shopify/bootsnap/issues/132]

	From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-14 15:21:50 +00:00
nagachika
756009186b merge revision(s) 65350: [Backport #15245]
compile.c: fix peephole optimization

	* compile.c (iseq_peephole_optimize): should `pop` before jump
	  instruction which succeeds to `newarray` of a literal object,
	  not after.  [ruby-core:89536] [Bug #15245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 15:13:01 +00:00
nagachika
cd8b9033e6 merge revision(s) 64515:
remove `const` warning.

	* compile.c (iseq_ibf_load): remove `const` to pass iseq as no `const`
	  parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-21 11:19:59 +00:00
nagachika
ff5475bfa1 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_5@65002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-11 15:12:06 +00:00
nagachika
c1034574aa merge revision(s) 64514: [Backport #14702]
check trace flags at loading [Bug #14702]

	* iseq.c (iseq_init_trace): at ISeq loading time, we need to check
	  `ruby_vm_event_enabled_flags` to turn on trace instructions.
	  Seprate this checking code from `finish_iseq_build()` and make
	  new function. `iseq_ibf_load()` calls this funcation after loading.

	* test/ruby/test_iseq.rb: add a test for this fix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-11 14:20:25 +00:00
nagachika
0628973435 merge revision(s) 63868,63870: [Backport #14897]
Fix a bug of peephole optimization

	```
	  if   L1
	L0:
	  jump L2
	L1:
	  ...
	L2:
	```

	was wrongly optimized to:

	```
	  unless L2
	L0:
	L1:
	  ...
	L2:
	```

	To make it conservative, this optimization is now disabled when there is
	any label between `if` and `jump` instructions.
	Fixes [Bug #14897].

	compile.c: remove unreachable jump only

	* compile.c (iseq_peephole_optimize): remove unreachable jump
	  instruction only.  if it is labeled and referred from other
	  instructions, it is reachable and must not be removed.
	  [ruby-core:87830] [Bug #14897]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-01 12:02:17 +00:00
nagachika
428db82403 merge revision(s) 63255: [Backport #14708]
compile.c: fix unconditional branch optimization

	* compile.c (iseq_peephole_optimize): add dummy `putnil` after a
	  `jump` replacing an unconditional branch, to adjust removed
	  `dup`.  [ruby-core:86666] [Bug #14708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-17 15:48:46 +00:00
naruse
2d414cb1ac merge revision(s) 61587,61617,61618: [Backport #14273]
compile.c: next label

	* compile.c (compile_next): label for jump to the end of block is
	  removable.

	compile.c: remove more unreachable chunk

	* compile.c (remove_unreachable_chunk): remove beyond labels to be
	  removed.

	compile.c: fix stack consistency error

	* compile.c (iseq_peephole_optimize): fix stack consistency error
	  from return in loop, by adding extra `pop` when replacing `jump`
	  with `leave`, which is never reached but needed to adjust sp
	  calculation.  [ruby-core:84589] [Bug #14273]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-24 16:00:27 +00:00
naruse
526cc90092 merge revision(s) 62333: [Backport #14459]
compile.c: popped hash

	* compile.c (compile_array): skip creating new hash if preceeding
	  elements are popped all.  [ruby-core:85486] [Bug #14459]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 11:01:13 +00:00
naruse
c1dc8a1354 merge revision(s) 61711:
compile.c (iseq_compile_each0): remove irrelevant tracecoverage

	This change removes tracecoverage instructions on a line that has any
	NODE but is non-significant, such as, just one literal.

	This fixes the following failure that occurs only when coverage is
	enabled:

	  1) Failure:
	TestISeq#test_to_a_lines [.../ruby/test/ruby/test_iseq.rb:56]:
	<[3, 4, 7, 9]> expected but was
	<[3, 4, 5, 6, 7, 8, 9]>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-19 06:33:01 +00:00
naruse
d191339b9e Revert r62426
it cause test failure


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-18 11:53:14 +00:00
naruse
38aa137666 merge revision(s) 61617,61618: [Backport #14273]
compile.c: remove more unreachable chunk

	* compile.c (remove_unreachable_chunk): remove beyond labels to be
	  removed.

	compile.c: fix stack consistency error

	* compile.c (iseq_peephole_optimize): fix stack consistency error
	  from return in loop, by adding extra `pop` when replacing `jump`
	  with `leave`, which is never reached but needed to adjust sp
	  calculation.  [ruby-core:84589] [Bug #14273]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:28:48 +00:00
naruse
53859b791d 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_5@62420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 07:32:11 +00:00
ko1
360c00572f Set first line numbers for empty iseqs.
* compile.c (iseq_compile_each): for empty method, block and so on,
  `last_line` is not set so that line number of `putnil` instruction
  will be zero. This patch set `first_lineno` for such `putnil`.

  Problem is reported by deivid-rodriguez via Yuichiro Kaneko.

* test/ruby/test_iseq.rb: add a test for this spec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-25 00:27:17 +00:00
nobu
2e5cf0b711 compile.c: toplevel return arguments
* compile.c (compile_return): evaluate arguments to top-level
  return but ignore the results.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-24 02:38:27 +00:00
ko1
0c8e6ae0b8 fix last commit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-23 14:48:28 +00:00
ko1
3044138bd7 RubyVM::InstructionSequence#trace_points.
* iseq.c (iseqw_trace_points): add `RubyVM::InstructionSequence#trace_points`
  method for tools which want to manipulate ISeq (and traces).

* test/ruby/test_iseq.rb: add a test for this method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-23 14:46:59 +00:00
ko1
919fa894f5 revert line number spec of *return events.
* compile.c (rb_iseq_compile_node): line number spec of :return, :b_return
  and :end events of 'TracePoint` is changed for [Feature #14104].

  Quoted from [Feature #14104]:
  > Line numbers on :return/:b_return events show the last executed lines,
  > instead of end lines (without return statement).
  Note that :end event also affected.

  However, "buybug", a well-known ruby debugger depends on previous behavior
  so that I reverted this specification.

* test/ruby/test_settracefunc.rb: catch up this fix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-23 11:00:48 +00:00
ko1
85277d5be0 revert r61371 for [Bug #14214]
Reverted patch doesn't check overwritten value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-21 08:29:56 +00:00
nobu
a94ede7a5a compile.c: branch on block param
* compile.c (compile_branch_condition): replace block param value
  in branch conditions with `defined(yield)`, to get rid of
  creating proc value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 15:45:01 +00:00
mame
c08e8886ba compile.c: add a RUBY_EVENT_COVERAGE_LINE event for line coverage
2.5's line coverage measurement was about two times slower than 2.4
because of two reasons; (1) vm_trace uses rb_iseq_event_flags (which
takes O(n) currently where n is the length of iseq) to get an event
type, and (2) RUBY_EVENT_LINE uses setjmp to call an event hook.

This change adds a special event for line coverage,
RUBY_EVENT_COVERAGE_LINE, and adds `tracecoverage` instructions where
the event occurs in iseq.
`tracecoverage` instruction calls an event hook without vm_trace.
And, RUBY_EVENT_COVERAGE_LINE is an internal event which does not
use setjmp.

This change also cancells lineno change due to the deletion of trace
instructions [Feature #14104].  So fixes [Bug #14191].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 04:24:14 +00:00
nobu
23beb59456 compile.c: pop splat result
* compile.c (compile_array): pop splat result without creating a
  new hash if the whole hash is popped.
  [ruby-core:84340] [Bug #14201]

From: Nobuyoshi Nakada <nobu@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19 02:41:37 +00:00
nobu
5c3f9641c0 compile.c: side effect in splat
* compile.c (compile_array): splat which may have side effects
  should be compiled even if the result will be popped.
  [ruby-core:84340] [Bug #14201]

From: Nobuyoshi Nakada <nobu@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19 00:45:55 +00:00
mame
2e24a66b88 iseq.c (finish_iseq_build): fix coverage leakage [Bug #14191]
Before this change, coverage.so had failed to measure some multiple-line
code fragments.  This is because removing trace instructions (#14104)
changed TracePoint's lineno (new lineno), and coverage counter array was
based on old lineno.
This change initializes coverage counter array based on new lineno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-18 02:44:36 +00:00
mame
ad12b5c285 node.[ch], parse.y, compile.c: rename nd_column to nd_first_column
nd_set_column -> nd_first_set_column
nd_lineno -> nd_first_lineno
nd_set_lineno -> nd_first_set_lineno

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 06:02:26 +00:00
mame
e0bed5f32e compile.c (rb_iseq_compile_node): Move the check for imemo_ifunc to top
Applying nd_type to imemo_ifunc object seems harmless fortunately, but
very dirty (to me).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:26:54 +00:00
mame
55f93cb63f vm_core.h (RUBY_EVENT_COVERAGE_BRANCH): renamed
This change moves RUBY_EVENT_COVERAGE from include/ruby/ruby.h to
vm_core.h and renames it to RUBY_EVENT_COVERAGE_BRANCH.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:19:17 +00:00
mame
c7e4f91246 insns.def (tracebranch): renamed from trace2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:04:49 +00:00
mame
c3c0c0745f thread.c (update_branch_coverage): renamed from update_coverage
Now this function only deals with branch events, so this change renames
it and remove complexity that is no longer needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 07:04:48 +00:00
mame
ec02c4861b thread.c (update_line_coverage): Use RUBY_EVENT_LINE
This change makes coverage use the general event type RUBY_EVENT_LINE
instead of a special event type RUBY_EVENT_COVERAGE.
Just a refactoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 06:39:05 +00:00
mame
a5e02f249d vm_core.h (rb_iseq_locatoin_t): add a field code_range
This change makes each ISeq keep NODE's code range.  This information is
needed for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 08:56:50 +00:00
mame
0a6816ecd7 Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting
`trace2` instruction to the head of method iseq.  So, it just measured
methods defined by `def` keyword.

This commit drastically changes the measuring mechanism of method
coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t*
to runs (i.e., it counts the runs per method entry), and at
`Coverage.result`, it creates the result hash by enumerating all
`rb_method_entry_t*` objects (by `ObjectSpace.each_object`).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-05 07:16:42 +00:00
ko1
26451ab3ba introduce `trace_events' info for iseq.
* vm_core.h (rb_iseq_t::aux): add `trace_events` which represents
  which events are enabled on this iseq. With this information,
  we can skip useless trace-on changes for ISeqs.

* vm_trace.c (RUBY_EVENTS_TRACE_BY_ISEQ): moved to iseq.h and rename it
  with ISEQ_TRACE_EVENTS.

* iseq.h: introduce ISEQ_USE_COMPILE_DATA iseq (imemo) flag to represent
  COMPILE_DATA is available. In other words, iseq->aux.trace_events is not
  available when this flag is set.
  * ISEQ_COMPILE_DATA() is changed from a macro.
  * ISEQ_COMPILE_DATA_ALLOC() is added.
  * ISEQ_COMPILE_DATA_CLEAR() is added.

* iseq.c: use them.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-18 09:39:41 +00:00
mame
ec3a906bb6 Refactoring out the direct accesses of NODE's u1, u2, and u3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 11:03:37 +00:00
yui-knk
7fbab01f77 Add a last location to branch coverage
* compile.c (DECL_BRANCH_BASE, ADD_TRACE_BRANCH_COVERAGE): Add
  a last location to arguments.

* compile.c (compile_if, compile_case, compile_case2, compile_loop, iseq_compile_each0):
  Pass a last location to macros.

* ext/coverage/coverage.c (branch_coverage): Add a last location to
  a return value.

* test/coverage/test_coverage.rb: Follow-up these changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 03:36:20 +00:00
ko1
1d7247e694 fix uninitialized memory reference.
* compile.c (iseq_set_sequence): clear kwargs (in ci_entries) memory area.
  kwargs ci entries are initialized by compiler. However, sometimes these
  initializations are skipped because corresponding calls are eliminated
  by some optimizations (for example, `if true` syntax elimnates else code).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15 04:52:39 +00:00
nobu
c00265bbcc compile.c: fixup TRACE
* compile.c (remove_unreachable_chunk): ignore TRACE elements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 17:07:47 +00:00
ko1
b000b1d930 fix prefix.
* compile.c: the following functions accept LINK_ELEMENT so
  rename to `ELEM_` prefix names:
  * INSERT_ELEM_NEXT -> ELEM_INSERT_NEXT
  * INSERT_ELEM_PREV -> ELEM_INSERT_PREV
  * REPLACE_ELEM     -> ELEM_REPLACE
  * REMOVE_ELEM      -> ELEM_REMOVE


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 13:18:44 +00:00
ko1
665ba24b44 remove trace instruction. [Feature #14104]
* tool/instruction.rb: create `trace_` prefix instructions.

* compile.c (ADD_TRACE): do not add `trace` instructions but add
  TRACE link elements. TRACE elements will be unified with a next
  instruction as instruction information.

* vm_trace.c (update_global_event_hook): modify all ISeqs when
  hooks are enabled.

* iseq.c (rb_iseq_trace_set): added to toggle `trace_` instructions.

* vm_insnhelper.c (vm_trace): added.
  This function is a body of `trace_` prefix instructions.

* vm_insnhelper.h (JUMP): save PC to a control frame.

* insns.def (trace): removed.

* vm_exec.h (INSN_ENTRY_SIG): add debug output (disabled).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 12:58:36 +00:00
nobu
9cabbf849e compile.c: comments for concatstrings optimization [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14 02:40:04 +00:00
nobu
496b4267b2 compile.c: fixup r60727
* compile.c (iseq_peephole_optimize): skip next `freezestring`
  instruction after `concatstrings` instruction when frozen string
  literal is enabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13 23:53:00 +00:00
nobu
7b1f3906a0 compile.c: optimize nested string interpolations
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-09 08:27:01 +00:00
ko1
1c5ae5a163 insn_info/insns_info
* iseq.h (iseq_line_info_entry): rename to iseq_insn_info_entry.

* vm_core.h (rb_iseq_constant_body): rename field name line_info_table
  to insns_info and also from line_info_size to insns_info_size.

* compile.c (INSN): add struct insn_info to contain per insn information.

* compile.c (add_insn_info): added to add new insn_info entry.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-09 06:57:24 +00:00
ko1
976b6df959 fix peephole optimization.
* compile.c (iseq_peephole_optimize): do not need to put `pop`
  instruction.

* test/ruby/test_optimization.rb (test_peephole_optimization_without_trace):
  This code "def foo; 1.times{|(a), &b| nil && a}; end" fails to compile
  by stack underflow because of above bug (fixed by this patch).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-09 04:27:27 +00:00