summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-02fix SEGV touching uninitialized memoryshyouhei
This function can be called from boot_defclass(). No assumption can be made about object internals. (lldb) run Process 2386 launched: './miniruby' (x86_64) Process 2386 stopped * thread #1: tid = 0x13f3b6, 0x00000001001e0b26 miniruby`rb_class_path_cached(klass=4311373720) + 20 at variable.c:321, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) frame #0: 0x00000001001e0b26 miniruby`rb_class_path_cached(klass=4311373720) + 20 at variable.c:321 318 VALUE 319 rb_class_path_cached(VALUE klass) 320 { -> 321 st_table *ivtbl = RCLASS_IV_TBL(klass); 322 st_data_t n; 323 324 if (!ivtbl) return Qnil; (lldb) bt * thread #1: tid = 0x13f3b6, 0x00000001001e0b26 miniruby`rb_class_path_cached(klass=4311373720) + 20 at variable.c:321, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) * frame #0: 0x00000001001e0b26 miniruby`rb_class_path_cached(klass=4311373720) + 20 at variable.c:321 frame #1: 0x000000010009cbd0 miniruby`rb_raw_obj_info(buff="0x0000000100fa5798 [2 ] T_CLASS", buff_size=256, obj=4311373720) + 1393 at gc.c:9341 frame #2: 0x000000010009cf16 miniruby`obj_info(obj=4311373720) + 98 at gc.c:9423 frame #3: 0x000000010008ca87 miniruby`newobj_init(klass=0, flags=66, v1=0, v2=0, v3=0, wb_protected=1, objspace=0x00000001007cf280, obj=4311373720) + 338 at gc.c:1887 frame #4: 0x000000010008cd51 miniruby`newobj_of(klass=0, flags=66, v1=0, v2=0, v3=0, wb_protected=1) + 171 at gc.c:1970 frame #5: 0x000000010008ce1b miniruby`rb_wb_protected_newobj_of(klass=0, flags=66) + 54 at gc.c:1990 frame #6: 0x0000000100027563 miniruby`class_alloc(flags=2, klass=0) + 46 at class.c:165 frame #7: 0x000000010002761a miniruby`rb_class_boot(super=0) + 35 at class.c:203 frame #8: 0x0000000100028612 miniruby`boot_defclass(name="BasicObject", super=0) + 28 at class.c:537 frame #9: 0x000000010002868b miniruby`Init_class_hierarchy + 26 at class.c:548 frame #10: 0x00000001000efe69 miniruby`InitVM_Object + 9 at object.c:3892 frame #11: 0x00000001000f138e miniruby`Init_Object + 57 at object.c:4122 frame #12: 0x00000001000a59bd miniruby`rb_call_inits + 29 at inits.c:23 frame #13: 0x000000010007af30 miniruby`ruby_setup + 229 at eval.c:61 frame #14: 0x000000010007af7e miniruby`ruby_init + 13 at eval.c:78 frame #15: 0x0000000100000c58 miniruby`main(argc=2, argv=0x00007fff5fbfdbf0) + 88 at main.c:41 frame #16: 0x00007fff88eda5ad libdyld.dylib`start + 1 (lldb) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02fix memory leak (FOUND BY A COMPILER WARNING)shyouhei
Confusion of argument order ignores this st_free_table. Results in garbaged table not GCed. Easily noticable when you read the compiper warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02offsetof(type, foo.bar) is (arguably) a GCCismshyouhei
TL;DR see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2031.htm Suppose we have: struct X { struct Y { z_t z; } y; } x; then, you _cant_ infer offsetof(struct X, y.z). The ISO C99 section 7.17 says nothing about such situation. At least clang warns this being an extension to the language (-Wextended-offsetof). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02comparing function pointer versus void* is a GCCismshyouhei
However dlsym() requires such feature so this function is non- portable by nature. Cannot but suppress warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02label as lvalue is a GCCismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02statement experssion is a GCCismshyouhei
should mark as such. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02enum value grater than int is a GCCismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02_Static_assert is a C11ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02bit-fields other than int is a C99ismshyouhei
To be precise C90 says "A bit-field may have type int, unsigned int, or signed int". It is clear that char or enum are NG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02initializer paren-string `{("str")}` is a C99ismshyouhei
First, `"str"` is a string constant but `("str")` is not. It is a random expression whose type happen to be const char*. Second, non-constant initializer element is forbidden in C90. Mixture of these two results in the fact that `{("str")}` is a C99ism. Just delete the parens and everything goes well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02string literal longer than 509 characters is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02flexible array member is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02long long is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02comma at the end of enum is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02__VA_ARGS__ is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02long long is a C99simshyouhei
Don't assume 8-bytes integers == "long long". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02string literal longer than 509 characters is a C99ismshyouhei
Should avoid such thing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02"%z" printf format specifier is a C99ismshyouhei
PRIxSIZE is also. But shimmed in ruby.h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02int (*)(void) is incompatible with void*shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02rb_insn_func_t is incompatible with void*shyouhei
Why not just use void* ? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02explicit cast to void* required for %pshyouhei
These functions take variadic arguments so no automatic type promotion is expected. You have to do it by hand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02suppress warning for clangshyouhei
In this function, "volatile" is specified twice in macro-expanded `VAR_INITIALIZED(cont)` part. That is a problem in fact. However I don't want to touch this line because it is already a messy workaround for clang SEGV. Let me just ignore. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02parse.y: fix typonobu
* parse.y (singleton): fix typo, show the expression. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02* 2018-01-02svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02parse.y: code end positionnobu
* parse.y (parser_yyerror): use the given location as the end of erred code, instead of the current position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01vm_core.h: make the algorithm of get_insn_info selectablemame
Currently, VM_INSN_INFO_TABLE_IMPL == 0 means linear search, and VM_INSN_INFO_TABLE_IMPL == 1 means binary search. I plan to add succinct bitvector algorithm later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01iseq.h: Extract position array from iseq_insn_info_entrymame
This makes TracePoint a bit fast by reducing cache misses of `get_insn_info_binary_search`. Also, I plan to use succinct bitvector algorithm for `get_insn_info` instead of binary search. This change will make it easy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01iseq.c: fix build error when VM_CHECK_MODE is enabledmame
Follow up of r61534. Sorry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01vm_core.h: refactoring of insns_infomame
This factors rb_iseq_constant_body#insns_info and #insns_info_size to struct iseq_insn_info. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01parse.y: highlight yyerrornobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-01[DOC] doc/NEWS-2.5.0: remove trailing comma [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31Removed debug code. It is inconsistency in rubygems upsteream.hsbt
Revert r58657, r58660, r58692, r58723. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31parse.y: yyerror1nobu
* parse.y (yyerror1): pass location to parser_yyerror. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31* 2018-01-01svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31parse.y: yylloc at yyerrornobu
* parse.y (parser_yyerror): consider the case first_loc and last_loc point different lines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31error.c: limit depthnobu
* error.c (rb_warn_m): limit backtrace depth to reduce objects to be created but not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31test_exception.rb: more assertionsnobu
[ruby-core:84568] [Bug #14262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31error.c: negative uplevelnobu
* error.c (rb_warn_m): negative uplevel is not allowed. [ruby-core:84568] [Bug #14262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31prelude.c.tmpl: get rid of warnings on old gccnobu
* template/prelude.c.tmpl: ignore missing-field-initializers on old gcc, e.g. 4.4, which does not support pushing/popping diagnostics. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31parse.y: assignable_errornobu
* parse.y (assignable_gen): should return valid NODE always even on errors. [ruby-core:84565] [Bug #14261] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31parse.y: yylloc at yyerrornobu
* parse.y (parser_yyerror): utilize the location given by bison. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-31fix reset order.ko1
* lib/rdoc/test_case.rb (setup): call `RDoc::Markup::PreProcess.reset` at the end of `setup` method. `RDoc::RDoc.new` requires `rdoc/generator/darkfish` and requires `rdoc/tom_doc.rb` at last. It add post_proecssor (at `add_post_processor`) and it fails `TestRDocMarkupPreProcess#test_class_post_process`. This issue occured only with sorted tests by alphabetical order. `make test-all TESTS='rdoc/test_rdoc_markup_pre_process.rb --test-order=alpha`) We can observe this failure with parallel test only a few times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30increase test timeout.ko1
* test/ruby/test_thread.rb (test_signal_at_join): increase timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30* 2017-12-31svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30bit fields treating negative values should be declared as signed intngoto
* internal.h (struct vm_ifunc_argc): Bit fields are unsigned by default. For storing nagative values to bit fields, they must be declated as signed int. Fix multiple test failure observed by 32-bit binaries compiled with Oracle Developer Studio (Solaris Studio) 12.x on Solaris 10 on sparc architecture. [Bug #14260] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30numeric.c: Fix Integer#pow with a large Fixnum modulomrkn
* numeric.c: Fix Integer#pow with a large Fixnum modulo [Bug #14259] [ruby-core:84562] * test/ruby/test_numeric.rb: add assertions for reproducing this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30drb: use \A and \znobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30* 2017-12-30svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30hash literal deduplicates like Hash#[]=normal
From: Eric Wong <e@80x24.org> * hash.c (rb_hash_key_str): new function (hash_aset_str): use rb_hash_key_str * internal.h: add rb_hash_key_str * st.c (st_stringify): use rb_hash_key_str * test/ruby/test_hash.rb (test_NEWHASH_fstring_key): dynamic key [ruby-core:84554] [Feature #14258] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-29string.c: chomp rs at the endnobu
* string.c (rb_str_enumerate_lines): should chomp record separator only, but not a newline, at the end of the receiver as well as middle, if the separator is given. [ruby-core:84552] [Bug #14257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e