Commit Graph

10127 Commits

Author SHA1 Message Date
KOBAYASHI Shuji cdb458ed4e Commented out String#scan because it is not implemented yet 2019-04-21 20:34:39 +09:00
Yukihiro "Matz" Matsumoto 88c3595db3 Merge pull request #4393 from robfors/twiddle_wakka
Fixes the twiddle wakka comparison algorithm
2019-04-20 07:31:11 +09:00
Yukihiro "Matz" Matsumoto ff765c814d Merge pull request #4390 from shuujii/add-type-check-in-String-aset
Add type check (conversion) in `String#[]=`
2019-04-20 07:30:12 +09:00
Rob 73bb144ef0 Fixes the twiddle wakka comparison algorithm to support passing only a major number 2019-04-19 17:18:30 -04:00
Yukihiro "Matz" Matsumoto 2f9ebc6f32 Merge pull request #4392 from dearblue/true-false-p
Add `mrb_true_p()` and `mrb_false_p()` macro functions
2019-04-20 04:09:34 +09:00
dearblue 125c3bef19 Add mrb_true_p() and mrb_false_p() macro functions 2019-04-19 22:50:05 +09:00
KOBAYASHI Shuji 4a8b88f775 Add type check (conversion) in String#[]=
Before this patch:

  'a'[0] = 1        #=> 1
  'a'[:a] = '1'     #=> ArgumentError
  'a'[:a, 0] = '1'  #=> ArgumentError
  'a'[0, :a] = '1'  #=> ArgumentError
  'a'[0, 1] = 1     #=> 1

After this patch / Ruby:

  'a'[0] = 1        #=> TypeError
  'a'[:a] = '1'     #=> TypeError
  'a'[:a, 0] = '1'  #=> TypeError
  'a'[0, :a] = '1'  #=> TypeError
  'a'[0, 1] = 1     #=> TypeError
2019-04-19 20:14:23 +09:00
Yukihiro "Matz" Matsumoto 05f65d2d42 Merge pull request #4388 from shuujii/remove-duplicated-include-Comparable-in-mrblib-string.rb
Remove duplicated `include Comparable` in `mrblib/string.rb`
2019-04-19 10:44:14 +09:00
KOBAYASHI Shuji 916045921e Remove duplicated include Comparable in mrblib/string.rb 2019-04-18 19:58:05 +09:00
Yukihiro "Matz" Matsumoto 2f6baf60e9 Merge pull request #4387 from shuujii/add-Array-sample-test
Add `Array#sample` test
2019-04-18 08:10:45 +09:00
KOBAYASHI Shuji 2ae727ac3a Add Array#sample test
And simplify tests for `Array#shuffle` and `Array#shuffle!`.
2019-04-17 21:04:46 +09:00
Yukihiro "Matz" Matsumoto 77c42988c8 Merge pull request #4385 from shuujii/avoid-potential-zero-size-array-declaration
Avoid potential zero size array declaration; fix #4382
2019-04-16 21:53:28 +09:00
KOBAYASHI Shuji 79a7f18150 Avoid potential zero size array declaration; fix #4382 2019-04-16 19:56:11 +09:00
Yukihiro "Matz" Matsumoto 4e45e320b0 Fixed a bug in recursive mrb_top_run calls; fix #4384 2019-04-16 18:47:46 +09:00
Yukihiro "Matz" Matsumoto 3760f58d53 Merge pull request #4383 from Shokuji/fix_mruby-io_test
Fix test in mruby-io
2019-04-16 17:34:50 +09:00
Shokuji cdfeb53887 Merge branch 'master' into fix_mruby-io_test 2019-04-16 09:47:32 +09:00
Yukihiro "Matz" Matsumoto 4e3e4260c3 Merge pull request #4381 from shuujii/fix-missing-assertions-in-mruby-random-test
Fix missing assertions in `mruby-random` test
2019-04-16 08:39:08 +09:00
KOBAYASHI Shuji d53eb8a377 Fix missing assertions in mruby-random test 2019-04-15 19:03:39 +09:00
Shouji Kuboyama 164985881b Fix test, popen and cmd in mruby-io 2019-04-15 17:16:08 +09:00
Yukihiro "Matz" Matsumoto 6b8d3c7070 Fixed wrong function names; fix #4380 2019-04-15 07:15:38 +09:00
Yukihiro "Matz" Matsumoto 7a62efae63 Merge pull request #4379 from shuujii/extract-similar-codes-to-macros-for-math-opcode-in-mrb_vm_exec
Extract similar codes to macros for math opcode in `mrb_vm_exec()`
2019-04-15 07:08:27 +09:00
KOBAYASHI Shuji 30c880bea9 Extract similar codes to macros for math opcode in mrb_vm_exec 2019-04-14 22:40:17 +09:00
Yukihiro "Matz" Matsumoto ea6aab20e8 Merge pull request #4378 from dearblue/memleak-hashtable
Fix memory leak for hash table index if occur out of memory
2019-04-14 20:36:29 +09:00
Yukihiro "Matz" Matsumoto 6ad89d30d2 Merge pull request #4377 from dearblue/wrong-iv-size
Fix wrong size of instance variable if occur out of memory
2019-04-14 20:36:05 +09:00
Yukihiro "Matz" Matsumoto e74a8a7360 Merge pull request #4376 from dearblue/leak-symbols
Fix leaked function symbols
2019-04-14 20:35:19 +09:00
Yukihiro "Matz" Matsumoto 4a1d29cbb8 Merge pull request #4375 from dearblue/forgotten-structs
Include `RFiber` and `RIstruct` as a part of `RVALUE`
2019-04-14 20:34:45 +09:00
Yukihiro "Matz" Matsumoto ec41262e22 Merge pull request #4374 from dearblue/hexdump
Fix hexdigits convertion
2019-04-14 20:34:14 +09:00
dearblue d328808892 Fix memory leak for hash table index if occur out of memory 2019-04-14 17:55:20 +09:00
dearblue d8527d17ea Fix wrong size of instance variable if occur out of memory 2019-04-14 17:42:35 +09:00
dearblue d557f97732 Remove pointer check after mrb_malloc() 2019-04-14 17:39:50 +09:00
dearblue 3f3e4754d9 Fix leaked function symbols
- `free_heap()` in src/gc.c
- `symhash()` in src/symbol.c
- `no_optimize()` in mrbgems/mruby-compiler/core/codegen.c
2019-04-14 17:23:16 +09:00
dearblue dac0f3f5e8 Fix string index for appending
`sizeof(string-literal)` is included `'\0'` character
2019-04-14 16:16:05 +09:00
dearblue c2fa935fee Fix hexdigits convertion 2019-04-14 16:11:21 +09:00
dearblue 0ebbc491a1 Include RFiber and RIstruct as a part of RVALUE 2019-04-14 15:35:51 +09:00
Yukihiro "Matz" Matsumoto 4d8ff2fba4 Merge pull request #4373 from shuujii/fix-broken-NaN-with-MRB_NAN_BOXING
Fix broken NaN with `MRB_NAN_BOXING`
2019-04-14 12:25:54 +09:00
KOBAYASHI Shuji f639da0f1c Fix broken NaN with MRB_NAN_BOXING
Example:

  $ bin/mruby -e '(Float::INFINITY - Float::INFINITY).nan?'
  zsh: segmentation fault

