Commit Graph

9304 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 8bfad558f8 Merge pull request #4007 from iij/sort-should-not-consume-system-stack
sort method should not consume system stack.
2018-04-23 13:15:10 +09:00
Yukihiro "Matz" Matsumoto 1ca06f407b Merge pull request #4006 from take-cheeze/fix_ub_check
Fix undefined error of pointer dereference.
2018-04-23 13:13:36 +09:00
Tomoyuki Sahara f0e54df4fe sort method should not consume system stack. 2018-04-23 12:28:15 +09:00
Takeshi Watanabe 25c40c2f12 Fix undefined error of pointer dereference. 2018-04-23 12:06:13 +09:00
Yukihiro "Matz" Matsumoto 2213deeeaa Implement String#upto in Ruby.
Avoid using `mrb_yield` in C code. The function is not recommended.
Because it doesn't work well with fibers.
2018-04-21 22:30:54 +09:00
Yukihiro "Matz" Matsumoto 8b92ab5c7b CRuby2.6 stops deprecating String#lines with a block.
`String#lines` (with a block) is now implemented in Ruby.
2018-04-19 17:33:00 +09:00
Yukihiro "Matz" Matsumoto c79e81ebc3 String#lines with a block is deprecated style. 2018-04-19 09:07:11 +09:00
Yukihiro "Matz" Matsumoto 54905e98cf ary_dup() should not use `ary_replace(); fix #4004
Otherwise the duplicated object may have shared entities that
should not be modified in-line.
2018-04-18 17:30:33 +09:00
Yukihiro "Matz" Matsumoto 391e24210f A new function ary_from_values(); ref #4004 2018-04-18 17:29:45 +09:00
Yukihiro "Matz" Matsumoto c9275bbbed mrb_io_initialize_copy should not free existing fptr; fix #4005
When arguments `copy` and `orig` are the same object.
2018-04-18 17:27:41 +09:00
Yukihiro "Matz" Matsumoto 05db341ef5 mrb_dup() should fail if fd is a negative integer; ref #4005 2018-04-18 17:25:52 +09:00
Yukihiro "Matz" Matsumoto 135b4773e3 Turn off major GC mode before full GC; fix #4000 2018-04-18 00:18:03 +09:00
Yukihiro "Matz" Matsumoto 0866fa38b0 Avoid unnecessary object allocation (addrinfo) in _accept; ref #3999 2018-04-18 00:18:03 +09:00
Yukihiro "Matz" Matsumoto f7cf5812b1 Merge pull request #4003 from take-cheeze/int32_overflow
Fallback to float when compiled binary with 64bit compiler.
2018-04-17 23:08:36 +09:00
Takeshi Watanabe 87ef6aeb02 Fallback to float when caompiled binary with 64bit compiler.
closes #3997.
2018-04-17 22:59:07 +09:00
Yukihiro "Matz" Matsumoto 4880f6dc89 Socket.accept should have returned [fd, addr]; fix #3999 2018-04-17 17:21:49 +09:00
Yukihiro "Matz" Matsumoto 0e76faed8c Make ary_replace() to share entry buffers if possible. 2018-04-17 17:21:45 +09:00
Yukihiro "Matz" Matsumoto 5c15aa2f3b Make ary_concat() to replace the receiver when it is empty. 2018-04-17 12:34:30 +09:00
Yukihiro "Matz" Matsumoto c078783a5a Make ary_replace() to take struct RArray* argument. 2018-04-17 12:33:01 +09:00
Yukihiro "Matz" Matsumoto 66b1695ba9 Define SOL_IP and SOL_TCP; ref #3999 2018-04-17 12:01:32 +09:00
Yukihiro "Matz" Matsumoto d88191e7e7 Implement Array#__svalue in C. 2018-04-17 11:32:31 +09:00
Yukihiro "Matz" Matsumoto b51b21fc63 Fix use after free in File#initilialize_copy; fix #4001
The bug and the fix were reported by https://hackerone.com/pnoltof
2018-04-17 09:57:41 +09:00
Yukihiro "Matz" Matsumoto fabc460880 Invoke full GC when too many objects allocated during GC; fix #3998
When object allocation rate during incremental GC is too high, the
`gc->majorgc_old_threshold` becomes too big. This means major GC
start slower and old objects stay longer (and consume too much memory).
2018-04-14 06:18:49 +09:00
Yukihiro "Matz" Matsumoto 3b273243e6 Change MAJOR_GC_INC_RATIO to 120; ref #3998
Because 200% is consumes too much memory for some cases.
2018-04-14 06:13:00 +09:00
Yukihiro "Matz" Matsumoto fc85016a32 Remove DEFAULT_ from DEFAULT_MAJOR_GC_INC_RATIO; ref #3998
Because unlike other GC ratio constants, it's not a default value.
2018-04-14 06:12:12 +09:00
Yukihiro "Matz" Matsumoto c6736357a7 No longer need to insert write barriers for fibers.
Those barriers are inserted to fix #3699 but all living fibers are
marked from `mark_context()` anyway now.
2018-04-13 23:46:40 +09:00
Yukihiro "Matz" Matsumoto e3e87ee26a The #3871 fix caused wrong break from proc-closure error; fix #3996 2018-04-13 21:56:45 +09:00
Yukihiro "Matz" Matsumoto 4df0380f1e Add fallthrough comment to silence gcc warning. 2018-04-13 11:23:27 +09:00
Yukihiro "Matz" Matsumoto 4b09c7364e Silence gcc initializer warning. 2018-04-13 11:22:54 +09:00
Yukihiro "Matz" Matsumoto 1905091634 Check length of env stack before accessing upvar; fix #3995 2018-04-11 10:24:44 +09:00
Yukihiro "Matz" Matsumoto e340b17252 Merge pull request #3994 from kou/fix-windows-build-error-on-dll-build
Fix build error on Windows with MRB_BUILD_AS_DLL
2018-04-10 16:35:48 +09:00
Kouhei Sutou 0bc6c17490 Fix build error on Windows with MRB_BUILD_AS_DLL
Error message:

    C:\projects\groonga\vendor\mruby-source\include\mruby.h(1098): error C2375: 'mrb_gc_arena_save' : redefinition; different linkage [C:\projects\groonga\vendor\mruby\mruby.vcxproj]
              C:\projects\groonga\vendor\mruby-source\include\mruby.h(1083) : see declaration of 'mrb_gc_arena_save'
    C:\projects\groonga\vendor\mruby-source\include\mruby.h(1099): error C2375: 'mrb_gc_arena_restore' : redefinition; different linkage [C:\projects\groonga\vendor\mruby\mruby.vcxproj]
              C:\projects\groonga\vendor\mruby-source\include\mruby.h(1084) : see declaration of 'mrb_gc_arena_restore'
2018-04-10 15:24:41 +09:00
Yukihiro "Matz" Matsumoto e9ddb593f3 Merge pull request #3991 from take-cheeze/fix_eval_env_gc
Fix possible heap use after free in `mrb_exec_irep` and stack expanding.
2018-04-05 15:44:24 +09:00
Takeshi Watanabe 26e436e247 Adjust environment when mrb_exec_irep happened. 2018-04-05 11:53:30 +09:00
Yukihiro "Matz" Matsumoto f23c3cddc8 Merge pull request #3990 from mimaki/fix-mrdb-illegal-free
Fixed memory failure on mruby debugger.
2018-04-04 15:44:49 +09:00
mimaki e57d9e6047 Fixed test case for mruby ddebugger. 2018-04-04 14:07:59 +09:00
mimaki c1b9ec0c30 Fixed illegal memory operation on mruby debugger. 2018-04-04 13:20:40 +09:00
Yukihiro "Matz" Matsumoto 951ebbafdc Merge pull request #3988 from ksss/each_with_object
Refactoring for `Enumerable#each_with_object`
2018-03-28 14:50:41 +09:00
ksss e683c95e90 Refactoring for Enumerable#each_with_object
`each_with_object` arity should be 1
2018-03-27 23:09:10 +09:00
Yukihiro "Matz" Matsumoto a072015c4e Merge pull request #3987 from ksss/enum-lazy-zip
Reimplement `Enumerable#zip` with Enumerator
2018-03-27 13:53:37 +09:00
Yukihiro "Matz" Matsumoto 211d417b02 Merge pull request #3986 from ksss/enum-zip
Support block yielding for Enumerable#zip
2018-03-27 13:52:13 +09:00
ksss 3a22d113ee Reimplement Enumerable#zip with Enumerator
for fix some specs
- [passes each element of the result array to a block and return nil if a block is given](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L11-L17)
- [converts arguments to arrays using #to_ary](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L23-L27)
- [converts arguments to enums using #to_enum](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L29-L34)
- [gathers whole arrays as elements when each yields multiple](https://github.com/ruby/spec/blob/a585ec35d185435e5c11f371ba4ed2a29d8817bd/core/enumerable/zip_spec.rb#L36-L39)
2018-03-27 10:53:33 +09:00
ksss b1c8fad94a Should raise TypeError instead of NoMethodError 2018-03-27 10:52:32 +09:00
ksss 5a7ce01f12 Support block yielding for Enumerable#zip 2018-03-27 10:51:59 +09:00
Yukihiro "Matz" Matsumoto 203b071ca2 Merge pull request #3985 from take-cheeze/revert_ai_protocol
Revert #3984 .
2018-03-26 11:07:50 +09:00
Takeshi Watanabe baff7c63ee Revert #3984 . 2018-03-26 11:02:05 +09:00
Yukihiro "Matz" Matsumoto 0da7b4454f Merge pull request #3984 from take-cheeze/merge_socket
Catch up with latest mruby-socket.
2018-03-25 22:25:15 +09:00
Takeshi Watanabe 306cb99b10 Merge commit '36d016afd663d34607c843d03371bedb71efa34e' 2018-03-25 21:10:11 +09:00
Yukihiro "Matz" Matsumoto 4b5c21cf3b Merge pull request #3982 from take-cheeze/fix_str_cmp
Return nil if type differ in `String#<=>`.
2018-03-24 16:27:22 +09:00
Takeshi Watanabe 77a3863a3d Return nil if type differ in String#<=>. 2018-03-24 16:18:44 +09:00