1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby
normal a2e025a7d0 introduce rb_autoload_str to replace rb_autoload
rb_autoload_str may be safer by preventing premature GC.  It
can also be more efficient by passing a pre-frozen string that
can be deduped using rb_fstring.  Common autoload callers (e.g.
rubygems, rdoc) already use string literals as the file
argument.

There seems to be no reason to expose rb_autoload_str to the
public C API since autoload is not performance-critical.
Applications may declare autoloads in Ruby code or via
rb_funcall; so merely deprecate rb_autoload without exposing
rb_autoload_str to new users.

Running: valgrind -v ruby -rrdoc -rubygems -e exit
shows a minor memory reduction (32-bit userspace)

before:

  in use at exit: 1,600,621 bytes in 28,819 blocks
total heap usage: 55,786 allocs, 26,967 frees, 6,693,790 bytes allocated

after:

  in use at exit: 1,599,778 bytes in 28,789 blocks
total heap usage: 55,739 allocs, 26,950 frees, 6,692,973 bytes allocated

* include/ruby/intern.h (rb_autoload): deprecate
* internal.h (rb_autoload_str): declare
* load.c (rb_mod_autoload): use rb_autoload_str
* variable.c (rb_autoload): become compatibility wrapper
  (rb_autoload_str): hoisted out from old rb_autoload
  [ruby-core:71369] [Feature #11664]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 12:28:09 +00:00
..
backward * include/ruby/backward/util.h: Good-by Borland-C. 2015-10-18 05:41:34 +00:00
debug.h
defines.h configure.in: FUNC_UNOPTIMIZED 2015-12-01 01:05:48 +00:00
encoding.h ruby.h: add prefix 2015-09-13 02:03:31 +00:00
intern.h introduce rb_autoload_str to replace rb_autoload 2015-12-06 12:28:09 +00:00
io.h socket: memoize common socket families in fptr->mode 2015-07-02 01:58:14 +00:00
missing.h missing.h: __STDC_WANT_LIB_EXT1__ 2015-12-02 09:17:42 +00:00
oniguruma.h oniguruma.h: constify 2015-08-27 19:49:45 +00:00
re.h
regex.h
ruby.h * include/ruby/ruby.h (RB_OBJ_TAINT): follow-up of r52881. 2015-12-04 15:59:10 +00:00
st.h st.c: use ccan linked-list (try 3) 2015-06-29 18:10:00 +00:00
subst.h
thread.h
thread_native.h
util.h * include/ruby/util.h: remove a warning suppression C4723 2015-11-30 20:27:52 +00:00
version.h ruby/version.h: bump API version 2014-12-29 11:16:17 +00:00
vm.h
win32.h win32.c: more fcntl 2015-09-12 05:23:22 +00:00