[前][次][番号順一覧][スレッド一覧]

ruby-changes:66498

From: John <ko1@a...>
Date: Thu, 17 Jun 2021 06:09:27 +0900 (JST)
Subject: [ruby-changes:66498] c10d5085a2 (master): Enable frozen_string_literal in builtin_iseq_load

https://git.ruby-lang.org/ruby.git/commit/?id=c10d5085a2

From c10d5085a247266c6399dc6fb68706d87cbdab05 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Mon, 14 Jun 2021 17:32:42 -0700
Subject: Enable frozen_string_literal in builtin_iseq_load

Currently this has a fairly minor effect as strings are not used heavily
inside the builtins (outside of warnings, requires, and errors).
Hopefully this allows us to use strings in the future where appropriate.
---
 mini_builtin.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/mini_builtin.c b/mini_builtin.c
index 86803e1..eade347 100644
--- a/mini_builtin.c
+++ b/mini_builtin.c
@@ -23,7 +23,20 @@ builtin_iseq_load(const char *feature_name, const struct rb_builtin_function *ta https://github.com/ruby/ruby/blob/trunk/mini_builtin.c#L23
 
     vm->builtin_function_table = table;
     vm->builtin_inline_index = 0;
-    const rb_iseq_t *iseq = rb_iseq_new(&ast->body, name_str, name_str, Qnil, NULL, ISEQ_TYPE_TOP);
+    static const rb_compile_option_t optimization = {
+	TRUE, /* int inline_const_cache; */
+	TRUE, /* int peephole_optimization; */
+	FALSE,/* int tailcall_optimization; */
+	TRUE, /* int specialized_instruction; */
+	TRUE, /* int operands_unification; */
+	TRUE, /* int instructions_unification; */
+	TRUE, /* int stack_caching; */
+	TRUE, /* int frozen_string_literal; */
+	FALSE, /* int debug_frozen_string_literal; */
+	FALSE, /* unsigned int coverage_enabled; */
+	0, /* int debug_level; */
+    };
+    const rb_iseq_t *iseq = rb_iseq_new_with_opt(&ast->body, name_str, name_str, Qnil, INT2FIX(0), NULL, 0, ISEQ_TYPE_TOP, &optimization);
     GET_VM()->builtin_function_table = NULL;
 
     rb_ast_dispose(ast);
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]