Cause:

  `SET_FLOAT_VALUE` is not used. It is needed for normalizing NaN.

Treatment:

  In my environment, this issue could be reproduced only when
  `infinity - infinity`, however `SET_FLOAT_VALUE` should be used in all
  arithmetic operations (regardless of boxing setting), I think.

  So I fixed all similar codes by extracting to macro.
2019-04-13 19:27:17 +09:00
Yukihiro "Matz" Matsumoto 79fd986bcb Small refactoring in mrb_funcall_with_block. 2019-04-12 23:04:10 +09:00
Yukihiro "Matz" Matsumoto 7f1984a01e Merge pull request #4372 from shuujii/refine-assert_float
Refine `assert_float`
2019-04-12 22:58:57 +09:00
Yukihiro "Matz" Matsumoto befdf59e61 Deallocate s->lines in codegen_error; ref #4370 2019-04-12 22:54:25 +09:00
Yukihiro "Matz" Matsumoto 00545fc51d The number of local variables should be less than 1024; fix #4370
The `env` stores stack length in a 10 bit field.
See `MRB_ENV_STACK_LEN()` macro.
2019-04-12 22:52:26 +09:00
KOBAYASHI Shuji 6626fbc500 Refine assert_float
Avoid arithmetic operations when `exp` and/or `act` are infinity or NaN.
2019-04-12 22:27:07 +09:00
Yukihiro "Matz" Matsumoto 6da10f643a Merge pull request #4369 from shuujii/remove-incorrect-flags-updating-in-mrb_regexp_p
Remove incorrect flags updating in `mrb_regexp_p()`
2019-04-12 21:01:49 +09:00
Yukihiro "Matz" Matsumoto 9b9c41d699 Merge pull request #4371 from clayton-shopify/fix-buffer-overflows
Fix buffer overflows in parser.
2019-04-12 19:56:35 +09:00
Clayton Smith 57e617620a Fix buffer overflows in parser. 2019-04-11 20:07:43 -04:00
KOBAYASHI Shuji 0c9c3f08ee Remove incorrect flags updating in mrb_regexp_p() 2019-04-11 21:42:18 +09:00
Yukihiro "Matz" Matsumoto 9c252410cf Merge pull request #4368 from shuujii/use-mrb_immediate_p-in-mrb_obj_freeze-and-mrb_obj_frozen
Use `mrb_immediate_p()` in `mrb_obj_freeze()` and `mrb_obj_frozen()`
2019-04-10 19:34:58 +09:00
KOBAYASHI Shuji 7b0ebed033 Use mrb_immediate_p() in mrb_obj_freeze() and mrb_obj_frozen() 2019-04-10 19:19:53 +09:00
Yukihiro "Matz" Matsumoto 4776ac50ed Remove too aggressive initialize call in mrb_instance_new. 2019-04-10 19:11:35 +09:00
Yukihiro "Matz" Matsumoto 88ac7549c0 Remove MRB_API from mrb_instance_new. 2019-04-10 19:11:35 +09:00
Yukihiro "Matz" Matsumoto d0b30f4ce2 Merge pull request #4367 from shuujii/extract-frozen-checking-to-function
Extract frozen checking to function
2019-04-10 06:03:32 +09:00