summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-07-03* method.h: introduce rb_callable_method_entry_t to removeko1
rb_control_frame_t::klass. [Bug #11278], [Bug #11279] rb_method_entry_t data belong to modules/classes. rb_method_entry_t::owner points defined module or class. module M def foo; end end In this case, owner is M. rb_callable_method_entry_t data belong to only classes. For modules, MRI creates corresponding T_ICLASS internally. rb_callable_method_entry_t can also belong to T_ICLASS. rb_callable_method_entry_t::defined_class points T_CLASS or T_ICLASS. rb_method_entry_t data for classes (not for modules) are also rb_callable_method_entry_t data because it is completely same data. In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class. For example, there are classes C and D, and incldues M, class C; include M; end class D; include M; end then, two T_ICLASS objects for C's super class and D's super class will be created. When C.new.foo is called, then M#foo is searcheed and rb_callable_method_t data is used by VM to invoke M#foo. rb_method_entry_t data is only one for M#foo. However, rb_callable_method_entry_t data are two (and can be more). It is proportional to the number of including (and prepending) classes (the number of T_ICLASS which point to the module). Now, created rb_callable_method_entry_t are collected when the original module M was modified. We can think it is a cache. We need to select what kind of method entry data is needed. To operate definition, then you need to use rb_method_entry_t. You can access them by the following functions. * rb_method_entry(VALUE klass, ID id); * rb_method_entry_with_refinements(VALUE klass, ID id); * rb_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me); To invoke methods, then you need to use rb_callable_method_entry_t which you can get by the following APIs corresponding to the above listed functions. * rb_callable_method_entry(VALUE klass, ID id); * rb_callable_method_entry_with_refinements(VALUE klass, ID id); * rb_callable_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me); VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry() returns rb_callable_method_entry_t. You can check a super class of current method by rb_callable_method_entry_t::defined_class. * method.h: renamed from rb_method_entry_t::klass to rb_method_entry_t::owner. * internal.h: add rb_classext_struct::callable_m_tbl to cache rb_callable_method_entry_t data. We need to consider abotu this field again because it is only active for T_ICLASS. * class.c (method_entry_i): ditto. * class.c (rb_define_attr): rb_method_entry() does not takes defiend_class_ptr. * gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS. * cont.c (fiber_init): rb_control_frame_t::klass is removed. * proc.c: fix `struct METHOD' data structure because rb_callable_method_t has all information. * vm_core.h: remove several fields. * rb_control_frame_t::klass. * rb_block_t::klass. And catch up changes. * eval.c: catch up changes. * gc.c: ditto. * insns.def: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_backtrace.c: ditto. * vm_dump.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03* lib/cmath.rb: shouldn't use non-ASCII characters in documentation. as ausa
custom, single quote is seen as the same as apostrophe in computer typography. [skip ci] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03file.c: _wfreopen_s on mingwnobu
* win32/file.c: some mingw compilers need a tweek for the declarations of _wfreopen_s. [Bug #11320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03transcode.c: empty encoding namenobu
* transcode.c (rb_econv_set_replacement): target encoding name can be empty now. [ruby-core:69841] [Bug #11324] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02object.c: fix up r51039nobu
* object.c (convert_type): conversion without "to_" prefix is not implicit. fix up r51039. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02delay `exception: false' checks for minor speedupnormal
Delay hash lookups until we are about to hit an exception. This gives a minor speedup ratio of 2-3% in the new bm_io_nonblock_noex benchmark as well as reducing code. * benchmark/bm_io_nonblock_noex.rb: new benchmark * ext/openssl/ossl_ssl.c (no_exception_p): new function (ossl_start_ssl): adjust for no_exception_p (ossl_ssl_connect): adjust ossl_start_ssl call (ossl_ssl_connect_nonblock): ditto (ossl_ssl_accept): ditto (ossl_ssl_accept_nonblock): ditto (ossl_ssl_read_internal): adjust for no_exception_p (ossl_ssl_write_internal): ditto (ossl_ssl_write): adjust ossl_write_internal call (ossl_ssl_write_nonblock): ditto * ext/stringio/stringio.c (strio_read_nonblock): delay exception check * io.c (no_exception_p): new function (io_getpartial): call no_exception_p (io_readpartial): adjust for io_getpartial (get_kwargs_exception): remove (io_read_nonblock): adjust for io_getpartial, check no_exception_p on EOF (io_write_nonblock): call no_exception_p (rb_io_write_nonblock): do not check `exception: false' (argf_getpartial): adjust for io_getpartial [ruby-core:69778] [Feature #11318] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* 2015-07-03svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02dir.c: set errnonobu
* dir.c (replace_real_basename): Win32 API does not set errno, get the last error by GetLastError() and map to errno. [Bug #10015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02fix typos [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02dir.c: show warningsnobu
* dir.c (replace_real_basename): show warnings at errors. [Bug #10015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* gc.c: remove `#define RGENGC_OBJ_INFO 1' line introduced toko1
debug Bug #11244. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* gc.c (rb_raw_obj_info): separated from rb_obj_info().ko1
Fill internal object information into passed buffer. * gc.h: declare rb_raw_obj_info(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02dir.c: update path typenobu
* dir.c (replace_real_basename): update path type by the target attributes if possible, to improve the performance. [Bug #10015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* st.c: get rid of VC++'s warnings of C4700 (uninitialized localusa
variable used). I think that these are wrong, but should shut them up. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02rubygems.rb: use @gem_prelude_indexnobu
* lib/rubygems.rb (Gem.load_path_insert_index): search @gem_prelude_index first. * lib/rubygems/test_case.rb (Gem::TestCase#setup): keep already expanded paths to prserve instance variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02ruby.c: copy initial load path marksnobu
* ruby.c (process_options): also copy initial load path marks at setting load paths encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02revert r51101nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02skip test_dash_i_beats_gemsnobu
* test/rubygems/test_require.rb (test_dash_i_beats_gems): skip because the target feature just does not work. requiring a gem inserts its paths and its dependents' paths at the beginning of $LOAD_PATH, regardless -I options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02test_gem_server.rb: Don't specify port numbernobu
* test/rubygems/test_gem_server.rb (process_based_port): use dynamically chosen port numberss to get rid of conflicts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* test/rubygems/test_gem_specification.rb: skip tests which theusa
platform does not permit the filename of its test file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02fix redefinitionsnobu
* test/rubygems/test_gem_resolver_git_specification.rb: require rubygems/installer.rb before Gem::TestCase#setup runs, otherwise as Gem::TestCase#teardown restores $LOADED_FEATURES to the state at that time, the requiring the file in GitSpecification#install method causes a lot of constant redefinitions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02socket: memoize common socket families in fptr->modenormal
This provides a minor speedup by avoiding an extra syscall require 'socket' require 'benchmark' nr = 100000 msg = 'hello world' buf = '' size = msg.bytesize puts(Benchmark.measure do UNIXSocket.pair(:SEQPACKET) do |a, b| nr.times do a.sendmsg_nonblock(msg, 0, exception: false) b.recv(size, 0, buf) end end end) user system total real before: 0.330000 0.340000 0.670000 ( 0.678235) after: 0.290000 0.240000 0.530000 ( 0.534527) * ext/socket/rubysocket.h: flags for common socket families (rsock_getfamily): update signature * include/ruby/io.h: comment socket FMODE flags * ext/socket/init.c (rsock_getfamily): memoize family * ext/socket/basicsocket.c: adjust rsock_getfamily calls * ext/socket/ancdata.c: ditto [ruby-core:69713] [Feature #11298] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* lib/rubygems/resolver.rb: fixed NameError of Gem::Util::NULL_DEVICE.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* lib/rubygems/resolver.rb: fix error of null device reference with DOSISHhsbt
platform. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01* properties.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01* 2015-07-02svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01* lib/rubygems: Update to RubyGems HEAD(c202db2).hsbt
this version contains many enhancements see http://git.io/vtNwF * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01fix a failure without zlibkazu
* test/net/http/test_httpresponse.rb (HTTPResponseTest#test_read_body_content_encoding_deflate_uppercase): fix failure without zlib. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01vm_method.c: remove unused codenobu
* vm_method.c (rb_method_entry_make): remove unused code to prohibit method re-definition, introduced at r34983. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01vm_method.c: no NOEX macrosnobu
* vm_method.c (rb_method_entry_make): NOEX macros are no longer defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01method.h: update argument checksnobu
* method.h (METHOD_ENTRY_VISI_SET, METHOD_ENTRY_BASIC_SET), (METHOD_ENTRY_SAFE_SET, METHOD_ENTRY_FLAGS_SET): get rid of negative arguments, and safe leve is restricted to 1 now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01vm_method.c: orignial visibilitiesnobu
* vm_method.c (Init_eval_method): copy the orignial visibilities, instead of setting explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01test_object.rb: use assert_separatelynobu
* test/ruby/test_object.rb (test_redef_method_missing): use assert_separately to catch segfaults and show the diagnostic reports. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: AREF_HASH_UNIT enumnobu
* struct.c (AREF_HASH_UNIT): name a magic number, which is shared by struct_member_pos_probe and struct_set_members. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: AREF_HASH_THRESHOLD enumnobu
* struct.c (AREF_HASH_THRESHOLD): make an enum not to exceed the int range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01* Add test for Enumerable#none? [fix GH-950] Patch by @yui-knkhsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: hide internal objectsnobu
* struct.c (struct_set_members): hide internal back_members object, and members object does not need to be duped as it should be frozen and hidden. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-01struct.c: fix implicit conversionsnobu
* struct.c (struct_member_pos): revert r51080 to fix other implicit conversions but cast the return value to fix the previous implicit conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* struct.c (struct_member_pos): avoid implicit conversion losesnaruse
integer precision: 'long' to 'int'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30move RB_GC_GUARD responsibility to rb_add_method_iseqnormal
This simplifies all the callers and makes code easier to use and review. I was confused about the need for RB_GC_GUARD in define_{aset,aref}_method of struct.c without reading rb_add_method_iseq. Likewise, do the same for rb_iseq_clone, where the GC guard only seems neccesary iff RGenGC is disabled. * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD * class.c (clone_method): remove RB_GC_GUARD * struct.c (define_aref_method): ditto (define_aset_method): ditto * vm.c (vm_define_method): * iseq.c (rb_iseq_clone): add RB_GC_GUARD git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* 2015-07-01svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30struct.c: speedup for big structsnormal
use simple custom open-addressing hash for big structs. Original-patch-by: Sokolov Yura aka funny_falcon <funny.falcon@gmail.com> in https://bugs.ruby-lang.org/issues/10585 * struct.c (AREF_HASH_THRESHOLD): new macro (id_back_members): new ID (struct_member_pos_ideal): new function (struct_member_pos_probe): ditto (struct_set_members): ditto (struct_member_pos): ditto (rb_struct_getmember): use struct_member_pos for O(1) access (rb_struct_aref_sym): ditto (rb_struct_aset_sym): ditto (setup_struct): call struct_set_members (struct_define_without_accessor): ditto (Init_Struct): initialize __members_back__ [ruby-core:66851] [ruby-core:69705] [ruby-core:69821] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30io.c: remove unnecessary sharednobu
* io.c (rb_io_reopen): FilePathValue() ensures the path NUL-terminated and frozen, so it is unnecessary to make it shared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30ensure paths NUL-terminatednobu
* dir.c (check_dirname): ensure path name NUL-terminated for SHARABLE_MIDDLE_SUBSTRING. * io.c (rb_sysopen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30file.c: not xfreenobu
* win32/file.c (rb_freopen): should free rb_w32_mbstr_to_wstr result instead of xfree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* win32/file.c (rb_freopen): remove debug code.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* win32/file.c (rb_freopen): need to terminate by NUL.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30io.c: reopen OS encoding pathnobu
* io.c (rb_io_reopen): freopen(3) with OS encoding path. [ruby-core:69780] [Bug #11320] * win32/file.c (rb_freopen): wrapper of wchar version freopen(3). use _wfreopen_s() if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30test_io.rb: skip method definitionsnobu
* test/ruby/{test_io,test_io_m17n}.rb: skip method definitions on unsupported platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e