[#85349] [Ruby trunk Bug#14334] Segmentation fault after running rspec (ruby/2.5.0/erb.rb:885 / simplecov/source_file.rb:85) — pragtob@...
Issue #14334 has been updated by PragTob (Tobias Pfeiffer).
3 messages
2018/02/02
[#85358] Re: [ruby-cvs:69220] nobu:r62039 (trunk): compile.c: unnecessary freezing — Eric Wong <normalperson@...>
[email protected] wrote:
5 messages
2018/02/03
[#85612] Why require autoconf 2.67+ — leam hall <leamhall@...>
Please pardon the intrusion; I am new to Ruby and like to pull the
6 messages
2018/02/17
[#85616] Re: Why require autoconf 2.67+
— Vít Ondruch <v.ondruch@...>
2018/02/18
VGhpcyBjb3VsZCBoZWxwIHlvdSB0byBidWlsZCBSdWJ5IHdpdGggb2xkZXIgYXV0b2NvbmYgKDIu
[#85634] [Ruby trunk Bug#14494] [PATCH] tool/m4/ruby_replace_type.m4 use AC_CHECK_TYPES for HAVE_* macros — normalperson@...
Issue #14494 has been reported by normalperson (Eric Wong).
3 messages
2018/02/19
[#85674] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — matz@...
Issue #13618 has been updated by matz (Yukihiro Matsumoto).
5 messages
2018/02/20
[#85686] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/02/20
[email protected] wrote:
[#85704] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Koichi Sasada <ko1@...>
2018/02/21
On 2018/02/20 18:06, Eric Wong wrote:
[ruby-core:85359] [PATCH] compile.c: avoid String#+@ call with FSL
From:
Eric Wong <normalperson@...>
Date:
2018-02-03 07:39:56 UTC
List:
ruby-core #85359
Eric Wong wrote:
> Considering String#+@ and String#-@ look like syntax elements
> and are relatively new; can get rid of redefinition check in
> opt_str_uminus?
Maybe we can do this (still running tests, will take a while):
----8<---
Subject: [PATCH] compile.c: avoid String#+@ call with FSL
When using "frozen_string_literal: true", String#+@ is often
used to create mutable strings. Treat it like an immutable
syntax to allow for optimization.
Followup to r62039 and r62041.
---
compile.c | 22 ++++++++++++++++++++++
test/ruby/test_optimization.rb | 10 ++++++++++
2 files changed, 32 insertions(+)
diff --git a/compile.c b/compile.c
index 315e2dc92e..12f1c481e9 100644
--- a/compile.c
+++ b/compile.c
@@ -2850,6 +2850,28 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
}
}
+ if (IS_INSN_ID(iobj, putobject) &&
+ RB_TYPE_P(OPERAND_AT(iobj, 0), T_STRING) &&
+ IS_NEXT_INSN_ID(&iobj->link, send)) {
+ INSN *niobj = (INSN *)iobj->link.next;
+ struct rb_call_info *ci = (struct rb_call_info *)OPERAND_AT(niobj, 0);
+
+ /*
+ * (with frozen_string_literal: true)
+ * putobject "literal"
+ * send <:+@, 0, ARG_SIMPLE>
+ * =>
+ * putstring "literal"
+ */
+ if (ci->mid == idUPlus &&
+ (ci->flag & VM_CALL_ARGS_SIMPLE) &&
+ ci->orig_argc == 0) {
+ ELEM_REMOVE(iobj->link.next);
+ iobj->insn_id = BIN(putstring);
+ return COMPILE_OK;
+ }
+ }
+
if (do_tailcallopt &&
(IS_INSN_ID(iobj, send) ||
IS_INSN_ID(iobj, opt_aref_with) ||
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index e8b4f92d92..5d7118d045 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -718,4 +718,14 @@ def obj.a(&block)
end
assert_equal(:ok, obj.a())
end
+
+ def test_uplus_removal
+ code = '+"unfrozen"'
+ opt = { frozen_string_literal: true }
+ iseq = RubyVM::InstructionSequence.compile(code, nil, nil, opt)
+ insn = iseq.disasm.inspect
+ assert_match %r{\bputstring\b}, insn
+ assert_no_match %r{\bputobject\b}, insn
+ assert_no_match %r{\bmid:\+@\b}, insn
+ end
end
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>