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

ruby-changes:57138

From: Nobuyoshi <ko1@a...>
Date: Sun, 18 Aug 2019 00:37:48 +0900 (JST)
Subject: [ruby-changes:57138] Nobuyoshi Nakada: 74ca6b88dd (master): Omit a tag unless loading with a wrapper module

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

From 74ca6b88dd9673d2a47ce4bbfd9214dcea5ee366 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 17 Aug 2019 23:33:12 +0900
Subject: Omit a tag unless loading with a wrapper module


diff --git a/load.c b/load.c
index c3d1d63..6ebe8e5 100644
--- a/load.c
+++ b/load.c
@@ -587,7 +587,7 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname) https://github.com/ruby/ruby/blob/trunk/load.c#L587
 }
 
 static inline enum ruby_tag_type
-rb_load_internal0(rb_execution_context_t *ec, VALUE fname, int wrap)
+load_wrapping(rb_execution_context_t *ec, VALUE fname)
 {
     enum ruby_tag_type state;
     rb_thread_t *th = rb_ec_thread_ptr(ec);
@@ -599,15 +599,10 @@ rb_load_internal0(rb_execution_context_t *ec, VALUE fname, int wrap) https://github.com/ruby/ruby/blob/trunk/load.c#L599
 
     ec->errinfo = Qnil; /* ensure */
 
-    if (!wrap) {
-	th->top_wrapper = 0;
-    }
-    else {
-	/* load in anonymous module as toplevel */
-	th->top_self = rb_obj_clone(rb_vm_top_self());
-	th->top_wrapper = rb_module_new();
-	rb_extend_object(th->top_self, th->top_wrapper);
-    }
+    /* load in anonymous module as toplevel */
+    th->top_self = rb_obj_clone(rb_vm_top_self());
+    th->top_wrapper = rb_module_new();
+    rb_extend_object(th->top_self, th->top_wrapper);
 
     EC_PUSH_TAG(ec);
     state = EC_EXEC_TAG();
@@ -641,7 +636,14 @@ static void https://github.com/ruby/ruby/blob/trunk/load.c#L636
 rb_load_internal(VALUE fname, int wrap)
 {
     rb_execution_context_t *ec = GET_EC();
-    raise_load_if_failed(ec, rb_load_internal0(ec, fname, wrap));
+    enum ruby_tag_type state = TAG_NONE;
+    if (wrap) {
+        state = load_wrapping(ec, fname);
+    }
+    else {
+        load_iseq_eval(ec, fname);
+    }
+    raise_load_if_failed(ec, state);
 }
 
 void
-- 
cgit v0.10.2


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

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