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

ruby-changes:49911

From: normal <ko1@a...>
Date: Thu, 25 Jan 2018 06:07:20 +0900 (JST)
Subject: [ruby-changes:49911] normal:r62029 (trunk): ruby/ruby.h: remove unnecessary exports from C-API

normal	2018-01-25 06:07:14 +0900 (Thu, 25 Jan 2018)

  New Revision: 62029

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62029

  Log:
    ruby/ruby.h: remove unnecessary exports from C-API
    
    Needlessly exporting can reduce performance locally and increase
    binary size.
    
    Increasing the footprint of our C-API larger is also detrimental
    to our development as it encourages tighter coupling with our
    internals; making it harder for us to preserve compatibility.
    
    If some parts of the core codebase needs access to globals,
    internal.h should be used instead of anything in include/ruby/*.
    
    "Urabe, Shyouhei" <shyouhei@r...> wrote:
    > On Thu, Jan 18, 2018 at 7:33 PM, Eric Wong <normalperson@y...> wrote:
    > > shyouhei@r... wrote:
    > >>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61908
    > >>
    > >>     export rb_mFConst
    > >
    > > Why are we exporting all these and making the public C-API bigger?
    > > If anything, we should make these static.  Thanks.
    >
    > No concrete reason, except they have already been externed in 2.5.
    > These variables had lacked declarations so far, which resulted in their
    > visibility to be that of extern. The commit is just confirming the status quo.
    >
    > I'm not against to turn them into static.
    
    This reverts changes from r61910, r61909, r61908, r61907, and r61906.
    
    * transcode.c (rb_eUndefinedConversionError): make static
      (rb_eInvalidByteSequenceError): ditto
      (rb_eConverterNotFoundError): ditto
    * process.c (rb_mProcGID, rb_mProcUid, rb_mProcID_Syscall): ditto
    * file.c (rb_mFConst): ditto
    * error.c (rb_mWarning, rb_cWarningBuffer): ditto
    * enumerator.c (rb_cLazy): ditto
      [Misc #14381]

  Modified files:
    trunk/enumerator.c
    trunk/error.c
    trunk/file.c
    trunk/include/ruby/ruby.h
    trunk/process.c
    trunk/transcode.c
Index: process.c
===================================================================
--- process.c	(revision 62028)
+++ process.c	(revision 62029)
@@ -7590,9 +7590,9 @@ rb_clock_getres(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L7590
 }
 
 VALUE rb_mProcess;
-VALUE rb_mProcUID;
-VALUE rb_mProcGID;
-VALUE rb_mProcID_Syscall;
+static VALUE rb_mProcUID;
+static VALUE rb_mProcGID;
+static VALUE rb_mProcID_Syscall;
 
 
 /*
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 62028)
+++ include/ruby/ruby.h	(revision 62029)
@@ -1905,18 +1905,12 @@ RUBY_EXTERN VALUE rb_mKernel; https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1905
 RUBY_EXTERN VALUE rb_mComparable;
 RUBY_EXTERN VALUE rb_mEnumerable;
 RUBY_EXTERN VALUE rb_mErrno;
-RUBY_EXTERN VALUE rb_mFConst;
 RUBY_EXTERN VALUE rb_mFileTest;
 RUBY_EXTERN VALUE rb_mGC;
 RUBY_EXTERN VALUE rb_mMath;
-RUBY_EXTERN VALUE rb_mProcGID;
-RUBY_EXTERN VALUE rb_mProcID_Syscall;
-RUBY_EXTERN VALUE rb_mProcUID;
 RUBY_EXTERN VALUE rb_mProcess;
 RUBY_EXTERN VALUE rb_mWaitReadable;
 RUBY_EXTERN VALUE rb_mWaitWritable;
-RUBY_EXTERN VALUE rb_mWarning;
-RUBY_EXTERN VALUE rb_cWarningBuffer;
 
 RUBY_EXTERN VALUE rb_cBasicObject;
 RUBY_EXTERN VALUE rb_cObject;
@@ -1941,7 +1935,6 @@ RUBY_EXTERN VALUE rb_cFloat; https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1935
 RUBY_EXTERN VALUE rb_cHash;
 RUBY_EXTERN VALUE rb_cIO;
 RUBY_EXTERN VALUE rb_cInteger;
-RUBY_EXTERN VALUE rb_cLazy;
 RUBY_EXTERN VALUE rb_cMatch;
 RUBY_EXTERN VALUE rb_cMethod;
 RUBY_EXTERN VALUE rb_cModule;
@@ -1991,9 +1984,6 @@ RUBY_EXTERN VALUE rb_eSysStackError; https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1984
 RUBY_EXTERN VALUE rb_eRegexpError;
 RUBY_EXTERN VALUE rb_eEncodingError;
 RUBY_EXTERN VALUE rb_eEncCompatError;
-RUBY_EXTERN VALUE rb_eUndefinedConversionError;
-RUBY_EXTERN VALUE rb_eInvalidByteSequenceError;
-RUBY_EXTERN VALUE rb_eConverterNotFoundError;
 
 RUBY_EXTERN VALUE rb_eScriptError;
 RUBY_EXTERN VALUE rb_eNameError;
Index: file.c
===================================================================
--- file.c	(revision 62028)
+++ file.c	(revision 62029)
@@ -5802,7 +5802,7 @@ rb_file_s_mkfifo(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/file.c#L5802
 #define rb_file_s_mkfifo rb_f_notimplement
 #endif
 
-VALUE rb_mFConst;
+static VALUE rb_mFConst;
 
 void
 rb_file_const(const char *name, VALUE value)
Index: enumerator.c
===================================================================
--- enumerator.c	(revision 62028)
+++ enumerator.c	(revision 62029)
@@ -102,7 +102,7 @@ https://github.com/ruby/ruby/blob/trunk/enumerator.c#L102
  *
  */
 VALUE rb_cEnumerator;
-VALUE rb_cLazy;
+static VALUE rb_cLazy;
 static ID id_rewind, id_new, id_yield, id_to_enum;
 static ID id_next, id_result, id_lazy, id_receiver, id_arguments, id_memo, id_method, id_force;
 static VALUE sym_each, sym_cycle;
Index: transcode.c
===================================================================
--- transcode.c	(revision 62028)
+++ transcode.c	(revision 62029)
@@ -17,9 +17,9 @@ https://github.com/ruby/ruby/blob/trunk/transcode.c#L17
 #define ENABLE_ECONV_NEWLINE_OPTION 1
 
 /* VALUE rb_cEncoding = rb_define_class("Encoding", rb_cObject); */
-VALUE rb_eUndefinedConversionError;
-VALUE rb_eInvalidByteSequenceError;
-VALUE rb_eConverterNotFoundError;
+static VALUE rb_eUndefinedConversionError;
+static VALUE rb_eInvalidByteSequenceError;
+static VALUE rb_eConverterNotFoundError;
 
 VALUE rb_cEncodingConverter;
 
Index: error.c
===================================================================
--- error.c	(revision 62028)
+++ error.c	(revision 62029)
@@ -53,8 +53,8 @@ int rb_str_end_with_asciichar(VALUE str, https://github.com/ruby/ruby/blob/trunk/error.c#L53
 VALUE rb_eEAGAIN;
 VALUE rb_eEWOULDBLOCK;
 VALUE rb_eEINPROGRESS;
-VALUE rb_mWarning;
-VALUE rb_cWarningBuffer;
+static VALUE rb_mWarning;
+static VALUE rb_cWarningBuffer;
 
 static ID id_warn;
 

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

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