Hiroshi Mimaki
4c91adc4b2
Update version to 2.1.0. (mruby 2.1.0 RC)
2019-10-18 14:59:27 +09:00
Hiroshi Mimaki
b654683545
Merge master.
2019-10-18 14:46:03 +09:00
Yukihiro "Matz" Matsumoto
20d01f118d
Merge pull request #4778 from shuujii/move-methods-of-Kernel-to-kernel.rb-from-io.rb-in-mruby-io-gem
...
Move methods of `Kernel` to `kernel.rb` from `io.rb` in `mruby-io` gem
2019-10-18 12:23:28 +09:00
KOBAYASHI Shuji
e5d767b149
Move methods of Kernel to kernel.rb from io.rb in mruby-io gem
2019-10-18 10:50:23 +09:00
Yukihiro "Matz" Matsumoto
e5f7b1d262
Merge pull request #4777 from yurie/pr
...
Remove constant export declaration for MRBC output compiled as C
2019-10-18 06:58:08 +09:00
yuri
d29178a9cd
delete extern in C
2019-10-17 23:49:58 +09:00
Yukihiro "Matz" Matsumoto
bc4799361e
Merge pull request #4776 from shuujii/make-IO-each-family-without-block-to-return-Enumerator
...
Make `IO#each` family without block to return `Enumerator`
2019-10-17 20:50:22 +09:00
KOBAYASHI Shuji
14870a290d
Make IO#each family without block to return Enumerator
2019-10-17 20:14:02 +09:00
Yukihiro "Matz" Matsumoto
84db8edade
Merge pull request #4775 from shuujii/use-mrb_sym_name_len-instead-of-mrb_sym_name-in-assign_class_name
...
Use `mrb_sym_name_len` instead of `mrb_sym_name` in `assign_class_name`
2019-10-16 20:22:00 +09:00
KOBAYASHI Shuji
3827c4deb2
Use mrb_sym_name_len instead of mrb_sym_name in assign_class_name
2019-10-16 18:18:58 +09:00
Yukihiro "Matz" Matsumoto
b7af9c47b3
Merge pull request #4774 from shuujii/adjust-buf-size-in-str_escape
...
Adjust `buf` size in `str_escape`
2019-10-16 07:36:33 +09:00
KOBAYASHI Shuji
b0507e7678
Adjust buf size in str_escape
2019-10-15 19:23:30 +09:00
Yukihiro "Matz" Matsumoto
dc474b625b
Merge pull request #4773 from shuujii/fix-the-example-of-Array-intersection-in-the-document
...
Fix the example of `Array#intersection` in the document [ci skip]
2019-10-14 18:56:12 +09:00
KOBAYASHI Shuji
ac29638a8a
Fix the example of Array#intersection in the document [ci skip]
2019-10-14 18:22:00 +09:00
Yukihiro "Matz" Matsumoto
bdacdfaea9
Add Array#intersection which is new in Ruby2.7.
2019-10-14 17:04:19 +09:00
Yukihiro "Matz" Matsumoto
682406a384
Move Array#difference just after Array#-.
2019-10-14 17:04:19 +09:00
Yukihiro "Matz" Matsumoto
67ea80b2bd
Fixed a bug in Array#difference.
2019-10-14 17:04:19 +09:00
Yukihiro "Matz" Matsumoto
265034134a
Merge pull request #4772 from shuujii/refactor-mrb_class_name_class
...
Refactor `mrb_class_name_class`
2019-10-13 17:20:46 +09:00
KOBAYASHI Shuji
6377c9bce5
Refactor mrb_class_name_class
...
- Use `mrb_sym_name_len` instead of `mrb_sym_name` (class name should not
be escaped).
- Avoid `mrb_str_dup` (it is unnecessary to be shared string because it is
changed).
2019-10-13 17:03:39 +09:00
Yukihiro "Matz" Matsumoto
d128e2d09e
Merge pull request #4770 from shuujii/sHARED-string-is-not-required-when-sharing-POOL-string
...
SHARED string is not required when sharing POOL string
2019-10-12 23:35:43 +09:00
Yukihiro "Matz" Matsumoto
9f3b6ebbde
Merge pull request #4769 from shuujii/rename-str_make_shared-to-str_share
...
Rename `str_make_shared()` to `str_share()` in `src/string.c`
2019-10-12 23:33:20 +09:00
KOBAYASHI Shuji
7594983671
SHARED string is not required when sharing POOL string
...
The heap string buffer of POOL string always exists, does not need to be
released, and read only, so it can be shared as NOFREE string.
2019-10-12 21:32:56 +09:00
KOBAYASHI Shuji
cdd36c979d
Rename str_make_shared() to str_share() in src/string.c
...
Because it may not create `struct mrb_shared_string`.
2019-10-12 12:49:51 +09:00
Yukihiro "Matz" Matsumoto
c310c8dc24
Move exception raising to scope_new.
...
Besides that fix bugs that mistakenly calls `raise_error` that emits
code to raise runtime error instead of `codegen_error` that terminates
code generation immediately.
2019-10-11 20:31:29 +09:00
Yukihiro "Matz" Matsumoto
20ceee794b
Merge pull request #4767 from shuujii/remove-unused-exception-classes-in-mruby-io-gem
...
Remove unused exception classes in `mruby-io` gem
2019-10-11 19:54:44 +09:00
KOBAYASHI Shuji
a7ae0d5b9e
Remove unused exception classes in mruby-io gem
2019-10-11 11:32:14 +09:00
Yukihiro "Matz" Matsumoto
529a336966
Fixed a bug in mruby-time with NO_GETTIMEOFDAT.
2019-10-10 20:46:12 +09:00
Yukihiro "Matz" Matsumoto
78e54904b5
Silence double free warnings by mrb_local_free().
...
The warnings were detected by cppcheck.
2019-10-10 20:46:12 +09:00
Yukihiro "Matz" Matsumoto
8fe6a1904c
Merge pull request #4764 from shuujii/integrate-mrb_str_inspect-and-mrb_str_dump
...
Integrate `mrb_str_inspect` and `mrb_str_dump`
2019-10-10 20:45:59 +09:00
KOBAYASHI Shuji
7ce5d33947
Integrate mrb_str_inspect and mrb_str_dump
2019-10-10 19:50:48 +09:00
Yukihiro "Matz" Matsumoto
20aab8a10b
Merge pull request #4763 from shuujii/mrdb-Fix-that-print-command-raises-FrozenError
...
Fix that `print` command raises `FrozenError` in `mrdb`; ref 1f5a7f2f
2019-10-09 22:47:12 +09:00
KOBAYASHI Shuji
7f6e8e8ddc
Fix that print command raises FrozenError in mrdb; ref 1f5a7f2f
...
#### Before this patch:
```
$ echo 'p true' | bin/mrdb /dev/null
(/dev/null:1) mruby application exited.
FrozenError: can't modify frozen String
(-:0)
```
#### After this patch:
```
$ echo 'p true' | bin/mrdb /dev/null
(/dev/null:1) $1 = true
(/dev/null:1)
```
2019-10-09 20:00:17 +09:00
Yukihiro "Matz" Matsumoto
7624e23426
Revert part of #4758 to reduce number of tests.
...
More tests, more time.
2019-10-09 10:29:04 +09:00
Yukihiro "Matz" Matsumoto
3e9b501ff8
Merge pull request #4761 from take-cheeze/fix_4759
...
Add mrbgem version field to lock file
2019-10-09 08:01:52 +09:00
take-cheeze
f7616c4287
Add mrbgem version field to lock file
2019-10-09 02:22:33 +09:00
Yukihiro "Matz" Matsumoto
b68818a8a0
Merge pull request #4758 from shuujii/implement-Ruby2.7-frozen-strings-from-Module-name
...
Implement Ruby2.7's frozen strings from `Module#name`
2019-10-08 22:25:43 +09:00
Yukihiro "Matz" Matsumoto
e348326fa7
Merge pull request #4760 from shuujii/use-mrb_str_concat-instead-of-mrb_str_to_str-plus-mrb_str_cat_str
...
Use `mrb_str_concat` instead of `mrb_str_to_str` + `mrb_str_cat_str`
2019-10-08 22:23:59 +09:00
KOBAYASHI Shuji
97c62408fb
Use mrb_str_concat instead of mrb_str_to_str + mrb_str_cat_str
2019-10-08 18:55:45 +09:00
KOBAYASHI Shuji
fb103c1319
Implement Ruby2.7's frozen strings from Module#name
2019-10-08 17:34:13 +09:00
Yukihiro "Matz" Matsumoto
b7a8d538c1
Remove unnecessary function: mrb_str_freeze.
2019-10-06 22:18:11 +09:00
Yukihiro "Matz" Matsumoto
ff1ac49a72
Merge pull request #4754 from dearblue/get-keyword-args
...
Get keyword arguments with `mrb_get_args()`
2019-10-06 22:08:15 +09:00
dearblue
5f929d6940
Get keyword arguments with mrb_get_args()
...
Keyword arguments can now be retrieved with the `:` specifier and
`mrb_kwargs` data.
For the interface, I referred to CRuby's `rb_get_kwargs()`.
For implementation, I referred to `OP_KARG` or etc.
2019-10-06 21:23:55 +09:00
Yukihiro "Matz" Matsumoto
ffaa2968ed
Merge pull request #4757 from shuujii/refine-the-usage-message-of-mirb-command
...
Refine the usage message of `mirb` command
2019-10-06 20:23:30 +09:00
Yukihiro "Matz" Matsumoto
028ab5a143
Merge pull request #4755 from shuujii/refine-the-usage-message-of-mruby-command
...
Refine the usage message of `mruby` command
2019-10-06 20:23:04 +09:00
KOBAYASHI Shuji
ea14df2e3a
Refine the usage message of mirb command
2019-10-06 20:12:28 +09:00
KOBAYASHI Shuji
0cdc984b1c
Refine the usage message of mruby command
2019-10-06 19:35:41 +09:00
Yukihiro "Matz" Matsumoto
c613813364
Merge pull request #4752 from shuujii/drop-initialization-dependency-from-mruby-print-to-mruby-sprintf
...
Drop initialization dependency from `mruby-print` to `mruby-sprintf`
2019-10-05 17:18:12 +09:00
KOBAYASHI Shuji
1d8456fe7d
Drop initialization dependency from mruby-print to mruby-sprintf
...
In the old implementation, `Kernel#printf` raise error if `mruby-sprintf`
gem isn't specified before `mruby-print` gem. The new implementation
eliminates this ordering issue. This way is the same as `Kernel#printf` and
`IO#printf` in `mruby-io` gem.
2019-10-05 15:22:43 +09:00
Yukihiro "Matz" Matsumoto
1f5a7f2f49
Freeze strings from nil.to_s, true.to_s, false.to_s.
...
This is an experimental changes in Ruby 2.7.
2019-10-04 16:02:50 +09:00
Yukihiro "Matz" Matsumoto
08eafe21d3
Implement Ruby2.7's frozen strings from Symbol#to_s.
2019-10-04 14:42:01 +09:00
Yukihiro "Matz" Matsumoto
264239f78f
Refactor local variables addition in optional/keyword arguments.
2019-10-04 14:39:53 +09:00
Yukihiro "Matz" Matsumoto
d4e9de84c5
Merge pull request #4751 from shuujii/remove-unused-code-to-old-Visual-Studio
...
Remove unused code to old Visual Studio in `tasks/toolchains/visualcpp.rake`
2019-10-04 10:11:30 +09:00
KOBAYASHI Shuji
edd412966e
Remove unused code to old Visual Studio in tasks/toolchains/visualcpp.rake
2019-10-04 09:31:54 +09:00
Yukihiro "Matz" Matsumoto
4695542f37
Merge pull request #4750 from dearblue/c++-abi
...
Remove duplicates header files in `src/pool.c`
2019-10-04 08:03:38 +09:00
dearblue
fab062f7b5
Remove duplicates header files in src/pool.c
...
These are included in `mruby.h`.
As a background, if `enable_cxx_abi` is specified, the macro that
defines the maximum value in `stdint.h` is undefined depending on the
environment.
- Confirmed with gcc on FreeBSD 12.0 and mingw32-gcc available on
FreeBSD.
- `INTPTR_MAX`, `INT64_MAX` and `UINT64_MAX` are defined by `cstdint`
added in C++11. But `toolchains :gcc` adds `-std=c++03`, so the macros
are not defined.
- To have these defined in `C++03`, `__STDC_CONSTANT_MACROS` must be
defined in advance. This is already done by `mruby.h`.
2019-10-03 23:32:24 +09:00
Yukihiro "Matz" Matsumoto
de176d37e0
Merge pull request #4749 from shuujii/add-tests-for-4746
...
Add tests for #4746
2019-10-03 21:30:23 +09:00
KOBAYASHI Shuji
882bc80dd0
Add tests for #4746
2019-10-03 16:59:18 +09:00
Yukihiro "Matz" Matsumoto
3d2781311e
Merge pull request #4748 from HirohitoHigashi/master
...
Fix opcode semantics comment miss.
2019-10-03 15:18:06 +09:00
Hirohito Higashi
63496a6730
Fix opcode semantics comment miss. (op_jmpnil)
2019-10-03 15:06:06 +09:00
Hirohito Higashi
b4bf7a2282
Fix opcode semantics comment miss.
2019-10-03 14:44:47 +09:00
Yukihiro "Matz" Matsumoto
ec6c8b2a3c
Add local variable reordering to kwargs; ref #4746
2019-10-03 09:17:37 +09:00
Yukihiro "Matz" Matsumoto
47cdda370e
Need to reorder local variables defined in opt; fix #4746
...
For example, local variables in the following def:
```ruby
def foo(a = (not_set = true), &block)
...
end
```
should be `a, block, not_set`, but were `a, not_set, block`.
2019-10-03 07:52:31 +09:00
Yukihiro "Matz" Matsumoto
306f02117b
Refactor append_gen function.
2019-10-03 07:52:03 +09:00
Yukihiro "Matz" Matsumoto
a406a35cf8
Merge pull request #4747 from shuujii/avoid-symhash-call-for-inline-symbol-in-sym_intern
...
Avoid `symhash()` call for inline symbol in `sym_intern()`
2019-10-02 23:36:32 +09:00
KOBAYASHI Shuji
855d996847
Avoid symhash() call for inline symbol in sym_intern()
2019-10-02 16:56:22 +09:00
Yukihiro "Matz" Matsumoto
c33100c4f0
Merge pull request #4736 from dearblue/ast-strdump
...
Escape the AST string
2019-10-02 07:07:20 +09:00
Yukihiro "Matz" Matsumoto
97433c0263
Merge pull request #4745 from shuujii/dump-more-node-types
...
Dump more node types in `mrb_parser_dump`
2019-10-01 19:35:11 +09:00
KOBAYASHI Shuji
8df2763b56
Support NODE_LITERAL_DELIM in mrb_parser_dump
...
#### Before this patch:
```terminal
$ bin/mruby -v -e '%w[1 2]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 NODE_WORDS:
00001 NODE_STR "1" len 1
00001 node type: 85 (0x55)
00001 NODE_STR "2" len 1
(snip)
```
#### After this patch:
```terminal
$ bin/mruby -v -e '%w[1 2]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 NODE_WORDS:
00001 NODE_STR "1" len 1
00001 NODE_LITERAL_DELIM
00001 NODE_STR "2" len 1
(snip)
```
2019-10-01 17:20:39 +09:00
KOBAYASHI Shuji
42c7f2d6b0
Support NODE_SYMBOLS in mrb_parser_dump
...
#### Before this patch:
```terminal
$ bin/mruby -v -e '%i[1]; %I[#{2}]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 node type: 87 (0x57)
00001 node type: 87 (0x57)
(snip)
```
#### After this patch:
```terminal
$ bin/mruby -v -e '%i[1]; %I[#{2}]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 NODE_SYMBOLS:
00001 NODE_STR "1" len 1
00001 NODE_SYMBOLS:
00001 NODE_STR "" len 0
00001 NODE_BEGIN:
00001 NODE_INT 2 base 10
00001 NODE_STR "" len 0
(snip)
```
2019-10-01 17:10:34 +09:00
KOBAYASHI Shuji
732ef6b10e
Support NODE_WORDS in mrb_parser_dump
...
#### Before this patch:
```terminal
$ bin/mruby -v -e '%w[1]; %W[#{2}]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 node type: 86 (0x56)
00001 node type: 86 (0x56)
(snip)
```
#### After this patch:
```terminal
$ bin/mruby -v -e '%w[1]; %W[#{2}]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 NODE_WORDS:
00001 NODE_STR "1" len 1
00001 NODE_WORDS:
00001 NODE_STR "" len 0
00001 NODE_BEGIN:
00001 NODE_INT 2 base 10
00001 NODE_STR "" len 0
(snip)
```
2019-10-01 17:07:30 +09:00
Yukihiro "Matz" Matsumoto
cdb35a12fc
Merge pull request #4744 from shuujii/remove-a-trailing-space-in-MRUBY_DESCRIPTION
...
Remove a trailing space in `MRUBY_DESCRIPTION`
2019-10-01 12:16:27 +09:00
KOBAYASHI Shuji
482d0626b8
Remove a trailing space in MRUBY_DESCRIPTION
2019-09-30 21:39:13 +09:00
KOBAYASHI Shuji
16745261e3
Support NODE_DSYM in mrb_parser_dump
...
#### Before this patch:
```terminal
$ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 node type: 83 (0x53)
00001 NODE_ARRAY:
00001 NODE_KW_HASH:
00001 key:
00001 node type: 83 (0x53)
00001 value:
00001 NODE_INT 0 base 10
(snip)
```
#### After this patch:
```terminal
$ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]'
mruby 2.0.1 (2019-04-04)
00001 NODE_SCOPE:
00001 NODE_BEGIN:
00001 NODE_DSYM:
00001 NODE_DSTR:
00001 NODE_STR "" len 0
00001 NODE_BEGIN:
00001 NODE_INT 1 base 10
00001 NODE_STR "" len 0
00001 NODE_ARRAY:
00001 NODE_KW_HASH:
00001 key:
00001 NODE_DSYM:
00001 NODE_DSTR:
00001 NODE_STR "" len 0
00001 NODE_BEGIN:
00001 NODE_INT 2 base 10
00001 NODE_STR "" len 0
00001 value:
00001 NODE_INT 0 base 10
(snip)
```
2019-09-30 11:54:51 +09:00
Yukihiro "Matz" Matsumoto
9ddde3be39
Merge pull request #4742 from dearblue/mrb_hash_value
...
Remove unnecessary type `mrb_hash_value`
2019-09-30 03:06:56 +09:00
dearblue
40e8a90e89
Remove unnecessary type mrb_hash_value
...
The type `mrb_hash_value` is no longer used by the segmented list
implementation (ref e8dcfe1 and e65d426 ).
2019-09-29 23:55:38 +09:00
Yukihiro "Matz" Matsumoto
4621907fca
Merge pull request #4741 from shuujii/print-missing-colon-before-newline-in-mrb_parser_dump
...
Print missing `:` before newline in `mrb_parser_dump`
2019-09-29 22:05:41 +09:00
KOBAYASHI Shuji
a5d140ae42
Print missing : before newline in mrb_parser_dump
2019-09-29 17:14:52 +09:00
Yukihiro "Matz" Matsumoto
e55f881bc2
Merge pull request #4740 from dearblue/rethrow-break
...
Allow rethrowing `MRB_TT_BREAK`
2019-09-29 15:38:16 +09:00
dearblue
d8f1099419
Allow rethrowing MRB_TT_BREAK
2019-09-29 15:11:36 +09:00
Yukihiro "Matz" Matsumoto
ccf7a8248f
Merge pull request #4739 from dearblue/restore-arena
...
Restore GC arena frequently
2019-09-29 14:40:29 +09:00
Yukihiro "Matz" Matsumoto
a1886942eb
Further refactoring over #4738
2019-09-29 14:30:41 +09:00
Yukihiro "Matz" Matsumoto
c5d500d51e
Merge pull request #4738 from dearblue/unneed-assign
...
Remove unnecessary assignments
2019-09-29 14:29:07 +09:00
dearblue
39855a3304
Restore GC arena frequently
2019-09-29 13:57:22 +09:00
Yukihiro "Matz" Matsumoto
704c40bfa2
Merge pull request #4737 from dearblue/hash-delete
...
Add an annotation about the return value
2019-09-29 13:56:31 +09:00
Yukihiro "Matz" Matsumoto
bbfd64d01b
Add an annotation of the return value from mrb_delete_key; #4737
...
The return value from `mrb_delete_key` needs to be protected from GC in
some cases.
2019-09-29 13:53:45 +09:00
dearblue
e48207cdb3
Remove unnecessary assignments
2019-09-29 13:45:16 +09:00
Yukihiro "Matz" Matsumoto
acbea6affe
Merge pull request #4735 from shuujii/remove-unused-node-type-in-codegen
...
Remove unused node type in `codegen()`
2019-09-29 12:47:16 +09:00
dearblue
f6d3d675ab
Add an annotation about the return value
2019-09-29 11:49:15 +09:00
dearblue
e2f54ff594
Escape the AST string
2019-09-29 10:39:55 +09:00
KOBAYASHI Shuji
ae530d89c4
Remove unused node type in codegen()
2019-09-28 15:15:31 +09:00
Yukihiro "Matz" Matsumoto
19e4f56c67
Merge pull request #4734 from shuujii/simplify-arguments-check-in-String-rindex
...
Simplify arguments check in `String#rindex`
2019-09-28 00:20:01 +09:00
Yukihiro "Matz" Matsumoto
2de757eef0
Replace mrb_sym_name with mrb_sym_dump; ref #4684
2019-09-28 00:06:01 +09:00
KOBAYASHI Shuji
198683e914
Simplify arguments check in String#rindex
...
Also fix document about type of the first argument.
2019-09-27 17:13:57 +09:00
Yukihiro "Matz" Matsumoto
5cd6ed4511
Merge pull request #4733 from shuujii/use-type-predicate-macros-instead-of-mrb_type-if-possible
...
Use type predicate macros instead of `mrb_type` if possible
2019-09-27 00:00:03 +09:00
Yukihiro "Matz" Matsumoto
d4be545d54
Fixed codedump for human readable symbol format; ref #4684
2019-09-26 23:56:40 +09:00
KOBAYASHI Shuji
feaf80d899
Use type predicate macros instead of mrb_type if possible
...
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
2019-09-26 22:23:27 +09:00
Yukihiro "Matz" Matsumoto
60cc46a92c
Use proper type specifier for mrb_raisef(); ref #4731
...
The following two may be different:
* `%d` for `int`
* `%i` for `mrb_int`
2019-09-26 09:48:01 +09:00
Yukihiro "Matz" Matsumoto
184aeb0694
Merge pull request #4732 from dearblue/inttypes
...
Use inttypes for `snprintf()`
2019-09-26 06:31:07 +09:00
Yukihiro "Matz" Matsumoto
0d661bcca6
Merge pull request #4731 from dearblue/consistent-type
...
Keep the type of `posarg` consistent
2019-09-26 06:30:55 +09:00
Yukihiro "Matz" Matsumoto
9bf193b49a
Merge pull request #4728 from shuujii/remove-MRB_TT_HAS_BASIC-macro
...
Remove `MRB_TT_HAS_BASIC` macro
2019-09-25 23:55:55 +09:00
Yukihiro "Matz" Matsumoto
5c381032b0
Merge pull request #4729 from dearblue/fix-4598
...
Fix `MRB_WITHOUT_FLOAT` reversal; fix #4598
2019-09-25 23:55:36 +09:00
Yukihiro "Matz" Matsumoto
b5fa2dadfc
Merge pull request #4730 from dearblue/fall-through
...
Add "fall through"
2019-09-25 23:53:34 +09:00
Yukihiro "Matz" Matsumoto
a365f9a67d
Rename symbol-to-string functions; close #4684
...
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
2019-09-25 23:52:00 +09:00
dearblue
84d9296c05
Use inttypes for snprintf()
2019-09-25 23:28:05 +09:00
dearblue
9f6ba4bfa1
Keep the type of posarg consistent
...
Match the type with the caller and related functions.
2019-09-25 23:17:06 +09:00
dearblue
5ce1bec1bc
Add "fall through"
2019-09-25 23:07:05 +09:00
dearblue
eb2f34719d
Fix MRB_WITHOUT_FLOAT reversal; fix #4598
2019-09-25 22:55:41 +09:00
KOBAYASHI Shuji
27e8ea4ea2
Remove MRB_TT_HAS_BASIC macro
...
The value of `MRB_TT_HAS_BASIC` is meaningless because `MRB_TT_HAS_BASIC` is
no longer used with `MRB_WORD_BOXING` at b2c3d88f .
2019-09-25 18:17:01 +09:00
Yukihiro "Matz" Matsumoto
3c1a2612e7
Merge pull request #4727 from shuujii/exception-initialize-should-not-allow-two-or-more-arguments
...
`Exception#initialize` should not allow two or more arguments
2019-09-24 23:01:13 +09:00
KOBAYASHI Shuji
07856a7e8f
Exception#initialize should not allow two or more arguments
2019-09-24 21:43:46 +09:00
Yukihiro "Matz" Matsumoto
4f0f712b51
Merge pull request #4726 from shuujii/fix-Fixnum-overflow-test-in-Integer-lshift-test
...
Fix `Fixnum` overflow test in `Integer#<<` test
2019-09-23 23:27:15 +09:00
KOBAYASHI Shuji
549317a36b
Fix Fixnum overflow test in Integer#<< test
...
- Skip when `MRB_WITHOUT_FLOAT` is defined.
- Make `Fixnum` overflow even when `MRB_INT64` is defined.
2019-09-23 21:59:35 +09:00
Yukihiro "Matz" Matsumoto
a4f2e1276c
Merge pull request #4725 from shuujii/implement-all-type-predicate-macros-for-MRB_WORD_BOXING
...
Implement all type predicate macros for `MRB_WORD_BOXING`
2019-09-23 03:30:24 +09:00
KOBAYASHI Shuji
5dda4f5da3
Implement all type predicate macros for MRB_WORD_BOXING
...
The default implementations of type predicate macros use `mrb_type`.
But `mrb_type` with `MRB_WORD_BOXING` isn't very efficient, so the new
implementations avoid `mrb_type`.
2019-09-22 22:36:12 +09:00
Yukihiro "Matz" Matsumoto
046b116c18
Merge pull request #4716 from MaskRay/rodata
...
Rename MRB_USE_ETEXT_EDATA to MRB_USE_LINK_TIME_RO_DATA_P and support lld linked programs
2019-09-22 17:00:49 +09:00
Fangrui Song
7f044341f9
Rename MRB_USE_ETEXT_EDATA to MRB_USE_LINK_TIME_RO_DATA_P and support lld linked programs
...
In lld linked programs, .rodata comes before .text, thus mrb_ro_data_p
will return false for strings in .rodata. Change the lower bound from
_etext to __ehdr_start to catch these cases. This works for ld.bfd, gold
and lld, and it does not have false positives even if .init_array does
not exist.
Remove the branch that uses _edata: strings in .data can be modified so
this is semantically incorrect. Delete the __APPLE__ branch (its
manpages say get_etext() and get_edata() are strongly discouraged).
.init_array has been adopted by most ELF platforms to supersede .ctors.
Neither _etext nor _edata is used, so rename MRB_USE_ETEXT_EDATA to
MRB_USE_EHDR_START.
2019-09-21 17:55:14 -07:00
Yukihiro "Matz" Matsumoto
8db7dfb5c4
Merge pull request #4724 from shuujii/use-mrb_define_method-instead-of-mrb_define_alias
...
Use `mrb_define_method` instead of `mrb_define_alias`
2019-09-21 17:50:21 +09:00
KOBAYASHI Shuji
f252ab0770
Use mrb_define_method instead of mrb_define_alias
2019-09-21 16:51:10 +09:00
Yukihiro "Matz" Matsumoto
15701a32f5
Fix compatibility issue of class variables.
...
Singleton class definition do not introduce its own class variable scope
in CRuby/JRuby. So should mruby.
```
module Mod1
class << Object.new
C = 1
@@cv = 1
p Module.nesting, # => [#<Class:#<Object:0x55cb16e60a50>>, Mod1]
constants, # => [:C]
class_variables, # => []
Mod1.class_variables # => [:@@cv]
end
end
```
2019-09-20 13:07:58 +09:00
Yukihiro "Matz" Matsumoto
683baec4f0
Add optional argument to Module#class_variables.
2019-09-20 13:07:58 +09:00
Yukihiro "Matz" Matsumoto
01ce5824f0
Merge pull request #4723 from shuujii/fix-typo-in-Array-difference-document
...
Fix typo in `Array#difference` document [ci skip]
2019-09-20 09:46:19 +09:00
KOBAYASHI Shuji
1fb4e73981
Fix typo in Array#difference document [ci skip]
2019-09-20 09:28:56 +09:00
Yukihiro "Matz" Matsumoto
21c0c78d2e
Merge pull request #4722 from shuujii/simplify-arguments-check-in-String-index
...
Simplify arguments check in `String#index`
2019-09-20 08:02:14 +09:00
KOBAYASHI Shuji
e61095426b
Simplify arguments check in String#index
...
Also fix document about type of the first argument.
2019-09-19 20:19:38 +09:00
Yukihiro "Matz" Matsumoto
77f00d5006
Merge pull request #4720 from shuujii/fix-Enumerable-filter_map-without-block
...
Fix `Enumerable#filter_map` without block; ref d380c7d2
2019-09-18 21:52:28 +09:00
KOBAYASHI Shuji
c7c344dbc2
Fix Enumerable#filter_map without block; ref d380c7d2
2019-09-18 19:33:15 +09:00
Yukihiro "Matz" Matsumoto
c20dda4f4c
Merge pull request #4719 from shuujii/remove-unneeded-mrb_get_args
...
Remove `mrb_get_args(mrb, "")`; ref 30f37872
2019-09-18 17:14:00 +09:00
KOBAYASHI Shuji
0bedd900b9
Remove mrb_get_args(mrb, ""); ref 30f37872
2019-09-18 16:07:21 +09:00
Yukihiro "Matz" Matsumoto
ca2d47c20f
Fix super from aliased methods to work correctly; fix #4718
...
We needed to preserve the original method name somewhere. We kept it in
the `env` structure pointed from aliased methods. #1457 and #1531 tried
to address this issue. But this patch is more memory efficient.
Limitation: this fix does not support `super` from methods defined by
`define_method`. This limitation may be addressed in the future, but
it's low priority.
2019-09-18 10:31:28 +09:00
Yukihiro "Matz" Matsumoto
47add060cc
Merge pull request #4717 from shuujii/fix-Fixnum-to_s-inspect-argument-specs
...
Fix `Fixnum#(to_s|inspect)` argument specs
2019-09-17 13:39:51 +09:00
KOBAYASHI Shuji
2f7175442f
Fix Fixnum#(to_s|inspect) argument specs
...
Before this patch:
$ bin/mruby -e 'p 3.to_s(2)'
trace (most recent call last):
[0] -e:1
-e:1: 'to_s': wrong number of arguments (1 for 0) (ArgumentError)
After this patch:
$ bin/mruby -e 'p 3.to_s(2)'
"11"
2019-09-17 09:28:51 +09:00
Yukihiro "Matz" Matsumoto
88cd1d6593
Merge pull request #4714 from dearblue/shrink-mrb_get_args
...
Shrink `mrb_get_args()`
2019-09-17 08:41:51 +09:00
Yukihiro "Matz" Matsumoto
cc636f334f
Merge pull request #4715 from dearblue/need-block
...
Entrust "no block given" error to `mrb_get_args()`
2019-09-17 08:40:03 +09:00
Yukihiro "Matz" Matsumoto
d45c94fe1c
Merge pull request #4713 from shuujii/fix-argument-specs-to-Enumerable
...
Fix argument specs to `Enumerable`
2019-09-17 08:31:18 +09:00
dearblue
099a4f3969
Entrust "no block given" error to mrb_get_args()
...
Some error messages will be changed.
2019-09-16 20:29:58 +09:00
dearblue
62499c6250
Shrink mrb_get_args()
...
As a side effect, all specifiers now accept the `!` modifier.
2019-09-16 18:14:00 +09:00
dearblue
f312638ecd
Cache argv first in each specifiers for mrb_get_args(); ref #3090
...
In terms of specifiers, argv is never referenced after a method call as
shown in #3090 .
Reduction of object code can be expected.
If you need to refer to argv after a method call in the same loop,
update argv after the method call.
2019-09-16 18:14:00 +09:00
Yukihiro "Matz" Matsumoto
2f9b1fdb0c
Merge pull request #4255 from shuujii/enumerator-size-is-not-supported
...
`Enumerator#size` is not supported [ci skip]
2019-09-16 15:37:58 +09:00
KOBAYASHI Shuji
b3b55132a9
Fix argument specs to Enumerable
2019-09-16 11:58:35 +09:00
Yukihiro "Matz" Matsumoto
2256bb07b0
Remove MRB_METHOD_TABLE_INLINE.
...
`MRB_METHOD_TABLE_INLINE` was fragile. It requires `-falign-functions=n`.
On platform that uses higher bits of function pointers, you can use new
`MRB_METHOD_T_STRUCT` configuration macro.
2019-09-16 11:14:13 +09:00
Yukihiro "Matz" Matsumoto
30f3787248
Raise ArgumentError by aspec check; ref #4688
...
This is partial `aspec` check that only checks `MRB_ARGS_NONE()`.
2019-09-16 10:50:31 +09:00
Yukihiro "Matz" Matsumoto
2764fdf9f0
Share common definition of MRB_METHOD_FUNC_FL.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
0eb9355acd
Use bit shifting to pack function pointers to mrb_method_t.
...
So you don't need `-falign-functions=2` anymore. Instead your platform
must not use higher bits of the pointer (true for most platforms).
If not, you have to use `struct mrb_method_t` version.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
743d480fba
Refactor mrb_method_t.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
a57b6f8ed0
Implement Enumerable tally from Ruby2.7.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
d380c7d26f
Implement filter_map from Ruby2.6.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
57a0132b41
Add filter aliases for Enumerable and Hash.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
f4117d81d2
Add Array#difference method from Ruby2.6.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
3daa53ce63
Implement bind_call method from Ruby2.7.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto
a016d1d0ff
Merge branch 'dearblue-mruby-io'
2019-09-16 07:45:42 +09:00
Yukihiro "Matz" Matsumoto
6de1c64a9c
Add small fix over #4712
2019-09-16 07:44:51 +09:00
dearblue
992ba476a9
Fix broken UTF-8 characters by IO#getc
...
Character (multi-byte UTF-8) is destroyed when character spanning
`IO::BUF_SIZE` (4096 bytes) exist.
- Prepare file:
```ruby
File.open("sample", "wb") { |f| f << "●" * 1370 }
```
- Before patched:
```ruby
File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a }
# => ["●", "●", ..., "●", "\xe2", "\x97", "\x8f", "●", "●", "●", "●"]
- After patched:
```ruby
File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a }
# => ["●", "●", ..., "●", "●", "●", "●", "●", "●"]
2019-09-16 00:26:41 +09:00
dearblue
7cc8c7d2ff
Small improvement for mruby-io
2019-09-16 00:11:43 +09:00
dearblue
52a0ad4108
Fix IO#pos
2019-09-16 00:11:43 +09:00
dearblue
77368ce762
Revert part of 8c90b5fc6
...
`IO#readline` and `IO#readchar` process in character units.
2019-09-16 00:11:43 +09:00
Yukihiro "Matz" Matsumoto
0734d9f314
Merge pull request #4512 from lopopolo/patch-1
...
Support parsing a Regexp literal with 'o' option
2019-09-15 18:19:59 +09:00
Yukihiro "Matz" Matsumoto
e790fb5128
Merge pull request #4710 from shuujii/refactor-mrb_type-in-include-mruby-boxing_word.h
...
Refactor `mrb_type` in `include/mruby/boxing_word.h`
2019-09-15 18:19:27 +09:00
KOBAYASHI Shuji
7fcda585bc
Refactor mrb_type in include/mruby/boxing_word.h
2019-09-15 18:11:16 +09:00
Yukihiro "Matz" Matsumoto
76355dee68
Add unavailability of declaration form of visibility methods; #4708
2019-09-14 23:21:44 +09:00
Yukihiro "Matz" Matsumoto
28bbd3e7d9
Add argument names to C function prototypes.
2019-09-14 23:21:44 +09:00
Yukihiro "Matz" Matsumoto
57d7fe94a9
Add a macro mrb_frozen_p that points to MRB_FROZEN_P.
2019-09-14 23:21:44 +09:00
Yukihiro "Matz" Matsumoto
6f1c08f7d8
Replace String#byteslice by custom IO._bufread.
...
`byteslice` creates 2 string objects. `_bufread` creates one, and
modifies the original buffer string, that is more efficient.
2019-09-14 23:21:44 +09:00
Yukihiro "Matz" Matsumoto
dcc2d44d93
Merge pull request #4707 from shuujii/use-%C-to-mrb_name_error-in-mrb_method_search
...
Use `%C` to `mrb_name_error` in `mrb_method_search`; ref 5890c7d5
2019-09-14 14:35:36 +09:00
KOBAYASHI Shuji
2f74a97d04
Use %C to mrb_name_error in mrb_method_search; ref 5890c7d5
2019-09-14 11:28:02 +09:00
Yukihiro "Matz" Matsumoto
6620b1cdcb
Revert "Update %pure-parser to %define api.pure for newer bison; fix #4706 "
...
The `bison` on MacOS does not support `%define api.pure`.
This reverts commit f7c9f1f796 .
2019-09-14 10:28:07 +09:00
Yukihiro "Matz" Matsumoto
f7c9f1f796
Update %pure-parser to %define api.pure for newer bison; fix #4706
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
76f1aa7de5
Remove mrb_funcall from <=> operations.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
fcd3f8450d
Raise an error from String#<=> with a non string operand.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
34cdff5ee4
Use mrb_equal instead of mrb_funcall.
...
In the typical case, `mrb_funcall` invocation would be skipped.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
5890c7d516
Remove mrb_funcall from mrb_method_search.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
2fa4a55e80
Replace loop method with while true loop to gain performance.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
5489fae8f2
Merge pull request #4705 from shuujii/revert-part-of-Refine-tasks-toolchains-gcc-clang.rake
...
Revert part of "Refine `tasks/toolchains/(gcc|clang).rake`" (07c6b7f0 )
2019-09-13 22:55:50 +09:00
KOBAYASHI Shuji
895ab2342e
Revert part of "Refine tasks/toolchains/(gcc|clang).rake" ( 07c6b7f0)
...
`-Wzero-length-array` is not a mandatory option, so the original is better.
2019-09-13 21:28:23 +09:00
Yukihiro "Matz" Matsumoto
1e82b1958b
Merge pull request #4704 from shuujii/fix-warnings-for-invalid-C++-option-with-enable_cxx_abi
...
Fix warnings for invalid C++ option with `enable_cxx_abi`; ref #3618 , #4703
2019-09-13 19:59:40 +09:00
KOBAYASHI Shuji
be76cec342
Fix warnings for invalid C++ option with enable_cxx_abi; ref #3618 , #4703
2019-09-13 17:14:37 +09:00
Yukihiro "Matz" Matsumoto
ad4bdda074
Update assert_take for zero size take.
2019-09-13 02:28:56 +09:00
Yukihiro "Matz" Matsumoto
f5542b9927
Add Enumerator.produce from Ruby2.7
2019-09-13 02:28:56 +09:00
Yukihiro "Matz" Matsumoto
d4af765651
Remove -std=gnu99 when enable_cxx_abi; ref #4703
...
To stop warnings since C++ do not accept `-std=gnu99` option.
2019-09-13 02:23:16 +09:00
Yukihiro "Matz" Matsumoto
5a0204bb45
Remove unnecessary files from mruby-{io,pack,socket}.
2019-09-13 02:23:16 +09:00
Yukihiro "Matz" Matsumoto
915bb4e206
Merge pull request #4703 from shuujii/refine-tasks-toolchains-gcc-clang.rake
...
Refine `tasks/toolchains/(gcc|clang).rake`
2019-09-12 22:53:47 +09:00
KOBAYASHI Shuji
07c6b7f0ab
Refine tasks/toolchains/(gcc|clang).rake
...
- Make sure to specify `-std=gnu99` for C compiler flag.
- Make sure to specify `-Wzero-length-array` for C/C++ compiler flag (Clang).
- Extract similar codes.
2019-09-12 21:45:47 +09:00
Yukihiro "Matz" Matsumoto
231a1d68b0
Remove $/ from mruby implementation.
...
1. `$/` and other Perl-ish global variables are not defined in ISO.
2. The current Ruby policy do not encourage those variables.
3. Those variables has global effect and can cause troubles.
2019-09-12 21:22:59 +09:00
Yukihiro "Matz" Matsumoto
6bbdb97e75
Merge pull request #4527 from lopopolo/string-each-line-paragraph-mode
...
Add paragraph mode to String#each_line in mrblib
2019-09-12 21:19:42 +09:00
Yukihiro "Matz" Matsumoto
b98bf36a15
Use mrb_str_inspect instead of mrb_str_dup; fix #4678
2019-09-12 17:15:55 +09:00
Yukihiro "Matz" Matsumoto
9383e9d469
Removed unnecessary files from mruby-sleep; #4702
2019-09-12 06:54:09 +09:00
Yukihiro "Matz" Matsumoto
13c3802073
Remove Rakefile from mruby-sleep gem; fix #4702
...
The `Rakefile` was a leftover from the time it was an independent gem.
2019-09-11 20:28:52 +09:00
Yukihiro "Matz" Matsumoto
04b098d000
Move tests related to getbyte, setbyte, byteslice` to core.
2019-09-11 18:49:08 +09:00
Yukihiro "Matz" Matsumoto
8c90b5fc6a
Fixed length for IO should be in bytes, not in characters; #4696
...
E.g. `io.read(5)` should read 5 byte string, not 5 characters.
2019-09-11 18:47:39 +09:00
Yukihiro "Matz" Matsumoto
ec3aeede20
Move String#{getbyte,setbyte,byteslice} to the core; #4696
...
Unlike CRuby, there's no way to process strings byte-wise by core
methods because there's no per string encoding in mruby, so that
we moved 3 byte-wise operation methods from `mruby-string-ext` gem.
2019-09-11 18:47:39 +09:00
Yukihiro "Matz" Matsumoto
08d4e7c0c4
Merge pull request #4701 from shuujii/drop-test-dependency-from-mruby-string-ext-to-mruby-enumerator
...
Drop test dependency from `mruby-string-ext` to `mruby-enumerator`
2019-09-11 18:47:27 +09:00
KOBAYASHI Shuji
fab781cf8b
Drop test dependency from mruby-string-ext to mruby-enumerator
2019-09-11 10:35:52 +09:00
Yukihiro "Matz" Matsumoto
896f3fe703
Merge pull request #4700 from shuujii/refine-documentation-for-C99-compliance
...
Refine documentation for C99 compliance; ref #4685 [ci skip]
2019-09-10 17:00:29 +09:00
KOBAYASHI Shuji
1c1ebb1833
Refine documentation for C99 compliance; ref #4685 [ci skip]
...
The refinement was based on comment from @matz.
2019-09-10 16:49:14 +09:00
Yukihiro "Matz" Matsumoto
080f7baeaf
Merge pull request #4699 from takkaw/mirb_lv_under_score
...
add special local variable _ in mirb
2019-09-10 09:24:27 +09:00
takkaw
3f70e3a81f
change _ variable in mirb to be enable by default
2019-09-09 23:40:51 +09:00
Yukihiro "Matz" Matsumoto
9d9cb0ab6a
Fix mod.constants not to have duplicate constant names; #4698
...
The fix was based on PR from @dearblue
2019-09-09 23:14:07 +09:00
Yukihiro "Matz" Matsumoto
a1a838d966
Remove duplication of BasicObject constant; fix #4698
2019-09-09 23:14:07 +09:00
Yukihiro "Matz" Matsumoto
6b157397ba
Merge pull request #4697 from shuujii/fix-Class.new-argument-specs
...
Fix `Class.new` argument specs
2019-09-09 22:51:15 +09:00
takkaw
e28451585d
add special local variable _ in mirb
2019-09-09 22:32:10 +09:00
KOBAYASHI Shuji
b156aa2cf6
Fix Class.new argument specs
2019-09-09 21:37:35 +09:00
Yukihiro "Matz" Matsumoto
715afd6fdb
Merge pull request #4695 from dearblue/promote-to-int
...
Fix `mrb_vformat()` crashes with `MRB_INT16`
2019-09-08 22:46:25 +09:00
Yukihiro "Matz" Matsumoto
801343b56b
Merge pull request #4694 from shuujii/optimize-mrb_bool-with-MRB_WORD_BOXING
...
Optimize `mrb_bool()` with `MRB_WORD_BOXING`
2019-09-08 22:44:07 +09:00
dearblue
311d867deb
Fix mrb_vformat() crashes with MRB_INT16
...
If `MRB_INT16` is specified, the variable length argument `mrb_int` is
converted to `int`.
2019-09-08 20:31:35 +09:00
KOBAYASHI Shuji
d47bd0a2cd
Optimize mrb_bool() with MRB_WORD_BOXING
2019-09-08 12:17:25 +09:00
Yukihiro "Matz" Matsumoto
9d08025b8b
Revert part of #4225
...
Since in mruby, Integer and Float interchange frequently (mostly on
overflow), so adding explicit `.0` can cause problems sometimes.
For example:
https://github.com/mattn/mruby-json/pull/40
https://github.com/pepabo/mruby-msd/pull/13
https://github.com/mattn/mruby-json/pull/42
2019-09-07 22:27:30 +09:00
Yukihiro "Matz" Matsumoto
8f04d6561f
Merge pull request #4693 from shuujii/increase-symbol-bit-size-on-32-bit-mode-with-MRB_WORD_BOXING
...
Increase symbol bit size on 32-bit mode with `MRB_WORD_BOXING`
2019-09-07 22:16:54 +09:00
KOBAYASHI Shuji
17c53040ab
Increase symbol bit size on 32-bit mode with MRB_WORD_BOXING
...
This change increases the max length of lower inline symbols to 5 bytes.
2019-09-07 21:38:11 +09:00
Yukihiro "Matz" Matsumoto
bb7eccc9c4
Merge pull request #4692 from shuujii/avoid-bit-fields-in-mrb_value
...
Avoid bit fields in `mrb_value`; ref b2c3d88f
2019-09-06 22:23:16 +09:00
KOBAYASHI Shuji
19e2cc187b
Avoid bit fields in mrb_value; ref b2c3d88f
...
The changes at b2c3d88f were inappropriate because the memory layout of bit
fields are implementation defined. Therefor, I fixed it not to use bit
fields.
2019-09-06 13:24:35 +09:00
Yukihiro "Matz" Matsumoto
c3b16c26a6
Merge pull request #4691 from shuujii/fix-Range-max-test-TypeError-is-raised-on-32-bit-mode-with-word-boxing
...
Fix `Range#max` test (`TypeError` is raised) on 32-bit mode with word boxing
2019-09-05 23:02:53 +09:00
Yukihiro "Matz" Matsumoto
968547d79b
Merge pull request #4690 from takumakume/add_assert_not_nil
...
Add `assert_not_nil` method
2019-09-05 22:59:34 +09:00
takumakume
6c4278144a
add assert_not_nil method
2019-09-05 19:51:54 +09:00
KOBAYASHI Shuji
6cfcff6f10
Fix Range#max test (TypeError is raised) on 32-bit mode with word boxing
2019-09-05 19:51:32 +09:00
Yukihiro "Matz" Matsumoto
be8bb2be61
Merge pull request #4687 from shuujii/fix-argument-specs-to-BasicObject
...
Fix argument specs to `BasicObject`
2019-09-05 11:15:34 +09:00
KOBAYASHI Shuji
489f655d18
Fix argument specs to BasicObject
2019-09-04 22:49:57 +09:00
Yukihiro "Matz" Matsumoto
2df419e324
Merge pull request #4686 from shuujii/add-to-doc-limitations.md-about-nil-redefinition
...
Add to `doc/limitations.md` about `nil?` redefinition; ref 4996709 [ci skip]
2019-09-04 01:25:00 +09:00
KOBAYASHI Shuji
74e7c4aa0b
Add to doc/limitations.md about nil? redefinition; ref 4996709 [ci skip]
2019-09-03 21:51:15 +09:00
Yukihiro "Matz" Matsumoto
148fffa21a
Merge pull request #4683 from shuujii/enumeratorChain-rewind-shouldnt-rewind-elements-arent-iterated
...
`Enumerator::Chain#rewind` shouldn't rewind elements aren't iterated
2019-09-02 16:50:47 +09:00
KOBAYASHI Shuji
66211394e1
Enumerator::Chain#rewind shouldn't rewind elements aren't iterated
...
### Example:
```ruby
# example.rb
e = [1]
def e.rewind; p :r end
c = e.chain(e)
c.each{break c}.rewind
```
#### Before this patch:
```terminal
$ bin/mruby example.rb
:r
:r
```
#### After this patch (same as Ruby):
```terminal
$ bin/mruby example.rb
:r
```
2019-09-02 08:58:33 +09:00
Yukihiro "Matz" Matsumoto
aea5880c10
Small refactoring in fiber.c.
2019-09-02 08:41:44 +09:00
Yukihiro "Matz" Matsumoto
5cd52d2d69
Fix an error in refactoring; fix #4682
2019-09-02 08:41:44 +09:00
Yukihiro "Matz" Matsumoto
e8de7c6819
Merge pull request #4681 from shuujii/array-permutation-with-a-negative-argument-should-not-yield
...
`Array#permutation` with a negative argument should not yield
2019-09-01 13:01:59 +09:00
KOBAYASHI Shuji
fe6cf851bf
Array#permutation with a negative argument should not yield
...
Before this patch:
$ bin/mruby -e '[1].permutation(-1){|v| p v}' #=> [1]
After this patch (same as Ruby):
$ bin/mruby -e '[1].permutation(-1){|v| p v}' #=> no output
2019-09-01 09:28:11 +09:00
Yukihiro "Matz" Matsumoto
1a4ea94bc7
Fix mrb_immediate_p(MRB_TT_FREE) to return false; ref #4679
2019-08-31 23:19:08 +09:00
Yukihiro "Matz" Matsumoto
d48a2190bf
Refactor #4662 with different names.
2019-08-31 22:14:25 +09:00
Yukihiro "Matz" Matsumoto
49967097ed
Skip nil? method call in if conditionals.
...
Compile `if expr.nil?` to use `OP_JMPNIL` instead of calls.
2019-08-31 22:14:25 +09:00
Yukihiro "Matz" Matsumoto
49896abe2b
Merge pull request #4679 from shuujii/implement-mrb_immediate_p-macro-for-MRB_WORD_BOXING
...
Implement `mrb_immediate_p` macro for `MRB_WORD_BOXING`
2019-08-31 22:14:14 +09:00
KOBAYASHI Shuji
b2c3d88fbf
Implement mrb_immediate_p macro for MRB_WORD_BOXING
...
The default implementation of `mrb_immediate_p` uses `mrb_type`. However,
in `MRB_WORD_BOXING`, `mrb_type` has many branches and is inefficient, so
provide an implementation that does not use `mrb_type`.
2019-08-31 16:55:57 +09:00
Yukihiro "Matz" Matsumoto
55ef4e4bdd
Merge pull request #4677 from shuujii/array-permutation-combination-without-block-should-return-self
...
`Array#(permutation|combination)` without block should return `self`
2019-08-30 22:38:15 +09:00
KOBAYASHI Shuji
28d1f6cdc4
Array#(permutation|combination) without block should return self
2019-08-30 17:04:25 +09:00
Yukihiro "Matz" Matsumoto
0ce1878aba
Merge pull request #4674 from shuujii/remove-unneeded--src-y.tab.c-in-.gitignore
...
Remove unneeded `/src/y.tab.c` in `.gitignore`
2019-08-29 16:24:48 +09:00
KOBAYASHI Shuji
d9614549bb
Remove unneeded /src/y.tab.c in .gitignore
...
Currently, `y.tab.c` is generated to under the `build/` directory.
2019-08-29 14:05:53 +09:00
Yukihiro "Matz" Matsumoto
aa97b8a4fe
Merge pull request #4672 from shuujii/fix-build-of-mruby-random-on-32-bit-mode
...
Fix build of `mruby-random` on 32-bit mode
2019-08-27 15:03:47 +09:00
KOBAYASHI Shuji
7993b87235
Fix build of mruby-random on 32-bit mode
2019-08-27 10:48:25 +09:00
Yukihiro "Matz" Matsumoto
c1cd2007b8
Merge pull request #4671 from shuujii/fix-Array-sample-with-MRB_INT32
...
Fix `Array#sample` with `MRB_INT32`
2019-08-26 22:18:36 +09:00
KOBAYASHI Shuji
7178a5e7d3
Fix Array#sample with MRB_INT32
...
Array index became potentially negative because `uint32_t` is cast to
`mrb_int`.
2019-08-26 20:23:46 +09:00
Yukihiro "Matz" Matsumoto
4aabf91ee2
Merge pull request #4635 from shuujii/fix-wrong-argument-for-fprintf-in-mruby-bin-mrbc
...
Fix wrong argument for `fprintf` in `mruby-bin-mrbc`
2019-08-26 19:18:49 +09:00
Yukihiro "Matz" Matsumoto
cd96998372
Merge pull request #4670 from shuujii/remove-unused-random.h
...
Remove unused `random.h`
2019-08-26 19:17:38 +09:00
KOBAYASHI Shuji
b9350f908f
Remove unused random.h
2019-08-26 18:08:32 +09:00
Yukihiro "Matz" Matsumoto
2d09fd2135
Merge pull request #4669 from davidsiaw/doxygen
...
Fixes for Doxygen docs
2019-08-26 07:46:57 +09:00
David Siaw
6375639917
fix lots of warnings and make logo not so big
2019-08-26 02:08:33 +09:00
David Siaw
e1e96c0cf4
change doc directory and reduce warnings
2019-08-26 00:23:28 +09:00
Yukihiro "Matz" Matsumoto
a4870a579f
Merge pull request #4668 from shuujii/defer-several-build-libraries-loading-until-needed
...
Defer several build libraries loading until needed
2019-08-25 17:56:03 +09:00
KOBAYASHI Shuji
3110d84ed8
Defer several build libraries loading until needed
2019-08-25 09:48:07 +09:00
Yukihiro "Matz" Matsumoto
e3f7429173
Merge pull request #4667 from shuujii/fix-Range-max-test-TypeError-is-raised-on-32-bit-mode
...
Fix `Range#max` test (`TypeError` is raised) on 32-bit mode
2019-08-25 01:30:45 +09:00
Yukihiro "Matz" Matsumoto
ee0806ad4b
Merge pull request #4666 from dearblue/warn-str_new_capa
...
Suppress warning by gcc with `-Wmaybe-uninitialized`
2019-08-25 01:29:49 +09:00
Yukihiro "Matz" Matsumoto
17623fd0d3
Merge pull request #4665 from dearblue/fix-4642
...
Create a symbolic link in the temporary directory; fix #4642
2019-08-25 01:28:14 +09:00
Yukihiro "Matz" Matsumoto
ce89974679
Merge pull request #4664 from shuujii/remove-unused-constant-in-Rakefile
...
Remove unused constant in `Rakefile`; ref e312842a
2019-08-25 01:25:32 +09:00
KOBAYASHI Shuji
13f58f9bc2
Fix Range#max test (TypeError is raised) on 32-bit mode
2019-08-24 14:22:10 +09:00
dearblue
c9c27e9d69
Suppress warning by gcc with -Wmaybe-uninitialized
2019-08-24 11:44:51 +09:00
KOBAYASHI Shuji
e7b49e3f09
Remove unused constant in Rakefile; ref e312842a
2019-08-24 11:30:03 +09:00
dearblue
6ad2442fb9
Create a symbolic link in the temporary directory; fix #4642
...
Because the linker gives a warning on FreeBSD 12.0.
```
warning: mktemp() possibly used unsafely; consider using mkstemp()
```
2019-08-24 11:11:00 +09:00
Yukihiro "Matz" Matsumoto
71242c0f2e
Merge pull request #4662 from shuujii/fix-RBreak-exceeding-6-words-on-32-bit-mode-w-o-boxing-and-MRB_USE_FLOAT
...
Fix `RBreak` exceeding 6 words on 32-bit mode w/o boxing and `MRB_USE_FLOAT`
2019-08-23 22:35:28 +09:00
KOBAYASHI Shuji
be78b5d8f7
Fix RBreak exceeding 6 words on 32-bit mode w/o boxing and MRB_USE_FLOAT
...
ref: https://github.com/mruby/mruby/pull/4483#issuecomment-498001736
In this configuration, `tt` of `RBreak::val` is set into `RBreak::flags`.
2019-08-23 22:15:42 +09:00
Yukihiro "Matz" Matsumoto
14d5a86b29
Merge pull request #4656 from shuujii/refine-processing-for-gem-lock-file
...
Refine processing for gem lock file
2019-08-23 05:46:20 +09:00
KOBAYASHI Shuji
e312842a18
Refine processing for gem lock file
...
- Defer YAML library and lock file loading until needed.
- Don't write empty parts into lock file.
- Extract code to read/write lock file to `MRuby::Lockfile`.
- `MRuby::Lockfile.disable` disables the use of lock file.
2019-08-22 21:40:01 +09:00
Yukihiro "Matz" Matsumoto
246179518d
Merge pull request #4655 from yamori813/master
...
make clean error workaround
2019-08-22 13:50:28 +09:00
yamori813
07b2d33347
workaround error
2019-08-22 10:59:46 +09:00
Yukihiro "Matz" Matsumoto
3ad58f4dae
Add lock files to .gitignore; #4180
2019-08-22 08:16:51 +09:00
Yukihiro "Matz" Matsumoto
ef46fb4840
Merge pull request #4654 from take-cheeze/mruby_version_lock
...
Take commit hash of mruby too
2019-08-22 08:07:30 +09:00
Yukihiro "Matz" Matsumoto
2aa22206be
Merge pull request #4653 from take-cheeze/sep_repo_build
...
Separate repos directory and build directory
2019-08-22 08:06:47 +09:00
take-cheeze
8e7a3a4df1
Take commit hash of mruby too
2019-08-22 03:03:24 +09:00
take-cheeze
a86f8f26a2
Separate repos directory and build directory
...
closes #4652
2019-08-22 02:43:00 +09:00
Yukihiro "Matz" Matsumoto
90bffaa2a6
Merge pull request #4180 from take-cheeze/lock_file
...
Support lock file for git.
2019-08-21 17:17:30 +09:00
Yukihiro "Matz" Matsumoto
4c8e6daab7
Merge pull request #4651 from shuujii/prioritize-embedded-string-over-nofree-or-normal-string
...
Prioritize embedded string over nofree (or normal) string
2019-08-21 12:39:59 +09:00
KOBAYASHI Shuji
a84ab12735
Prioritize embedded string over nofree (or normal) string
...
Prioritize embedded string in the following functions:
- `str_new_static`
- `str_new`
- `mrb_str_new_capa`
- `mrb_str_pool`
The reasons are as follows:
- Consistency with `mrb_str_byte_subseq` and `str_replace`.
- Memory locality increases and may be slightly faster.
- No conversion cost to embedded string when modifying the string.
2019-08-21 12:06:03 +09:00
Yukihiro "Matz" Matsumoto
def7925873
Merge pull request #4650 from take-cheeze/patch-5
...
Remove deprecated iij stuffs
2019-08-21 07:10:08 +09:00
Yukihiro "Matz" Matsumoto
55ac140c25
Merge pull request #4649 from take-cheeze/patch-4
...
Fix link of mruby-io
2019-08-21 07:09:32 +09:00
Yukihiro "Matz" Matsumoto
392f8f840d
Merge pull request #4648 from take-cheeze/patch-3
...
Use mruby-onig-regexp instead in example
2019-08-21 07:08:56 +09:00
Yukihiro "Matz" Matsumoto
f563cc227b
Merge pull request #4647 from take-cheeze/patch-2
...
Add note about checksum_hash in mrbgem doc
2019-08-21 07:08:08 +09:00
Takeshi Watanabe
fd4db7e6dd
Remove deprecated iij stuffs
2019-08-20 23:56:10 +09:00
Takeshi Watanabe
2e172fd932
Fix link of mruby-io
2019-08-20 23:54:36 +09:00
Takeshi Watanabe
c138b9ea30
Use mruby-onig-regexp instead in example
2019-08-20 23:52:21 +09:00
Takeshi Watanabe
3256fae147
Add note about checksum_hash in mrbgem doc
2019-08-20 23:50:16 +09:00
Yukihiro "Matz" Matsumoto
4c001673b6
Avoid C++ strict aliasing warning.
...
Based on code proposed by @dearblue to avoid the warning:
`dereferencing type-punned pointer will break strict-aliasing rules`.
2019-08-20 22:50:21 +09:00
Yukihiro "Matz" Matsumoto
183fb961b3
Fixed a bug in the OP_JMPNOT optimization ( 13eaff4); fix #4644
2019-08-20 22:01:50 +09:00
Yukihiro "Matz" Matsumoto
942c076938
Merge pull request #4646 from shuujii/use-RBasic-padding-for-embedded-string-on-64-bit-CPU
...
Use `RBasic` padding for embedded string on 64-bit CPU
2019-08-20 22:00:54 +09:00
KOBAYASHI Shuji
8157672a29
Use RBasic padding for embedded string on 64-bit CPU
...
On 64-bit CPU, there is padding in `RBasic`, so reorder the fields and use
it as buffer of embedded string. This change allows 4 more bytes to be
embedded on 64-bit CPU.
However, an incompatibility will occur if `RString::as::ary` is accessed
directly because `RString` structure has changed.
2019-08-20 18:49:55 +09:00
Yukihiro "Matz" Matsumoto
b836fd05dd
Merge pull request #4645 from shuujii/move-mrb_str_pool-to-src-string.c-to-use-str_init-family
...
Move `mrb_str_pool` to `src/string.c` to use `str_init` family
2019-08-19 21:29:38 +09:00
KOBAYASHI Shuji
507dbf984e
Move mrb_str_pool to src/string.c to use str_init family
2019-08-19 19:18:52 +09:00
Yukihiro "Matz" Matsumoto
1961059330
Merge pull request #4643 from lopopolo/externally-define-MRB_API
...
Allow external definition of MRB_API macro
2019-08-19 13:18:41 +09:00
Ryan Lopopolo
b5662c87c8
Allow external definition of MRB_API macro
...
When building WebAssembly targets with clang (e.g. wasm32-unknown-unknown), all
symbols are hidden by default. To export a symbol, it must be marked with
__attribute__((visibility(default)))
Rather than detecting this exotic target in mruby, allow MRB_API to be defined
externally.
2019-08-18 19:40:12 -07:00
Yukihiro "Matz" Matsumoto
3fbd5f0029
Merge pull request #4639 from dearblue/suppress-Wstringop-truncation
...
Suppress warnings for `strncat()`
2019-08-19 07:31:26 +09:00
Yukihiro "Matz" Matsumoto
f263088b0d
Merge pull request #4638 from dearblue/simplify-get-args
...
Simplify get arguments
2019-08-19 07:30:48 +09:00
Yukihiro "Matz" Matsumoto
b5e2d208b9
Merge pull request #4636 from davidsiaw/doxygen
...
Generate doxygen docs for mruby
2019-08-19 07:29:46 +09:00
Yukihiro "Matz" Matsumoto
fe8428b33b
Merge pull request #4642 from dearblue/unique-symlink
...
Make symbolic link names unique for test
2019-08-19 07:25:07 +09:00
Yukihiro "Matz" Matsumoto
1b9801a04b
Merge pull request #4641 from shuujii/rename-mrb_shared_string-len-to-mrb_shared_string-capa
...
Rename `mrb_shared_string::len` to `mrb_shared_string::capa`
2019-08-19 07:24:06 +09:00
Yukihiro "Matz" Matsumoto
feecb3321a
Merge pull request #4640 from shuujii/also-use-str_init_shared-for-orig-in-str_make_shared
...
Also use `str_init_shared` for `orig` in `str_make_shared()`
2019-08-19 07:23:23 +09:00
Yukihiro "Matz" Matsumoto
6f61b35bcf
Merge pull request #4637 from dearblue/immutable-iseq
...
Prohibit changes to iseq in principle
2019-08-18 23:25:40 +09:00
dearblue
734a7f52a7
Make symbolic link names unique for test
2019-08-18 22:10:41 +09:00
David Siaw
b5299b1c58
fix up documentation for values
2019-08-18 20:12:44 +09:00
KOBAYASHI Shuji
d2d201cc82
Rename mrb_shared_string::len to mrb_shared_string::capa
...
Because this field is used as capacity of string buffer.
2019-08-18 20:08:04 +09:00
KOBAYASHI Shuji
aaa509dd07
Also use str_init_shared for orig in str_make_shared()
2019-08-18 19:44:00 +09:00
dearblue
74395d7577
Suppress warnings for strncat()
...
`strncat()` also needs `'\0'`.
2019-08-18 15:46:17 +09:00
dearblue
05a873c25c
Simplify get arguments
...
- `mrb_str_index_m()` and `mrb_str_rindex()`
Make `mrb_get_args()` called only once from called twice.
- `mrb_str_byteslice()`
Replace `goto` with `if ~ else`.
2019-08-18 15:38:25 +09:00
dearblue
279c21b816
Prohibit changes to iseq in principle
2019-08-18 15:00:32 +09:00
David Siaw
2c86895468
fix up markdown display in doxygen
2019-08-18 13:59:29 +09:00
David Siaw
8d70a9b1b5
first bit of doc generation
2019-08-18 13:07:24 +09:00
Yukihiro "Matz" Matsumoto
83dab1ee0d
Merge pull request #4634 from shuujii/refactor-set-unset-string-type-flags
...
Refactor set/unset string type flags
2019-08-17 23:41:52 +09:00
KOBAYASHI Shuji
5345731b1d
Fix wrong argument for fprintf in mruby-bin-mrbc
2019-08-17 21:46:45 +09:00
KOBAYASHI Shuji
caba5fef27
Refactor set/unset string type flags
...
Introduce `RSTR_SET_TYPE_FLAG` macro to set the specified string type flag and
clear the others.
2019-08-17 21:24:08 +09:00
Yukihiro "Matz" Matsumoto
277c91e94c
Merge pull request #4625 from dearblue/rindex-broken-utf8
...
Fix `String#rindex` with invalid UTF-8 string
2019-08-17 15:52:34 +09:00
Yukihiro "Matz" Matsumoto
b55e72b2d6
Resolve conflict between #4582 and C++ warning.
2019-08-17 15:47:14 +09:00
Yukihiro "Matz" Matsumoto
5b1f25a4e0
Implement Array#each using inline mruby bytecode.
2019-08-17 14:46:32 +09:00
Yukihiro "Matz" Matsumoto
13eaff4f9f
Remove unnecessary OP_JMPNOT for unless statement.
2019-08-17 12:29:04 +09:00
dearblue
bc27273087
Fix String#rindex with invalid UTF-8 string
...
Previously `String#rindex` returned the wrong index when given an
invalid UTF-8 string.
```terminal
% ruby26 -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")'
11
% ./mruby-head -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")'
nil
% ./mruby-patched -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")'
11
```
2019-08-17 12:05:03 +09:00
Yukihiro "Matz" Matsumoto
e76c5aad36
Stop using mrb_to_str as a converter (it is not).
2019-08-17 11:49:00 +09:00
dearblue
414ab682f3
Add String#rindex test for invalid UTF-8 string
2019-08-17 11:44:27 +09:00
dearblue
cf5f290fa0
Fix String#rindex test for UTF-8 string
2019-08-17 11:44:27 +09:00
Yukihiro "Matz" Matsumoto
0286a7f709
Avoid mrb_funcall from Class#new when no overloading.
2019-08-17 09:02:47 +09:00
Yukihiro "Matz" Matsumoto
99715a2e62
Merge pull request #4633 from shuujii/shared-fshared-string-is-not-required-when-sharing-nofree-string
...
SHARED/FSHARED string is not required when sharing NOFREE string
2019-08-16 23:20:44 +09:00
Yukihiro "Matz" Matsumoto
c1a0a99309
Update struct RArray union to silence C++ warning.
2019-08-16 22:51:07 +09:00
Yukihiro "Matz" Matsumoto
0923ff6313
Optimize bytecode for Class#new.
2019-08-16 22:37:30 +09:00
Yukihiro "Matz" Matsumoto
61763129db
Implement Class#new using inline mruby bytecode.
2019-08-16 22:30:03 +09:00
KOBAYASHI Shuji
9832e91304
SHARED/FSHARED string is not required when sharing NOFREE string
...
I think the string buffer of NOFREE string always exists and does not need
to be released, so it can be shared as another NOFREE string.
Also changed the `mrb_shared_string` field order so that eliminate padding if
`int` and `mrb_int` sizes are less than pointer size.
2019-08-16 22:05:58 +09:00
Yukihiro "Matz" Matsumoto
06c7ff0666
Avoid creating unnecessary empty arrays on splat.
...
But this changes requires `OP_ARYCAT` and `OP_ARYPUSH` to accept `nil`
as their first operand. Alternative VMs (e.g. `mruby/c`) that understand
mruby bytecode need to be updated.
2019-08-16 16:42:40 +09:00
Yukihiro "Matz" Matsumoto
fa8515bc2c
Stop raising exceptions from undef C API.
...
Some `undef' functions may be called before initialization, thus causes
infinite error recursion.
2019-08-16 16:42:40 +09:00
Yukihiro "Matz" Matsumoto
8fa9a7b965
Merge pull request #4632 from shuujii/remove-unneeded--include-in-src-string.c
...
Remove unneeded `#include` in `src/string.c`
2019-08-15 18:41:30 +09:00
KOBAYASHI Shuji
59844ddde0
Remove unneeded #include in src/string.c
2019-08-15 12:18:33 +09:00
Yukihiro "Matz" Matsumoto
0c5ebd75a3
Merge pull request #4631 from shuujii/extract-initialization-code-of-shared-and-fshared-string-to-function
...
Extract initialization code of shared and fshared string to function
2019-08-14 23:29:07 +09:00
KOBAYASHI Shuji
af6724c2f6
Extract initialization code of shared and fshared string to function
2019-08-14 22:20:34 +09:00
Yukihiro "Matz" Matsumoto
d986b9ff7b
Avoid array copying in mrb_instance_new.
2019-08-14 15:08:48 +09:00
Yukihiro "Matz" Matsumoto
603005ba65
Integrate kazuho/mruby-class-new-fiber-safe in the master.
...
Avoid calling `initialize` via `mrb_funcall`, which cause `cross C
boundary` error from Fibers started in the method.
2019-08-14 14:09:56 +09:00
Yukihiro "Matz" Matsumoto
8ed15fd92e
Small refactoring on #4630
2019-08-14 12:20:40 +09:00
Yukihiro "Matz" Matsumoto
9f6328d499
Remove MRB_API from functions only called from vm.c.
...
* `mrb_vm_define_class`
* `mrb_vm_define_module`
Only functions called from user code requires `MRB_API`.
2019-08-14 09:33:23 +09:00
Yukihiro "Matz" Matsumoto
e2ab8cca82
Merge pull request #4630 from shuujii/extract-struct-RString-initialization-code-to-function
...
Extract `struct RString` initialization code to function
2019-08-14 08:16:45 +09:00
KOBAYASHI Shuji
7af0ee099d
Extract struct RString initialization code to function
2019-08-13 22:40:30 +09:00
Yukihiro "Matz" Matsumoto
8a3457c330
Merge pull request #4629 from shuujii/mrb_str_pool-can-embed-one-more-byte
...
`mrb_str_pool` can embed one more byte; ref #4626
2019-08-12 22:41:51 +09:00
KOBAYASHI Shuji
dfb297e3c4
mrb_str_pool can embed one more byte; ref #4626
2019-08-12 21:42:31 +09:00
Yukihiro "Matz" Matsumoto
f113fa2a4f
Remove unnecessary prototypes from 'keywords`; fix #4628
2019-08-12 18:22:31 +09:00
Yukihiro "Matz" Matsumoto
ad0b546088
Merge pull request #4626 from shuujii/mrb_str_modify_keep_ascii-can-embed-one-more-byte
...
`mrb_str_modify_keep_ascii` can embed one more byte
2019-08-12 17:09:21 +09:00
Yukihiro "Matz" Matsumoto
285ce9d8aa
Replacing region may overwrap with the target region; fix #4627
2019-08-12 16:51:01 +09:00
Yukihiro "Matz" Matsumoto
472dba19ea
Revert "Should have cleared mrb->globals in mrb_gc_free_gv; fix #4618 "
...
This reverts commit 3dc8d9d7b3 .
2019-08-11 22:14:56 +09:00
Yukihiro "Matz" Matsumoto
0376383354
Reorder finalization to avoid potential crash; ref #4618
...
`mrb_gc_destroy` may call other mruby API functions from the finalizers.
So call that function first.
2019-08-11 22:14:56 +09:00
Yukihiro "Matz" Matsumoto
70b53f91c2
Add NUL always to short strings; ref 98fc887
2019-08-11 22:14:56 +09:00
KOBAYASHI Shuji
450684ab33
mrb_str_modify_keep_ascii can embed one more byte
...
The condition to make an embedded string was incorrect. Because there were
several similar codes, extracted into `RSTR_EMBEDDABLE_P` macro.
2019-08-11 20:48:37 +09:00
Yukihiro "Matz" Matsumoto
ce7fd7e1a3
Merge pull request #4621 from shuujii/remove-monkey-patches-for-Ruby-1.9-or-earlier
...
Remove monkey patches for Ruby 1.9 or earlier
2019-08-11 03:23:51 +09:00
Yukihiro "Matz" Matsumoto
469dbeb42e
Merge pull request #4624 from shuujii/enumerable-reject-etc.-should-return-Enumerable-without-block
...
`Enumerable#reject`, etc. should return `Enumerable` without block
2019-08-11 03:22:35 +09:00
KOBAYASHI Shuji
9f18aced9f
Enumerable#reject, etc. should return Enumerable without block
2019-08-10 22:18:54 +09:00
Yukihiro "Matz" Matsumoto
496a2c3264
Merge pull request #4623 from chasonr/complex-fixes
...
Avoid premature overflow in Complex#abs and Complex#/
2019-08-09 21:47:00 +09:00
Ray Chason
1cd0ff0d42
Avoid overflow and underflow in Complex#/
2019-08-09 00:08:36 -04:00
Ray Chason
c181d1e7fa
Implement Complex#abs in terms of Math.hypot
...
Math.hypot avoids premature overflow and underflow
2019-08-08 23:59:25 -04:00
KOBAYASHI Shuji
1868fd453d
Remove monkey patches for Ruby 1.9 or earlier
2019-08-08 22:12:25 +09:00
Yukihiro "Matz" Matsumoto
438638b42e
Merge pull request #4620 from shuujii/improve-MiniRake-rule-enhancement-for-Rake-compatibility
...
Improve MiniRake rule enhancement for Rake compatibility
2019-08-07 23:55:51 +09:00
KOBAYASHI Shuji
7e42b6ad3f
Improve MiniRake rule enhancement for Rake compatibility
...
Support pathmap notation, recursive dependencies search, and so on.
2019-08-07 21:50:22 +09:00
Yukihiro "Matz" Matsumoto
b377b7d580
Update mrb_to_str and related functions.
...
Contrary to the name, `mrb_to_str` just checks type, no conversion.
2019-08-07 16:20:40 +09:00
Yukihiro "Matz" Matsumoto
98fc887cb3
Reorganize mrb_string_value_cstr and related functions.
...
`mrb_string_value_cstr` and `mrb_string_value_len`: obsolete
`mrb_string_cstr`: new function to retrieve NULL terminated C string
`RSTRING_CSTR`: wrapper macro of `mrb_string_cstr`
2019-08-07 15:52:10 +09:00
Yukihiro "Matz" Matsumoto
b8a87bd111
Update required Ruby version to 2.0 or later.
2019-08-07 15:03:16 +09:00
Yukihiro "Matz" Matsumoto
2e73fe5ea1
Replace i.e. (means "that is") with e.g. (means "for example").
2019-08-07 15:02:38 +09:00
Yukihiro "Matz" Matsumoto
eceaa80de7
RUBY_PLATFORM may not contain mswin or mingw; Add msys
2019-08-07 08:54:40 +09:00
Yukihiro "Matz" Matsumoto
97672b22e6
Merge pull request #4619 from shuujii/add-mrb_noreturn-to-cmperr-in-src-numeric.c
...
Add `mrb_noreturn` to `cmperr()` in `src/numeric.c`
2019-08-07 08:54:25 +09:00
KOBAYASHI Shuji
6e2edd8ed2
Add mrb_noreturn to cmperr() in src/numeric.c
2019-08-06 23:04:40 +09:00
Yukihiro "Matz" Matsumoto
2ba8399ac8
Removed an unused local variable; ref #4615
2019-08-06 20:50:26 +09:00
Yukihiro "Matz" Matsumoto
3dc8d9d7b3
Should have cleared mrb->globals in mrb_gc_free_gv; fix #4618
2019-08-06 20:47:35 +09:00
Yukihiro "Matz" Matsumoto
151d0c14ed
Merge pull request #4615 from shuujii/use-new-specifiers-modifiers-of-mrb_vfromat
...
Use new specifiers/modifiers of `mrb_vfromat()`
2019-08-05 13:33:46 +09:00
KOBAYASHI Shuji
334afb167c
Use new specifiers/modifiers of mrb_vfromat()
...
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a ) with this change.
------------+-------------------+-------------------+--------
BINARY | BEFORE (5116789a ) | AFTER (This PR) | RATIO
------------+-------------------+-------------------+--------
mruby | 593416 bytes | 593208 bytes | -0.04%
libmruby.a | 769048 bytes | 767264 bytes | -0.23%
------------+-------------------+-------------------+--------
BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613 ,
so I put it back.
2019-08-05 13:18:50 +09:00
Yukihiro "Matz" Matsumoto
96ce4563bd
Merge pull request #4614 from shuujii/use-mrb_int-instead-of-to_int-in-mruby-numeric-ext
...
Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`
2019-08-05 12:33:59 +09:00
Yukihiro "Matz" Matsumoto
0e2e8b79d3
Merge pull request #4612 from dearblue/float-consts
...
Add constants for floating point number
2019-08-05 07:29:25 +09:00
Yukihiro "Matz" Matsumoto
dc11e7f027
Merge pull request #4613 from shuujii/change-second-argument-to-%l-of-mrb_vformat-to-size_t-from-mrb_int
...
Change second argument to `%l` of `mrb_vformat()` to `size_t` from `mrb_int`
2019-08-05 07:26:20 +09:00
KOBAYASHI Shuji
d599e35aa4
Use mrb_int() instead of to_int() in mruby-numeric-ext
2019-08-04 22:02:39 +09:00
dearblue
eb86340139
Add constants for floating point number
2019-08-04 18:34:46 +09:00
KOBAYASHI Shuji
1e9cb74cc6
Change second argument to %l of mrb_vformat() to size_t from mrb_int
...
- `size_t` is more commonly used.
- `len` argument of `mrb_str_new()` is `size_t`.
NOTE:
The test for `%l` is temporarily disabled because adding a new type to
`mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual
Studio 2017 in AppVeyor.
2019-08-03 19:42:22 +09:00
Yukihiro "Matz" Matsumoto
f6c41c1862
Merge pull request #4611 from shuujii/fix-mrb_vformat%f-with-MRB_USE_FLOAT
...
Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`
2019-08-03 15:33:35 +09:00
Yukihiro "Matz" Matsumoto
d5695a84df
Merge pull request #4610 from dearblue/time-warnings
...
Suppress compiler warnings for mruby-time; fix #4600
2019-08-03 15:31:36 +09:00
KOBAYASHI Shuji
a4243360a2
Fix mrb_vformat("%f") with MRB_USE_FLOAT
...
It potentially not work when `mrb_float` is `float` because `float` variable
in variable length arguments is promoted to `double`.
Also I fixed build with `MRB_WITHOUT_FLOAT`.
2019-08-03 11:54:45 +09:00
dearblue
07308a2fc9
Suppress compiler warnings for mruby-time; fix #4600
...
Warnings:
- If `MRB_TIME_T_UINT` is defined, the compiler issues a warning with an
integer comparison of different signs.
- It is mentioned that the `usec` variable passed to the
`mrb_to_time_t()` function may not be initialized
2019-08-03 10:35:39 +09:00
Yukihiro "Matz" Matsumoto
c883f4e332
Merge pull request #4609 from shuujii/change-the-mrb_vformat-specifier-%d-for-int
...
Change the `mrb_vformat` specifier `%d` for `int`
2019-08-02 20:38:41 +09:00
KOBAYASHI Shuji
d1817e7791
Change the mrb_vformat specifier %d for int
...
It potentially breaks, for example, in the case of `mrb_int` is 64-bit
and more smaller type is passed by `%d`. In fact, the problem could
become apparent when I used `%d` to `backtrace_location::lineno` in
`src/backtrace.c:mrb_unpack_backtrace()` on AppVeyor.
Therefore, change `%d` for `int` (not `mrb_int`) so that it can be
used mostly without casting.
2019-08-02 19:22:08 +09:00
Yukihiro "Matz" Matsumoto
3bacc302a3
Merge pull request #4608 from shuujii/add-new-specifiers-modifiers-to-format-string-of-mrb_vfromat
...
Add new specifiers/modifiers to format string of `mrb_vfromat()`
2019-08-01 22:10:53 +09:00
KOBAYASHI Shuji
eea42e06af
Add new specifiers/modifiers to format string of mrb_vfromat()
...
Format sequence syntax:
%[modifier]specifier
Modifiers:
----------+------------------------------------------------------------
Modifier | Meaning
----------+------------------------------------------------------------
! | Convert to string by corresponding `inspect` instead of
| corresponding `to_s`.
----------+------------------------------------------------------------
Specifiers:
----------+----------------+--------------------------------------------
Specifier | Argument Type | Note
----------+----------------+--------------------------------------------
c | char |
d,i | mrb_int |
f | mrb_float |
l | char*, mrb_int | Arguments are string and length.
n | mrb_sym |
s | char* | Argument is NUL terminated string.
t | mrb_value | Convert to type (class) of object.
v,S | mrb_value |
C | struct RClass* |
T | mrb_value | Convert to real type (class) of object.
Y | mrb_value | Same as `!v` if argument is `true`, `false`
| | or `nil`, otherwise same as `T`.
% | - | Convert to percent sign itself (no argument
| | taken).
----------+----------------+--------------------------------------------
This change will increase the binary size, but replacing all format strings
with new specifiers/modifiers will decrease the size because it reduces
inline expansion of `mrb_obj_value()`, etc. at the caller.
2019-08-01 13:24:52 +09:00
Yukihiro "Matz" Matsumoto
3d3a6da2ca
Merge pull request #4607 from shuujii/fix-UTC-offset-representation-in-Time-to_s-on-some-environments
...
Fix UTC offset representation in `Time#to_s` on some environments; ref #4604
2019-07-31 22:07:31 +09:00
KOBAYASHI Shuji
5116789aa0
Fix UTC offset representation in Time#to_s on some environments; ref #4604
...
Use own implementation to calculate UTC offset on Visual Studio 2015 or
earlier or MinGW because `strftime("%z")` on these environments does not
conform C99.
2019-07-31 20:34:27 +09:00
Yukihiro "Matz" Matsumoto
96ac49b75b
Avoid MRB_INT_MIN to apply fixdivmod.
...
`MRB_INT_MIN` is the only integer value that has no corresponding
positive integer value (i.e. `-MRB_INT_MIN` = `MRB_INT_MIN`).
2019-07-31 00:58:12 +09:00
Yukihiro "Matz" Matsumoto
c31e1ea798
Normalize floating point negative zero to positive zero in `flodivmod'.
2019-07-31 00:57:00 +09:00
Yukihiro "Matz" Matsumoto
28405d26b0
Should return +/- infinity for float division by zero.
2019-07-31 00:55:31 +09:00
Yukihiro "Matz" Matsumoto
8175d92b4b
Use NULL instead of 0 for null pointers.
2019-07-31 00:54:39 +09:00
Yukihiro "Matz" Matsumoto
5900b29fb4
Fixed integer overflow in lshift.
2019-07-30 23:16:34 +09:00
Yukihiro "Matz" Matsumoto
7dae0ec74c
Merge pull request #4606 from shuujii/refine-message-to-skip-in-nested-assert
...
Refine message to `skip` in nested `assert`
2019-07-30 14:41:09 +09:00
KOBAYASHI Shuji
44381f0a0c
Refine message to skip in nested assert
...
- I think "Info" is used only to `skip`, so change to "Skip".
- Changed the default value of `assert` and specify the argument explicitly
at the caller of `assert` because it is unnatural "Assertion failed" is
output even though the assertion doesn't fail.
== Example:
def assert_foo(exp, act)
assert do
assert_equal exp[0], act[0]
assert_equal exp[1], act[1]
end
end
def assert_bar(exp, act)
assert do
skip
end
end
def assert_baz(exp, act)
assert do
assert_equal exp, act
assert_bar exp, act
end
end
assert 'test#skip_in_nested_assert' do
assert_baz 1, 1
end
=== Before this patch:
?..
Info: test#skip_in_nested_assert (core)
- Assertion[1]
Info: Assertion failed (core)
- Assertion[1-2]
Skip: Assertion failed (core)
Total: 3
OK: 2
KO: 0
Crash: 0
Warning: 0
Skip: 1
=== After this patch:
???
Skip: test#skip_in_nested_assert (core)
- Assertion[1]
Skip: assert (core)
- Assertion[1-2]
Skip: assert (core)
Total: 3
OK: 0
KO: 0
Crash: 0
Warning: 0
Skip: 3
2019-07-30 13:05:01 +09:00
Yukihiro "Matz" Matsumoto
428e34abba
Merge pull request #4605 from shuujii/fix-Warn-if-assertion-is-missing-inside-assert
...
Fix "Warn if assertion is missing inside `assert`"; ref ff43b2b9
2019-07-29 22:37:13 +09:00
KOBAYASHI Shuji
5091d047c0
Fix "Warn if assertion is missing inside assert"; ref ff43b2b9
2019-07-29 21:40:58 +09:00
Yukihiro "Matz" Matsumoto
a8001d693a
Merge pull request #4604 from kou/time-to-s-utf8
...
Fix Time#to_s encoding on Windows
2019-07-29 18:43:16 +09:00
Sutou Kouhei
effae4ae55
Fix Time#to_s encoding on Windows
...
strftime() on Windows returns locale encoding time zone for "%z" even
if MSDN says "%z" is "The offset from UTC in ISO 8601 format; no
characters if time zone is unknown" in MSDN:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019
So we need to convert encoding of string from strftime().
2019-07-29 18:16:21 +09:00
Yukihiro "Matz" Matsumoto
ff43b2b97c
Fixed a conflict between #4407 and #4540
2019-07-29 01:25:58 +09:00
Yukihiro "Matz" Matsumoto
2ebc6d5b6f
Merge pull request #4407 from shuujii/add-assert_raise_with_message-and-assert_raise_with_message_pattern
...
Add `assert_raise_with_message` and `assert_raise_with_message_pattern`
2019-07-29 01:05:26 +09:00
Yukihiro "Matz" Matsumoto
cd8fc9bcb8
Resolved conflicts in #4320
2019-07-29 01:02:03 +09:00
Yukihiro "Matz" Matsumoto
3ac98009d3
Merge pull request #4602 from shuujii/remove-EnumeratorChain-initialize_copy
...
Remove `Enumerator::Chain#initialize_copy`
2019-07-28 23:44:11 +09:00
Yukihiro "Matz" Matsumoto
34741d513f
Merge pull request #4603 from shuujii/define-plus-to-Enumerator-and-Enumerator-Chain-instead-of-Enumerable
...
Define `#+` to `Enumerator` and `Enumerator#Chain` instead of `Enumerable`
2019-07-28 23:43:31 +09:00
KOBAYASHI Shuji
7f80a5f73c
Define #+ to Enumerator and Enumerator#Chain instead of Enumerable
2019-07-28 22:52:24 +09:00
KOBAYASHI Shuji
27e3d92a30
Remove Enumerator::Chain#initialize_copy
...
I think `Enumerator::Chain#initialize_copy` is unnecessary because CRuby
doesn't clone elements.
2019-07-28 22:12:02 +09:00
Yukihiro "Matz" Matsumoto
04a422e499
Merge pull request #4601 from shuujii/drop-dependency-from-mruby-enumerator-to-mruby-enum-ext
...
Drop dependency from `mruby-enumerator` to `mruby-enum-ext`
2019-07-28 14:48:15 +09:00
KOBAYASHI Shuji
a70107d725
Drop dependency from mruby-enumerator to mruby-enum-ext
2019-07-28 13:08:11 +09:00
Yukihiro "Matz" Matsumoto
fa798f17ff
Merge pull request #4600 from dearblue/time-precision
...
Fix the lack of precision for `Time`; ref d74355061
2019-07-28 10:38:07 +09:00
Yukihiro "Matz" Matsumoto
8c6cd2da76
Merge pull request #4599 from shuujii/drop-dependency-from-mruby-enum-chain-to-mruby-enum-ext
...
Drop dependency from `mruby-enum-chain` to `mruby-enum-ext`
2019-07-27 21:38:20 +09:00
dearblue
fda5c0c073
Fix the lack of precision for Time; ref d74355061
...
- `Time.local` and `Time.utc` are able to use with `MRB_INT16 + MRB_WITHOUT_FLOAT`.
- `time_t` is converted directly from the Ruby object.
- `time + sec` and` time - sec` are not affected by the precision of `mrb_float`.
Similarly, calculations are possible with `MRB_INT16 + MRB_WITHOUT_FLOAT`.
2019-07-27 21:25:18 +09:00
KOBAYASHI Shuji
fe9a58c193
Drop dependency from mruby-enum-chain to mruby-enum-ext
2019-07-27 20:45:14 +09:00
Yukihiro "Matz" Matsumoto
2f0a95768b
Merge pull request #4598 from dearblue/time-without-float
...
Fix mruby-time with `MRB_WITHOUT_FLOAT`; ref d74355061
2019-07-27 15:05:16 +09:00
Yukihiro "Matz" Matsumoto
b58f769c96
Fix line number bug; fix #4513
...
Also fix the misfeature introduced in 23783a4 , that ignores newlines
between method chains.
2019-07-27 15:00:46 +09:00
dearblue
1467c14adc
Fix mruby-time with MRB_WITHOUT_FLOAT; ref d74355061
2019-07-27 14:42:37 +09:00
Yukihiro "Matz" Matsumoto
42fb251d0a
Merge pull request #4597 from shuujii/drop-dependency-from-mruby-array-ext-to-mruby-enum-ext
...
Drop dependency from `mruby-array-ext` to `mruby-enum-ext`
2019-07-27 14:01:37 +09:00
Yukihiro "Matz" Matsumoto
3103da8570
Merge pull request #4594 from shuujii/move-NilClass-to_h-to-mruby-object-ext-from-mruby-enum-ext
...
Move `NilClass#to_h` to `mruby-object-ext` from `mruby-enum-ext`
2019-07-27 13:09:34 +09:00
KOBAYASHI Shuji
778310260c
Drop dependency from mruby-array-ext to mruby-enum-ext
2019-07-26 11:48:53 +09:00
Yukihiro "Matz" Matsumoto
381a6ddddb
Merge pull request #4595 from shuujii/refine-Array-permutation-combination-test
...
Refine `Array#(permutation|combination) test`
2019-07-26 00:04:52 +09:00
KOBAYASHI Shuji
87cc58ba3d
Refine Array#(permutation|combination) test
...
- No guarantees about the order in which the permutations/combinations
are yielded.
- Drop dependency on `Enumerator`.
2019-07-25 22:31:54 +09:00
KOBAYASHI Shuji
2d520eaf6f
Move NilClass#to_h to mruby-object-ext from mruby-enum-ext
2019-07-24 20:13:26 +09:00
Yukihiro "Matz" Matsumoto
5779464ec3
Add return to silence a warning; ref #4593
2019-07-24 10:50:22 +09:00
Yukihiro "Matz" Matsumoto
866a9e6481
Use MRB_TT_ISTRUCT for Random to reduce memory.
...
When the size of Xorshift128 seed (`sizeof(uint32)*4`) is bigger than
ISTRUCT_DATA_SIZE, `Random` uses Xorshift96 instead.
2019-07-24 10:48:00 +09:00
Yukihiro "Matz" Matsumoto
a57a9bce79
Call MRB_SET_INSTANCE_TT for Complex and Rational.
2019-07-24 10:48:00 +09:00
Yukihiro "Matz" Matsumoto
e968bdf629
Merge pull request #4593 from shuujii/add-encoding-argument-to-Integral-chr
...
Add encoding argument to `Integral#chr`
2019-07-23 23:36:50 +09:00
KOBAYASHI Shuji
e86aa61f20
Add encoding argument to Integral#chr
...
Currently, `Integral#chr` in mruby changes behavior by `MRB_UTF8_STRING`
setting.
before this patch:
$ bin/mruby -e 'p 171.chr' #=> "\xab" (`MRB_UTF8_STRING` is disabled)
$ bin/mruby -e 'p 171.chr' #=> "«" (`MRB_UTF8_STRING` is enabled)
This behavior is incompatible with Ruby, and a little inconvenient because
it can't be interpreted as ASCII-8BIT with `MRB_UTF8_STRING`, I think.
So add encoding argument according to Ruby.
after this patch:
$ bin/mruby -e 'p 171.chr' #=> "\xab"
$ bin/mruby -e 'p 171.chr("ASCII-8BIT")' #=> "\xab"
$ bin/mruby -e 'p 171.chr("UTF-8")' #=> "«"
Allow only `String` for encoding because mruby doesn't have `Encoding`
class, and `"ASCII-8BIT"` (`"BINARY"`) and `"UTF-8"` (only with
`MRB_UTF8_STRING`) are valid value (default is `"ASCII-8BIT"`).
2019-07-23 20:16:46 +09:00
Yukihiro "Matz" Matsumoto
5166e316ef
Merge pull request #4591 from shuujii/integrate-Integral-chr-Fixnum-chr-to-mruby-string-ext
...
Integrate `Integral#chr` (`Fixnum#chr`) to `mruby-string-ext`
2019-07-22 21:40:02 +09:00
Yukihiro "Matz" Matsumoto
d2dd2d0e48
Merge pull request #4590 from shuujii/fix-Module-dup-to-frozen-module
...
Fix `Module#dup` to frozen module
2019-07-22 21:38:56 +09:00
Yukihiro "Matz" Matsumoto
477be45244
Merge pull request #4592 from shuujii/set-MRB_STR_ASCII-flag-in-String-inspect
...
Set `MRB_STR_ASCII` flag in `String#inspect`
2019-07-22 21:38:08 +09:00
Yukihiro "Matz" Matsumoto
d74355061b
Fix mruby-time to work with MRB_WITHOUT_FLOAT; ref #4576
...
As a side effect, `mrb_time_at()` now takes `mrb_int` instead of
`double` as time arguments.
2019-07-22 21:34:37 +09:00
Yukihiro "Matz" Matsumoto
87d1b2a910
Improve conflict error message of Time and Math; ref #4576
2019-07-22 20:21:30 +09:00
Yukihiro "Matz" Matsumoto
949f6f5324
Check conflicts with Complex and MRB_WITHOUT_FLOAT; ref #4576
...
The Complex class needs `mrb_float` so that it does not work with
`MRB_WITHOUT_FLOAT` anyway.
2019-07-22 20:19:01 +09:00
KOBAYASHI Shuji
fe8b463c4e
Set MRB_STR_ASCII flag in String#inspect
...
`String#inspect` can set `MRB_STR_ASCII` flag to receiver and return value
because it checks character byte length.
2019-07-22 19:39:25 +09:00
Yukihiro "Matz" Matsumoto
f99e9963b2
Switch random generator from Mersenne Twister to Xorshit128.
...
Now `rand` can be used with `MRB_WITHOUT_FLOAT`; ref #4576
2019-07-22 15:49:59 +09:00
Yukihiro "Matz" Matsumoto
277be410f3
No rounding needed if 'ndigits is bigger than DBL_DIG+2`; fix #4566
2019-07-22 13:23:53 +09:00
Yukihiro "Matz" Matsumoto
6f67fddb87
Fix FIXABLE_FLOAT() on MRB_INT64; ref #4566
...
Normal `TYPED_FIXABLE(f,mrb_float)` does not work on 64bit int from
casting problems. The new approach works well, but assumes two's
complement and IEEE-754 floating point numbers.
2019-07-22 13:23:53 +09:00
KOBAYASHI Shuji
c980fe2792
Integrate Integral#chr (Fixnum#chr) to mruby-string-ext
...
Because they're defined in both `mruby-string-ext` and `mruby-numeric-ext`
(they seem more natural to define in N, but `mruby-string-ext` depends on
`Integral#chr`).
2019-07-21 22:59:41 +09:00
KOBAYASHI Shuji
7675fcb5d3
Fix Module#dup to frozen module
...
Before this patch:
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> true
After this patch (same as Ruby):
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> false
2019-07-20 22:41:57 +09:00
Yukihiro "Matz" Matsumoto
cf4cddf7a1
Merge pull request #4589 from shuujii/refine-String-chr-test
...
Refine `String#chr` test and separate `Fixnum#chr` test
2019-07-20 08:15:02 +09:00
KOBAYASHI Shuji
8ab846b5b9
Refine String#chr test and separate Fixnum#chr test
2019-07-19 21:48:06 +09:00
Yukihiro "Matz" Matsumoto
7e229c470a
Merge pull request #4575 from dearblue/attr-use-stack
...
Use stack memory for small name of attr accessors
2019-07-18 18:37:08 +09:00
Yukihiro "Matz" Matsumoto
317fba47a6
Merge pull request #4588 from shuujii/fix-String-times-test-with-MRB_WITHOUT_FLOAT
...
Fix `String#*` test with `MRB_WITHOUT_FLOAT`
2019-07-18 18:36:32 +09:00
KOBAYASHI Shuji
9873d5e0b9
Fix String#* test with MRB_WITHOUT_FLOAT
2019-07-18 17:51:02 +09:00
Yukihiro "Matz" Matsumoto
94a1f488a6
Clear env before top-level execution; fix #4581
2019-07-18 00:35:21 +09:00
Yukihiro "Matz" Matsumoto
2a410c0e1b
Avoid making top-level env in initialization code; ref #4581
2019-07-18 00:34:08 +09:00
Yukihiro "Matz" Matsumoto
0b5e155016
Merge pull request #4587 from shuujii/fix-String-aref-test
...
Fix `String#[]` test
2019-07-17 22:35:16 +09:00
Yukihiro "Matz" Matsumoto
626c21466f
Merge pull request #4585 from shuujii/fix-range-min-with-mruby-range-ext
...
Fix `(fixnum_value ... float_value).min` with `mruby-range-ext`
2019-07-17 22:34:29 +09:00
Yukihiro "Matz" Matsumoto
cdf5e3963d
Merge branch 'master' into fix-range-min-with-mruby-range-ext
2019-07-17 22:33:55 +09:00
Yukihiro "Matz" Matsumoto
7172231b8f
Merge pull request #4586 from shuujii/revert-4300
...
Revert #4300
2019-07-17 22:29:35 +09:00
Yukihiro "Matz" Matsumoto
47ac318920
Merge pull request #4584 from shuujii/allow-mruby-range-ext-to-work-with-MRB_WITHOUT_FLOAT
...
Allow `mruby-range-ext` to work with `MRB_WITHOUT_FLOAT`; ref 2add8641
2019-07-17 20:42:25 +09:00
KOBAYASHI Shuji
9d2272ec2c
Fix String#[] test
2019-07-17 20:09:37 +09:00
KOBAYASHI Shuji
e38ba3d58c
Revert #4300
...
Originally, it was not necessary to change. I made mistake.
2019-07-17 19:49:58 +09:00
KOBAYASHI Shuji
1b7516a4ae
Fix (fixnum_value ... float_value).min with mruby-range-ext
...
Before this patch:
$ bin/mruby -e 'p (2...4.0).min' #=> TypeError
After this patch (same as CRuby and without `mruby-range-ext`):
$ bin/mruby -e 'p (2...4.0).min' #=> 2
2019-07-17 19:18:23 +09:00
KOBAYASHI Shuji
8cb37804c1
Allow mruby-range-ext to work with MRB_WITHOUT_FLOAT; ref 2add8641
2019-07-17 18:58:21 +09:00
Yukihiro "Matz" Matsumoto
d5939879cc
Fixed a bug in #4034
2019-07-17 10:39:17 +09:00
Yukihiro "Matz" Matsumoto
b22bde6596
Avoid MRB_INLINE for mrb_str_modify(); ref #4579
...
Functions that are called infrequently need not to be inline.
2019-07-17 10:36:10 +09:00
Yukihiro "Matz" Matsumoto
2add864164
Allow mruby-range-ext to work with MRB_WITHOUT_FLOAT; ref #4576
2019-07-17 10:36:10 +09:00
Yukihiro "Matz" Matsumoto
5eef75b678
Merge pull request #4034 from i110/i110/inspect-recursion
...
Let inspect recursion do the right thing
2019-07-17 10:35:59 +09:00
Yukihiro "Matz" Matsumoto
d605b72c1d
Merge branch 'master' into i110/inspect-recursion
2019-07-17 10:35:41 +09:00
Yukihiro "Matz" Matsumoto
9af3b7c625
Merge pull request #4583 from shuujii/set-MRB_STR_ASCII-flag-in-some-methods-of-String
...
Copy receiver's `MRB_STR_ASCII` flag in some methods of `String`
2019-07-16 22:51:55 +09:00
KOBAYASHI Shuji
31492a177c
Copy receiver's MRB_STR_ASCII flag in some methods of String
2019-07-16 21:56:58 +09:00
Yukihiro "Matz" Matsumoto
d9a656756b
Merge pull request #4576 from dearblue/error-configuration
...
Error needed/conflicts configuration
2019-07-16 12:12:58 +09:00
Yukihiro "Matz" Matsumoto
8e10a026e6
Merge pull request #4580 from shuujii/unify-type-of-line-number-to-uint16_t
...
Unify type of line number to `uint16_t`
2019-07-16 06:36:47 +09:00
Yukihiro "Matz" Matsumoto
d7f9d71ea5
Merge pull request #4579 from shuujii/keep-MRB_STR_ASCII-flag-in-some-methods-of-String
...
Keep `MRB_STR_ASCII` flag in some methods of `String`
2019-07-16 06:35:12 +09:00
KOBAYASHI Shuji
acad9567c1
Unify type of line number to uint16_t
2019-07-15 23:03:41 +09:00
KOBAYASHI Shuji
9093f3403f
Add MRB_API to mrb_str_modify_keep_ascii()
2019-07-15 07:43:46 +09:00
Yukihiro "Matz" Matsumoto
df293c7be1
Merge pull request #4578 from dearblue/improve-utf8len
...
Improve `utf8len()` performance with UTF-8
2019-07-15 05:34:12 +09:00
KOBAYASHI Shuji
380805ece2
Keep MRB_STR_ASCII flag in some methods of String
2019-07-14 19:13:19 +09:00
Yukihiro "Matz" Matsumoto
38624074e9
Merge pull request #4577 from dearblue/pack-unpack
...
Fix pack/unpack for base64; ref #4556
2019-07-14 18:59:41 +09:00
dearblue
7b260d9c2d
Improve utf8len() performance with UTF-8
2019-07-14 18:55:38 +09:00
dearblue
fd89948164
Fix empty array refers; ref #4556
...
For example, `"".unpack("")` evaluates to `[]`.
2019-07-14 12:03:44 +09:00
dearblue
4861be1171
Fix pack/unpack for base64; ref #4556
...
The pack/unpack "m" directive should be treated as a length rather than
an element count.
2019-07-14 12:03:00 +09:00
dearblue
109d926e9c
Add pack/unpack test for base64
2019-07-15 10:41:32 +09:00
dearblue
c96b517ea2
Error needed/conflicts configuration
...
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
2019-07-14 00:29:17 +09:00
dearblue
c417c16788
Use stack memory for small name of attr accessors
...
Also integrated the common parts of `mrb_mod_attr_reader()` and
`mrb_mod_attr_writer()` functions.
2019-07-13 23:04:12 +09:00
Yukihiro "Matz" Matsumoto
a7be9f1cab
Merge pull request #4574 from shuujii/add-mruby-method-gem-to-default.gembox
...
Add `mruby-method` gem to `default.gembox` [ci skip]
2019-07-13 21:11:45 +09:00
KOBAYASHI Shuji
e8a84d663f
Add mruby-method gem to default.gembox [ci skip]
2019-07-13 20:42:32 +09:00
Yukihiro "Matz" Matsumoto
b4cdced22f
Enumerable#detect {and #find} should call ifnone; fix #4484
...
It's an error in ISO specification; 15.3.2.2.4 and 15.3.2.2.7
2019-07-13 18:05:01 +09:00
Yukihiro "Matz" Matsumoto
a9fd2e6464
Resolve ambiguous argument warning.
2019-07-13 13:16:30 +09:00
Yukihiro "Matz" Matsumoto
9741df100b
Change type of a variable for signedness mismatch; ref #4573
2019-07-13 13:13:21 +09:00
Yukihiro "Matz" Matsumoto
6b1cc6e2fe
Avoid mrb_funcall() if possible using mrb_Float(); ref #4555
2019-07-13 12:54:02 +09:00
Yukihiro "Matz" Matsumoto
c902e30494
Merge pull request #4571 from shuujii/consider--MP-flag-specified-when-parsing-.d-file
...
Consider `-MP` flag specified when parsing `.d` file
2019-07-12 21:46:35 +09:00
Yukihiro "Matz" Matsumoto
1556371370
Merge pull request #4573 from dearblue/fix-4569
...
Fix heap buffer overflow; fix #4569
2019-07-12 21:46:02 +09:00
dearblue
bde2f35a9f
Fix heap buffer overflow; fix #4569
2019-07-12 21:23:55 +09:00
Yukihiro "Matz" Matsumoto
54712c0624
Merge pull request #4572 from shuujii/lazy-load-tasks-toolchains
...
Lazy load `tasks/toolchains/*.rake`
2019-07-12 19:01:58 +09:00
KOBAYASHI Shuji
16e4657acd
Lazy load tasks/toolchains/*.rake
2019-07-12 18:35:20 +09:00
KOBAYASHI Shuji
66909dfe86
Consider -MP flag specified when parsing .d file
...
`-MP` flag is used in `tasks/toolchains/android.rake`.
2019-07-12 14:23:35 +09:00
Yukihiro "Matz" Matsumoto
c5f0a0256b
Merge pull request #4569 from dearblue/improve-string-index
...
Improve performance `String#index` with UTF-8
2019-07-12 01:47:50 +09:00
dearblue
e4249b1b9e
Add UTF-8 test for String#index
2019-07-11 22:09:16 +09:00
dearblue
8c0d9ba1a3
Improve performance String#index with UTF-8
...
Based on Boyer-Moore-Horspool algorithm (Quick Search algorithm).
As a side effect, the correct position is returned even if an invalid UTF-8
string is given.
```console
% ./mruby@master -e 'p ("\xd1" * 100 + "#").index("#")'
50
% ./mruby@improve-index -e 'p ("\xd1" * 100 + "#").index("#")'
100
```
The other behavior should be the same as the current implementation.
2019-07-11 22:09:15 +09:00
Yukihiro "Matz" Matsumoto
5420895bcb
Merge pull request #4568 from shuujii/remove-an-unused-argument-of-str_with_class
...
Remove an unused argument of `str_with_class()`
2019-07-10 22:33:38 +09:00
KOBAYASHI Shuji
80f78ca196
Remove an unused argument of str_with_class()
2019-07-10 21:53:17 +09:00
Yukihiro "Matz" Matsumoto
bc7c5d376a
Merge pull request #4562 from shuujii/set-MRB_STR_ASCII-flag-when-an-inline-symbol-is-stringized
...
Set `MRB_STR_ASCII` flag when an inline symbol is stringized
2019-07-09 21:22:15 +09:00
KOBAYASHI Shuji
23fc3339ee
Set MRB_STR_ASCII flag when an inline symbol is stringized
2019-07-09 18:59:00 +09:00
Yukihiro "Matz" Matsumoto
59a76d48f8
Merge pull request #4560 from lopopolo/range-max-min-hang
...
Specialize Enumerable#max and Enumerable#min for Range
2019-07-09 18:44:53 +09:00
Ryan Lopopolo
3b77b5fd39
Revert Float dependency in Range#each
2019-07-09 02:08:14 -07:00
Ryan Lopopolo
56929362f5
Fix Range#min fast path with exclusive range
2019-07-09 01:48:15 -07:00
Ryan Lopopolo
0ad5ba7a0f
Add a fast path for Float and Fixnum ranges for Range#max and Range#min
...
If no block is given and the Range has Fixnum or Float endpoints, do not iterate with
each and instead compare the endpoints directly. This implementation passes all of
the applicable specs from Ruby Spec.
2019-07-09 01:42:40 -07:00
Ryan Lopopolo
eab07daf92
Add Range#max and Range#min tests from Ruby Spec
2019-07-09 01:41:10 -07:00
Ryan Lopopolo
d9c5303793
Remove attempt at spec-compliant Range#max and Range#min from core
2019-07-09 01:40:44 -07:00
Yukihiro "Matz" Matsumoto
9add4a66c0
Merge pull request #4561 from shuujii/fix-the-order-of-expected-and-actual-in-test-t-range.rb
...
Fix the order of "expected" and "actual" in `test/t/range.rb`
2019-07-09 16:41:32 +09:00
Ryan Lopopolo
4085709ae1
Specialize Enumerable#max and Enumerable#min for Range
...
This patch prevents a hang for pathalogical (large) Ranges when
computing max and min.
Range inherits its implementation of max and min from Enumerable.
Enumerable implements max and min by calling each. For Range objects,
this is unnecessary since we know the max and the min by the end and
begin attributes.
It is also very slow. This code hangs unnecessarily:
(0..2**32).max
# ... hang
(0..2**32).min
# ... hang
This patch overrides max and min after including enumerable to yield
based on the begin and end methods.
2019-07-08 22:36:24 -07:00
Ryan Lopopolo
469c6261c6
Add tests for String Ranges
...
Range#each depends on String#upto which is implemented in mruby-string-ext
which is why these tests live there.
2019-07-08 22:36:24 -07:00
Ryan Lopopolo
f7d59dfe23
Add tests for Range#max and Range#min
2019-07-08 22:36:24 -07:00
KOBAYASHI Shuji
c8a7d0ab95
Fix the order of "expected" and "actual" in test/t/range.rb
2019-07-09 13:13:13 +09:00
Yukihiro "Matz" Matsumoto
0484bf133b
Merge pull request #4559 from shuujii/add-macros-for-inline-symbol-for-readability
...
Add macros for inline symbol for readability
2019-07-09 09:25:54 +09:00
KOBAYASHI Shuji
0a79486380
Add macros for inline symbol for readability
2019-07-08 22:14:23 +09:00
Yukihiro "Matz" Matsumoto
fd4e37404b
Merge pull request #4557 from shuujii/fix-Numeric-step-to-infinity
...
Fix `Numeric#step` to infinity; ref. #4555
2019-07-08 18:50:28 +09:00
KOBAYASHI Shuji
32c2aa10c7
Fix Numeric#step to infinity; ref. #4555
2019-07-07 22:10:32 +09:00
Yukihiro "Matz" Matsumoto
519f396365
Merge pull request #4554 from shuujii/fix-missing--ifndef-MRB_ENABLE_ALL_SYMBOLS
...
Fix missing `#ifndef MRB_ENABLE_ALL_SYMBOLS`
2019-07-06 21:09:13 +09:00
KOBAYASHI Shuji
df1f1002d9
Fix missing #ifndef MRB_ENABLE_ALL_SYMBOLS
2019-07-06 19:55:37 +09:00
Yukihiro "Matz" Matsumoto
280a83f029
Merge pull request #4553 from shuujii/read-write-MRB_STR_ASCII-flag-only-when-MRB_UTF8_STRING-is-defined
...
Read/write `MRB_STR_ASCII` flag only when `MRB_UTF8_STRING` is defined
2019-07-06 07:30:06 +09:00
KOBAYASHI Shuji
f9bf2d9d8e
Read/write MRB_STR_ASCII flag only when MRB_UTF8_STRING is defined
2019-07-05 22:19:31 +09:00
Yukihiro "Matz" Matsumoto
8294ce9fd4
It was too early to check key for undef; ref #4534
2019-07-04 23:11:57 +09:00
Yukihiro "Matz" Matsumoto
991bdd4ed7
Rename MRB_STR_NO_UTF to 'MRB_STR_ASCII`; close #4550
...
In #4550 , @shuuji proposed the name name `MRB_STR_NO_MULTI_BYTE` for
more precise description. Although I agree that the name name is
correct, but the flag means the string does not contain multi byte UTF-8
characters, i.e. all characters fit in the range of ASCII.
2019-07-04 23:07:18 +09:00
Yukihiro "Matz" Matsumoto
f4f3ced955
Merge pull request #4551 from dearblue/fix-4549
...
Fix heap buffer overflow; ref #4549
2019-07-04 22:50:06 +09:00
dearblue
2bb30481b6
Fix heap buffer overflow; ref #4549
...
This patch is showed in #4549 .
2019-07-04 21:49:07 +09:00
Yukihiro "Matz" Matsumoto
93b3b83cc4
Merge pull request #4548 from shuujii/refine-document-to-mrb_get_args
...
Refine document to mrb_get_args()` [ci skip]
2019-07-04 01:49:00 +09:00
KOBAYASHI Shuji
d915261590
Refine document to mrb_get_args()` [ci skip]
2019-07-03 20:41:30 +09:00
Yukihiro "Matz" Matsumoto
8c29b5998f
Merge pull request #4546 from shuujii/fix-and-refine-error-message-in-mrb_obj_to_sym
...
Fix and refine error message in `mrb_obj_to_sym()`
2019-07-02 19:55:42 +09:00
KOBAYASHI Shuji
0d54dbb264
Fix and refine error message in mrb_obj_to_sym()
...
Before this patch:
$ bin/mruby -e '1.respond_to?(2)' #=> nil is not a symbol
After this patch (same as Ruby):
$ bin/mruby -e '1.respond_to?(2)' #=> 2 is not a symbol nor a string
2019-07-02 19:41:40 +09:00
Yukihiro "Matz" Matsumoto
38a10e8a98
Merge pull request #4545 from shuujii/remove-unused-C-header-file-from-src-etc.c
...
Remove unused C header file from `src/etc.c`
2019-07-02 00:20:37 +09:00
KOBAYASHI Shuji
7e3a8b7a75
Remove unused C header file from src/etc.c
2019-07-01 12:29:02 +09:00
Yukihiro "Matz" Matsumoto
8f19d516f9
Merge pull request #4544 from shuujii/fix-include-prepend-and-extend-to-frozen-object
...
Fix `include`, `prepend` and `extend` to frozen object
2019-06-30 16:29:55 +09:00
KOBAYASHI Shuji
97c9e6b000
Fix include, prepend and extend to frozen object
2019-06-30 15:06:39 +09:00
Yukihiro "Matz" Matsumoto
cf69724083
Merge pull request #4540 from dearblue/assert-nesting
...
Nested `assert` for mrbtest
2019-06-29 21:38:32 +09:00
Yukihiro "Matz" Matsumoto
ff5ec824fd
Merge pull request #4541 from dearblue/replace-string-aset
...
Replace `String#[]=` method by C implements
2019-06-29 21:36:48 +09:00
dearblue
0ad1cacff3
Simplify mrb_str_aref_m() and mrb_str_aref()
...
It is integration with part of argument parsing used in `mrb_str_aset_m()`.
2019-06-29 14:41:43 +09:00
dearblue
0d452073f4
Replace String#[]= method by C implements
...
The purpose is to eliminate string objects that are temporarily created during processing.
2019-06-29 14:41:43 +09:00
dearblue
40030a5dbc
Add test for String#[]=
2019-06-29 14:41:43 +09:00
dearblue
a215292b6a
Use nested assert
2019-06-29 11:54:17 +09:00
dearblue
1b9f949f36
Use a normal method instead of a lambda
...
Ref commit 35319bed01
2019-06-29 11:54:17 +09:00
dearblue
5f9034e428
Nested assert for mrbtest
...
When nesting `assert` used in test, it is indented and displayed.
Assertion numbers are concatenated by `"-"` at this time.
The purpose is to match the apparent numbers when failing with `assert_mruby`
which is defined by `mrbgems/mruby-bin-mruby/bintest/mruby.rb` for example.
Child assertions "skip" and "info" are reported as parent assertions "info"
and `$ok_test += 1`. The child assertions "ko" and "crash" are reported as the
parent assertion "ko" and `$ko_test += 1`.
When child assertions are mixed, "ko" takes precedence.
Incompatibility:
- `$mrbtest_assert_idx` takes `nil` or an integer array object.
So far it was `nil` or an integer.
- `$asserts` points to the top of the internal stack in the `assert`.
- `$mrbtest_assert` points to the top of the internal stack in `assert`.
2019-06-29 11:54:10 +09:00
Yukihiro "Matz" Matsumoto
4f4e240024
Merge pull request #4538 from shuujii/use-__ENCODING__-in-tests
...
Use `__ENCODING__` in tests
2019-06-28 20:08:52 +09:00
Yukihiro "Matz" Matsumoto
cf7a2292f3
Merge pull request #4539 from shuujii/remove-unnecessary-backticks-in-src-range.c
...
Remove unnecessary backticks in `src/range.c`; ref #2858
2019-06-28 20:07:34 +09:00
KOBAYASHI Shuji
c9a3867ff2
Remove unnecessary backticks in src/range.c; ref #2858
2019-06-28 19:27:58 +09:00
KOBAYASHI Shuji
bc3176da63
Use __ENCODING__ in tests
...
It cannot be used for `String#size` test if judging whether or not `MRB_UTF8_STRING` is defined by result of `String#size`.
2019-06-28 19:26:29 +09:00
Yukihiro "Matz" Matsumoto
dc03bea854
Merge pull request #4535 from shuujii/add-modification-tests-for-immediate-value
...
Add modification tests for immediate value
2019-06-28 08:32:23 +09:00
Yukihiro "Matz" Matsumoto
051cb9ca37
Merge pull request #4536 from komainu8/fix_broken_links
...
Fix broken links for mruby.org
2019-06-28 08:23:50 +09:00
Yasuhiro Horimoto
5727d3a30c
Fix broken links for mruby.org
...
A part of a fix for issue mruby/mruby.github.io#50
2019-06-27 22:31:25 +09:00
KOBAYASHI Shuji
ad8473bd66
Add modification tests for immediate value
2019-06-27 18:47:48 +09:00
Yukihiro "Matz" Matsumoto
23783a4430
Skip copying delete keys in a hash; fix #4534
2019-06-27 09:35:58 +09:00
Yukihiro "Matz" Matsumoto
9bc7edd673
Merge pull request #4533 from shuujii/silence-unused-label-warnings
...
Silence unused label warnings from gcc; ref #4524
2019-06-26 15:57:44 +09:00
KOBAYASHI Shuji
28c510cf41
Silence unused label warnings from gcc; ref #4524
...
mruby/mruby/src/string.c:1722:4: warning: label 'bytes' defined but not used [-Wunused-label]
bytes:
^~~~~
2019-06-26 15:38:20 +09:00
Yukihiro "Matz" Matsumoto
014f928229
Merge pull request #4524 from dearblue/reverse-utf8
...
Change to UTF-8 string reversing with in place
2019-06-26 13:22:42 +09:00
Yukihiro "Matz" Matsumoto
84779f0170
Merge pull request #4532 from shuujii/fix-String-byteslice-with-MRB_UTF8_STRING-and-some-edge-cases
...
Fix `String#byteslice` with `MRB_UTF8_STRING` and some edge cases
2019-06-26 12:41:56 +09:00
Yukihiro "Matz" Matsumoto
a5b005b57c
Merge pull request #4493 from dearblue/fix-rational-new
...
Fix rational new on 32 bits mode
2019-06-26 08:06:06 +09:00
Yukihiro "Matz" Matsumoto
45c99155d8
Merge pull request #4492 from dearblue/fix-complex-new
...
Fix complex new on 32 bits mode
2019-06-26 07:40:38 +09:00
KOBAYASHI Shuji
75df13a973
Fix String#byteslice with MRB_UTF8_STRING and some edge cases
...
Example:
$ bin/mruby -e '
p "あa".byteslice(1)
p "bar".byteslice(3)
p "bar".byteslice(4..0)
'
Before this patch:
"a"
""
RangeError (4..0 out of range)
After this patch (same as Ruby):
"\x81"
nil
nil
2019-06-25 23:09:23 +09:00
Yukihiro "Matz" Matsumoto
f268ecaf0d
Merge pull request #4516 from shuujii/fix-struct-RRange-overflow-on-32-bit-CPU-with-MRB_NAN_BOXING
...
Fix `struct RRange` overflow on 32-bit CPU with `MRB_NAN_BOXING`
2019-06-25 22:44:31 +09:00
Yukihiro "Matz" Matsumoto
a4124a3113
Merge pull request #4517 from shuujii/remove-unneeded-statement-in-SET_OBJ_VALUE-with-boxing_word.h
...
Remove unneeded statement in `SET_OBJ_VALUE` with `boxing_word.h`
2019-06-25 20:32:39 +09:00
Yukihiro "Matz" Matsumoto
e59a80c787
Merge pull request #4528 from shuujii/fix-argument-specs-to-Array
...
Fix argument specs to `Array`
2019-06-25 20:27:26 +09:00
Yukihiro "Matz" Matsumoto
d4c9eff67b
Merge pull request #4530 from shuujii/compare-obj-pointer-directly-instead-of-using-mrb_obj_eq-in-mrb_gc_unregister
...
Compare obj pointer directly instead of using mrb_obj_eq in mrb_gc_unregister
2019-06-25 18:50:46 +09:00
Yukihiro "Matz" Matsumoto
63d8b5e1e3
Fixed mrb_iv_remove with immediate objects; fix #4519
...
The #4520 tried to address the issue, but it changes the type of
`mrb_check_frozen` argument; close #4520
2019-06-25 18:41:17 +09:00
Yukihiro "Matz" Matsumoto
6724416d5c
Fixed a bug caused by to_s that returns nil; fix 4504
2019-06-25 18:07:48 +09:00
Yukihiro "Matz" Matsumoto
dc21024ec7
Fix mrb_str_to_str() to handle symbols.
2019-06-25 18:07:48 +09:00
Yukihiro "Matz" Matsumoto
ace0c76a69
Renamed stacked to onstack; ref #4523
2019-06-25 18:07:48 +09:00
Ryan Lopopolo
46c972f746
Unify loops to minimize bytecode size
2019-06-25 00:01:51 +02:00
KOBAYASHI Shuji
f71270df77
Compare obj pointer directly instead of using mrb_obj_eq in mrb_gc_unregister
...
Because immediate values are not registered.
2019-06-24 18:55:05 +09:00
KOBAYASHI Shuji
1fd08aee15
Fix argument specs to Array
2019-06-23 20:01:33 +09:00
Ryan Lopopolo
6b92acf361
Use explicit block parameter
2019-06-23 03:40:39 +01:00
Ryan Lopopolo
8ea45b862a
Optimize String#each_line
2019-06-23 03:29:47 +01:00
Yukihiro "Matz" Matsumoto
cb3ee2d050
Merge pull request #4526 from shuujii/refine-Hash-rehash-example
...
Refine `Hash#rehash` example [ci skip]
2019-06-23 10:56:41 +09:00
Yukihiro "Matz" Matsumoto
af9637e545
Merge pull request #4523 from dearblue/use-stack
...
Use stack memory for small name of Struct members
2019-06-23 10:51:34 +09:00
Yukihiro "Matz" Matsumoto
36f1c26d9d
Merge pull request #4525 from dearblue/utf8len-overflow
...
Fix potential overflow in `utf8len()`
2019-06-23 10:50:19 +09:00
dearblue
11e09dc5db
Fix the unnecessary mrb_str_modify() call
...
Now to be calls `mrb_str_modify()` only once when 2 or more characters.
2019-06-22 23:09:36 +09:00
dearblue
ec03e3f54a
Delete the unnecessary block brace in mrb_str_reverse_bang
2019-06-22 23:02:29 +09:00
dearblue
567075aab9
Fix string brakes for one UTF-8 charactor
2019-06-22 22:58:18 +09:00
dearblue
5af8a9777b
Add test for one UTF-8 charactor
2019-06-22 22:58:08 +09:00
dearblue
bd2c93c2df
Change to UTF-8 string reversing with in place
...
Reverses UTF-8 strings without allocated heap for working memory.
1. String before reversing:
```
"!yburmの界世"
# byte unit
[33, 121, 98, 117, 114, 109, 227, 129, 174, 231, 149, 140, 228, 184, 150]
```
2. Reverse the byte order of each character:
```
[33, 121, 98, 117, 114, 109, 174, 129, 227, 140, 149, 231, 150, 184, 228]
```
3. Reverse the whole byte order and complete:
```
[228, 184, 150, 231, 149, 140, 227, 129, 174, 109, 114, 117, 98, 121, 33]
# string
"世界のmruby!"
```
2019-06-22 22:36:58 +09:00
dearblue
7c6d6effae
Replacement to function for string reversing
2019-06-22 22:36:58 +09:00
Ryan Lopopolo
a932b8c96a
Speed up base case by 2x
...
Make non-paragraph mode twice as fast. Performance is within a factor of 2
of the original implementation.
2019-06-22 12:55:02 +01:00
Ryan Lopopolo
0f516bbe1d
Add paragraph mode to String#each_line in mrblib
...
mruby/mruby#4511 demonstrated an infinite loop in `String#each_line` when
given an empty string separator. In MRI, an empty separator places
String#each_line in paragraph mode, where the String is separated on
successive runs of newlines. In paragraph mode, the String
`"abc\n\n\ndef\nxyz"` is split into `["abc\n\n\n", "def\nxyz"]`.
This commit makes the String#each_line implementation as close to
ruby/spec compliant as possible given the limitations of mruby core.
With this patch, the following specs fail for `String#each_line`:
- uses `$/` as the separator when none is given (can be fixed by
aliasing and redefining the method to use $/ as the default value
of separator in mruby-io)
- when no block is given returned Enumerator size should return nil
(`Enumerator#size` is not supported on mruby)
- tries to convert the separator to a string using to_str (`String#to_str`
is not implemented on mruby)
This patch has similar memory consumption compared to the prior
implementation and is takes 4x the time the prior implementation takes to
execute:
```console
/usr/bin/time -l ./bin/mruby -e '("aaa\n\nbbbbb\n\n\n\n\ncccc" * 100000).each_line("\n") { }';
```
2019-06-22 12:31:01 +01:00
KOBAYASHI Shuji
28de6b0da1
Refine Hash#rehash example [ci skip]
...
Previous example doesn't work because string key (frozen) can't be modified.
2019-06-22 19:07:01 +09:00
dearblue
7583539029
Fix potential overflow in utf8len()
...
For example on 32 bit mode, when `p = 0xfffffffd`, `e = 0xfffffffe`
and `len = 4`, the sum of `p` and `len` can be to `1`, and comparison
with `e` will to be false.
As a result, a segmentation fault occurs by referring to address 0.
2019-06-22 18:16:38 +09:00
Yukihiro "Matz" Matsumoto
f94551ad40
Merge pull request #4518 from shuujii/add-ISO-section-number-to-Kernel-local_variables
...
Add ISO section number to `Kernel.#local_variables` [ci skip]
2019-06-22 17:52:32 +09:00
dearblue
a76da32567
Use stack memory for small name of Struct members
2019-06-22 17:49:07 +09:00
Yukihiro "Matz" Matsumoto
f13c5969eb
Merge pull request #4521 from shuujii/move-Kernel-__send__-test-to-core-from-mruby-metaprog
...
Move `Kernel#__send__` test to core from `mruby-metaprog`
2019-06-22 16:14:44 +09:00
KOBAYASHI Shuji
c43ff6fa40
Move Kernel#__send__ test to core from mruby-metaprog
2019-06-21 22:02:29 +09:00
KOBAYASHI Shuji
77996e6adc
Add ISO section number to Kernel.#local_variables [ci skip]
2019-06-20 19:59:56 +09:00
KOBAYASHI Shuji
4d9d6faf0d
Remove unneeded statement in SET_OBJ_VALUE with boxing_word.h
...
`(r).value.bp` and `v` have the same value due to assignment of the line
preceding the removed line.
2019-06-19 17:50:20 +09:00
Yukihiro "Matz" Matsumoto
c53b7cedcc
Merge pull request #4510 from shuujii/remove-unneeded-mrb_str_dup-in-Module-name
...
Remove unneeded `mrb_str_dup()` in `Module#name`
2019-06-19 08:50:14 +09:00
Yukihiro "Matz" Matsumoto
791391cf5b
Merge pull request #4514 from mimaki/fix-error.h
...
Fix path of `error.h`.
2019-06-19 07:58:57 +09:00
KOBAYASHI Shuji
81828f8b08
Fix struct RRange overflow on 32-bit CPU with MRB_NAN_BOXING
2019-06-18 18:17:03 +09:00
Hiroshi Mimaki
b630bf59ef
Fix path of error.h.
2019-06-18 13:27:16 +09:00
Ryan Lopopolo
eeb7d3a04f
Support parsing a Regexp literal with 'o' option
...
CRuby supports a 'o' `Regexp` option for `Regexp` literals, e.g. `/foo/o` that disables multiple interpolation passes.
This commit adds support for parsing such literals. Nothing is done with the option, it is consumed and ignored by the parser.
2019-06-17 21:42:19 +01:00
KOBAYASHI Shuji
faec8331b7
Remove unneeded mrb_str_dup() in Module#name
...
`mrb_class_path()` always returns a new string or `nil`.
2019-06-17 21:46:30 +09:00
Yukihiro "Matz" Matsumoto
1685c459dd
Merge pull request #4508 from shuujii/fix-cvar-ivar-const-and-method-can-be-removed-to-frozen-object
...
Fix cvar, ivar, const and method can be removed to frozen object
2019-06-17 12:22:33 +09:00
Yukihiro "Matz" Matsumoto
e514264b53
Merge pull request #4507 from shuujii/fix-index-in-error-message-of-Struct-aref
...
Fix index in error message of `Struct#[]`
2019-06-17 12:21:48 +09:00
Yukihiro "Matz" Matsumoto
0fba500826
Fixed indentation in parse.y
2019-06-17 12:18:57 +09:00
Yukihiro "Matz" Matsumoto
4296c77e29
Allow newlines and comments between method calls.
2019-06-17 12:18:57 +09:00
Yukihiro "Matz" Matsumoto
4124047cce
Support &. at the beginning of the line.
2019-06-17 12:18:57 +09:00
Yukihiro "Matz" Matsumoto
d895c5fe5a
Fixed wrong behavior on .. at the beginning of the line.
2019-06-17 12:18:57 +09:00
Yukihiro "Matz" Matsumoto
c1901539a8
Merge pull request #4502 from shuujii/adjust-allocation-size-in-mrb_id_attrset-mruby-struct
...
Adjust allocation size in `mrb_id_attrset()` (`mruby-struct`)
2019-06-17 12:18:48 +09:00
KOBAYASHI Shuji
030dd6655e
Fix cvar, ivar, const and method can be removed to frozen object
2019-06-16 20:43:23 +09:00
KOBAYASHI Shuji
9e378b451f
Fix index in error message of Struct#[]
...
Before this patch:
$ bin/mruby -e 'Struct.new(:a,:b).new[-3]'
#=> offset -1 too small for struct(size:2) (IndexError)
After this patch (same as Ruby):
$ bin/mruby -e 'Struct.new(:a,:b).new[-3]'
#=> offset -3 too small for struct(size:2) (IndexError)
2019-06-15 19:41:04 +09:00
Yukihiro "Matz" Matsumoto
ab5ffb308b
Merge pull request #4506 from shuujii/remove-a-meaningless-branch-condition-in-mruby-struct
...
Remove a meaningless branch condition in `mruby-struct`
2019-06-14 13:42:58 +09:00
KOBAYASHI Shuji
6084048b28
Remove a meaningless branch condition in mruby-struct
...
The following branch condition is always true:
// mrbgems/mruby-struct/src/struct.c:187 in make_struct_define_accessors()
if (is_local_id(mrb, name) || is_const_id(mrb, name)) {
2019-06-14 10:26:19 +09:00
Yukihiro "Matz" Matsumoto
27109d1ae0
Merge pull request #4505 from shuujii/fix-class-name-validation-in-Struct.new
...
Fix class name validation in `Struct.new`
2019-06-14 06:22:57 +09:00
KOBAYASHI Shuji
9bd692bc67
Fix class name validation in Struct.new
...
Before this patch:
$ bin/mruby -e 'p Struct.new("A-")'
#=> Struct::"A-"
After this patch:
$ bin/mruby -e 'p Struct.new("A-")'
#=> NameError: identifier A- needs to be constant
2019-06-13 21:24:48 +09:00
Yukihiro "Matz" Matsumoto
1a98b94100
Merge pull request #4500 from shuujii/kernel-global_variables-should-not-include-undefined-gvar
...
`Kernel#global_variables` should not include undefined `$1`-`$9`
2019-06-13 10:24:45 +09:00
Yukihiro "Matz" Matsumoto
e2e312dbfc
Merge pull request #4503 from shuujii/fix-typo-in-String-setbyte-error-message
...
Fix typo in `String#setbyte` error message
2019-06-13 10:24:11 +09:00
KOBAYASHI Shuji
db3e6f6ac6
Fix typo in String#setbyte error message
2019-06-12 20:45:27 +09:00
KOBAYASHI Shuji
ee955b58f7
Adjust allocation size in mrb_id_attrset() (mruby-struct)
2019-06-12 18:52:58 +09:00
Yukihiro "Matz" Matsumoto
b8d8f8fdae
Merge pull request #4501 from shuujii/remove-redundant-colon-in-Proc-inspect-mruby-proc-ext
...
Remove redundant colon in `Proc#inspect` (`mruby-proc-ext`)
2019-06-11 20:53:39 +09:00
KOBAYASHI Shuji
3b9b326d3c
Remove redundant colon in Proc#inspect (mruby-proc-ext)
...
Before this patch:
$ bin/mruby -e 'p proc{}' #=> #<Proc:0x7fd5eb8206d0@-e::1>
After this patch:
$ bin/mruby -e 'p proc{}' #=> #<Proc:0x7fd5eb8206d0@-e:1>
2019-06-11 20:33:07 +09:00
Yukihiro "Matz" Matsumoto
313059d08c
Merge pull request #4496 from dearblue/replace-obsolete
...
Replace obsolete macros
2019-06-11 09:36:15 +09:00
KOBAYASHI Shuji
38f1da6f26
Kernel#global_variables should not include undefined $1-$9
...
- They are not include in Ruby.
- Appear in duplicate when `$1`-`$9` are defined.
2019-06-10 18:46:57 +09:00
Yukihiro "Matz" Matsumoto
04999e969f
Merge pull request #4495 from shuujii/remove-Kernel-global_variables-from-core
...
Remove `Kernel#global_variables` from core
2019-06-10 15:42:33 +09:00
Yukihiro "Matz" Matsumoto
7cfa4d6011
Merge pull request #4494 from shuujii/clarify-mruby-kernel-object-ext-gem-summary
...
Clarify `mruby-(kernel|object)-ext` gem summary; ref 8e637bdd [ci skip]
2019-06-10 15:40:41 +09:00
Yukihiro "Matz" Matsumoto
a9e94d43b3
Merge pull request #4499 from shuujii/fix-missing-assertions-in-test-t-syntax.rb
...
Fix missing assertions in `test/t/syntax.rb`
2019-06-10 15:39:56 +09:00
KOBAYASHI Shuji
ffb700dea0
Fix missing assertions in test/t/syntax.rb
2019-06-09 18:27:28 +09:00
Yukihiro "Matz" Matsumoto
a7ae278d1a
Merge pull request #4497 from shuujii/remove-Check-the-usage-of-a-NUL-character-test
...
Remove "Check the usage of a NUL character" test
2019-06-09 07:57:51 +09:00
KOBAYASHI Shuji
2e160f53db
Remove "Check the usage of a NUL character" test
...
Because there is not assertion in this test and NUL character literal is
used in other tests.
2019-06-08 22:32:19 +09:00
dearblue
f8f75fc9c6
Replace obsolete macros
2019-06-07 22:54:03 +09:00
KOBAYASHI Shuji
4b83fe8b04
Remove Kernel#global_variables from core
...
This method is defined in `mruby-metaprog` gem.
2019-06-07 22:02:43 +09:00
KOBAYASHI Shuji
05493e651d
Clarify mruby-(kernel|object)-ext gem summary; ref 8e637bdd [ci skip]
2019-06-06 20:21:40 +09:00
dearblue
64b3d452ec
Drop precisions for rational when big numbers
2019-06-05 23:25:28 +09:00
dearblue
5e69760d91
Fix build error if struct mrb_rational is bigger than RIStruct
...
In that case, to be switched implementation with `RData`.
It is based to "complex".
2019-06-05 23:25:23 +09:00
dearblue
82831c6acd
Fix not frozen in Complex method by RData
...
Object allocation was separated, and initialization was made common.
2019-06-05 23:19:16 +09:00
dearblue
97e999c409
Fix memory leak in Complex method by RData
...
If `Data_Wrap_Struct()` raises a `NoMemoryError` exception,
it will leak memory if it does `mrb_malloc()` first.
2019-06-05 23:19:16 +09:00
Yukihiro "Matz" Matsumoto
2847692d59
Merge pull request #4491 from shuujii/fix-missing-assertions-in-test-t-module.rb
...
Fix missing assertions in `test/t/module.rb`
2019-06-05 23:10:36 +09:00
KOBAYASHI Shuji
dc1905e1bd
Fix missing assertions in test/t/module.rb
2019-06-05 19:13:36 +09:00
Yukihiro "Matz" Matsumoto
913a148ddc
Merge pull request #4489 from shuujii/fIx-typo-in-mrblib-range.rb
...
Fix typo in `mrblib/range.rb` [ci skip]
2019-06-05 01:46:58 +09:00
Yukihiro "Matz" Matsumoto
d47d561da3
Merge pull request #4490 from dearblue/explicit-cast
...
Need explicit cast for C++
2019-06-05 01:45:37 +09:00
dearblue
81ea89f10e
Need explicit cast for C++
2019-06-04 21:41:40 +09:00
KOBAYASHI Shuji
c75402a57b
Fix typo in mrblib/range.rb [ci skip]
2019-06-04 10:45:13 +09:00
Yukihiro "Matz" Matsumoto
3b061a90fe
Merge pull request #4485 from shuujii/fix-missing-assertions-in-mruby-objectspace-test
...
Fix missing assertions in `mruby-objectspace` test
2019-06-02 22:11:43 +09:00
KOBAYASHI Shuji
92f00d3e58
Fix missing assertions in mruby-objectspace test
2019-06-02 19:15:20 +09:00
Yukihiro "Matz" Matsumoto
366617dbc1
Merge pull request #4482 from shuujii/comment-out-the-empty-Array-bsearch_index-test
...
Comment out the empty `Array#bsearch_index` test
2019-06-01 11:02:07 +09:00
KOBAYASHI Shuji
c1e6f324c2
Comment out the empty Array#bsearch_index test
2019-05-31 20:50:54 +09:00
Yukihiro "Matz" Matsumoto
4677918676
Merge pull request #4481 from shuujii/fix-missing-assertions-in-mruby-fiber-test
...
Fix missing assertions in `mruby-fiber` test
2019-05-30 22:34:54 +09:00
KOBAYASHI Shuji
05056ddac4
Fix missing assertions in mruby-fiber test
2019-05-30 21:42:01 +09:00
Yukihiro "Matz" Matsumoto
729931a06c
Fix inverted compilation condition; fix #4478
2019-05-30 12:34:31 +09:00
Yukihiro "Matz" Matsumoto
53f93158a2
Merge pull request #4477 from shuujii/kernel-itself-should-not-be-a-module-function
...
`Kernel#itself` should not be a module function
2019-05-29 20:16:56 +09:00
KOBAYASHI Shuji
03fce2e206
Kernel#itself should not be a module function
2019-05-29 15:57:18 +09:00
Yukihiro "Matz" Matsumoto
855f2cdeea
Slightly simplify Rational#==; ref #4475
2019-05-29 11:49:21 +09:00
Yukihiro "Matz" Matsumoto
2b81ea7ec1
Add mrb_alloca again; ref #4470
...
This time, the allocated memory comes from the string object, which is
referenced from GC arena. The memory region will be reclaimed when the C
function called from VM is terminated, or the GC arena is restored.
2019-05-29 11:47:12 +09:00
Yukihiro "Matz" Matsumoto
a1e1af44d2
Merge pull request #4475 from shuujii/fix-Rational-eq-Complex
...
Fix `Rational#==(Complex)`
2019-05-29 11:46:42 +09:00
Yukihiro "Matz" Matsumoto
4b82fdb637
Merge pull request #4476 from shuujii/fix-missing-assertions-in-mruby-pack-test
...
Fix missing assertions in `mruby-pack` test
2019-05-29 10:35:45 +09:00
KOBAYASHI Shuji
ffc915fdee
Fix missing assertions in mruby-pack test
2019-05-28 18:26:01 +09:00
Yukihiro "Matz" Matsumoto
1727f0b7ff
Merge pull request #4474 from shuujii/use-undefined.equal-obj2-instead-of-obj2-eq-undefined-in-assert.rb
...
Use `$undefined.equal?(obj2)` instead of `obj2 == $undefined` in `ass…
2019-05-28 10:50:30 +09:00
Yukihiro "Matz" Matsumoto
6c5cb109ee
Merge pull request #4473 from shuujii/make-some-functions-static-in-mrbgems-mruby-metaprog-src-metaprog.c
...
Make some functions static in `mrbgems/mruby-metaprog/src/metaprog.c`
2019-05-27 23:32:55 +09:00
KOBAYASHI Shuji
a97a455c03
Use $undefined.equal?(obj2) instead of obj2 == $undefined in assert.rb
...
In case `obj2.==` is broken.
2019-05-27 21:43:55 +09:00
KOBAYASHI Shuji
902b2ce3c6
Fix Rational#==(Complex)
...
Consider a Numreic class like `Complex` that does not have `<=>` but `==`
works (`0i == 0r` is `true`).
2019-05-27 21:29:49 +09:00
KOBAYASHI Shuji
534b578da7
Make some functions static in mrbgems/mruby-metaprog/src/metaprog.c
2019-05-27 18:26:54 +09:00
Yukihiro "Matz" Matsumoto
8ad777c702
Merge pull request #4470 from dearblue/remove-mrb_alloca
...
Remove `mrb_alloca()` function
2019-05-27 14:45:10 +09:00
Yukihiro "Matz" Matsumoto
459c439243
Merge pull request #4472 from shuujii/move-mrb_mod_s_nesting-to-mruby-metaprog-gem-from-the-core
...
Move `mrb_mod_s_nesting()` to `mruby-metaprog` gem from the core
2019-05-27 08:17:06 +09:00
Yukihiro "Matz" Matsumoto
879f1586ab
Merge pull request #4471 from shuujii/add-Complex.rect
...
Add `Complex.rect`
2019-05-26 23:07:11 +09:00
KOBAYASHI Shuji
779251de64
Move mrb_mod_s_nesting() to mruby-metaprog gem from the core
2019-05-26 20:32:04 +09:00
KOBAYASHI Shuji
0bdb185a6f
Add Complex.rect
2019-05-26 20:17:03 +09:00
Yukihiro "Matz" Matsumoto
4261ba9443
Remove some overhead from methods defined in Ruby in Complex.
2019-05-26 09:19:29 +09:00
Yukihiro "Matz" Matsumoto
c33ab7c0bb
Merge pull request #4469 from dearblue/double-rounds
...
Fix double rounded by negative index for `String#[]`
2019-05-26 09:17:40 +09:00
dearblue
d1e1bb0d5b
Remove mrb_alloca() function
...
When I found this function, I expected it to behave the same as the
`alloca(3)` function, but it is accually the `mrb_alloca()` function
does not free the heap until the `mrb_close()` function is called.
Also, even if it is deleted, it can be replaced with the combination
of the `MRB_TT_DATA` object and the `mrb_gv_set()` function if it is
sure necessary.
2019-05-25 23:59:43 +09:00
dearblue
ecfca8def7
Fix double rounded by negative index
...
- Before patched:
```
$ mruby -e 'p (-12..-1).map { |i| "Hello"[i] }.join'
"HelloHello"
```
- After patched:
```
$ mruby -e 'p (-12..-1).map { |i| "Hello"[i] }.join'
"Hello"
```
2019-05-25 22:43:07 +09:00
Yukihiro "Matz" Matsumoto
f455cb6c40
Merge pull request #4467 from dearblue/naming-mrb_range_beg_len
...
Name the return value of `mrb_range_beg_len()`
2019-05-25 22:25:58 +09:00
dearblue
56e0e1934d
Name the return value of mrb_range_beg_len()
2019-05-25 12:12:21 +09:00
Yukihiro "Matz" Matsumoto
c6f30e8f17
Merge pull request #4466 from shuujii/fix-the-order-of-expected-and-actual-in-mruby-time-test
...
Fix the order of "expected" and "actual" in `mruby-time` test
2019-05-25 00:12:53 +09:00
KOBAYASHI Shuji
240bbc39e1
Fix the order of "expected" and "actual" in mruby-time test
2019-05-24 21:02:22 +09:00
Yukihiro "Matz" Matsumoto
43a26aa958
Merge pull request #4463 from shuujii/freeze-Rational-and-Complex-objects
...
Freeze `Rational` and `Complex` objects
2019-05-23 19:54:45 +09:00
KOBAYASHI Shuji
48903850e9
Freeze Rational and Complex objects
2019-05-23 13:40:49 +09:00
Yukihiro "Matz" Matsumoto
5f4eb87735
Merge pull request #4462 from shuujii/kernel-Rational-requires-numerator
...
`Kernel#Rational` requires numerator
2019-05-22 20:17:11 +09:00
KOBAYASHI Shuji
8513abd404
Kernel#Rational requires numerator
2019-05-22 19:57:35 +09:00
Yukihiro "Matz" Matsumoto
85a2dfc841
Merge pull request #4403 from dearblue/read-irep-from-buf
...
Read irep from buffers
2019-05-22 08:58:50 +09:00
Yukihiro "Matz" Matsumoto
38f8edbdd7
Update ISO section number for some Numeric methods.
2019-05-21 21:12:33 +09:00
Yukihiro "Matz" Matsumoto
c02e63eb77
Use MRB_TT_ISTRUCT for Complex numbers if possible.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
fccec8964a
Implements part of Complex class in C.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
e941cf06a3
Export mrb_int_value that converts mrb_float to Fixnum.
...
Or `Float` if `mrb_float` value is too big (or too small) to fit in
`mrb_int`. The `_int_` in `mrb_int_value` means `Integral` module, which
represents integer-like values in mruby.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
f6e4145ad9
Remove Complex(string) complex generation.
...
It should raise an error.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
b7f85b9df9
Should not refer Float class in case of MRB_WITHOUT_FLOAT.
...
This commit removes `Float` from `rational.c`.
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
5d30309e98
Silence the return value warnings from gcc; ref 237a57b
2019-05-21 21:08:26 +09:00
Yukihiro "Matz" Matsumoto
eca20a16bd
Merge pull request #4461 from shuujii/move-comparision-methods-to-Integral-from-Numeric
...
Move `**`,`/`,`quo`,`div` and comparison methods to Integral from Numeric
2019-05-21 21:07:39 +09:00
KOBAYASHI Shuji
3b46831da8
Move **,/,quo,div and comparison methods to Integral from Numeric
...
Having these methods in Numeric can get in the way of creating subclasses of
Numeric because they only support Fixnum and Float.
2019-05-21 20:43:42 +09:00
Yukihiro "Matz" Matsumoto
24525fd1ae
Merge pull request #4459 from shuujii/revert-part-of-4457
...
Revert part of #4457
2019-05-21 09:34:42 +09:00
KOBAYASHI Shuji
5d6c1794ad
Revert part of #4457
2019-05-21 09:31:06 +09:00
Yukihiro "Matz" Matsumoto
70e754e6da
Merge pull request #4457 from shuujii/change-the-order-of-expected-and-actual-in-mruby-rational-test
...
Change the order of "expected" and "actual" in `mruby-rational` test
2019-05-21 07:56:21 +09:00
Yukihiro "Matz" Matsumoto
a642f73b44
Merge pull request #4458 from shuujii/drop-dependency-from-mruby-rational-to-mruby-object-ext
...
Drop dependency from `mruby-rational` to `mruby-object-ext`
2019-05-21 06:38:04 +09:00
KOBAYASHI Shuji
3db5d7fe3d
Drop dependency from mruby-rational to mruby-object-ext
2019-05-20 18:36:13 +09:00
KOBAYASHI Shuji
97600ded8d
Change the order of "expected" and "actual" in mruby-rational test
2019-05-20 18:24:18 +09:00
Yukihiro "Matz" Matsumoto
8b8bf9f3f6
Add new functions for numerical operation; ref 237a57b
...
New functions:
* mrb_num_plus(mrb, x, y)
* mrb_num_minus(mrb, x, y)
* num_num_mul(mrb, x, y)
2019-05-20 14:59:25 +09:00
Yukihiro "Matz" Matsumoto
05e7544583
Merge pull request #4455 from dearblue/remove-LINE-section
...
Remove "LINE" section reader
2019-05-19 22:29:25 +09:00
Yukihiro "Matz" Matsumoto
e60891e453
Merge pull request #4454 from shuujii/fix-Rational-cmp-Numeric
...
Fix `Rational#<=>(Numeric)`
2019-05-19 22:24:49 +09:00
Yukihiro "Matz" Matsumoto
3e8b19b00e
Merge pull request #4453 from shuujii/move-Kernel-instance_eval-to-BasicObject
...
Move `Kernel#instance_eval` to `BasicObject`
2019-05-19 22:23:57 +09:00
Yukihiro "Matz" Matsumoto
aafaf79fdd
Merge pull request #4452 from shuujii/move-Kernel-equal-to-BasicObject
...
Move `Kernel#equal? to `BasicObject`
2019-05-19 22:23:14 +09:00
Yukihiro "Matz" Matsumoto
8170f6899c
Merge pull request #4450 from shuujii/move-Kernel-instance_exec-to-BasicObject
...
Move `Kernel#instance_exec` to `BasicObject`
2019-05-19 22:21:31 +09:00
Yukihiro "Matz" Matsumoto
8e637bdd83
Should clarify the role of mruby-kernel-ext and mruby-object-ext; close #4449
...
The former should contain function like methods, and the latter should
contain methods shared by all objects.
2019-05-19 22:17:56 +09:00
KOBAYASHI Shuji
a6eb01837b
Fix Rational#<=>(Numeric)
...
Reported by Sergey Ukrainskiy: https://github.com/mruby/mruby/commit/f5fb1307b017fb972c12b4ec4b1866d789b0ca09#r33590698
2019-05-19 13:52:18 +09:00
dearblue
67fc3428cb
Remove "LINE" section reader
...
Because it is not currently output by `mrbc`.
2019-05-19 11:09:25 +09:00
KOBAYASHI Shuji
9c79c28604
Move Kernel#instance_eval to BasicObject
2019-05-18 21:17:47 +09:00
KOBAYASHI Shuji
6fb5979d29
Move Kernel#equal? to BasicObject`
2019-05-18 20:57:54 +09:00
KOBAYASHI Shuji
ef5dd5d31d
Move Kernel#instance_exec to BasicObject
2019-05-18 19:19:52 +09:00
Yukihiro "Matz" Matsumoto
1cdb3ec93c
Merge pull request #4448 from shuujii/move-Object-Rational-Complex-to-Kernel
...
Move `Object#(Rational|Complex)` to `Kernel`
2019-05-18 18:57:47 +09:00
Yukihiro "Matz" Matsumoto
ed70e81264
Merge pull request #4447 from shuujii/move-Numeric-__coerce_step_counter-to-Integral
...
Move `Numeric#__coerce_step_counter` to `Integral`
2019-05-18 18:56:39 +09:00
KOBAYASHI Shuji
6c9c189e4b
Move Object#(Rational|Complex) to Kernel
2019-05-18 18:31:55 +09:00
KOBAYASHI Shuji
4f71e9eebe
Move Numeric#__coerce_step_counter to Integral
...
This method is only used in `Integral#step`
2019-05-18 18:22:56 +09:00
Yukihiro "Matz" Matsumoto
89d2926415
Add ISO section number to Module#===.
2019-05-18 11:48:59 +09:00
Yukihiro "Matz" Matsumoto
bd7328f5e6
Implement Rational._new in C.
2019-05-18 11:23:59 +09:00
Yukihiro "Matz" Matsumoto
e41f15747e
Rename struct RIstruct to struct RIStruct.
2019-05-18 11:10:20 +09:00
Yukihiro "Matz" Matsumoto
ace0d3949b
Support MRB_WITHOUT_FLOAT.
...
I assume there's no realistic usage of `Rational` with
`MRB_WITHOUT_FLOAT`. But just for consistency.
2019-05-18 08:38:45 +09:00
Yukihiro "Matz" Matsumoto
d2a2af2481
Merge pull request #4446 from dearblue/PoC-tuning-profiles
...
(Proof of Concept) mruby tuning profiles [ci skip]
2019-05-17 22:45:45 +09:00
Yukihiro "Matz" Matsumoto
b7bc03aa18
Stop wrapping the filename by double quotes; ref #4440
2019-05-17 22:39:41 +09:00
Yukihiro "Matz" Matsumoto
8d37a3575b
Revert "Add support for CC="gcc --option ..." again"
...
This reverts commit d5c8868346 .
2019-05-17 22:37:45 +09:00
dearblue
a14ae80102
(Proof of Concept) mruby tuning profiles [ci skip]
...
Not only mruby, it is one of the difficult things to adjust the performance vs. memory efficiency of the software.
If the approximate target device is divided and the adjustment value for it is prepared by default, it is a good indicator to do fine adjustment.
This PR divides into four profiles.
***Caution: There is no basis for the definitions in the patch.***
- `MRB_CONSTRAINED_BASELINE_PROFILE` - for microprocessors. Reduce memory consumption.
- `MRB_BASELINE_PROFILE` - Default value of mruby.
- `MRB_MAIN_PROFILE` - For desktop computers. Assume that a huge amount of RAM, 10 MiB or more, is on board.
- `MRB_HIGH_PROFILE` - for servers. Assume that mruby VM has a long life.
As you can see the profile name has been ~~stolen~~ imitated from H.264.
2019-05-17 22:32:01 +09:00
Yukihiro "Matz" Matsumoto
a46da9e44d
Merge pull request #4445 from bshastry/modifiy-ossfuzz-fork-config
...
Add/Edit ossfuzz config options
2019-05-17 21:31:09 +09:00
Yukihiro "Matz" Matsumoto
132c04bcc8
Merge pull request #4443 from shuujii/move-Integral-zero-nonzero-positive-negative-to-Numeric
...
Move `Integral#(zero|nonzero|positive|negative)?` to `Numeric`
2019-05-17 21:30:39 +09:00
Yukihiro "Matz" Matsumoto
4572d42d07
Merge pull request #4444 from bshastry/mruby-proto
...
proto fuzzer: Add source files necessary to compile proto fuzzer
2019-05-17 21:30:20 +09:00
Bhargava Shastry
1f3ece9631
proto fuzzer: Add source files necessary to compile proto fuzzer
2019-05-17 14:28:20 +02:00
Yukihiro "Matz" Matsumoto
eecac4f18b
Merge pull request #4442 from shuujii/drop-dependency-from-mruby-rational-to-mruby-numeric-ext
...
Drop dependency from `mruby-rational` to `mruby-numeric-ext`
2019-05-17 21:27:47 +09:00
Yukihiro "Matz" Matsumoto
6558d51b50
Merge pull request #4441 from shuujii/fix-Numeric-to_r
...
Fix `Numeric#to_r`
2019-05-17 21:26:48 +09:00
Bhargava Shastry
647569bfe8
Add/Edit ossfuzz config options
2019-05-17 14:26:41 +02:00
Yukihiro "Matz" Matsumoto
ed0a5f9e16
Merge pull request #4440 from kou/cc-with-option
...
Add support for CC="gcc --option ..." again
2019-05-17 21:26:00 +09:00
KOBAYASHI Shuji
c5c39f585b
Move Integral#(zero|nonzero|positive|negative)? to Numeric
...
Because these methods work if object is `Comparable`, and `Numeric` is
`Comparable`.
2019-05-17 21:13:31 +09:00
KOBAYASHI Shuji
aa41a5c9af
Drop dependency from mruby-rational to mruby-numeric-ext
2019-05-17 20:44:48 +09:00
KOBAYASHI Shuji
eeb95e058a
Fix Numeric#to_r
2019-05-17 19:53:31 +09:00
Kouhei Sutou
d5c8868346
Add support for CC="gcc --option ..." again
...
If $rake_root_fiber is used, sh runs command in another Fiber. If
command is ran in another Fiber, "rescue RuntimEerror" can't rescue
exception for system(...) failure.
How to reproduce:
$ CC="gcc -std=gnu99" ./minirake
(in /home/kou/work/ruby/mruby.kou)
CC mrbgems/mruby-compiler/core/codegen.c -> build/test/mrbgems/mruby-compiler/core/codegen.o
sh: 1: gcc -std=gnu99: not found
rake aborted!
Command Failed: ["gcc -std=gnu99" -g -std=gnu99 ...]
2019-05-17 17:59:24 +09:00
Yukihiro "Matz" Matsumoto
b6e9fab649
Implement part of Rational in C.
2019-05-17 16:37:34 +09:00
Yukihiro "Matz" Matsumoto
cec92673ae
Avoid direct access to instance variables in rational.rb.
2019-05-17 16:22:23 +09:00
Yukihiro "Matz" Matsumoto
912d23634d
Fixed wrong overloading.
...
`float op rational` should return `float`, since float is an inexact
value.
2019-05-17 16:18:46 +09:00
Yukihiro "Matz" Matsumoto
237a57bbe8
Make unused functions private.
...
* mrb_fixnum_plus()
* mrb_fixnum_minus()
* mrb_fixnum_mul()
2019-05-17 11:30:38 +09:00
Yukihiro "Matz" Matsumoto
0d61bcd823
Use div (integer divition) instead of / for rational numbers.
2019-05-17 11:27:52 +09:00
Yukihiro "Matz" Matsumoto
0c91da257b
Remove unused mrb_num_div() function.
2019-05-17 11:27:21 +09:00
Yukihiro "Matz" Matsumoto
223defd62a
Move Numeric#div to the core.
2019-05-17 11:26:16 +09:00
Yukihiro "Matz" Matsumoto
3734c53eb8
Make flo_rount to return Integeral.
2019-05-17 11:13:12 +09:00
Yukihiro "Matz" Matsumoto
bc18060149
Change the num.divmod(float) to return [int,num].
2019-05-17 10:58:17 +09:00
Yukihiro "Matz" Matsumoto
8a9f984eb8
Add a new function mrb_int_value.
...
This function returns `Fixnum` if the value fits in `mrb_int`,
otherwise it returns `Float` value (mruby behavior of handling integers).
2019-05-17 10:42:16 +09:00
Yukihiro "Matz" Matsumoto
80c789b394
Use int64_t instead of mrb_int in int64_value.
2019-05-17 10:40:19 +09:00
Yukihiro "Matz" Matsumoto
283530b19b
Use mrb_float instead of double in FIXABLE_FLOAT.
2019-05-17 10:37:49 +09:00
Yukihiro "Matz" Matsumoto
4bc48d0b76
Refactor time.c regarding memory allocation.
2019-05-16 22:49:27 +09:00
Yukihiro "Matz" Matsumoto
83071843da
Merge pull request #4439 from shuujii/fix-Rational-eq
...
Fix `Rational#==`
2019-05-16 22:49:15 +09:00
KOBAYASHI Shuji
f5fb1307b0
Fix Rational#==
2019-05-16 22:09:56 +09:00
Yukihiro "Matz" Matsumoto
9b604abc83
Enable YYSTACK_USE_ALLOCA.
...
It used heap allocated memory for the parser stack, but there's
possibility of parser termination by exceptions. In that case, the
parser stack memory is leaked.
We were afraid of stack consumption, but parser stack size is only 4KB,
so we don't have to worry about it (at least for the parser).
2019-05-16 11:46:37 +09:00
Yukihiro "Matz" Matsumoto
304b52fabe
Set maximum string (and symbol) size to 65534 (UINT16_MAX-1).
...
The previous value (`UINT16_MAX`) was too long for symbols, so it raises
an exception after the length check.
2019-05-16 11:44:51 +09:00
Yukihiro "Matz" Matsumoto
7aff5507dd
Avoid potential type mismatch warnings in pack.c.
2019-05-16 10:15:11 +09:00
Yukihiro "Matz" Matsumoto
2f14254142
Avoid potential integer overflow.
2019-05-16 10:13:52 +09:00
Yukihiro "Matz" Matsumoto
752edf413f
Terminate float right shift if shift value is too big.
2019-05-16 09:51:27 +09:00
Yukihiro "Matz" Matsumoto
6af0effda1
Merge pull request #4435 from shuujii/fix-typo-in-mrbgems-mruby-io-src-file_test.c
...
Fix typo in `mrbgems/mruby-io/src/file_test.c` [ci skip]
2019-05-15 17:00:46 +09:00
Yukihiro "Matz" Matsumoto
936f72fdd2
Do not overwrite conf.cc.defines.
2019-05-15 16:58:35 +09:00
Ukrainskiy Sergey
31bfc55866
Fix
2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey
fa45cc4272
Fix dependencies
2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey
d67d2ae8e8
Basic implementation of Complex and Rational classes
2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey
79c3335e8d
Small refactoring
2019-05-15 16:57:21 +09:00
Ukrainskiy Sergey
8808219e6d
Initial suffix support
2019-05-15 16:57:21 +09:00
KOBAYASHI Shuji
5f664fb6f8
Fix typo in mrbgems/mruby-io/src/file_test.c [ci skip]
2019-05-15 16:27:08 +09:00
Yukihiro "Matz" Matsumoto
7f1f499b22
Merge pull request #4400 from shuujii/fix-name-assignment-to-frozen-anonymous-class-module
...
Fix name assignment to frozen anonymous class/module
2019-05-15 15:47:02 +09:00
Yukihiro "Matz" Matsumoto
780342eddb
Add Enumerator support to String#each_byte.
...
`String#each_byte` is not defined in ISO Ruby but it is implemented in
the core mruby because it's useful.
2019-05-15 14:59:48 +09:00
Yukihiro "Matz" Matsumoto
138845a519
Merge pull request #4434 from shuujii/refine-Time-to_s-inspect
...
Refine `Time#(to_s|inspect)`
2019-05-15 14:22:47 +09:00
Yukihiro "Matz" Matsumoto
fd37bc53de
Remove String#=~ and String#match that requires Regexp.
2019-05-15 09:55:21 +09:00
KOBAYASHI Shuji
edf4b33c61
Refine Time#(to_s|inspect)
...
For the following reasons:
- Ruby compatibility.
- Add UTC offset (time zone informations was not included by #4433 ).
- More readable.
Example:
Before this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> Sat Apr 5 06:07:08 2003
p Time.local(2013,10,28,16,27,48) #=> Mon Oct 28 16:27:48 2013
After this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> 2003-04-05 06:07:08 UTC
p Time.local(2013,10,28,16,27,48) #=> 2013-10-28 16:27:48 +0900
Implementation:
I use `strftime(3)` because UTC offset can be added and program size become
smaller than the other implementations (using `sprintf(3)`, self conversion
etc) in my environment.
2019-05-14 22:50:36 +09:00
Yukihiro "Matz" Matsumoto
d8eff635fd
Merge pull request #4433 from shuujii/fix-Time-asctime-ctime-according-to-ISO-Ruby
...
Fix `Time#(asctime|ctime)` according to ISO Ruby
2019-05-14 18:36:55 +09:00
KOBAYASHI Shuji
a2616db4dc
Fix Time#(asctime|ctime) according to ISO Ruby
...
- A leading charactor for day is space.
- Time zone does not included.
Before this patch:
Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 04 05:06:07 UTC 1982"
After this patch:
Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 4 05:06:07 1982"
2019-05-13 19:46:26 +09:00
Yukihiro "Matz" Matsumoto
b145ed9de5
Merge pull request #4432 from shuujii/fix-missing-assertions-in-mruby-time-test
...
Fix missing assertions in `mruby-time` test
2019-05-13 08:33:55 +09:00
KOBAYASHI Shuji
2c2584138a
Fix missing assertions in mruby-time test
2019-05-12 20:25:11 +09:00
Yukihiro "Matz" Matsumoto
e28ebed661
Merge pull request #4431 from shuujii/use-mrb_ensure_string_type-in-mrb_to_str
...
Use `mrb_ensure_string_type` in `mrb_to_str`
2019-05-12 14:33:10 +09:00
KOBAYASHI Shuji
fa317fabbd
Use mrb_ensure_string_type in mrb_to_str
2019-05-11 18:40:33 +09:00
Yukihiro "Matz" Matsumoto
4cce39cab7
Merge pull request #4430 from bshastry/ossfuzz
...
Update ossfuzz options
2019-05-11 09:26:19 +09:00
Yukihiro "Matz" Matsumoto
4601ac7f13
Merge pull request #4429 from shuujii/move-mrb_gc_arena_restore-into-loop-in-mrb_file_s_chmod
...
Move `mrb_gc_arena_restore` to inside the loop in `mrb_file_s_chmod`
2019-05-11 09:24:35 +09:00
Bhargava Shastry
1e2983bd04
Update ossfuzz options
2019-05-10 16:13:05 +02:00
KOBAYASHI Shuji
f2719e903a
Move mrb_gc_arena_restore to inside the loop in mrb_file_s_chmod
2019-05-10 21:10:44 +09:00
Yukihiro "Matz" Matsumoto
2e99f34fe3
Merge pull request #4428 from shuujii/raise-TypeError-if-the-argument-type-is-unsupported-in-mrb_stat0
...
Raise `TypeError` if the argument type is unsupported in `mrb_stat0`
2019-05-10 12:25:10 +09:00
KOBAYASHI Shuji
0d94a2e3a9
Raise TypeError if the argument type is unsupported in mrb_stat0
2019-05-10 00:31:30 +09:00
Yukihiro "Matz" Matsumoto
9a4f3029d9
Update README.md; mruby is now Ruby 2.x compatible.
2019-05-08 21:32:25 +09:00
Yukihiro "Matz" Matsumoto
ecc6eb81b5
Merge pull request #4426 from shuujii/use-mrb_string_value_cstr-in-mrb_str_to_dbl
...
Use `mrb_string_value_cstr` in `mrb_str_to_dbl`
2019-05-08 21:32:11 +09:00
KOBAYASHI Shuji
1975dedb21
Use mrb_string_value_cstr in mrb_str_to_dbl
2019-05-08 20:35:03 +09:00
Yukihiro "Matz" Matsumoto
f405d35dac
Merge pull request #4425 from shuujii/refactor-mrb_str_to_cstr-and-mrb_string_value_cstr
...
Refactor `mrb_str_to_cstr` and `mrb_string_value_cstr`
2019-05-08 06:23:50 +09:00
KOBAYASHI Shuji
35943e7beb
Refactor mrb_str_to_cstr and mrb_string_value_cstr
...
- Extract null byte check to function.
- Avoid string allocation if null byte is included.
- Use `str_new` instead of `mrb_str_dup` + `mrb_str_modify`
2019-05-07 23:01:13 +09:00
Yukihiro "Matz" Matsumoto
c778c234b0
Merge pull request #4424 from shuujii/avoid-using-mrb_str_to_cstr-if-possible
...
Avoid using `mrb_str_to_cstr` if possible
2019-05-07 06:21:10 +09:00
KOBAYASHI Shuji
e2604c1550
Avoid using mrb_str_to_cstr if possible
...
Because it always allocate new string. Replace with the followings:
- Use `RSRING_PTR` if string is guaranteed to be null-terminated.
- Use `mrb_string_value_cstr` or `mrb_get_args("z")` if return value isn't
modified.
2019-05-06 23:32:53 +09:00
Yukihiro "Matz" Matsumoto
31cc8573f0
Merge pull request #4423 from shuujii/use-mrb_fixnum_to_str-instead-of-Fixnum-to_s
...
Use `mrb_fixnum_to_str()` instead of `Fixnum#to_s`
2019-05-05 21:57:35 +09:00
KOBAYASHI Shuji
0ccb058b90
Use mrb_fixnum_to_str() instead of Fixnum#to_s
2019-05-05 20:31:12 +09:00
Yukihiro "Matz" Matsumoto
2b1c4e9acd
Merge pull request #4179 from bshastry/ossfuzz
...
ossfuzz: Add simple mruby compile test harness
2019-05-04 18:32:40 +09:00
Yukihiro "Matz" Matsumoto
82b04f927e
Merge pull request #4422 from shuujii/check-whether-object-is-immediate-in-mrb_gc_register-unregister
...
Check whether object is immediate in `mrb_gc_(register|unregister)`
2019-05-04 18:28:06 +09:00
KOBAYASHI Shuji
a5bda13fb7
Check whether object is immediate in mrb_gc_(register|unregister)
2019-05-04 16:38:07 +09:00
Yukihiro "Matz" Matsumoto
181d14668a
Merge pull request #4420 from shuujii/simplify-conversion-process-for-i-in-mrb_get_args
...
Simplify conversion process for `i` in `mrb_get_args()`
2019-05-04 00:19:14 +09:00
Yukihiro "Matz" Matsumoto
187b4c819f
Merge pull request #4419 from dearblue/fix-always-static
...
Fix `FLAG_SRC_STATIC` always set in `mrb_read_irep()` with `MRB_USE_CUSTOM_RO_DATA_P`
2019-05-04 00:17:10 +09:00
Yukihiro "Matz" Matsumoto
a277a6e47d
Merge pull request #4418 from dearblue/clean-duplicate
...
Clean duplicate code
2019-05-04 00:15:56 +09:00
KOBAYASHI Shuji
0692f7916c
Simplify conversion process for i in mrb_get_args()
2019-05-03 13:39:19 +09:00
dearblue
e86e360b36
Fix FLAG_SRC_STATIC always set in mrb_read_irep() with MRB_USE_CUSTOM_RO_DATA_P
2019-05-03 11:42:14 +09:00
dearblue
f5d5caaf82
Clean duplicate code
...
Removed duplicates in the code entered for "Concatenate string literal".
2019-05-03 11:36:31 +09:00
Yukihiro "Matz" Matsumoto
8c8e6e25ad
Merge pull request #4417 from shuujii/unify-overflow-error-class-for-conversion-to-integer-to-RangeError
...
Unify overflow error class for conversion to integer to `RangeError`
2019-05-02 23:05:13 +09:00
Yukihiro "Matz" Matsumoto
35319bed01
Use a normal method instead of a lambda in bintest/mruby; ref #4416
2019-05-02 23:03:38 +09:00
Yukihiro "Matz" Matsumoto
f83112cea2
Fixed include specifier format for mruby/common.h.
2019-05-02 22:55:19 +09:00
Yukihiro "Matz" Matsumoto
335602e85c
Merge pull request #4416 from shuujii/small-fix-in-mruby-bin-mruby
...
Small fix in `mruby-bin-mruby`
2019-05-02 22:52:38 +09:00
Yukihiro "Matz" Matsumoto
a7871ce77e
Merge pull request #4415 from shuujii/remove-unneeded-argc-check-in-mrb_str_aref_m
...
Remove unneeded `argc` check in `mrb_str_aref_m()`
2019-05-02 22:31:58 +09:00
KOBAYASHI Shuji
95a92d35c8
Unify overflow error class for conversion to integer to RangeError
2019-05-02 20:45:31 +09:00
KOBAYASHI Shuji
2a94bf8fbd
Small fix in mruby-bin-mruby
...
- Modify some error messages for consistency.
- Add test for codegen error.
- Use regular expression for error message matching in test.
2019-05-01 16:49:56 +09:00
KOBAYASHI Shuji
1a8f6e70b5
Remove unneeded argc check in mrb_str_aref_m()
2019-05-01 15:04:08 +09:00
Yukihiro "Matz" Matsumoto
eeb78a7259
Merge pull request #4414 from shuujii/refine-error-message-output-for-mruby-command
...
Refine error message output for `mruby` command
2019-04-30 19:37:00 +09:00
KOBAYASHI Shuji
9bd17226d5
Refine error message output for mruby command
...
- Write message to stderr instead of stdout.
- Avoid duplicate message output (`SyntaxError`, `ScriptError` etc).
- Refine invalid option message.
- Suppress redundant usage output.
- Fix some incorrect exit code.
2019-04-30 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
0615970877
Merge pull request #4413 from shuujii/fix-missing-assertions-in-mruby-io-test
...
Fix missing assertions in `mruby-io` test
2019-04-29 11:54:51 +09:00
Yukihiro "Matz" Matsumoto
b7ff23d235
Merge pull request #4412 from shuujii/refine-the-default-values-of-flunk
...
Refine the default values of `flunk`
2019-04-29 11:53:58 +09:00
KOBAYASHI Shuji
4bf6b8c136
Refine the default values of flunk
...
The default message for the second argument should be set to the first
argument because only one argument is normally specified.
2019-04-29 11:34:41 +09:00
KOBAYASHI Shuji
8cc2ad3348
Fix missing assertions in mruby-io test
2019-04-29 11:09:35 +09:00
Yukihiro "Matz" Matsumoto
e4992cdd03
Merge pull request #4411 from shuujii/commented-out-Struct.new-removes-existing-constant-test
...
Commented out "Struct.new removes existing constant" test
2019-04-28 23:44:37 +09:00
KOBAYASHI Shuji
5969ed1afb
Commented out "Struct.new removes existing constant" test
...
Because this test is always skipped.
2019-04-28 18:42:23 +09:00
Yukihiro "Matz" Matsumoto
b15293e709
Merge pull request #4410 from dearblue/update-docs
...
Update document for `MRB_USE_CUSTOM_RO_DATA_P` and some configurations
2019-04-27 23:18:18 +09:00
dearblue
828a998941
Update document for MRB_USE_CUSTOM_RO_DATA_P
2019-04-27 22:29:20 +09:00
dearblue
b57f61ac95
Update document for any configurations
...
- (Modify) `MRB_INT16`
- (Add) `MRB_INT32`
- (Modify) `MRB_INT64`
- (Add) `MRB_USE_ETEXT_EDATA`
- (Add) `MRB_NO_INIT_ARRAY_START
- (Add) `MRB_WITHOUT_FLOAT`
- (Add) `MRB_METHOD_CACHE`
- (Add) `MRB_METHOD_CACHE_SIZE`
- (Add) `MRB_METHOD_TABLE_INLINE
- (Add) `MRB_ENABLE_ALL_SYMBOLS`
2019-04-27 22:28:54 +09:00
Yukihiro "Matz" Matsumoto
6f779ceac2
Merge pull request #4409 from shuujii/remove-duplicated-String-each_char
...
Remove duplicated `String#each_char`
2019-04-27 14:02:38 +09:00
KOBAYASHI Shuji
270131253f
Remove duplicated String#each_char
2019-04-27 12:50:02 +09:00
Yukihiro "Matz" Matsumoto
2b0135e869
Merge pull request #4408 from dearblue/my-ro_data_p
...
Add customized `mrb_ro_data_p()`
2019-04-26 23:36:50 +09:00
KOBAYASHI Shuji
1fb635ac03
Add assert_raise_with_message and assert_raise_with_message_pattern
2019-04-26 21:48:40 +09:00
dearblue
302ad847a3
Add customized mrb_ro_data_p()
...
User definable `mrb_ro_data_p()` functions are available
by defining `MRB_USE_CUSTOM_RO_DATA_P`.
(Limitation) It can not be defined as an inline function.
2019-04-26 21:28:57 +09:00
Yukihiro "Matz" Matsumoto
c078758644
Merge pull request #4405 from shuujii/singleton-class-of-frozen-object-should-be-frozen
...
Singleton class of frozen object should be frozen
2019-04-26 01:14:11 +09:00
KOBAYASHI Shuji
8fa3995a1a
Singleton class of frozen object should be frozen
...
Before this patch:
p (class << Object.new.freeze; self end).frozen? #=> false
sc = class << (o=Object.new); self end; o.freeze; p sc.frozen? #=> false
After this patch / Ruby:
p (class << Object.new.freeze; self end).frozen? #=> true
sc = class << (o=Object.new); self end; o.freeze; p sc.frozen? #=> true
2019-04-25 19:48:40 +09:00
Yukihiro "Matz" Matsumoto
e5799b5d40
Merge pull request #4402 from shuujii/fix-modiying-class-variable-to-frozen-class
...
Fix modiying class variable to frozen class/module
2019-04-25 07:17:10 +09:00
dearblue
8f6f36f654
Add mruby binary loader functions from buffer memory
...
Add new functions (with `MRB_API`):
- `mrb_read_irep_buf()`
- `mrb_load_irep_buf()`
- `mrb_load_irep_buf_cxt()`
2019-04-24 22:56:39 +09:00
dearblue
58d525c9fa
Check mruby binary size
2019-04-24 22:56:39 +09:00
dearblue
4d85019e4c
Check mruby binary version
2019-04-24 22:56:38 +09:00
KOBAYASHI Shuji
4720648137
Fix modiying class variable to frozen class/module
2019-04-24 21:05:44 +09:00
Yukihiro "Matz" Matsumoto
163a6d01e0
Reorganize defines related to MRB_INLINE; ref #4391
2019-04-24 12:09:16 +09:00
Yukihiro "Matz" Matsumoto
0c5f26e0ff
Remove unnecessary mrb_regexp_check() and related functions.
2019-04-24 11:43:05 +09:00
Yukihiro "Matz" Matsumoto
9ca9af60f2
Merge pull request #4401 from shuujii/fix-ambiguous-first-argument-warning-in-test-t-float.rb
...
Fix "ambiguous first argument" warning in `test/t/float.rb`
2019-04-24 00:30:30 +09:00
KOBAYASHI Shuji
9f4147f28e
Fix "ambiguous first argument" warning in test/t/float.rb
2019-04-23 21:02:42 +09:00
KOBAYASHI Shuji
cc7f9190ba
Fix name assignment to frozen anonymous class/module
...
Fix the following issues:
A = Class.new.freeze #=> FrozenError
Module.new::B = Class.new.freeze #=> FrozenError
String::B = Module.new.freeze #=> FrozenError
2019-04-23 20:45:38 +09:00
Yukihiro "Matz" Matsumoto
e9f3902ab5
Fixed the condition in mrb_funcall_with_block; fix #4389
2019-04-23 15:30:10 +09:00
Yukihiro "Matz" Matsumoto
7cf1bc39a7
Merge pull request #4356 from shuujii/add-assert_match-and-assert_not_match
...
Add `assert_match` and `assert_not_match`
2019-04-22 22:29:15 +09:00
Yukihiro "Matz" Matsumoto
5ab8ca41a5
Merge branch 'shuujii-add-assert_predicate-and-assert_operator'
2019-04-22 22:26:46 +09:00
KOBAYASHI Shuji
0debf154ee
Add assert_predicate and assert_operator
2019-04-22 22:26:11 +09:00
Yukihiro "Matz" Matsumoto
49cb149033
Merge pull request #4391 from dearblue/inlines
...
Change modifier to `MRB_INLINE` from `static inline`
2019-04-22 21:17:27 +09:00
Yukihiro "Matz" Matsumoto
9985d0aaca
Merge pull request #4399 from shuujii/use-MRB_ASPEC_XXX-macro-in-codedump
...
Use `MRB_ASPEC_XXX()` macro in `codedump()`
2019-04-22 21:15:02 +09:00
KOBAYASHI Shuji
0e6a93a9ca
Use MRB_ASPEC_XXX() macro in codedump()
2019-04-22 19:09:29 +09:00
Yukihiro "Matz" Matsumoto
0e704d195f
Merge pull request #4396 from shuujii/commented-out-String-scan
...
Commented out `String#scan` because it is not implemented yet
2019-04-22 08:57:55 +09:00
Yukihiro "Matz" Matsumoto
a025cd2268
Merge pull request #4395 from shuujii/expand-BOXWORD_SET_VALUE-macro-in-include-mruby-boxing_word.h
...
Expand `BOXWORD_SET_VALUE()` macro in `include/mruby/boxing_word.h`
2019-04-22 08:56:47 +09:00
KOBAYASHI Shuji
cdb458ed4e
Commented out String#scan because it is not implemented yet
2019-04-21 20:34:39 +09:00
KOBAYASHI Shuji
b212050026
Expand BOXWORD_SET_VALUE() macro in include/mruby/boxing_word.h
...
In `SET_OBJ_VALUE()`, branch isn't removed because `switch` condition isn't
constant expression.
2019-04-20 21:23:58 +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
dearblue
6907e97fa1
Change modifier to MRB_INLINE from static inline
2019-04-19 22:24:22 +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
8ee516436b
Merge pull request #4386 from tomas/stable
...
Fix compilation on gcc 4.9.x
2019-04-17 08:03:15 +09:00
Tomás Pollak
ef3b539125
Prevent 'mixed declarations and code' C90 warning
2019-04-16 18:02:30 -04:00
Tomas Pollak
bcb8e297fc
Fix compilation on gcc 4.9.x
2019-04-16 12:34:09 -04: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
KOBAYASHI Shuji
716a99b069
Add assert_match and assert_not_match
2019-04-14 19:06:28 +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
Yukihiro "Matz" Matsumoto
b433001a1b
Merge pull request #4366 from shuujii/remove-unneeded-function-prototypes
...
Remove unneeded function prototypes
2019-04-10 06:02:16 +09:00
Yukihiro "Matz" Matsumoto
b351bdb8d5
Fixed old style declaration; ref #4365
2019-04-10 06:00:38 +09:00
Yukihiro "Matz" Matsumoto
d529501cbf
Rename itoa to dump_int to avoid name crash; ref #4173
2019-04-10 05:55:40 +09:00
Yukihiro "Matz" Matsumoto
16f86f8ede
Use the old style declaration; ref #4365
2019-04-10 05:42:36 +09:00
KOBAYASHI Shuji
e3beef065c
Extract frozen checking to function
2019-04-09 18:23:11 +09:00
KOBAYASHI Shuji
f89fe04d54
Remove unneeded function prototypes
2019-04-08 22:34:49 +09:00
Yukihiro "Matz" Matsumoto
292bffb32e
Avoid infinite loop when no Regexp class is available; fix #4363
2019-04-08 20:27:28 +09:00
Yukihiro "Matz" Matsumoto
ec1688807e
Avoid using snprintf when MRB_DISABLE_STDIO is set; fix #4173
2019-04-08 19:06:36 +09:00
Yukihiro "Matz" Matsumoto
6cec0c9f62
Fix C99 style inline declaration; fix #4365
2019-04-08 19:06:36 +09:00
Yukihiro "Matz" Matsumoto
2595d5f6c8
Merge pull request #4364 from shuujii/fix-test-for-Array-slice
...
Fix test for `Array#slice`
2019-04-07 22:12:33 +09:00
KOBAYASHI Shuji
f65b35dc9f
Fix test for Array#slice
2019-04-07 21:31:12 +09:00
Yukihiro "Matz" Matsumoto
6865826aff
Merge pull request #4362 from shuujii/move-Array-append-prepend-from-core-to-mruby-ary-ext
...
Move `Array#(append|prepend)` from core to `mruby-ary-ext`
2019-04-06 22:25:55 +09:00
Yukihiro "Matz" Matsumoto
64c2ea3f02
Merge pull request #4361 from shuujii/remove-unused-mrb_proc_cfunc_p
...
Remove unused `mrb_proc_cfunc_p()`
2019-04-06 22:22:38 +09:00
KOBAYASHI Shuji
5adef8ba44
Move Array#(append|prepend) from core to mruby-ary-ext
...
They are not included in ISO standard.
2019-04-06 17:40:51 +09:00
KOBAYASHI Shuji
271a91c648
Remove unused mrb_proc_cfunc_p()
2019-04-06 16:32:27 +09:00
Yukihiro "Matz" Matsumoto
293a7b2a6e
Merge pull request #4360 from shuujii/use-Module-alias_method-should-return-self-in-ISO-standard
...
`Module#alias_method` should return `self` in ISO standard
2019-04-05 22:17:34 +09:00
KOBAYASHI Shuji
623e15936a
Module#alias_method should return self in ISO standard
2019-04-05 19:03:46 +09:00
Yukihiro "Matz" Matsumoto
f882b6908e
Merge pull request #4357 from mruby/stable
...
Update version and release date. `mruby 2.0.1 (2019-4-4)`
2019-04-05 17:06:21 +09:00
Yukihiro "Matz" Matsumoto
d26f03b446
Merge pull request #4358 from shuujii/use-mrb_proc_arity-instead-of-Proc-arity-call-in-Method-arity
...
Use `mrb_proc_arity` instead of `Proc#arity` call in `Method#arity`
2019-04-05 13:58:20 +09:00
Yukihiro "Matz" Matsumoto
dd1c100b84
Merge pull request #4355 from shuujii/modify-else-and-endif-annotations-in-src-fmt_fp.c
...
Modify `#else` and `#endif` annotations in `src/fmt_fp.c` [ci skip]
2019-04-05 13:41:26 +09:00
KOBAYASHI Shuji
ed41bbb199
Use mrb_proc_arity instead of Proc#arity call in Method#arity
2019-04-04 22:17:26 +09:00
Hiroshi Mimaki
7c91efc1ff
Update version and release date.
...
`mruby 2.0.1 (2019-4-4)`
2019-04-04 09:26:40 +09:00
Yukihiro "Matz" Matsumoto
50a223f21f
Merge pull request #4354 from shuujii/remove-unnecessary-_set_output_format-call
...
Remove unnecessary `_set_output_format` call
2019-04-04 05:10:32 +09:00
KOBAYASHI Shuji
5e0caefa58
Modify #else and #endif annotations in src/fmt_fp.c [ci skip]
2019-04-03 19:25:06 +09:00
KOBAYASHI Shuji
abc6c990a6
Remove unnecessary _set_output_format call
...
Three-digit exponent issue was fixed via another workaround (63b8f5c ).
2019-04-03 18:54:25 +09:00
Yukihiro "Matz" Matsumoto
73feef9766
Merge pull request #4353 from shuujii/pad-leading-zero-to-month-and-day-in-MRUBY_RELEASE_DATE
...
Pad leading zero to month and day in `MRUBY_RELEASE_DATE`
2019-04-02 21:14:21 +09:00
KOBAYASHI Shuji
9b7e9addcd
Pad leading zero to month and day in MRUBY_RELEASE_DATE
...
For Ruby compatibility.
2019-04-02 16:24:07 +09:00
Yukihiro "Matz" Matsumoto
c274e1ae5a
Merge pull request #4352 from shuujii/fix-modifiable-class-name
...
Fix modifiable class name
2019-04-02 10:27:21 +09:00
KOBAYASHI Shuji
55cb625808
Fix modifiable class name
...
Fix the following example:
Object.const_set :A, Module.new{const_set :B, Class.new}
ab = A::B.to_s
p ab #=> "A::B" # Good
ab[0] = "x"
p A::B.to_s #=> "x::B" # Bad
2019-04-01 20:12:43 +09:00
Yukihiro "Matz" Matsumoto
2871d0cdc5
Avoid keeping pointers from mrb_sym2name_len(); fix #4342
...
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342 .
This changes small incompatible changes in function prototypes:
* `mrb_parser_get_filename`: return value changed to `mrb_sym`.
* `mrb_debug_get_filename`: add `mrb_state*` as a first argument.
* `mrb_debug_get_line`: ditto.
I believe above functions are almost internal, and no third-party
mrbgem use them.
2019-04-01 14:13:06 +09:00
Yukihiro "Matz" Matsumoto
6ec855a38e
Merge pull request #4351 from shuujii/fix-warning-interpreted-as-argument-prefix
...
Fix warning: '*' interpreted as argument prefix
2019-03-31 17:39:10 +09:00
KOBAYASHI Shuji
9b024dcf7a
Fix warning: '*' interpreted as argument prefix
2019-03-31 14:52:18 +09:00
Yukihiro "Matz" Matsumoto
19537b103c
Merge pull request #4349 from shuujii/add-pass-and-flunk-to-test-assert.rb
...
Add `pass` and `flunk` to `test/assert.rb`
2019-03-30 22:07:29 +09:00
KOBAYASHI Shuji
4e9c90ed47
Add pass and flunk to test/assert.rb
2019-03-30 13:19:31 +09:00
Yukihiro "Matz" Matsumoto
3c732cd28c
Merge pull request #4348 from shuujii/fix-missing-assertions-in-mruby-math-test
...
Fix missing assertions in `mruby-math` test
2019-03-29 15:51:20 +09:00
Yukihiro "Matz" Matsumoto
85f816528c
Merge pull request #4347 from iij/include-stdarg-in-mruby-h
...
fixes build on OpenBSD.
2019-03-29 15:49:41 +09:00
Tomoyuki Sahara
d8d59f70c1
va_list is defined in stdarg.h.
...
fixes build on OpenBSD.
2019-03-29 11:55:04 +09:00
KOBAYASHI Shuji
d1f937e1f4
Fix missing assertions in mruby-math test
2019-03-29 09:40:13 +09:00
Yukihiro "Matz" Matsumoto
42f240796f
Use Mrbtest::FLOAT_TOLERANCE instead of Math::TORELANCE; ref #4345
2019-03-28 23:22:32 +09:00
Yukihiro "Matz" Matsumoto
3b92b642eb
Break loop whem sum==0 to avoid zero division; ref #4345
2019-03-28 23:22:32 +09:00
Yukihiro "Matz" Matsumoto
a26856f883
Use DBL_EPSILON instead of 1E-12; ref #4345
2019-03-28 23:22:32 +09:00
Yukihiro "Matz" Matsumoto
6023180848
Merge pull request #4346 from shuujii/use-mrb_sym2str-in-implementation-of-symbol-to_s
...
Use `mrb_sym2str` in implementation of `Symbol#to_s`
2019-03-28 23:22:23 +09:00
KOBAYASHI Shuji
da2bc9e678
Use mrb_sym2str in implementation of Symbol#to_s
2019-03-28 19:56:51 +09:00
Yukihiro "Matz" Matsumoto
21b8d20d7e
Fixed mistakes in 92dce05
...
* rename `sym2name` to `sym2name_len`.
* `MRB_API` -> `static`
2019-03-28 07:06:44 +09:00
Yukihiro "Matz" Matsumoto
5fe00c46ba
Merge pull request #4344 from shuujii/remove-unused-variable-in-each_backtrace
...
Remove unused variable in `each_backtrace()`
2019-03-27 20:24:31 +09:00
KOBAYASHI Shuji
58ca4061b5
Remove unused variable in each_backtrace()
2019-03-27 19:27:00 +09:00
Yukihiro "Matz" Matsumoto
92dce053ad
Fix another bug related to #4342
...
For short symbols with alpha numeric characters, `mrb_sym2name_len()`
returns the same buffer `mrb->symbuf`. Some occasion, we forget the fact
that the second call could overwrite the result of first call of the
function.
We have prepared the static function `sym2name()` which specifies the
buffer region for inline packed symbols and use the function in
`mrb_sym_to_s`.
2019-03-27 17:38:06 +09:00
Yukihiro "Matz" Matsumoto
b8f00e439d
Avoid using 'mrb_str_new_static` if a symbol is packed; fix #4342
2019-03-27 12:53:24 +09:00
Yukihiro "Matz" Matsumoto
5598612336
Merge pull request #4343 from shuujii/fix-dealing-with-infinity-and-NaN-in-assert_float
...
Fix dealing with infinity and NaN in `test/assert.rb:assert_float`
2019-03-27 06:53:30 +09:00
KOBAYASHI Shuji
0b6696cc28
Fix dealing with infinity and NaN in test/assert.rb:assert_float
...
`assert_float` is always passed when expected value and/or actual value are
infinity or NaN. This behavior seems unintentional.
Before this patch:
assert_float(Float::INFINITY, 1.0) #=> pass
assert_float(-Float::INFINITY, 1) #=> pass
assert_float(1, 1/0) #=> pass
assert_float(1, -1/0) #=> pass
assert_float(1.0, Float::NAN) #=> pass
assert_float(Float::NAN, 1) #=> pass
After this patch:
assert_float(Float::INFINITY, 1.0) #=> fail: Expected 1.0 to be Infinity.
assert_float(-Float::INFINITY, 1) #=> fail: Expected 1 to be -Infinity.
assert_float(1, 1/0) #=> fail: Expected Infinity to be 1.
assert_float(1, -1/0) #=> fail: Expected -Infinity to be 1.
assert_float(1.0, Float::NAN) #=> fail: Expected NaN to be 1.0.
assert_float(Float::NAN, 1) #=> fail: Expected 1 to be NaN.
2019-03-26 22:12:09 +09:00
Yukihiro "Matz" Matsumoto
c2660b8111
Fix missing MRB_API prefix for functions below; clse #4267
...
Functions to add prototypes to headers:
* mrb_ary_splice()
* mrb_notimplement()
* mrb_vformat()
* mrb_cstr_to_dbl()
* mrb_cstr_to_inum()
Functions to be made `static` (`MRB_API` was not needed):
* mrb_mod_module_function()
* mrb_obj_hash()
* mrb_str_len_to_inum()
Functions to remove `MRB_API` from definitions (referenced from within `libmruby`):
* mrb_mod_cv_defined()
* mrb_mod_cv_get()
* mrb_f_send()
2019-03-26 10:23:52 +09:00
Yukihiro "Matz" Matsumoto
a5a6b51126
Use uppercase version of ctype macros e.g. ISSPACE; fix #4338
2019-03-25 22:05:31 +09:00
Yukihiro "Matz" Matsumoto
1e14afa4e4
Merge pull request #4341 from shuujii/remove-implementation-of-Symbol-eqq
...
Remove implementation of `Symbol#===`
2019-03-25 22:05:18 +09:00
KOBAYASHI Shuji
b489ddcbd1
Remove implementation of Symbol#===
...
For reducing program size.
2019-03-25 21:39:11 +09:00
Yukihiro "Matz" Matsumoto
33a9840e4a
Need to check length before packing a symbol; fix #4340
2019-03-25 20:28:21 +09:00
Yukihiro "Matz" Matsumoto
f7e05c7d22
Update float test values to avoid precision errors.
2019-03-25 16:54:34 +09:00
Yukihiro "Matz" Matsumoto
ce67561511
Avoid infinite binary floating numbers in float.
2019-03-25 16:21:50 +09:00
Yukihiro "Matz" Matsumoto
3e5dd40a5c
Merge pull request #4339 from shuujii/fix-arguments-spec-in-src-proc.c
...
Fix arguments spec in `src/proc.c`
2019-03-24 22:26:37 +09:00
Yukihiro "Matz" Matsumoto
e36db51bea
Merge pull request #4337 from shuujii/refactor-t_print-for-test
...
Refactor `t_print` for test
2019-03-24 21:29:00 +09:00
KOBAYASHI Shuji
10a8e0f105
Fix arguments spec in src/proc.c
2019-03-24 20:55:04 +09:00
KOBAYASHI Shuji
df4b081392
Refactor t_print for test
2019-03-23 19:27:21 +09:00
Yukihiro "Matz" Matsumoto
36c9416bff
Merge pull request #4336 from shuujii/simplify-assert_step
...
Simplify `assert_step` in `test/t/numeric.rb`
2019-03-22 22:38:05 +09:00
KOBAYASHI Shuji
04fc265858
Simplify assert_step in test/t/numeric.rb
2019-03-22 18:37:37 +09:00
Yukihiro "Matz" Matsumoto
84241d3dba
Merge pull request #4334 from shuujii/remove-redundant-content-in-assertion-failure-message-and-diff
...
Remove redundant content in assertion failure message and diff
2019-03-22 14:40:19 +09:00
Yukihiro "Matz" Matsumoto
19191a5476
Merge pull request #4335 from shuujii/fix-Float-eql
...
Fix `Float#eql?`
2019-03-22 14:38:23 +09:00
KOBAYASHI Shuji
a41b02ab91
Fix Float#eql?
2019-03-21 21:36:54 +09:00
KOBAYASHI Shuji
2b72baccf3
Remove redundant content in assertion failure message and diff
...
Based on minitest RubyGem.
Example of before this patch:
- Assertion[1] Failed: Expected 1 to be 2
Expected: 2
Actual: 1
- Assertion[2] Failed: Expected [1, 3] to include 2
Collection: [1, 3]
Object: 2
Example of after this patch:
- Assertion[1]
Expected: 2
Actual: 1
- Assertion[2]
Expected [1, 3] to include 2.
2019-03-21 20:53:52 +09:00
Yukihiro "Matz" Matsumoto
3f7cd4687f
Merge pull request #4333 from shuujii/use-FrozenError-instead-of-RuntimeError-in-frozen-obj-mod-test
...
Use `FrozenError` instead of `RuntimeError` in frozen object modification test
2019-03-20 18:43:41 +09:00
Yukihiro "Matz" Matsumoto
cd3bf55b3e
Merge pull request #4332 from shuujii/use-Rake-instead-of-MiniRake-on-AppVeyor
...
Use Rake instead of MiniRake on AppVeyor
2019-03-20 18:42:54 +09:00
KOBAYASHI Shuji
fbad7a1595
Use FrozenError instead of RuntimeError in frozen object modification test
2019-03-19 20:48:32 +09:00
KOBAYASHI Shuji
bc321ece4c
Use Rake instead of MiniRake on AppVeyor
...
1. Reduce build time
Build time becomes less than half. In MiniRake, a way of using fiber may not be good.
2. Synchronize standard output
No synchronized:
mrbtest - Embeddable Ruby Test
...........................
Total: 1165
(snip)
Time: 1.19 seconds
bintest - Command Binary Test
.....................
Total: 21
(snip)
Time: 0.39 seconds
mrbtest - Embeddable Ruby Test
...........................
Total: 1165
(snip)
Skip: 23
Time: 1.15 seconds
(snip)
>>> Test cxx_abi <<<
>>> Bintest host <<<
>>> Test host <<<
>>> Test full-debug <<<
>>> Bintest cxx_abi <<<
Synchronized:
>>> Test full-debug <<<
mrbtest - Embeddable Ruby Test
...........................
Total: 1165
(snip)
Time: 1.25 seconds
>>> Test host <<<
mrbtest - Embeddable Ruby Test
...........................
Total: 1165
(snip)
Time: 1.16 seconds
>>> Bintest host <<<
bintest - Command Binary Test
.....................
Total: 21
(snip)
Time: 0.41 seconds
>>> Test cxx_abi <<<
mrbtest - Embeddable Ruby Test
(snip)
2019-03-18 14:25:24 +09:00
Yukihiro "Matz" Matsumoto
f8b17d1ec4
Merge pull request #4331 from shuujii/fix-class-instance-variable-name-validation
...
Fix class/instance variable name validation
2019-03-17 18:38:06 +09:00
KOBAYASHI Shuji
b588e5a5b7
Fix class/instance variable name validation
...
- `@@?` etc are invalid class variable name.
- `@1` etc are invalid instance variable name.
2019-03-17 16:58:31 +09:00
Yukihiro "Matz" Matsumoto
15b6499c8b
Merge pull request #4330 from shuujii/refine-appveyor.yml
...
Refine `appveyor.yml`
2019-03-16 20:30:07 +09:00
KOBAYASHI Shuji
1809fb755a
Refine appveyor.yml
...
- Add Visual Studio 2017.
- Enable `shallow_clone` for saving build time.
- Cache extracted WinFlexBison.
2019-03-16 13:37:52 +09:00
Yukihiro "Matz" Matsumoto
e9b1f14cdc
Merge pull request #4329 from shuujii/use-FrozenError-instead-of-RuntimeError
...
Use `FrozenError` instead of `RuntimeError` in `String#rstrip!`
2019-03-15 23:18:19 +09:00
KOBAYASHI Shuji
cd4daf78ec
Use FrozenError instead of RuntimeError in String#rstrip!
2019-03-15 22:49:40 +09:00
Yukihiro "Matz" Matsumoto
a1e1201148
Merge pull request #4328 from shuujii/fix-constant-name-validation
...
Fix constant name validation
2019-03-15 21:19:48 +09:00
Yukihiro "Matz" Matsumoto
298807fa4e
Avoid using infinite binary floating point numbers in tests.
2019-03-15 15:25:43 +09:00
Yukihiro "Matz" Matsumoto
63b8f5cf57
Use fmt_fp() for portable float representation.
2019-03-15 15:25:43 +09:00
KOBAYASHI Shuji
16b1b2978e
Fix constant name validation
...
`X!` etc are invalid constant name.
2019-03-14 23:09:05 +09:00
Yukihiro "Matz" Matsumoto
63124bf633
Merge pull request #4327 from shuujii/do-not-raise-an-exception-when-bintest-fail
...
Do not raise an exception when bintest fail
2019-03-13 22:30:08 +09:00
KOBAYASHI Shuji
c3122c887a
Do not raise an exception when bintest fail
...
- An exception do not raise when mrbtest fail.
- There are no useful informations in exception message and backtrace.
2019-03-13 22:04:14 +09:00
Yukihiro "Matz" Matsumoto
ad0a8888f3
Merge pull request #4326 from shuujii/fix-typo-in-AUTHORS
...
Fix typo in `AUTHORS` [ci skip]
2019-03-13 09:06:18 +09:00
KOBAYASHI Shuji
29951a6d07
Fix typo in AUTHORS [ci skip]
2019-03-13 07:56:32 +09:00
Yukihiro "Matz" Matsumoto
1d38c1f307
Merge pull request #4322 from shuujii/reduce-String-creation-in-checking-name
...
Reduce `String` creation in `check_(cv|const)_name_sym`
2019-03-12 23:48:48 +09:00
Yukihiro "Matz" Matsumoto
d2c325d08a
Merge pull request #4325 from shuujii/fix-missing-assertions-in-mruby-string-ext-test
...
Fix missing assertions in `mruby-string-ext` test
2019-03-12 23:48:03 +09:00
Yukihiro "Matz" Matsumoto
07b9a10c06
Update the description at the head of AUTHORS; ref #4324
2019-03-12 23:36:26 +09:00
KOBAYASHI Shuji
e3b339bec6
Fix missing assertions in mruby-string-ext test
2019-03-12 21:47:33 +09:00
Yukihiro "Matz" Matsumoto
adfb25ab13
Merge pull request #4324 from shuujii/update-AUTHORS
...
Update `AUTHORS` [ci skip]
2019-03-12 21:21:25 +09:00
KOBAYASHI Shuji
fc96dbcac6
Update AUTHORS [ci skip]
2019-03-12 09:46:29 +09:00
Yukihiro "Matz" Matsumoto
46e4524566
Merge pull request #4323 from shuujii/rename-MITL-to-LICENSE
...
Rename `MITL` to `LICENSE` in `.yardopts`; ref 67728c1 [ci skip]
2019-03-12 09:27:04 +09:00
KOBAYASHI Shuji
e2976172c5
Rename MITL to LICENSE in .yardopts; ref 67728c1 [ci skip]
2019-03-12 09:21:43 +09:00
Yukihiro "Matz" Matsumoto
67728c1576
Rename MITL to LICENSE to conform GitHub convention.
2019-03-12 07:54:38 +09:00
KOBAYASHI Shuji
425e6e0ffb
Reduce String creation in check_(cv|const)_name_sym
2019-03-11 17:26:19 +09:00
Yukihiro "Matz" Matsumoto
fba8ecf55c
Merge pull request #4321 from shuujii/add-bintest-header
...
Add bintest header
2019-03-10 23:51:03 +09:00
KOBAYASHI Shuji
7d1a8d3f8e
Add bintest header
2019-03-10 21:46:24 +09:00
Yukihiro "Matz" Matsumoto
6a0ae792df
Merge pull request #4316 from shuujii/add-a-missing-file-for-4314
...
Add a missing file for #4314
2019-03-09 10:19:32 +09:00
Yukihiro "Matz" Matsumoto
d27808ef82
Merge pull request #4319 from shuujii/allow-enable_bintest-without-enable_test
...
Allow `enable_bintest` without `enable_test` in build config
2019-03-08 23:05:05 +09:00
KOBAYASHI Shuji
441c964716
Allow enable_bintest without enable_test in build config
2019-03-08 22:00:06 +09:00
Yukihiro "Matz" Matsumoto
4fb3edce11
Merge pull request #4318 from shuujii/set-GEMNAME-on-bintest
...
Set `GEMNAME` on bintest
2019-03-08 12:22:24 +09:00
KOBAYASHI Shuji
968e3b9400
Set GEMNAME on bintest
2019-03-07 22:16:47 +09:00
KOBAYASHI Shuji
f6326803c7
Add a missing file for #4314
2019-03-07 21:36:54 +09:00
Yukihiro "Matz" Matsumoto
bf922c9f7a
Merge pull request #4315 from shuujii/refer-also-CXX-and-CC-env-vars-as-linker-command
...
Refer also CXX and CC env vars as linker command in gcc and clang toolchain
2019-03-06 22:26:34 +09:00
KOBAYASHI Shuji
e2bb5ce079
Refer also CXX and CC env vars as linker command in gcc and clang toolchain
...
ref #4292
2019-03-06 20:42:31 +09:00
Yukihiro "Matz" Matsumoto
06e07cbcd8
Merge pull request #4314 from shuujii/count-skip-test
...
Count skip tests
2019-03-06 19:54:37 +09:00
KOBAYASHI Shuji
650ca7da17
Count skip tests
2019-03-05 19:53:25 +09:00
Yukihiro "Matz" Matsumoto
06dae1a9b6
Merge pull request #4313 from shuujii/extract-similar-code-fragment-to-method-in-src-class.c
...
Extract similar code fragment to method in `src/class.c`
2019-03-04 21:57:37 +09:00
Yukihiro "Matz" Matsumoto
f82e11a7ed
Merge pull request #4312 from shuujii/GEMNAME-is-undefined-in-bintest
...
`GEMNAME` is undefined in bintest
2019-03-04 06:48:31 +09:00
KOBAYASHI Shuji
ee537eceee
GEMNAME is undefined in bintest
...
ref: https://github.com/mruby/mruby/pull/4296#discussion_r261868710
2019-03-04 00:18:54 +09:00
Yukihiro "Matz" Matsumoto
d1cdb9ef75
Merge pull request #4311 from shuujii/simplify-MRubyTestSkip-in-test-assert.rb
...
Simplify `MRubyTestSkip` in `test/assert.rb`
2019-03-03 23:22:23 +09:00
KOBAYASHI Shuji
376dd992f1
Extract similar code fragment to method in src/class.c
2019-03-03 20:45:44 +09:00
KOBAYASHI Shuji
c6b8106924
Simplify MRubyTestSkip in test/assert.rb
2019-03-03 18:58:11 +09:00
Yukihiro "Matz" Matsumoto
83a1df3785
Merge pull request #4309 from shuujii/fix-missing-assertion-in-test-t-class.rb
...
Fix missing assertion in `test/t/class.rb`
2019-03-02 21:14:41 +09:00
KOBAYASHI Shuji
729ab86d49
Fix missing assertion in test/t/class.rb
2019-03-02 18:55:02 +09:00
Yukihiro "Matz" Matsumoto
ad45f51caf
Remove unused gem.bin= method; close #4271
2019-03-02 15:57:39 +09:00
Yukihiro "Matz" Matsumoto
af51119d3a
Raise error on failed comparison in sort; ref #4307
2019-03-02 15:46:50 +09:00
Yukihiro "Matz" Matsumoto
73091ab202
Do not apply mrb_ptr() to immediate objects; fix #4307
2019-03-02 15:45:15 +09:00
Yukihiro "Matz" Matsumoto
ca0dcbb226
Free struct mrb_time before error; fix #4308
...
To avoid memory leak from `time_update_datetime`.
2019-03-02 14:13:06 +09:00
Yukihiro "Matz" Matsumoto
e5649eba70
Remove useless regression tests; ref #4306
2019-03-02 14:01:52 +09:00
Yukihiro "Matz" Matsumoto
997cc8238d
Remove useless regression tests; fix #4306
2019-03-02 14:00:25 +09:00
Yukihiro "Matz" Matsumoto
13e0a48e3c
Print length of the iseq in code dump header; fix #4304
2019-03-02 13:51:46 +09:00
Yukihiro "Matz" Matsumoto
48fb239efb
Merge pull request #4305 from shuujii/add-warning-prefix-to-parser-warning-message
...
Add `warning: ` prefix to parser warning message
2019-03-01 06:58:33 +09:00
KOBAYASHI Shuji
8c04ba2222
Add warning: prefix to parser warning message
2019-02-28 19:54:45 +09:00
Yukihiro "Matz" Matsumoto
d25b9c9d0e
Remove unnecessary backticks; ref #4301
2019-02-28 12:59:16 +09:00
Yukihiro "Matz" Matsumoto
f1fb2bf29e
Remove ?A style string literals from string tests; #4303
...
We have a plan to obsolete this style in the future.
2019-02-28 12:55:44 +09:00
Yukihiro "Matz" Matsumoto
4f3067fe2f
Merge pull request #4301 from shuujii/remove-unnecessary-backticks
...
Remove unnecessary backticks; ref #2858
2019-02-28 12:55:26 +09:00
Yukihiro "Matz" Matsumoto
5424640f6f
Merge pull request #4303 from dearblue/string-literal-concatenation
...
String literal concatenation
2019-02-28 07:05:08 +09:00
dearblue
f9a568adcb
Add test for string literal concatenation
2019-02-27 22:58:13 +09:00
dearblue
e871a1538d
Compositing NODE_DSTR and NODE_DSTR
2019-02-27 22:58:13 +09:00
dearblue
4d2bb3cb47
Compositing NODE_DSTR and NODE_STR
2019-02-27 22:58:13 +09:00
dearblue
8ead6da913
Compositing NODE_STR and NODE_DSTR
2019-02-27 22:58:13 +09:00
dearblue
25957421bc
Replacement to function for composite two string nodes
2019-02-27 22:58:13 +09:00
dearblue
477e5285e8
Replacement to function for NODE_STR cheking
2019-02-27 22:58:09 +09:00
dearblue
9913643ed8
Compositing NODE_STR and NODE_STR
2019-02-27 22:57:45 +09:00
dearblue
cece016389
Concatenate string literals
2019-02-27 22:35:53 +09:00
Yukihiro "Matz" Matsumoto
6962d0ddde
Merge pull request #4302 from shuujii/add-newline-to-warning-by-mrb_warn
...
Add newline to warning by `mrb_warn()`
2019-02-27 22:33:22 +09:00
Yukihiro "Matz" Matsumoto
759b57d22a
Merge pull request #4300 from shuujii/use-yywarning-instead-of-yywarning_s-for-MRB_WITHOUT_FLOAT
...
Use `yywarning()` instead of `yywarning_s()` for `MRB_WITHOUT_FLOAT`
2019-02-27 22:32:31 +09:00
KOBAYASHI Shuji
62bb9c6436
Add newline to warning by mrb_warn()
2019-02-27 20:58:20 +09:00
KOBAYASHI Shuji
c11bd075f7
Remove unnecessary backticks; ref #2858
2019-02-27 20:27:29 +09:00
KOBAYASHI Shuji
2894625089
Use yywarning() instead of yywarning_s() for MRB_WITHOUT_FLOAT
2019-02-27 20:21:40 +09:00
Yukihiro "Matz" Matsumoto
018f4bd32e
Merge pull request #4299 from shuujii/remove-unneeded-separator-in-test-skip-error-messages
...
Remove unneeded `=>` in test skip/error messages
2019-02-27 07:29:17 +09:00
Yukihiro "Matz" Matsumoto
d544401f1f
Merge pull request #4298 from shuujii/remove-unneeded-const_defined-Time-in-mruby-io-test
...
Remove unneeded `const_defined?(:Time)` in `mruby-io` test
2019-02-26 21:49:32 +09:00
KOBAYASHI Shuji
fdb7f9dad3
Remove unneeded => in test skip/error messages
2019-02-26 21:32:34 +09:00
KOBAYASHI Shuji
c6cd69970b
Remove unneeded const_defined?(:Time) in mruby-io test
...
`mruby-time` is included in test dependencies.
2019-02-26 21:12:41 +09:00
Yukihiro "Matz" Matsumoto
68f421c859
Merge pull request #4294 from shuujii/remove-explicit-set-of-DISABLE_GEMS
...
Remove explicit set of `DISABLE_GEMS`
2019-02-25 23:49:16 +09:00
Yukihiro "Matz" Matsumoto
6337bde8a5
Merge pull request #4296 from shuujii/refine-mrbgem-name-in-assertion-failure-message-for-core-test
...
Refine mrbgem name in assertion failure/skip message for core test
2019-02-25 23:48:04 +09:00
Yukihiro "Matz" Matsumoto
96b12b9813
Merge pull request #4297 from shuujii/refactor-src-backtrace.c
...
Refactor `src/backtrace.c`
2019-02-25 23:46:24 +09:00
KOBAYASHI Shuji
c49a10f9a0
Refactor src/backtrace.c
...
- Move calling `mrb_debug_get_filename()` to after `lineno` check.
- Remove unneeded array check in `print_backtrace()`.
- Add a few `const` qualifier.
2019-02-25 20:39:20 +09:00
KOBAYASHI Shuji
5c40203930
Refine mrbgem name in assertion failure/skip message for core test
2019-02-24 19:21:40 +09:00
Yukihiro "Matz" Matsumoto
ad87fd2287
Merge pull request #4295 from wataash/struct-dig
...
Move `Object#dig` to `Struct#dig`
2019-02-24 18:13:56 +09:00
Wataru Ashihara
e91f3ec770
Move Object#dig to Struct#dig
...
This method seems to be mistakenly put into `Object` instead of `Struct`
since it's in `struct.rb` and daf83946b says:
add #dig to Array,Hash and Struct
2019-02-24 16:59:02 +09:00
KOBAYASHI Shuji
31f1b4a553
Remove explicit set of DISABLE_GEMS
...
`DISABLE_GEMS` is automatically set (or unset); ref #790
2019-02-23 18:29:37 +09:00
Yukihiro "Matz" Matsumoto
f5cfb77078
Merge pull request #4293 from shuujii/integrate-init_mrbtest.c-to-driver.c-in-mruby-test-mrbgem
...
Integrate `init_mrbtest.c` to `driver.c` in `mruby-test` mrbgem
2019-02-23 10:31:40 +09:00
KOBAYASHI Shuji
f209f781ac
Integrate init_mrbtest.c to driver.c in mruby-test mrbgem
...
- `mrbgemtest_init()` is needed if `DISABLE_GEMS` is enabled because core
tests are run as part of `mruby-test` mrbgem (moreover, `DISABLE_GEMS` is
disabled when `enable_test` is used in build config).
- For the same reason `mrb_open_core()` etc for core tests is unneeded.
2019-02-22 20:41:20 +09:00
Yukihiro "Matz" Matsumoto
5cc277340f
Merge pull request #4291 from shuujii/fix-typo-in-lib-mruby-build-command.rb
...
Fix typo in `lib/mruby/build/command.rb`
2019-02-21 22:40:17 +09:00
Yukihiro "Matz" Matsumoto
769b56c3ae
Merge pull request #4290 from shuujii/refactor-exception-handling-in-assert
...
Refactor exception handling in `assert`
2019-02-21 22:37:09 +09:00
KOBAYASHI Shuji
37fb5f929f
Fix typo in lib/mruby/build/command.rb
2019-02-21 19:47:00 +09:00
KOBAYASHI Shuji
ad789944db
Refactor exception handling in assert
2019-02-21 17:44:45 +09:00
Yukihiro "Matz" Matsumoto
76262b8e28
Merge pull request #4288 from shuujii/assert_true-should-pass-when-actual-is-only-true
...
`assert_true`/`assert_false` should pass when actual is only `true`/`false`
2019-02-20 19:42:01 +09:00
KOBAYASHI Shuji
244abdae09
assert_true/assert_false should pass when actual is only true/false
...
For the following reasons:
- Previous behavior is confusable because it's different from test/unit rubygem's `assert_true`
- Tests may pass unintentionally in an inappropriate way; ref #4285 #4287
2019-02-20 18:49:38 +09:00
Yukihiro "Matz" Matsumoto
baf8fbe6ed
Merge pull request #4286 from kimushu/mrdb-local-variables
...
mrdb: add "info locals" command
2019-02-19 20:44:16 +09:00
Yukihiro "Matz" Matsumoto
8781596c35
Merge pull request #4287 from shuujii/use-more-appropriate-assertion-methods
...
Use more appropriate assertion methods
2019-02-19 20:31:10 +09:00
KOBAYASHI Shuji
8a7298e069
Use more appropriate assertion methods
2019-02-19 20:02:50 +09:00
kimu_shu
477ffc7473
Add "info locals" command to mrdb
2019-02-19 18:10:05 +09:00
Yukihiro "Matz" Matsumoto
971bfd13c1
Merge pull request #4284 from shuujii/use-assert_same-instead-of-assert_equal-in-enum-reverse_each-test
...
Use `assert_same` instead of `assert_equal` in `Enumerable#reverse_each` test
2019-02-18 21:50:08 +09:00
Yukihiro "Matz" Matsumoto
4164d4efdf
Merge pull request #4285 from shuujii/fix-wrong-assertin-method-in-some-tests
...
Fix wrong assertion method in some tests
2019-02-18 21:47:41 +09:00
KOBAYASHI Shuji
d68eb3d043
Fix wrong assertion method in some tests
2019-02-18 21:24:20 +09:00
KOBAYASHI Shuji
f86e4a5d93
Use assert_same instead of assert_equal in Enumerable#reverse_each test
2019-02-18 21:06:18 +09:00
Yukihiro "Matz" Matsumoto
9215c85450
Parenthesize expression to suppress warning; ref #4278
2019-02-18 17:25:01 +09:00
Yukihiro "Matz" Matsumoto
4ccc3f1525
Use key argument register for OP_KEY_P to reduce register use.
2019-02-18 17:25:01 +09:00
Yukihiro "Matz" Matsumoto
e986dfa8aa
Merge pull request #4283 from shuujii/reorder-members-in-struct-backtrace_location
...
Reorder members in `struct backtrace_location`
2019-02-18 17:24:48 +09:00
Yukihiro "Matz" Matsumoto
93e25f4aaa
Merge pull request #4282 from shuujii/remove-unneeded-memset-in-backtrace.c
...
Remove unneeded `memset()` in `src/backtrace.c`
2019-02-18 17:24:16 +09:00
KOBAYASHI Shuji
a28d714398
Reorder members in struct backtrace_location
...
`sizeof(struct backtrace_location)` is 24 bytes -> 16 bytes in LP64
data model etc.
2019-02-18 16:38:56 +09:00
KOBAYASHI Shuji
15344dfd0b
Remove unneeded memset() in src/backtrace.c
2019-02-18 16:12:12 +09:00
Yukihiro "Matz" Matsumoto
3e0d29b7be
Merge pull request #4279 from dearblue/fix-inline-packed-symbols
...
Fix destroyed "inline packed symbols" on 32 bit mode with `MRB_WORD_BOXING`
2019-02-17 22:13:22 +09:00
Yukihiro "Matz" Matsumoto
a3e8b750ef
Merge pull request #4280 from shuujii/refine-deps-for-mruby-config
...
Refine dependencies for `mruby-config`
2019-02-17 22:12:19 +09:00
Yukihiro "Matz" Matsumoto
391b5aa0d8
Merge pull request #4281 from yui-knk/typos [ci skip
...
Fix typos
2019-02-17 22:11:32 +09:00
yui-knk
f614eed13a
Fix typos
2019-02-17 21:34:33 +09:00
KOBAYASHI Shuji
b3e0a13989
Refine dependencies for mruby-config
2019-02-17 15:52:16 +09:00
dearblue
5067a5cd58
Use const int instead of enum
2019-02-16 22:13:16 +09:00
Yukihiro "Matz" Matsumoto
21933b7790
Merge pull request #4278 from shuujii/add-length-argument-for-sym_inline_unpack
...
Add length argument for `sym_inline_unpack()`
2019-02-16 21:52:39 +09:00
dearblue
81cbc92513
Fix inline packed symbols on 32 bit mode with MRB_WORD_BOXING
2019-02-16 21:26:45 +09:00
dearblue
d1db959cab
Fix to defined MRB_SYMBOL_BITSIZE and MRB_SYMBOL_MAX always; ref #4077
2019-02-16 21:24:05 +09:00
KOBAYASHI Shuji
2c8af128f4
Add length argument for sym_inline_unpack()
...
`sym_inline_unpack_with_bit()` is moved inside of `sym_inline_unpack()`
because this is used only one place.
2019-02-16 20:48:33 +09:00
Yukihiro "Matz" Matsumoto
c769013f9b
Merge pull request #4277 from shuujii/extract-code-fragment-for-unpacking-in-sym_inline_unpack
...
Extract code fragment for unpacking into method in `sym_inline_unpack()`
2019-02-15 20:12:49 +09:00
KOBAYASHI Shuji
5b10439f6f
Extract code fragment for unpacking into method in sym_inline_unpack()
2019-02-15 19:48:00 +09:00
Yukihiro "Matz" Matsumoto
cc94c8bf9d
Merge pull request #4276 from shuujii/use-assert-for-checking-sym-in-sym_inline_unpack
...
Use `mrb_assert()` for checking `sym` in `sym_inline_unpack()`
2019-02-15 16:34:18 +09:00
Yukihiro "Matz" Matsumoto
702a868b86
Merge pull request #4275 from shuujii/add-const-to-pack_table-in-symbol.c
...
Add `const` to `pack_table` in `src/symbol.c`
2019-02-14 20:12:03 +09:00
KOBAYASHI Shuji
921af6923d
Use mrb_assert() for checking sym in sym_inline_unpack()
2019-02-14 18:48:41 +09:00
KOBAYASHI Shuji
bedd672571
Add const to pack_table to src/symbol.c
2019-02-14 18:44:00 +09:00
Yukihiro "Matz" Matsumoto
01c908117d
Merge pull request #4274 from shuujii/lazy-message-diff-creation-for-assertion
...
Lazy message/diff creation for assertion in `test/assert.rb`
2019-02-14 13:10:48 +09:00
KOBAYASHI Shuji
6cdac5efb6
Lazy message/diff creation for assertion in test/assert.rb
...
Include the following changes too:
- Extract part of logic with block to a method
- Use `var ||= ...` instead of `var = ... unless var`
- Unify using parentheses for `t_print`
- Change methods order
2019-02-14 09:04:42 +09:00
Yukihiro "Matz" Matsumoto
a6c0aa8306
Merge pull request #4269 from shuujii/always-through-assert_true-for-assertion
...
Always through `assert_true` for assertion methods in `test/assert.rb`
2019-02-13 07:10:13 +09:00
Yukihiro "Matz" Matsumoto
ae5ff737e0
Merge pull request #4273 from shuujii/refine-mruby-bin-config-mrbgem.rake
...
Refine `mrbgems/mruby-bin-config/mrbgem.rake`
2019-02-13 07:09:07 +09:00
KOBAYASHI Shuji
c592c093aa
Refine mrbgems/mruby-bin-config/mrbgem.rake
...
- Use `MRuby::Gem::Specification`
- Fix a binary name is added to `MRuby::Build#bins` multiple times
- Close file immediately (avoid using `open(...).read`)
- Simplify
2019-02-12 21:45:38 +09:00
Yukihiro "Matz" Matsumoto
37bc343e0a
Disable Symbol.all_symbols.
2019-02-12 17:30:34 +09:00
Yukihiro "Matz" Matsumoto
06ba5905f0
Implement inline packed symbols.
...
Small symbols with all alphanumeric characters (<5) are packed in 32bit
symbol integer a la base64. This means those small symbols are not
listed in `Symbol.all_symbols`.
2019-02-12 17:30:34 +09:00
Yukihiro "Matz" Matsumoto
3a95bf0ddb
Merge pull request #4272 from shuujii/refactor-for-node_back_ref-in-codegen
...
Small refactoring in `codegen.c`
2019-02-11 22:47:43 +09:00
KOBAYASHI Shuji
c6e2d91536
Small refactoring in codegen.c
2019-02-11 21:09:40 +09:00
Yukihiro "Matz" Matsumoto
ef93ff6405
Should not copy keys&values when a hash table is empty; fix #4270
2019-02-11 15:20:34 +09:00
Yukihiro "Matz" Matsumoto
639f6e2799
No strict argument check for blocks when keyword arguments exist; ref #4270
2019-02-11 15:20:34 +09:00
Yukihiro "Matz" Matsumoto
55e58d8512
Merge pull request #4268 from dearblue/null-safe-mrb_open_core
...
NULL safed `mrb_open_core()`
2019-02-10 08:58:10 +09:00
KOBAYASHI Shuji
e60f5f5cee
Always through assert_true for assertion methods in test/assert.rb
2019-02-09 21:48:12 +09:00
dearblue
eb6aee117b
mrb_default_allocf() is default allocator for NULL safe
2019-02-09 20:22:08 +09:00
Yukihiro "Matz" Matsumoto
fc883de458
Merge pull request #4266 from shuujii/add-no_method_error-tests-to-enumerator
...
Add `NoMethodError` tests to `mruby-enumerator`
2019-02-08 23:28:38 +09:00
KOBAYASHI Shuji
19740d45a1
Add NoMethodError tests to mruby-enumerator
2019-02-08 17:40:12 +09:00
Yukihiro "Matz" Matsumoto
3d73a29783
Merge branch 'shuujii-fix-enumerator-initialize-for-nil-or-false'
2019-02-08 09:35:34 +09:00
Yukihiro "Matz" Matsumoto
e0bc87297e
Update mruby-enumerator test to conform the last update.
2019-02-08 09:35:28 +09:00
Yukihiro "Matz" Matsumoto
9ab7c1111b
Update #4265 patch.
...
* Update doc comment to clarify `Enumerator.new` without a block is
deprecated and left only for internal use.
* Fixed some cases `mruby` raise `ArgumentError` too eagerly compared
with `CRuby`.
2019-02-08 09:35:28 +09:00
KOBAYASHI Shuji
2650999092
Fix Enumerator#(initialize|inspect) for nil/false
2019-02-08 09:35:28 +09:00
Yukihiro "Matz" Matsumoto
c32e3158f5
Update mruby-enumerator test to conform the last update.
2019-02-08 09:34:31 +09:00
Yukihiro "Matz" Matsumoto
32f3ffa2c9
Update #4265 patch.
...
* Update doc comment to clarify `Enumerator.new` without a block is
deprecated and left only for internal use.
* Fixed some cases `mruby` raise `ArgumentError` too eagerly compared
with `CRuby`.
2019-02-08 09:31:55 +09:00
Yukihiro "Matz" Matsumoto
60529fdeeb
Merge branch 'fix-enumerator-initialize-for-nil-or-false' of https://github.com/shuujii/mruby into shuujii-fix-enumerator-initialize-for-nil-or-false
2019-02-08 09:13:39 +09:00
Yukihiro "Matz" Matsumoto
687a4d961f
Merge pull request #4251 from shuujii/remove-no-meaning-statements-in-mruby-io-tests
...
Remove no meaning statements in `mruby-io` tests
2019-02-08 07:19:40 +09:00
KOBAYASHI Shuji
e846db709f
Fix Enumerator#(initialize|inspect) for nil/false
2019-02-07 23:52:08 +09:00
Yukihiro "Matz" Matsumoto
bdc9de875f
Add OP_ENTER to blocks without parameters; fix #4175
...
So that `lambda{}.call(1)` raises `ArgumentError` as CRuby does.
Also, fixed junk assignment for `lambda{|;a|p a}.call{}`.
2019-02-07 22:44:36 +09:00
Yukihiro "Matz" Matsumoto
156641515c
Merge branch 'shuujii-rename-bin-mruby-config-to-bin-config'
2019-02-07 15:54:08 +09:00
Yukihiro "Matz" Matsumoto
e199df032d
Merge branch 'rename-bin-mruby-config-to-bin-config' of https://github.com/shuujii/mruby into shuujii-rename-bin-mruby-config-to-bin-config
2019-02-07 15:52:58 +09:00
Yukihiro "Matz" Matsumoto
6397ec727f
Raise NameError for symbol struct access.
2019-02-07 15:52:33 +09:00
Yukihiro "Matz" Matsumoto
215906dc83
Merge pull request #4264 from shuujii/integrate-definition-of-exefile
...
Integrate definition of `MRuby::Build#exefile`
2019-02-07 07:05:05 +09:00
Yukihiro "Matz" Matsumoto
d52f46da45
Implement symbol hash table to boost find_symbol.
...
In 4174e02, we removed the symbol hash table from `mrb_state` but
`find_symbol` was too slow with linear search. My performance estimation
was wrong. So we implemented a new compact hash table for symbols.
2019-02-06 22:07:11 +09:00
Yukihiro "Matz" Matsumoto
905fef2669
Reduce invocation of mrb_convert_type() from mrb_str_to_str().
2019-02-06 22:07:11 +09:00
Yukihiro "Matz" Matsumoto
02fbb2c211
Remove symbol hash table from mrb_state structure.
...
Use linear search instead. Number of symbols is usually small (<1K), so
we don't need performance boost from hash tables. In our benchmark
measurement, hash tables consumes 790KB for `build/full-debug/mrbtest`.
2019-02-06 22:07:11 +09:00
KOBAYASHI Shuji
c8628f7ca4
Integrate definition of MRuby::Build#exefile
2019-02-06 22:05:10 +09:00
Yukihiro "Matz" Matsumoto
1076bebde7
Merge pull request #4256 from shuujii/move-none-to-mrblib-enum
...
Move `NONE` to `mrblib/enum.rb`
2019-02-06 20:18:45 +09:00
Yukihiro "Matz" Matsumoto
cb8bbd9e12
Merge pull request #4262 from shuujii/remove-old-comment-in-symbol
...
Remove old comment for `mrb_sym2name_len()` [ci skip]
2019-02-05 22:51:26 +09:00
Yukihiro "Matz" Matsumoto
f51c0f5a59
Merge pull request #4261 from shuujii/fix-doc-markup-in-string
...
Fix markup and remove unneeded comment for doc in `src/string.c` [ci skip]
2019-02-05 22:50:56 +09:00
KOBAYASHI Shuji
5ef1e479da
Remove old comment for mrb_sym2name_len() [ci skip]
2019-02-05 19:16:23 +09:00
KOBAYASHI Shuji
7a2865cfef
Fix markup and remove unneeded comment for doc in src/string.c [ci skip]
2019-02-05 19:11:59 +09:00
Yukihiro "Matz" Matsumoto
db2545cb3c
Merge pull request #4260 from shuujii/fix-symbol-size-with-mrb_utf8_string
...
Fix `Symbol#size` for multi-byte characters with `MRB_UTF8_STRING`
2019-02-04 21:11:06 +09:00
KOBAYASHI Shuji
69fd1a5925
Fix Symbol#size for multi-byte characters with MRB_UTF8_STRING
...
Before:
p :あ.size #=> 3
After:
p :あ.size #=> 1
2019-02-04 18:11:22 +09:00
Yukihiro "Matz" Matsumoto
5fd9f68b27
Merge pull request #4259 from shuujii/use-eException_class-instead-of-mrb_class_get
...
Use `mrb->eException_class` instead of `mrb_class_get()`
2019-02-04 07:35:00 +09:00
KOBAYASHI Shuji
c86861bddf
Use mrb->eException_class instead of mrb_class_get()
2019-02-03 22:00:55 +09:00
Yukihiro "Matz" Matsumoto
3f7137feae
Merge pull request #4258 from shuujii/extend-only-when-necessary
...
Extend only when necessary in `lib/mruby-core-ext.rb`
2019-02-02 21:14:55 +09:00
KOBAYASHI Shuji
668ed60521
Extend only when necessary in lib/mruby-core-ext.rb
2019-02-02 18:53:49 +09:00
KOBAYASHI Shuji
6da3cd5d22
Move NONE to mrblib/enum.rb
2019-02-01 16:02:01 +09:00
KOBAYASHI Shuji
465fdde52d
Enumerator#size is not supported [ci skip]
2019-01-31 21:25:35 +09:00
Yukihiro "Matz" Matsumoto
32067b5005
Merge pull request #4254 from shuujii/remove-unneeded-dup-in-enumerator-initialize
...
Remove unneeded `dup` in `Enumerator#initialize`
2019-01-31 16:20:11 +09:00
KOBAYASHI Shuji
6218585968
Remove unneeded dup in Enumerator#initialize
2019-01-30 19:41:32 +09:00
Yukihiro "Matz" Matsumoto
cc32cc50f8
Merge pull request #4253 from shuujii/remove-unused-macro-in-string
...
Remove unused macro in `src/string.c`
2019-01-29 23:10:27 +09:00
KOBAYASHI Shuji
486154ce34
Remove unused macro in src/string.c
2019-01-29 20:21:25 +09:00
Yukihiro "Matz" Matsumoto
c02c4047f8
Merge pull request #4252 from shuujii/class-expr-with-empty-body-should-return-nil
...
`class`/`module` expression with empty body should return `nil`
2019-01-28 23:14:22 +09:00
KOBAYASHI Shuji
abbc501433
class/module expression with empty body should return nil
...
Before:
p(class A end) #=> A
p(class << self; end) #=> #<Class:#<Object:0x7fdc3880e420>>
p(module B end) #=> B
After/Ruby:
p(class A end) #=> nil
p(class << self; end) #=> nil
p(module B end) #=> nil
2019-01-28 21:29:55 +09:00
KOBAYASHI Shuji
12ba571a13
Use assertion methods in FileTest tests
2019-01-28 12:17:41 +09:00
KOBAYASHI Shuji
e85cb9799c
Remove no meaning statements in mruby-io tests
2019-01-27 20:35:41 +09:00
Yukihiro "Matz" Matsumoto
1b597f9da4
Merge pull request #4249 from takkaw/fix_time_carry_up_and_down
...
fix Time about carry-up and carry-down
2019-01-27 11:41:31 +09:00
takkaw
995a329bf4
fix Time about carry-up and carry-down
2019-01-26 23:19:53 +09:00
Yukihiro "Matz" Matsumoto
8a988643e8
Merge pull request #4241 from shuujii/fix-tests-for-string-reverse-with-mrb-utf8-string
...
Fix tests for `String#reverse` with `MRB_UTF8_STRING`
2019-01-26 22:34:05 +09:00
Yukihiro "Matz" Matsumoto
a03e721408
Merge pull request #4237 from dearblue/fix-memleak-Data_Wrap_Struct
...
Fix memory leak `sval` when out of memory in `Data_Wrap_Struct()`
2019-01-26 22:33:23 +09:00
Yukihiro "Matz" Matsumoto
2f62178dda
Merge pull request #4235 from shuujii/avoid-side-effect-when-run-rake
...
Avoid a side effect when run Rake without execution of tasks
2019-01-26 22:19:00 +09:00
Yukihiro "Matz" Matsumoto
1e67c98c85
Merge pull request #4248 from shuujii/refine-error-message-for-time-interval
...
Refine error message for time interval
2019-01-26 22:17:31 +09:00
KOBAYASHI Shuji
1cd57006f3
Refine error message for time interval
...
Time interval value can be zero, and float (in `Kernel#sleep`)
2019-01-26 18:37:53 +09:00
Yukihiro "Matz" Matsumoto
aee67eaf62
Merge pull request #4240 from shuujii/refactor-sleep-test
...
Use `assert_raise` and `assert_nothing_raised` in `mruby-sleep` tests
2019-01-25 22:47:56 +09:00
Yukihiro "Matz" Matsumoto
fc5dc5270c
Merge pull request #4245 from shuujii/remove-assert_nothing_raised-in-io-test
...
Remove definition of `assert_nothing_raised` in `IO` test
2019-01-25 22:47:15 +09:00
Yukihiro "Matz" Matsumoto
a2615900c0
Merge pull request #4246 from shuujii/use-assertion-methods-in-file-test
...
Use assertion methods in `File` test
2019-01-25 22:46:12 +09:00
Yukihiro "Matz" Matsumoto
89a76f4a49
Merge pull request #4247 from shuujii/remove-unused-file-for-mruby-io-test
...
Remove unused file for `mruby-io` test
2019-01-25 22:45:08 +09:00
KOBAYASHI Shuji
b91a17b33b
Remove unused file for mruby-io test
2019-01-25 20:35:55 +09:00
KOBAYASHI Shuji
e9a6ec05b6
Use assertion methods in File test
2019-01-25 20:12:24 +09:00
KOBAYASHI Shuji
bdbbac999f
Remove definition of assert_nothing_raised in IO test
2019-01-25 20:02:45 +09:00
Yukihiro "Matz" Matsumoto
671447964f
Merge pull request #4243 from shuujii/remove-definition-of-sprintf-in-mruby-print
...
Remove definition of `Kernel#sprintf` in `mruby-print`
2019-01-25 08:15:27 +09:00
Yukihiro "Matz" Matsumoto
8eddcbf53d
Merge pull request #4244 from shuujii/remove-redundant-null-check-for-mrb_malloc
...
Remove redundant `NULL` check for `mrb_malloc`
2019-01-24 22:20:56 +09:00
KOBAYASHI Shuji
a4c5fcc038
Remove redundant NULL check for mrb_malloc
2019-01-24 20:53:40 +09:00
KOBAYASHI Shuji
1d6679e9d1
Remove definition of Kernel#sprintf in mruby-print
2019-01-24 20:44:55 +09:00
Yukihiro "Matz" Matsumoto
5956f5b4e8
Merge pull request #4242 from shuujii/remove-no-meaning-statement
...
[ci skip] Remove no meaning statement in `bm_app_lc_fizzbuzz.rb`
2019-01-23 21:50:09 +09:00
KOBAYASHI Shuji
f54262776e
[ci skip] Remove no meaning statement in bm_app_lc_fizzbuzz.rb
2019-01-23 21:19:39 +09:00
KOBAYASHI Shuji
6d5a62cf5f
Fix tests for String#reverse with MRB_UTF8_STRING
2019-01-22 19:37:14 +09:00
KOBAYASHI Shuji
3707ef3d1c
Use assert_raise and assert_nothing_raised in mruby-sleep tests
2019-01-21 19:37:20 +09:00
KOBAYASHI Shuji
8c22911c86
Rename mruby-bin-mruby-config mrbgem to mruby-bin-config
...
For brevity and consistency (e.g. `mruby-bin-strip` doesn't have `mruby-`
after `bin-`).
2019-01-20 19:47:58 +09:00
dearblue
d6d02774c5
Fix memory leak sval when out of memory in Data_Wrap_Struct()
2019-01-20 14:23:22 +09:00
Yukihiro "Matz" Matsumoto
b83e4df43d
Merge pull request #4236 from shuujii/remove-gitkeep
...
Remove `.gitkeep` files
2019-01-20 10:30:12 +09:00
KOBAYASHI Shuji
dff0f2ee10
Remove .gitkeep files
2019-01-19 20:40:21 +09:00
KOBAYASHI Shuji
107dc0c778
Avoid a side effect when run Rake without execution of tasks
...
Avoid directory creation when run `rake -T` etc.
2019-01-18 23:29:35 +09:00
Yukihiro "Matz" Matsumoto
cb1946f26c
Merge pull request #4233 from shuujii/remove-special-treatments-for-without-float-in-build-scripts
...
Remove special treatments for `MRB_WITHOUT_FLOAT` in build scripts
2019-01-18 16:17:58 +09:00
Yukihiro "Matz" Matsumoto
3d32be6f3e
Merge pull request #4231 from shuujii/avoid-runtime-eval-for-without-float
...
Avoid runtime evaluation for `MRB_WITHOUT_FLOAT`
2019-01-18 16:16:48 +09:00
Yukihiro "Matz" Matsumoto
9a2366ded6
Merge pull request #4234 from shuujii/fix-assertion-name-for-numeric-test
...
Fix assertion name for `Numeric#**` test
2019-01-18 16:16:19 +09:00
KOBAYASHI Shuji
cfe3654fd1
Fix assertion name for Numeric#** test
2019-01-17 21:16:02 +09:00
KOBAYASHI Shuji
366a14f297
Remove special treatments for MRB_WITHOUT_FLOAT in build scripts
2019-01-16 23:48:59 +09:00
KOBAYASHI Shuji
8969edf03b
Avoid runtime evaluation for MRB_WITHOUT_FLOAT
2019-01-16 19:32:29 +09:00
Yukihiro "Matz" Matsumoto
fa34a8b5be
Merge pull request #4230 from shuujii/fix-coercing-for-step-counter-in-numeric-step
...
Fix coercing for first step counter in `Numeric#step`
2019-01-15 22:27:40 +09:00
KOBAYASHI Shuji
de5da4b7f6
Fix coercing for first step counter in Numeric#step
...
Before:
a=[]; 7.step(4, -3.0) { |c| a << c }; p a #=> [7, 4.0]
After / Ruby:
a=[]; 7.step(4, -3.0) { |c| a << c }; p a #=> [7.0, 4.0]
2019-01-15 21:41:54 +09:00
Yukihiro "Matz" Matsumoto
348442dd5e
Merge pull request #4228 from shuujii/sort-gitignore
...
[ci skip] Sort `.gitignore`
2019-01-15 20:09:00 +09:00
KOBAYASHI Shuji
adfc2d08c9
[ci skip] Sort .gitignore
2019-01-15 19:30:15 +09:00
Yukihiro "Matz" Matsumoto
127d355bf8
Merge pull request #4226 from dearblue/fix-build-cxx-exc
...
Build fails when set `conf.build_dir=<rel path>` and `conf.enable_cxx_exception`
2019-01-15 11:00:05 +09:00
Yukihiro "Matz" Matsumoto
4797542b71
Merge pull request #4227 from shuujii/ignore-compiler-tmp-files
...
Ignore compiler temporary files (for `-save-temps` flag)
2019-01-15 10:57:44 +09:00
KOBAYASHI Shuji
bb52efd0fc
Ignore compiler temporary files (for -save-temps flag)
2019-01-14 21:45:57 +09:00
Yukihiro "Matz" Matsumoto
17333bde3a
Merge pull request #4222 from shuujii/use-g-instead-of-e
...
Use `%g` instead of `%e` for float representation in dump format
2019-01-14 19:13:48 +09:00
Yukihiro "Matz" Matsumoto
348526e1ad
Merge pull request #4225 from shuujii/improve-compatibility-to-cruby-for-float-to_s
...
Improve compatibility to CRuby for `Float#to_s`
2019-01-14 19:13:09 +09:00
dearblue
a7c2ef9dab
Fix build failed when set conf.build_dir=<rel path> and conf.enable_cxx_exception
2019-01-14 15:21:21 +09:00
KOBAYASHI Shuji
0e04c46261
Use 2 digits exponent format for printf family on old MSVC
...
For conforming C standard.
2019-01-13 23:24:57 +09:00
KOBAYASHI Shuji
9f081183d2
Improve compatibility to CRuby for Float#to_s
...
Bfore:
Float::INFINITY.to_s #=> "inf"
50.0.to_s #=> "50"
1e20.to_s #=> "1e+20"
After / CRuby:
Float::INFINITY.to_s #=> "Infinity"
50.0.to_s #=> "50.0"
1e20.to_s #=> "1.0e+20"
2019-01-13 19:59:22 +09:00
Yukihiro "Matz" Matsumoto
c1b92f88a2
Merge pull request #4224 from shuujii/use-__send__-instead-of-send
...
Use `__send__` instead of `send`; ref #4207
2019-01-13 08:03:14 +09:00
KOBAYASHI Shuji
8b951710fe
Use __send__ instead of send; ref #4207
2019-01-12 22:21:34 +09:00
KOBAYASHI Shuji
2d8aec2b88
Use %g instead of %e for float representation in dump format
...
`%g` use shorter representation than `%e`.
2019-01-11 19:54:46 +09:00
Yukihiro "Matz" Matsumoto
980b7b5c50
Merge pull request #4221 from shuujii/remove-duplicate-code-in-numeric
...
Remove duplicate code in numeric.c
2019-01-11 08:47:02 +09:00
KOBAYASHI Shuji
856b8d9610
Remove duplicate code in numeric.c
2019-01-10 23:22:23 +09:00
Yukihiro "Matz" Matsumoto
8dcd66cc27
Merge pull request #4220 from shuujii/change-order-for-assertion-args
...
Change the order of "expected" and "actual" in test
2019-01-10 09:19:17 +09:00
KOBAYASHI Shuji
0740595f85
Change the order of "expected" and "actual" in test
2019-01-09 20:00:17 +09:00
Yukihiro "Matz" Matsumoto
d88d7aaf4b
Use $mrbtest_io_wfname for chmod test.
2019-01-09 13:04:23 +09:00
Yukihiro "Matz" Matsumoto
81862fd689
Update compiled binary format version; ref #4219
2019-01-08 21:44:40 +09:00
Yukihiro "Matz" Matsumoto
d38a8e8807
Update OP_APOST description (typo fixed).
2019-01-08 21:43:04 +09:00
Yukihiro "Matz" Matsumoto
712a8bb1b2
Merge pull request #4219 from shuujii/fix-dump-load-float-literal-evaluate-to-infinity
...
Fix dump/load float leteral evaluate to infinity
2019-01-08 21:42:50 +09:00
Yukihiro "Matz" Matsumoto
b575d0c45e
Merge pull request #4218 from take-cheeze/export_time_api
...
Add `Time` object creation API
2019-01-08 21:35:51 +09:00
KOBAYASHI Shuji
68735d1261
Fix dump/load float leteral evaluate to infinity
...
Example:
# example.rb
p(2e308)
p(-2e308)
Good:
$ bin/mruby example.rb
inf
-inf
Bad:
$ bin/mrbc example.rb
$ bin/mruby -b example.mrb
0
-0
Cause:
Float infinity representation is `inf` on dump and it is converted by
corresponding `String#to_f` on load.
Treatment:
- Introduce new representations (`i`: +infinity, `I`: -infinity)
- Allow old representations (`inf`, `-inf`, `infinity`, `-infinity`) too
- Raise error for unknown representations (use corresponding `Kernel#Float`)
2019-01-08 20:43:23 +09:00
take-cheeze
3e7a3a0a15
Export Time creation API
2019-01-08 20:26:39 +09:00
Yukihiro "Matz" Matsumoto
817436c33b
Merge pull request #4217 from shuujii/fix-0.0-handling
...
Fix `0.0` and `-0.0` handling.
2019-01-07 18:16:27 +09:00
KOBAYASHI Shuji
c8f904b7f5
Fix 0.0 and -0.0 handling.
...
Fix the following issue:
Good:
$ bin/mruby -e 'p(-0.0)' #=> "-0"
Bad:
$ bin/mruby -e 'a=0.0; p(-0.0)' #=> "0"
2019-01-06 23:05:13 +09:00
Yukihiro "Matz" Matsumoto
89c79e56c5
Merge pull request #4216 from shuujii/add-assert_same
...
Add `assert_same` and `assert_not_same`
2019-01-06 20:59:22 +09:00
KOBAYASHI Shuji
6f395a58d2
Add assert_same and assert_not_same
2019-01-05 20:41:09 +09:00
Yukihiro "Matz" Matsumoto
d45a6d8363
Merge pull request #4215 from shuujii/integrate-float.rb-into-numeric.c
...
Integrate mrblib/float.rb into src/numeric.c
2019-01-04 20:49:42 +09:00
KOBAYASHI Shuji
b30ca87bd0
Integrate mrblib/float.rb into src/numeric.c
...
- Avoid hack for `MRB_WITHOUT_FLOAT` in build scripts
- Avoid runtime dispatch for `MRB_WITHOUT_FLOAT`
2019-01-04 20:31:05 +09:00
Yukihiro "Matz" Matsumoto
1c574b065d
Remove mrb_ prefix from static functions in mruby-range-ext; #4213
2019-01-04 14:46:17 +09:00
Yukihiro "Matz" Matsumoto
53d87c59c0
Remove unused local variable n in range_initialize; #4213
2019-01-04 14:42:47 +09:00
Yukihiro "Matz" Matsumoto
1e7d6890a5
Merge pull request #4210 from dearblue/enum-chain
...
Add enumerator chain feature (CRuby-2.6 compatible)
2019-01-04 14:39:20 +09:00
Yukihiro "Matz" Matsumoto
1bf6c84682
Merge pull request #4213 from shuujii/range-rafactor
...
range: Refactor range.h/range.c
2019-01-04 14:39:04 +09:00
Yukihiro "Matz" Matsumoto
2a9ccf2449
Merge pull request #4211 from dearblue/proc-composition
...
Add proc composition feature (CRuby-2.6 compatible)
2019-01-04 14:32:19 +09:00
Yukihiro "Matz" Matsumoto
acb1fdc79f
Merge pull request #4212 from shuujii/pack-remove-float-check
...
pack: Remove redundant float check in pack_utf8()
2019-01-04 14:27:58 +09:00
KOBAYASHI Shuji
eb216fc858
range: Refactor range.h/range.c
...
Functions order, name, linkage and so on.
2019-01-03 20:09:41 +09:00
KOBAYASHI Shuji
668d632c6e
pack: Remove redundant float check in pack_utf8()
...
The argument is converted to fixnum before calling.
2019-01-03 19:11:30 +09:00
dearblue
f392337e10
Add test for Enumerator::Chain
2019-01-03 18:16:26 +09:00
dearblue
fc20d0186d
Add test for #<< and #>> for Proc and Method class
2019-01-03 18:16:26 +09:00
dearblue
a98359faa7
Add enumerator chain feature (CRuby-2.6 compatible)
...
- Enumerator::Chain
- Enumerable#chain
- Enumerable#+
2019-01-03 18:16:26 +09:00
dearblue
9a9e12a129
Add proc composition feature (CRuby-2.6 compatible)
...
- Proc#<< and Proc#>>
- Method#<< and Method#>>
2019-01-03 18:16:26 +09:00
Yukihiro "Matz" Matsumoto
cca19532c5
Remove Kernel#class_defined? which is not available in CRuby; #3829
2019-01-03 11:34:35 +09:00
Yukihiro "Matz" Matsumoto
f9d89e3fa5
mruby-inline-struct to support MRB_WITHOUT_FLOAT.
2019-01-03 11:29:10 +09:00
Yukihiro "Matz" Matsumoto
3e59f25eef
Merge pull request #4208 from shuujii/io-skip-tty-test
...
io: Skip TTY test for environments that TTY device is unavailable.
2019-01-02 11:41:57 +09:00
Yukihiro "Matz" Matsumoto
4ffc280372
Merge pull request #4209 from shuujii/range-embed-edges-in-rrange
...
range: Embed edges in RRange on boxing environment.
2019-01-02 11:40:32 +09:00
KOBAYASHI Shuji
ff0ab552d0
io: Skip TTY test for environments that TTY device is unavailable.
...
e.g. GitLab CI
2019-01-01 19:25:12 +09:00
KOBAYASHI Shuji
648b57620a
range: Embed edges in RRange on boxing environment.
...
[Breaking changes]
Developers must use following APIs for accessing attributes of RRange
because RRange structure depends on boxing setting.
- mrb_range_beg
- mrb_range_end
- mrb_range_excl_p
2019-01-01 15:35:56 +09:00
Yukihiro "Matz" Matsumoto
c6f9a09e39
Merge pull request #4207 from shuujii/use-__send__-instead-of-send
...
Use `__send__` instead of `send` in a Range test.
2019-01-01 11:24:54 +09:00
KOBAYASHI Shuji
4da687a6c3
Use __send__ instead of send in a Range test.
...
This assertion is accidentaly passed because `send` was removed from mruby
core so `NoMethodError` is raised and `NoMethodError` is subclass of
`NameError`.
2019-01-01 09:38:58 +09:00
Yukihiro "Matz" Matsumoto
b04506cdcc
Should not check non-node value to void_expr_error; fix #4203
...
This is also a reason for #4192 as well.
2018-12-31 12:52:27 +09:00
Yukihiro "Matz" Matsumoto
23ca1dcb4e
Merge pull request #4206 from shuujii/enumerator-refine-accessor
...
mruby-enumerator: Refine accessors (obj/meth/args/fib).
2018-12-31 11:22:11 +09:00
Yukihiro "Matz" Matsumoto
a5ad768cac
Merge pull request #4204 from shuujii/fix-yacc-running-multiple-times
...
Fix Yacc running multiple times.
2018-12-31 11:21:11 +09:00
KOBAYASHI Shuji
bc03650c6a
mruby-enumerator: Refine accessors (obj/meth/args/fib).
...
- `fib=` writer is not used.
- All accessors are used as public (e.g. in `initialized_copy`).
2018-12-30 11:30:14 +09:00
KOBAYASHI Shuji
482b2ea01e
Use each_with_object instead of reduce.
...
For fix Codacy issue.
2018-12-30 11:16:00 +09:00
KOBAYASHI Shuji
ce5e45443e
Fix Yacc running multiple times.
...
Example:
$ MRUBY_CONFIG=<(echo 'MRuby::Build.new{toolchain(:gcc);gem(core:"mruby-bin-mruby");enable_test}') ./minirake
Before:
...
CC build/host/mrbgems/gem_init.c -> build/host/mrbgems/gem_init.o
YACC mrbgems/mruby-compiler/core/parse.y -> build/host/mrbgems/mruby-compiler/core/y.tab.c
YACC mrbgems/mruby-compiler/core/parse.y -> build/host/mrbgems/mruby-compiler/core/y.tab.c
YACC mrbgems/mruby-compiler/core/parse.y -> build/host/mrbgems/mruby-compiler/core/y.tab.c
YACC mrbgems/mruby-compiler/core/parse.y -> build/host/mrbgems/mruby-compiler/core/y.tab.c
CC build/host/mrbgems/mruby-compiler/core/y.tab.c -> build/host/mrbgems/mruby-compiler/core/y.tab.o
CC build/host/mrbgems/mruby-compiler/core/y.tab.c -> build/host/mrbgems/mruby-compiler/core/y.tab.o
CC build/host/mrbgems/mruby-compiler/core/y.tab.c -> build/host/mrbgems/mruby-compiler/core/y.tab.o
CC build/host/mrbgems/mruby-compiler/core/y.tab.c -> build/host/mrbgems/mruby-compiler/core/y.tab.o
AR build/host/lib/libmruby_core.a
...
After:
...
CC build/host/mrbgems/gem_init.c -> build/host/mrbgems/gem_init.o
YACC mrbgems/mruby-compiler/core/parse.y -> build/host/mrbgems/mruby-compiler/core/y.tab.c
CC build/host/mrbgems/mruby-compiler/core/y.tab.c -> build/host/mrbgems/mruby-compiler/core/y.tab.o
AR build/host/lib/libmruby_core.a
...
2018-12-29 10:40:06 +09:00
Yukihiro "Matz" Matsumoto
37d795dec7
Revert "Simplify full-core.gembox"
...
This reverts commit e20d652f22 .
This change cannot handle hidden dependency between `mruby-print` and
`mruby-sprintf`; ref #4202
2018-12-25 23:17:10 +09:00
Yukihiro "Matz" Matsumoto
f2b48875a4
Merge pull request #4201 from take-cheeze/patch-2
...
Fix `$rake_root_fiber` checking
2018-12-25 18:44:15 +09:00
Yukihiro "Matz" Matsumoto
2216fb2895
Merge pull request #4202 from shuujii/simplify-full-core-gembox
...
Simplify full-core.gembox
2018-12-25 18:43:45 +09:00
KOBAYASHI Shuji
e20d652f22
Simplify full-core.gembox
...
Dependencies order is auto detected.
2018-12-25 15:23:05 +09:00
Takeshi Watanabe
5b5e54d38e
Fix $rake_root_fiber checking.
...
https://github.com/mruby/mruby/pull/4101#pullrequestreview-187752352
2018-12-25 14:37:32 +09:00
Yukihiro "Matz" Matsumoto
45e8cb47ea
Merge pull request #4200 from shuujii/add-test-dependency-for-mruby
...
mruby-bin-mruby: Add test dependency.
2018-12-25 09:55:32 +09:00
KOBAYASHI Shuji
1f91482585
mruby-bin-mruby: Add test dependency.
...
`Kernel#p` etc are used.
2018-12-25 09:47:28 +09:00
Yukihiro "Matz" Matsumoto
ecd2bcc9ae
Merge pull request #4199 from shuujii/refine-desc-for-rake-test
...
Refine description for rake test tasks.
2018-12-24 16:02:57 +09:00
KOBAYASHI Shuji
96bea076ec
Refine description for rake test tasks.
...
Before:
$ rake -T test
rake test_test # run all mruby tests
After:
$ rake -T test
rake test # run all mruby tests
2018-12-24 12:12:10 +09:00
Yukihiro "Matz" Matsumoto
c34aa8a63e
Merge pull request #4197 from shuujii/suppress-struct-initializer-warn
...
Suppress a struct initializer warning
2018-12-23 22:26:55 +09:00
Yukihiro "Matz" Matsumoto
2fbea74de5
Merge pull request #4198 from dearblue/missing-macros
...
Suppress missing macro warns
2018-12-23 22:18:07 +09:00
dearblue
0bfeefad2a
Suppress _MSC_VER warns for mingw32
2018-12-23 17:36:06 +09:00
dearblue
027f4ded34
Suppress TARGET_OS_IPHONE warns
2018-12-23 17:24:16 +09:00
dearblue
be980e9a7a
Suppress __FreeBSD_version warns for FreeBSD
2018-12-23 17:23:51 +09:00
dearblue
49cce74c1a
Suppress __STDC_VERSION__ warns for C++
2018-12-23 17:22:59 +09:00
KOBAYASHI Shuji
b0dc163b5d
Suppress a struct initializer warning
...
Suppress a compiler (clang) warning bellow:
src/vm.c:104:38: warning: suggest braces around initialization of
subobject [-Wmissing-braces]
const mrb_value mrb_value_zero = { 0 };
^
{}
2018-12-23 14:23:44 +09:00
Yukihiro "Matz" Matsumoto
f6c07b8835
Merge pull request #4196 from dearblue/add-Wundef-cflags
...
Append cflags for undefined macro
2018-12-22 22:49:14 +09:00
Yukihiro "Matz" Matsumoto
a154d657ae
Merge pull request #4194 from shuujii/mirb-drop-dependency-on-mruby-print
...
mirb: drop dependency on mruby-print in a test
2018-12-22 22:47:27 +09:00
Yukihiro "Matz" Matsumoto
30dae4742b
Merge pull request #4195 from dearblue/fix-byteorder
...
Fix byte order
2018-12-22 22:47:03 +09:00
dearblue
129a804136
Append cflags for undefined macro
2018-12-22 21:58:58 +09:00
dearblue
b7a832bf4f
Define byte order macros, if not defined it and there are alternatives
2018-12-22 21:05:27 +09:00
dearblue
e9ceb865b6
Fix MRB_ENDIAN_BIG is always defined, if byte order macro is not defined
2018-12-22 20:37:51 +09:00
KOBAYASHI Shuji
6578fec779
mirb: drop dependency on mruby-print in a test
2018-12-22 17:26:11 +09:00
Yukihiro "Matz" Matsumoto
281d0ff4ea
Merge pull request #4193 from dearblue/fix-assert-variable
...
Fix undefined variable is using
2018-12-22 13:31:06 +09:00
dearblue
9377da9775
Fix undefined variable is using
2018-12-21 23:44:38 +09:00
Yukihiro "Matz" Matsumoto
aeafce23e4
Merge branch 'cubicdaiya-feature/optimize_proc_parameters'
2018-12-21 13:00:27 +09:00
Tatsuhiko Kubo
d2fb4752e2
Add test for Proc#parameters
2018-12-21 12:59:38 +09:00
Tatsuhiko Kubo
cc71bd51f1
optimize Proc#parameters
2018-12-21 12:59:38 +09:00
Yukihiro "Matz" Matsumoto
94b73b1440
Add NULL pointer check before void_expr_error(); fix #4192
2018-12-21 09:35:10 +09:00
Yukihiro "Matz" Matsumoto
ed2bc5d4ed
Simplify MRB_ENDIAN_BIG macro definition; ref #4190
...
`cpp` does not raise error on undefined macro access in condition.
2018-12-21 09:28:19 +09:00
Yukihiro "Matz" Matsumoto
445c64d0ad
Fixed a bug on platforms without BYTE_ORDER; ref #4190
2018-12-21 09:26:48 +09:00
Yukihiro "Matz" Matsumoto
f5537912ab
Define MRB_ENDIAN_BIG automatically; ref #4190
...
You had to define this macro on big endian platforms, but it is very
error-prone. So define the macro automatically if possible.
2018-12-21 08:57:17 +09:00
Yukihiro "Matz" Matsumoto
2fdb309e55
mruby-pack should not rely on MRB_ENDIAN_BIG macro; fix #4190
...
The `MRB_ENDIAN_BIG` macro is originally used for `NaN` boxing.
We cannot assume it is defined on every big endian platform (#4190
is the case). So instead of relying on untrusted `MRB_ENDIAN_BIG`, we
use `BYTE_ORDER` macro with a fallback function to check endian in
runtime.
2018-12-21 08:52:31 +09:00
Yukihiro "Matz" Matsumoto
7e35c659aa
Remove things we've done in TODO file.
2018-12-21 00:47:56 +09:00
Yukihiro "Matz" Matsumoto
e588e9df23
Merge pull request #4191 from dearblue/parenthesis
...
Fix parenthesis for macros
2018-12-19 20:40:34 +09:00
Yukihiro "Matz" Matsumoto
624b126fb6
Added Android Hack to time.c.
...
Android bionic defines `TIME_UTC` but does not provide `timespec_get`.
2018-12-19 13:12:30 +09:00
dearblue
e19353be25
Fix macro expressions with paren
2018-12-18 23:14:26 +09:00
dearblue
14133f4057
Fix macro arguments with paren
2018-12-18 23:05:36 +09:00
Yukihiro "Matz" Matsumoto
11071b9ab1
Merge pull request #4189 from sdottaka/fix-mrb_ary_clear
...
Make mrb_ary_clear() function callable from C again
2018-12-17 16:29:00 +09:00
Yukihiro "Matz" Matsumoto
ccc5edc60d
Small refactoring of #4188
2018-12-17 16:00:22 +09:00
Yukihiro "Matz" Matsumoto
e65d42644a
Remove #include <mruby/khash.h> from mruby/hash.h.
2018-12-17 15:59:42 +09:00
Yukihiro "Matz" Matsumoto
e690314525
Recover #to_int; ref #4177
...
We have removed implicit conversion to strings using `to_int`. But some
users still using `to_int` as a typical integer method, i.e. they do
string check by code like: `obj.respond_to?(:to_int)`. So we have
recovered the method.
2018-12-17 15:59:42 +09:00
Yukihiro "Matz" Matsumoto
c03fa0e1b3
Recover String#to_str; ref #4177
...
We have removed implicit conversion to strings using `to_str`. But some
people still using `to_str` as a typical string method, i.e. they do
string check by code like: `obj.respond_to?(:to_str)`. So we have
recovered the method.
2018-12-17 15:59:42 +09:00
Yukihiro "Matz" Matsumoto
ea71f1165b
Merge pull request #4188 from dearblue/mrb_hash_size
...
Add `mrb_hash_size()` function
2018-12-17 15:59:31 +09:00
Takashi Sawanaka
d8c70167f7
Make mrb_ary_clear() function callable from C again
2018-12-15 05:17:38 +09:00
dearblue
62dd4d89fc
Add mrb_hash_size() function.
2018-12-14 21:41:07 +09:00
Yukihiro "Matz" Matsumoto
ec812c646f
Merge pull request #4185 from icm7216/fix-sleep-example
...
Fix sleep example
2018-12-12 13:48:58 +09:00
icm7216
59651f43ad
Specify the core library instead of the external library.
2018-12-12 00:54:15 +09:00
icm7216
74c5402211
Sleep module is undefined. Remove module name.
2018-12-12 00:52:07 +09:00
Yukihiro "Matz" Matsumoto
730b925332
Merge pull request #4184 from mruby/stable
...
Release mruby 2.0.0
2018-12-11 11:52:33 +09:00
Yukihiro "Matz" Matsumoto
60da293d5c
Avoid using floating point number for HT_SEG_INCREASE_RATIO; ref #4182
2018-12-11 10:54:47 +09:00
Hiroshi Mimaki
1c09046c13
Update release date.
2018-12-11 10:52:20 +09:00
Yukihiro "Matz" Matsumoto
265171a28c
Rename ht_foreach_func to mrb_hash_foreach_func.
2018-12-11 10:41:26 +09:00
Yukihiro "Matz" Matsumoto
e935d20ab5
Add mrb_ prefix to iv_foreach_func.
2018-12-11 10:39:53 +09:00
Yukihiro "Matz" Matsumoto
a0df27d8e0
Add new API mrb_iv_foreach() to iterate over instance variables.
2018-12-11 09:48:15 +09:00
Yukihiro "Matz" Matsumoto
f6b2e6231a
Update iv_foreach() function.
...
* return `void` instead of `mrb_bool'.
* non zero return value from `func` breaks the loop.
* no longer remove items on negative return value from `func`.
2018-12-11 09:47:06 +09:00
Hiroshi Mimaki
716e7b815f
Fixed missing comma in mruby/mirb usage.
2018-12-11 09:37:23 +09:00
Yukihiro "Matz" Matsumoto
378c728338
Update comments.
2018-12-11 09:04:08 +09:00
Yukihiro "Matz" Matsumoto
c0d91a14e7
Add API function mrb_hash_foreach() to iterate over items in a hash.
2018-12-11 09:01:05 +09:00
Yukihiro "Matz" Matsumoto
c23e68d32b
Need to clear stack before invoking a block; fix #4181
2018-12-10 10:23:01 +09:00
take-cheeze
b6850f88a1
Support lock file for git.
2018-12-06 11:47:17 +09:00
Bhargava Shastry
05b4eaac4b
ossfuzz: Moved config related files to a namesake directory under ossfuzz
2018-12-05 18:06:30 +01:00
Bhargava Shastry
bccf9e4a3f
ossfuzz: Add fuzzing dictionary for mruby.
2018-12-05 18:00:47 +01:00
Bhargava Shastry
1d1b47044c
ossfuzz: Add simple mruby compile test harness
2018-12-05 17:45:27 +01:00
Yukihiro "Matz" Matsumoto
e6bad6766a
Add new methods Module#{>,>=,<=>}; ref #4174
2018-12-04 08:41:09 +09:00
Yukihiro "Matz" Matsumoto
d5d9cc8b62
Remove unnecessary check in Module#<; ref #4174
2018-12-04 08:40:23 +09:00
Yukihiro "Matz" Matsumoto
6ef4a5fd6b
Replace RDoc <i></i> to Markdown back quotes; ref #4174
2018-12-04 08:39:44 +09:00
Yukihiro "Matz" Matsumoto
20c655dc45
Merge pull request #4174 from robfors/module_operators
...
Adds Module#< and Module#<=
2018-12-04 08:09:18 +09:00
Rob
e300ac8e3a
Adds Module#< and Module#<=
2018-12-02 20:56:47 -05:00
Hiroshi Mimaki
e3ae0e4f29
Merge branch 'master' into stable
2018-11-27 09:09:20 +09:00
Yukihiro "Matz" Matsumoto
26475d0a78
Update doc/limitations.md for argument destructuring.
2018-11-25 18:03:27 +09:00
Yukihiro "Matz" Matsumoto
762f682b80
Allow destructuring in formal arguments.
...
e.g.
```
def m(a,(b,c),d); p [a,b,c,d]; end
m(1,[2,3],4) # => [1,2,3,4]
```
mruby limitation:
Destructured arguments (`b` and `c` in above example) cannot be accessed
from the default expression of optional arguments and keyword arguments,
since actual assignment is done after the evaluation of those default
expressions. Thus:
```
def f(a,(b,c),d=b)
p [a,b,c,d]
end
f(1,[2,3])
```
raises `NoMethodError` for `b` in mruby.
2018-11-25 09:07:49 +09:00
Yukihiro "Matz" Matsumoto
e6b72b2121
Remove redundant rules from parse.y.
2018-11-25 07:30:32 +09:00
Yukihiro "Matz" Matsumoto
7ed9bb3bd3
Fix wrong number of arguments in Array#fetch; fix #4170
2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto
e2e6554b56
Protect from exceptions raised outside of mrb_vm_run().
...
It can happen if signals are used (e.g. from `mruby-alarm` gem).
2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto
91bf55bbe5
Remove do { ... } while(0) hacks from MRB_TRY macros.
...
Because it can swallow `break` etc. if they are used in loops.
2018-11-25 06:05:07 +09:00
Hiroshi Mimaki
0711c861ca
Fix mruby-socket test failure on MinGW.
2018-11-22 09:49:00 +09:00
Yukihiro "Matz" Matsumoto
b158f26f0c
Merge pull request #4168 from robfors/doc
...
Add documentation to mrb_load_irep
2018-11-21 12:16:07 +09:00
Rob Fors
c9a66d4c41
Update documentation to mrb_load_irep
2018-11-20 21:27:03 -05:00
Yukihiro "Matz" Matsumoto
68c5384830
Update version number; fix #4165
2018-11-20 10:43:34 +09:00
Yukihiro "Matz" Matsumoto
ec19c34a20
Fixed a bug in mirb heredoc handling; fix #3989
2018-11-20 10:39:34 +09:00
Yukihiro "Matz" Matsumoto
f1eeaad84a
Stop special treating of \r in the lexer; fix #4132
2018-11-20 09:35:38 +09:00
Yukihiro "Matz" Matsumoto
86d102350b
Restrict total recursion number of ecall(); fix #3789
2018-11-20 09:14:34 +09:00
Yukihiro "Matz" Matsumoto
afd46eccd1
Add -fpermissive to C++ compiler flags.
2018-11-19 17:11:59 +09:00
Yukihiro "Matz" Matsumoto
65a2c2082d
Call mrb_str_to_str from mrb_string_value_ptr for compatibility.
2018-11-19 17:11:19 +09:00
Yukihiro "Matz" Matsumoto
53e2df3e93
Restore mrb_string_type function for compatibility.
2018-11-19 16:13:26 +09:00
Yukihiro "Matz" Matsumoto
c308a149f0
Add Hash type check for OP_KARG and OP_KEY_P; ref #4166
2018-11-19 15:35:59 +09:00
Yukihiro "Matz" Matsumoto
423f872c84
Need to keep rooms for empty splat; fix #4166
2018-11-19 15:26:19 +09:00
Yukihiro "Matz" Matsumoto
87ffab5713
Adjust codedump output format; ref #4166
2018-11-19 15:25:42 +09:00
Yukihiro "Matz" Matsumoto
9516731329
Use type checking mrb_to_str instead of converting mrb_str_to_str.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
c022e4643f
Avoid assignments from type checking String#__to_str.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
610bcc88c2
Removed to_hash conversion method.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
698f5f707c
Removed to_ary conversion method.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
5bbcea9b3b
Removed try_convert method from Array and Hash.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
b5d43a16a3
Removed String#try_convert method from mruby-string-ext gem.
...
Because `try_convert` method rarely used in production. For mruby users,
we have `__to_str` utility method to check string type.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
ff08856fe3
Remove implicit conversion using to_str method; fix #3854
...
We have added internal convenience method `__to_str` which
does string type check.
The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
2018-11-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto
426c1f9e0b
fix non-ASCII comment.
2018-11-19 11:28:03 +09:00
Yukihiro "Matz" Matsumoto
0a0cc5a217
Check method existence for Enumerators; fix #3920
...
The issue #3920 was fixed but the fundamental flaw of lack of stack
depth check along with fibers still remains, even though it's not
easy to cause the issue. Use `MRB_GC_FIXED_ARENA` to avoid the issue
for workaround.
After this patch, `obj.to_enum` raises `ArgumentError` if the object
does not respond to the enumerating method. This is incompatible to
CRuby but I think this behavior is better and CRuby should be updated
to behave like this.
2018-11-19 10:57:07 +09:00
Yukihiro "Matz" Matsumoto
31a961acf1
The current context may be changed in mrb_vm_exec; ref #3668 #4104
2018-11-19 09:50:31 +09:00
Yukihiro "Matz" Matsumoto
cab6b0f39b
Protect Fiber from GC in ecall(); fix #4104
2018-11-19 09:49:20 +09:00
Yukihiro "Matz" Matsumoto
25d390d6cc
Improve Hash table using variable sized segments.
2018-11-19 09:30:15 +09:00
Yukihiro "Matz" Matsumoto
180b73fec4
The key or value object could be reclaimed by GC; fix #4164
...
The GC may occur between `sg_shift` and `mrb_assoc_new`, in which
case `key` and `value` could be freed even tough they are still alive.
The issue is found and fixed by https://hackerone.com/hexodus
2018-11-16 01:04:57 +09:00
Yukihiro "Matz" Matsumoto
0a022f7b8d
The saved pc from ERR_PC_SET was wrong; fix #4138
...
The saving `pc` position should be beginning of the instruction.
But after `mruby 2.0` byte code modification, the `pc` variable
points the beginning of the next instruction. We save the previous
position in a local variable `pc0`.
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
418ad65db4
Fixed a bug in continuous read of target files; ref #4138
...
Line number information in a compiled file was wrong.
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
7e3e8d8ed5
Shrink file name table size to uint16_t; ref #4138
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
faf51f82c7
Rename local variables in mrb_debug_info_append_file
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
56db3cf3eb
Simplify argument parsing; ref #4161
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto
f39f428ed4
Silence -fsanitize=undefined warning in src/enum.c; fix #4161
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto
61f49690e4
Remove filename&lines from mrb_irep struct.
...
This patch slightly reduce memory consumption (2% for my test).
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto
1bea1e2050
Small renaming refactor in dump.c
2018-11-15 19:24:45 +09:00
Yukihiro "Matz" Matsumoto
485955eccc
String#{squeeze,delete,count} to use bitmap for matching; ref #4163
2018-11-15 04:51:27 +09:00
Yukihiro "Matz" Matsumoto
4550f4e381
Pattern length may overflow uint16_t; fixed #4163
...
The issue is reported by `https://hackerone.com/dgaletic `.
2018-11-15 02:03:54 +09:00
Yukihiro "Matz" Matsumoto
c3188cac43
Merge pull request #4160 from mimaki/wrong-negative-float-in-mrb
...
Wrong pool data length for negative floating value in a mrb file.
2018-11-07 18:22:13 +09:00
Hiroshi Mimaki
7d7f9feee7
Wrong pool data length for negative floating value in a mrb file.
2018-11-07 17:20:18 +09:00
Yukihiro "Matz" Matsumoto
d25ebec988
Fixed wrong ArgumentError with keyword arguments; fix #4159
2018-11-05 21:52:17 +09:00
Yukihiro "Matz" Matsumoto
d47003aea4
Fixed a bug in argument number check with kwargs; fix #4159
2018-11-05 07:44:25 +09:00
Yukihiro "Matz" Matsumoto
d9e2532552
Remove reserved symbols for now.
...
It should be done by planned embedded symbols.
2018-11-02 22:58:12 +09:00
Yukihiro "Matz" Matsumoto
9c5e28646b
Merge pull request #4151 from take-cheeze/remove_op_symidx
...
Reduce instruction size
2018-11-02 22:37:47 +09:00
Yukihiro "Matz" Matsumoto
788e4388f8
Merge branch 'take-cheeze-fix_dump_load'
...
Since our new VM instruction is byte based, there's no need to endian
conversion of instruction sequences.
2018-11-02 20:58:15 +09:00
take-cheeze
57a435aa1d
Suppress warning
2018-11-02 15:49:34 +09:00
take-cheeze
659c680a5b
Fix dump and load with endianess
2018-11-02 15:47:28 +09:00
Yukihiro "Matz" Matsumoto
0419f07915
Add NULL checks for mrb->ci and proc->upeer; #4024
2018-11-02 14:57:03 +09:00
Yukihiro "Matz" Matsumoto
f2084f300b
Add tests for empty patterns for tr and count; #4156 #4157
2018-11-02 08:58:21 +09:00
Yukihiro "Matz" Matsumoto
8e59695625
Empty pattern string for String#tr should remove characters; fix #4157
2018-11-02 08:55:17 +09:00
Yukihiro "Matz" Matsumoto
65b04066a2
Empty pattern string can generate TR_UNINITIALIZED pattern; fix #4156
2018-11-02 08:54:24 +09:00
Yukihiro "Matz" Matsumoto
7ad53273a2
Silence Appveyor's VC compilation warnings.
2018-11-01 22:52:12 +09:00
Yukihiro "Matz" Matsumoto
d68da042b3
The env object referenced from fibers may be freed; fix #4154
...
By dffa203 that reclaim `env` objects from heaps, there's more chance
for `env` objects referenced from fibers may be freed from heap pages.
2018-11-01 22:36:06 +09:00
Yukihiro "Matz" Matsumoto
830321fed5
Merge pull request #4155 from mimaki/fix-4153
...
Fixed a bug in INIT_DISPATCH for non direct threading; fix #4153
2018-11-01 22:31:31 +09:00
Hiroshi Mimaki
73727aeb50
Fixed a bug in INIT_DISPATCH for non direct threading; fix #4153
2018-11-01 11:10:47 +09:00
Yukihiro "Matz" Matsumoto
31eb5f4e1b
Merge pull request #4152 from take-cheeze/build_debug_flag
...
Add debug flag to `MRuby::Build`
2018-10-30 09:04:35 +09:00
Yukihiro "Matz" Matsumoto
cca5e0977c
VS 2017 C does not understand inline struct initialization; ref #4153
2018-10-30 09:01:12 +09:00
take-cheeze
08bd095446
Add debug flag to MRuby::Build
2018-10-29 20:10:03 +09:00
take-cheeze
6a6586ca84
Reduce unnecessary symbol table entry
2018-10-29 19:40:33 +09:00
take-cheeze
486c9d902d
Fix codedumper
2018-10-29 19:35:31 +09:00
take-cheeze
7d51a7bbf5
Fix document
2018-10-29 19:34:56 +09:00
take-cheeze
557805da07
Fix operator
2018-10-29 19:29:43 +09:00
take-cheeze
68714ab648
Fix SEGV
2018-10-29 19:26:00 +09:00
take-cheeze
e022080390
Define null symbol
2018-10-29 19:22:53 +09:00
take-cheeze
3248de83b6
Reduce instruction size
2018-10-29 19:17:05 +09:00
Yukihiro "Matz" Matsumoto
eebb56713e
Merge pull request #4149 from take-cheeze/static_tr_pattern
...
Keep `tr_pattern` static if possible
2018-10-29 15:34:07 +09:00
Yukihiro "Matz" Matsumoto
ae5463c9e4
Merge pull request #4148 from take-cheeze/rename_libmruby_stuff
...
Rename `MRuby::Build#libmruby` stuff to avoid confusion
2018-10-29 15:13:24 +09:00
Yukihiro "Matz" Matsumoto
63fade1396
Merge pull request #4147 from take-cheeze/add_missing_dep
...
Add missing dependency of source code generator
2018-10-29 15:12:07 +09:00
Yukihiro "Matz" Matsumoto
a7e42a2024
Merge pull request #4146 from take-cheeze/sup_sleep_warn
...
Suppress sleep test script warning
2018-10-29 15:11:07 +09:00
Yukihiro "Matz" Matsumoto
c7327c84dc
Merge pull request #4145 from take-cheeze/sort_test_rbfiles
...
Sort test script list too
2018-10-29 15:10:36 +09:00
take-cheeze
b37b312081
Rename libmruby stuff to avoid confusion
2018-10-29 14:07:16 +09:00
take-cheeze
c240aeada9
Add missing dependency of source code generator
2018-10-29 13:58:57 +09:00
take-cheeze
1b185f08e7
Suppress sleep test script warning
2018-10-29 13:58:25 +09:00
take-cheeze
ac512e9d9f
Sort test script list too
2018-10-29 13:57:41 +09:00
take-cheeze
52d55e6069
Keep tr_pattern static
2018-10-29 13:21:36 +09:00
Yukihiro "Matz" Matsumoto
fa33a4d75a
We need no write barrier here; ref #4143
2018-10-29 12:01:27 +09:00
Yukihiro "Matz" Matsumoto
3dc3643e34
Marking from terminated fibers are not needed; ref #4143
...
The old condition marks the top-level callinfo even after the
fiber is terminated.
2018-10-29 11:58:10 +09:00
Yukihiro "Matz" Matsumoto
34872e90d4
Re-implement Array#_inspect and Hash#_inspect without blocks.
...
To reduce the env object allocation; ref #4143
2018-10-29 11:55:49 +09:00
Yukihiro "Matz" Matsumoto
dffa203d07
Need to mark shared env objects as MRB_TT_FREE; fix #4143
...
The following code mistakenly exits from the function without marking
the env object as `MRB_TT_FREE`.
``` ruby
if (MRB_ENV_STACK_SHARED_P(e)) {
/* cannot be freed */
return; // <- should be `break`
}
```
2018-10-29 11:51:04 +09:00
Yukihiro "Matz" Matsumoto
7ff84789c3
Add argument check to Array#clear; fix #4144
2018-10-29 10:12:10 +09:00
Yukihiro "Matz" Matsumoto
b3a181aaa1
Fixed a bug in processing OP_EXT? instructions.
...
fix haconiwa/haconiwa#171
2018-10-23 21:10:03 +09:00
Yukihiro "Matz" Matsumoto
80b5a56f51
Need to freeze string keys.
2018-10-20 19:02:12 +09:00
Yukihiro "Matz" Matsumoto
e89676a6ec
Merge pull request #4142 from iij/mergesort
...
replace quicksort with mergesort.
2018-10-18 13:02:11 +08:00
Tomoyuki Sahara
91444c4747
replace quicksort with mergesort.
2018-10-18 13:07:47 +09:00
Yukihiro "Matz" Matsumoto
fdd5ce8fac
Fixed a bug caused by too much optimization; fix #4137
2018-10-13 00:31:13 +09:00
Yukihiro "Matz" Matsumoto
d2313aebd6
Fixed broken stack consistency; fix #4135
2018-10-12 23:26:14 +09:00
Yukihiro "Matz" Matsumoto
e5f160dc7e
Should not compare undef (deleted) key in hashes; fix #4136
2018-10-12 19:00:45 +09:00
Yukihiro "Matz" Matsumoto
ab0f4db688
Call uniq! for each union processing in Array#union.
2018-10-12 19:00:14 +09:00
Yukihiro "Matz" Matsumoto
249fef7dc4
Add NULL check in sg_compact(); fix #4139
2018-10-12 08:30:57 +09:00
Yukihiro "Matz" Matsumoto
82e00ce60f
Hash#delete should return the deleted value; fix #4133
2018-10-12 08:25:54 +09:00
Yukihiro "Matz" Matsumoto
a690aef8d3
Merge pull request #4131 from junaruga/feature/ci-refactoring
...
Refactor .travis.yml to remove duplicated env: MRUBY_CONFIG.
2018-10-05 22:10:51 +09:00
Jun Aruga
f38e6c63e9
Refactor .travis.yml to remove duplicated env: MRUBY_CONFIG.
2018-10-05 14:15:33 +02:00
Yukihiro "Matz" Matsumoto
8392578216
Fixed SEGV from eval called form top-level mrb_funcall(); fix #4028
2018-10-02 17:26:43 +09:00
Yukihiro "Matz" Matsumoto
e6841abad6
Fixed a String#squeeze bug in handling iso-8859-1 strings; ref #4127
2018-09-27 21:43:35 +09:00
Yukihiro "Matz" Matsumoto
54ec08c7f1
Implement Hash#rehash in C using sg_compact().
2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto
d78acc7afe
Add index to larger segment lists for performance
2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto
8ffd4e47fb
Use mrb_undef_value for delete mark instead of shifting Hash entry table.
...
That means entry table should be compacted periodically by `sg_compact()`.
2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto
e8dcfe1745
Use segmented list to implement Hash [Experimental]
...
I know it's not hash at all, but reduce memory consumption.
2018-09-26 12:55:22 +09:00
Yukihiro "Matz" Matsumoto
01c2f59e14
Revert "Fix comparisons in str_squeeze."
...
This reverts commit 7b04fcd092 .
The issue was addressed by 9e3cbaa . No longer needed.
2018-09-26 12:35:25 +09:00
Yukihiro "Matz" Matsumoto
9e3cbaaacd
Avoid using memmove() for performance; fix #4130
2018-09-26 12:20:37 +09:00
Yukihiro "Matz" Matsumoto
87ce740168
Disambiguate block braces.
2018-09-26 12:17:38 +09:00
Yukihiro "Matz" Matsumoto
fb49a94314
Rename tr_pattern_free() to tr_free_pattern().
2018-09-26 12:17:38 +09:00
Yukihiro "Matz" Matsumoto
78195eb2ae
Small refactoring in vm.c
2018-09-26 12:17:38 +09:00
Yukihiro "Matz" Matsumoto
09a99154c0
Merge pull request #4128 from take-cheeze/patch-1
...
Fix memory leak in `mrb_str_count`
2018-09-25 12:03:26 +09:00
Takeshi Watanabe
67897195de
Fix leak in mrb_str_count
2018-09-25 11:48:59 +09:00
Yukihiro "Matz" Matsumoto
152e8c5bb2
Merge pull request #4127 from clayton-shopify/fix-str-squeeze-comparisons
...
Fix comparisons in str_squeeze.
2018-09-25 11:43:41 +09:00
Daniel Varga
4d5e3e1e63
Fix minor typos ( #4126 )
2018-09-25 09:14:01 +09:00
Clayton Smith
7b04fcd092
Fix comparisons in str_squeeze.
2018-09-24 18:16:12 -04:00
sbsoftware
8fc56f062e
Add compiler flag to disable direct threading ( #4075 )
...
* Add option to disable direct threading
* Prepend MRB_ to option name
2018-09-21 11:22:53 +09:00
Yukihiro "Matz" Matsumoto
9bd2a3b5d9
Fixed a top-level local variable bug in mirb.
...
`OP_STOP` returned a wrong value.
2018-09-21 00:51:29 +09:00
Yukihiro "Matz" Matsumoto
346f154ece
Implement String#delete and #delete!; ref #4086
...
mruby restriction:
In mruby, `String#delete` only takes single pattern argument.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
58f7f2361a
Implement String#count; ref #4086
...
mruby restriction:
In mruby, `String#count` does not take multiple pattern arguments,
but only one pattern.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
68523b4ec4
Add String#squeeze and #squeeze!; ref #4086
...
mruby restriction:
`String#squeeze` can take more than 1 pattern arguments in CRuby,
in that case, the intersection of patterns will be used to match.
But in mruby, it doesn't take multiple patterns.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
c0ae8a96a1
Add String#tr_s and String#tr_s!; ref #4086
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
58ba38fe1e
Add String#tr and #tr! to mruby-string-ext gem; fix #4086
...
This patch is based on `mruby/c` implementation by Hirohito Higashi.
We might need to add `#tr_s`, `#squeeze` and `#delete` as well.
Adding them should not be too hard using functions we implemented here.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
f23f2bbdad
Implement Array#union which is introduced in Ruby2.6.
2018-09-21 00:01:48 +09:00
Yukihiro "Matz" Matsumoto
dd346be99a
Improve performance of Array#uniq!.
2018-09-20 23:56:53 +09:00
Yukihiro "Matz" Matsumoto
5ec5a41fd2
Merge branch 'dearblue-assign-anon-class-name'
2018-09-20 13:58:36 +09:00
Yukihiro "Matz" Matsumoto
159575f630
Renamed is_namespace() to namespace_p().
2018-09-20 13:57:43 +09:00
Yukihiro "Matz" Matsumoto
505e601730
Revert "Add MRB_IMPROVE_META_PROGRAMMING configuration"
...
This reverts commit 1997fcf98f .
It became the default behavior.
2018-09-20 13:53:55 +09:00
Yukihiro "Matz" Matsumoto
d192a52edb
Merge branch 'assign-anon-class-name' of https://github.com/dearblue/mruby into dearblue-assign-anon-class-name
2018-09-20 13:50:16 +09:00
Yukihiro "Matz" Matsumoto
3a9caad8eb
Move Symbol#to_proc to the core from mruby-symbol-ext gem.
...
Even though `Symbol#to_proc` is not included in ISO standard, the
`some_method(&:method_name)` is used very widely and convenient.
So we moved it to the core.
2018-09-20 13:47:29 +09:00
Yukihiro "Matz" Matsumoto
19d3bb2d90
Make #to_h to take a block; [ruby-core:89088]
2018-09-20 13:47:29 +09:00
Yukihiro "Matz" Matsumoto
fa5f5954da
Merge pull request #4112 from dearblue/fix-outer-module-name
...
Fix outer module name
2018-09-20 13:47:16 +09:00
Yukihiro "Matz" Matsumoto
b7e5c86612
Allow nested gemboxes; fix #4124
2018-09-20 11:10:34 +09:00
Yukihiro "Matz" Matsumoto
3820ef791f
Small refactoring in mruby-hash-ext.
2018-09-20 09:07:24 +09:00
Yukihiro "Matz" Matsumoto
8b43754644
Use mrb_to_flo() to check return value from to_f; fix #4115
...
The ISO standard does not include implicit type conversion using
`to_int`, `to_str` and sometimes `to_f`. For the compactness of the
mruby implementation, maybe we should remove those implicit conversion
from mruby.
2018-09-18 09:35:09 +09:00
Yukihiro "Matz" Matsumoto
e9b1d9dc2f
Array size may be changed in mrb_get_args() reentry.
...
fix #4116 ; fix #4117 ; fix #4118 ; fix #4119 ; fix #4120
2018-09-18 07:07:43 +09:00
Yukihiro "Matz" Matsumoto
0ff1540e8b
Merge pull request #4122 from blacktm/iphone-exclude-pipe-exec
...
Exclude pipe and exec on iOS/tvOS
2018-09-17 13:26:04 +09:00
Tom Black
82053dd945
Exclude pipe and exec on iOS/tvOS
...
Use of `execl()` is prohibited on these platforms
2018-09-15 13:55:11 -07:00
Yukihiro "Matz" Matsumoto
ed4dbce052
fixup! Add support for iOS platforms that does not support fork; fix #4113
2018-09-16 00:58:52 +09:00
Yukihiro "Matz" Matsumoto
05595c1284
Merge pull request #4121 from clayton-shopify/fix-sprintf-overflow
...
Prevent signed integer overflow.
2018-09-16 00:45:55 +09:00
Yukihiro "Matz" Matsumoto
2661ac7049
Add support for iOS platforms that does not support fork; fix #4113
2018-09-16 00:41:48 +09:00
Clayton Smith
2760cea451
Prevent signed integer overflow.
2018-09-14 16:53:26 -04:00
Yukihiro "Matz" Matsumoto
f93734f622
Merge pull request #4110 from dearblue/fix-typo1
...
Fix typo
2018-09-08 11:20:11 +09:00
dearblue
292ea06d4d
Fix outer module name
...
example:
a = Module.new
a::B = Module.new
p [a, a::B] # => [#<Module:0x801825890>, #<Class:0x801825890>::B]
# => [#<Module:0x801825890>, #<Module:0x801825890>::B] (Fixed)
2018-09-08 10:25:30 +09:00
dearblue
5e6cd86f6e
Fix to not define outer when outer is itself.
...
example:
a = Class.new
a::A = a
2018-09-07 23:56:06 +09:00
dearblue
366848996a
Clear terminated space
2018-09-07 22:32:34 +09:00
dearblue
1997fcf98f
Add MRB_IMPROVE_META_PROGRAMMING configuration
2018-09-07 22:32:34 +09:00
dearblue
1595e8368a
Fix indent
2018-09-07 22:32:34 +09:00
dearblue
9b0ef58a48
A class/module name is now defined for meta programing
2018-09-07 22:32:34 +09:00
dearblue
fd57af3ea4
Undesirable line split
2018-09-07 22:32:34 +09:00
dearblue
2a24b40d30
Not set a class/module name into anonymous class/module
2018-09-07 22:32:34 +09:00
dearblue
9da9e5eb4e
Fix typo for concatenate
2018-09-07 22:32:34 +09:00
Yukihiro "Matz" Matsumoto
625976d793
Fix integer overflow issue; fix #4108
...
I misunderstood the return value from `snprintf()`, which is NOT number
of characters written in buffer, but the number of character the buffer
has to have to write the complete output.
2018-09-07 03:20:57 +09:00
Yukihiro "Matz" Matsumoto
3447162a4c
Add a new method unpack1 to mruby-pack gem.
2018-09-07 02:16:56 +09:00
Yukihiro "Matz" Matsumoto
04f8b0431c
Fix heap buffer overflow in unpack_a; fix #4103
2018-09-07 02:15:55 +09:00
Yukihiro "Matz" Matsumoto
fdaec90780
Make Kernel#sleep to accept float as a duration time.
...
But when `MRB_WITHOUT_FLOAT` is set, there's no way to sleep for
sub seconds. So mruby specific `usleep` is provided.
2018-09-06 23:42:05 +09:00
Yukihiro "Matz" Matsumoto
72522f8e0e
Remove Sleep module that does not exist in CRuby.
2018-09-06 23:35:32 +09:00
Yukihiro "Matz" Matsumoto
0b44e802a9
Need to check if merging hash is empty; fix #4107
2018-09-06 23:30:32 +09:00
Yukihiro "Matz" Matsumoto
4cd4c64266
Need to support multiple ** splats in argument list; fix #4106
2018-09-06 14:40:21 +09:00
Yukihiro "Matz" Matsumoto
a170c1dd70
Refactored mruby-sleep gem.
...
* Method implementation functions made `static`.
* Function declaration style has been changed.
* Unnecessary header file `mrb_sleep.h` removed.
* Used `mrb_get_args()` instead of self parsing.
* Indentation kept untouched.
2018-09-05 14:55:49 +09:00
Yukihiro "Matz" Matsumoto
44fdd53f2e
Add mruby-sleep gem to the core.
2018-09-05 13:30:14 +09:00
Yukihiro "Matz" Matsumoto
b01b0d242b
Free mrbc_context on exit from mruby.
2018-09-05 07:58:36 +09:00
Yukihiro "Matz" Matsumoto
ade7185a2b
Merge pull request #4055 from take-cheeze/verbose_bintest
...
Support verbose mode in bintest.
2018-09-05 07:11:23 +09:00
Yukihiro "Matz" Matsumoto
2a9525caab
Add argv and argc check in OP_ENTER; fix #4102
...
`argv` may be retrieved from an array whose `ptr` is `NULL` when it`s
empty.
2018-09-05 07:06:25 +09:00
Yukihiro "Matz" Matsumoto
9b5910bd0f
Revert "Remove top-level constant lookup; CRuby2.5"; fix #4070
...
This reverts commit c96def7c96 .
This change was from my misunderstanding.
2018-09-04 21:19:07 +09:00
Yukihiro "Matz" Matsumoto
7592dfcf7d
Need more precise constant name check.
...
This change was inspired by [ruby-bugs#7573]
2018-09-04 20:50:54 +09:00
Yukihiro "Matz" Matsumoto
c2634e18b6
Add type casts to silence MSVC warnings.
2018-09-04 16:22:50 +09:00
Yukihiro "Matz" Matsumoto
28c50b3e90
Merge pull request #4101 from take-cheeze/fix_4085
...
Avoid root fiber initialization for CRuby.
2018-09-04 16:22:40 +09:00
take-cheeze
901dccb2df
Avoid root fiber initialization for CRuby workaround.
...
closes #4085 .
2018-09-04 16:18:01 +09:00
take-cheeze
e6357f3baa
Fix indent.
2018-09-04 16:18:01 +09:00
Yukihiro "Matz" Matsumoto
02adae167f
Merge pull request #4098 from dearblue/reverse-gems-final
...
Reversing gems final
2018-09-04 07:26:25 +09:00
dearblue
cbf2738861
Reverse gems final
2018-09-02 14:13:09 +09:00
Yukihiro "Matz" Matsumoto
a657117e4e
Avoid warning in MSVC compilation.
2018-09-01 17:36:35 +09:00
Yukihiro "Matz" Matsumoto
20c0c6330f
Too much peephole optimization in gen_call; fix #4091
...
It causes trouble for safe navigation operator.
2018-09-01 17:14:54 +09:00
Yukihiro "Matz" Matsumoto
b80e0ef742
Move Kernel#send to mruby-metaprog gem.
...
But `BasicObject#__send__` is still available from the core.
2018-09-01 11:20:30 +09:00
Yukihiro "Matz" Matsumoto
593c12a5cd
Avoid NoMethodError exception from mrb_func_basic_p.
2018-09-01 11:18:12 +09:00
Yukihiro "Matz" Matsumoto
05f377dee4
Use __send__ instead of send.
2018-09-01 11:02:59 +09:00
Yukihiro "Matz" Matsumoto
0c6353aa2c
Remove MRB_API from mrb_f_send which is not API.
2018-09-01 11:01:50 +09:00
Yukihiro "Matz" Matsumoto
2be42aef0f
Fix ISO/JIS section numbers.
2018-09-01 09:35:46 +09:00
Yukihiro "Matz" Matsumoto
1bc1fed534
Update RITE_BINARY_FORMAT_VER and RITE_VM_VER.
...
The bytecode format was updated so the header version constants must be
updated as well.
2018-08-30 22:48:05 +09:00
Yukihiro "Matz" Matsumoto
50b840c9de
Use mrb_ensure_hash_type() to check if an operand is a Hash; fix #4097
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto
f6564dd83e
Add new function mrb_ensure_hash_type(); ref #4097
...
Unlike `mrb_check_hash_type()` that returns `nil` if the argument is
not a `Hash`, `mrb_ensure_hash_type()` raises a `TypeError` exception.
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto
e471d37ca5
Separate meta-programming features to mruby-metaprog gem.
...
We assume meta-programming is less used in embedded environments.
We have moved following methods:
* Kernel module
global_variables, local_variables, singleton_class,
instance_variables, instance_variables_defined?, instance_variable_get,
instance_variable_set, methods, private_methods, public_methods,
protected_methods, singleton_methods, define_singleton_methods
* Module class
class_variables, class_variables_defined?, class_variable_get,
class_variable_set, remove_class_variable, included_modules,
instance_methods, remove_method, method_removed, constants
* Module class methods
constants, nesting
Note:
Following meta-programming methods are kept in the core:
* Module class
alias_method, undef_method, ancestors, const_defined?, const_get,
const_set, remove_const, method_defined?, define_method
* Toplevel object
define_method
`mruby-metaprog` gem is linked by default (specified in default.gembox).
When it is removed, it will save 40KB (stripped:8KB) on x86-64
environment last time I measured.
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto
75a01af710
Remove consequent OP_RETURN by peephole optimization.
2018-08-30 01:23:17 +09:00
Yukihiro "Matz" Matsumoto
5addd5db4a
Need to clear mrb->c->cibase->ridx (toplevel ridx) at L_STOP; fix #4092
...
This problem only appears when `mrb` executed multiple times (i.e. `mirb`)
2018-08-30 01:20:59 +09:00
Yukihiro "Matz" Matsumoto
500bd38dfe
uint16_t is too small for reference count; fix #4093
...
Use `uint32_t` instead. Theoretically `uint32_t` can overflow as well,
but I think it is sufficient size for embeddable Ruby VM.
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto
2c93e4a0a8
The operand of OP_ARYDUP may not be an array; fix #4094
...
This commit also fix #4096 .
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto
f76cc483d5
Fix off-by-one error in OP_EPUSH and OP_ONERR; fix #4095
2018-08-29 23:59:20 +09:00
Yukihiro "Matz" Matsumoto
e91b6a0378
Merge pull request #4080 from 'ukrainskiysergey-node_negate_fix'
2018-08-29 13:34:02 +09:00
Yukihiro "Matz" Matsumoto
441ff45a51
Merge branch 'node_negate_fix' of https://github.com/ukrainskiysergey/mruby into ukrainskiysergey-node_negate_fix
2018-08-29 13:29:54 +09:00
Yukihiro "Matz" Matsumoto
98c759e86a
Check the size of rescue&ensure stacks; ref #4088
...
Those small stack indexes can cause integer overflow.
2018-08-29 13:17:18 +09:00
Yukihiro "Matz" Matsumoto
2a88a546b2
Fix type of eidx and ridx from uint8_t to uint16_t; fix #4088
...
A byte was too small to hold ensure&rescue stacks indexes.
2018-08-29 13:15:24 +09:00
Yukihiro "Matz" Matsumoto
6aa091e5aa
Simplified #ifdef nesting in codedump.c; fix #4089
...
`printf()` and related functions should not be called when
`MRB_DISABLE_STDIO` is defined.
2018-08-29 12:37:07 +09:00
Yukihiro "Matz" Matsumoto
bc88fc6ed1
Check iseq buffer size before code emission; fix #4090
...
The type of `s->pc` is now `uint16_t` that can be overflowed easily.
Need more checks.
2018-08-29 12:31:48 +09:00
Yukihiro "Matz" Matsumoto
814b7b5ef8
Move back mrb_define_alias to mruby.h to avoid breakage.
2018-08-29 07:00:13 +09:00
Yukihiro "Matz" Matsumoto
93bab387a7
Merge branch 'mruby2-draft'
2018-08-28 22:13:52 +09:00
Yukihiro "Matz" Matsumoto
471288f37d
Reduce integer casting warnings.
2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
d79dbd92f9
fixup! New bytecode implementation of mruby VM.
2018-08-25 09:49:20 +09:00
Yukihiro "Matz" Matsumoto
49d1b16822
Hash splat ** should not be ignored.
...
Implemented by adding `OP_HASHCAT` that merges hashes.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
306732e02d
Fixed a bug in OP_HASHADD.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
a3fb80904d
Remove unused Hash#__update method.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
3554fc54de
Add a new function mrb_hash_merge().
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
b06dad43fa
Remove unused NODE_* constants from node.h.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
e5eb7ef046
Add NODE_KW_HASH support in mrb_parser_dump().
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
162243d95c
Remove arg_value from parse.y.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
b7e56e9d20
Add bytecode support for MRB_WORD_BOXING.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
eeb6d5658d
New bytecode implementation of mruby VM.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto
a16885efe5
Try to fix a fragile File#mtime test.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
31827189ab
Remove potential path to avoid uninitialized variable access.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
fbfe519be7
Simplify mruby-inline-struct tests.
...
`gcc -O3` raises error on truncation using `snprintf`.
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
b3a1d37926
Make Array.new to accept both integers and floats.
...
This time we used `Integral` module which is mruby specific.
2018-08-25 09:19:17 +09:00
Kazuhiro Sera
2b2ff844a1
Fix misspelling words in comments
2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto
b083c1351f
Fixed the corner case bug in String#{gsub!,sub!}.
...
`"a".sub!("a", "a")` should not return `nil`.
2018-08-25 09:17:46 +09:00
pyama86
821135e2df
irep is released when Fiber is terminated
2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto
49d9fb8f41
Reimplement Hash#compact! to conform the standard behavior.
...
`Hash#compact!` should return `nil` if the receiver does not change.
2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto
9409a2ff6d
Rename ambiguous function names.
...
`mrb_iv_p` -> `mrb_iv_name_sym_p`
`mrb_iv_check` -> `mrb_iv_name_sym_check`
2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto
5e469d2b92
Remove utility functions: mrb_vm_iv_{get,set}.
2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto
c88fd32713
Revert 04dbbff.
...
Use segment list for instance variable again to reduce memory.
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto
4c974b9523
Small refactoring.
...
The macro `RCLASS_SUPER`, `RCLASS_IV_TBL` and `RCLASS_M_TBL` are
removed from `include/mruby/class.h`.
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto
f3564a405e
Small refactoring of flodivmod().
2018-08-25 09:16:01 +09:00
dearblue
322eb2328a
Fix mrb_value size with MRB_WORD_BOXING on 32-bit mode
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto
6681e22c71
Simply use snprintf instead of custom fmt_fp,
...
Unless `MRB_DISABLE_STDIO` is set. `snprintf` is used anyway
if mruby is configured to use `stdio`. This change reduces 8KB
of program size on the Linux box.
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto
91c08d7631
Remove nregs member from mrb_callinfo.
...
This means reducing one word per a call frame.
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto
8a18d1539b
Should update ci->env to share the environment; fix #4073
2018-08-25 09:13:09 +09:00
Yukihiro "Matz" Matsumoto
fd086833ff
Reorganize flags values for classes; fix #3975
...
Renamed flag macro names as well:
`MRB_FLAG_IS_FROZEN` -> `MRB_FL_OBJ_FROZEN`
`MRB_FLAG_IS_PREPENDED` -> `MRB_FL_CLASS_IS_PREPENDED`
`MRB_FLAG_IS_ORIGIN` -> `MRB_FL_CLASS_IS_ORIGIN`
`MRB_FLAG_IS_INHERITED` -> `MRB_FL_CLASS_IS_INHERITED`
2018-08-25 09:13:09 +09:00
Yukihiro "Matz" Matsumoto
bfd11aab35
Check size of the integer multiply before actual overflow; fix #4062
2018-08-25 09:13:09 +09:00
Yukihiro "Matz" Matsumoto
fe77272c25
Kernel#p should return an array of arguments; fix #4083
...
Although the return value is not defined in ISO, it is better to behave
as CRuby does.
2018-08-18 22:40:44 +09:00
Yukihiro "Matz" Matsumoto
c095736002
Try to fix a fragile File#mtime test.
2018-08-13 23:15:52 +09:00
Yukihiro "Matz" Matsumoto
14206a75a3
Remove potential path to avoid uninitialized variable access.
2018-08-13 23:15:52 +09:00
Yukihiro "Matz" Matsumoto
1e52d47bc3
Simplify mruby-inline-struct tests.
...
`gcc -O3` raises error on truncation using `snprintf`.
2018-08-13 23:15:52 +09:00
Yukihiro "Matz" Matsumoto
fee9ec61bb
Make Array.new to accept both integers and floats.
...
This time we used `Integral` module which is mruby specific.
2018-08-13 23:15:52 +09:00
Yukihiro "Matz" Matsumoto
11d5782687
Merge pull request #4081 from seratch/fix-typo
...
Fix misspelling words in comments, docs
2018-08-11 10:35:13 +09:00
Kazuhiro Sera
b03f1f78e3
Fix misspelling words in comments
2018-08-11 00:28:32 +09:00
Ukrainskiy Sergey
fbe876b871
Added push() after OP_SEND
2018-08-10 06:44:19 +09:00
Ukrainskiy Sergey
672110dbe8
Small fix
2018-08-09 17:57:18 +09:00
Ukrainskiy Sergey
e3b181586c
Fix weird behavior of the NODE_NEGATE
2018-08-09 17:31:57 +09:00
Yukihiro "Matz" Matsumoto
35be8b2524
Fixed the corner case bug in String#{gsub!,sub!}.
...
`"a".sub!("a", "a")` should not return `nil`.
2018-08-07 23:03:17 +09:00
pyama86
54246db00a
irep is released when Fiber is terminated
2018-08-06 19:13:19 +09:00
Yukihiro "Matz" Matsumoto
62e8e910b2
Reimplement Hash#compact! to conform the standard behavior.
...
`Hash#compact!` should return `nil` if the receiver does not change.
2018-08-06 16:40:19 +09:00
Yukihiro "Matz" Matsumoto
0dca6206c1
Rename ambiguous function names.
...
`mrb_iv_p` -> `mrb_iv_name_sym_p`
`mrb_iv_check` -> `mrb_iv_name_sym_check`
2018-08-06 10:15:55 +09:00
Yukihiro "Matz" Matsumoto
8f386f7663
Remove utility functions: mrb_vm_iv_{get,set}.
2018-08-06 10:15:55 +09:00
Yukihiro "Matz" Matsumoto
14c7a9c548
Revert 04dbbff.
...
Use segment list for instance variable again to reduce memory.
2018-08-06 10:15:55 +09:00
Yukihiro "Matz" Matsumoto
afbbc0a2cb
Small refactoring.
...
The macro `RCLASS_SUPER`, `RCLASS_IV_TBL` and `RCLASS_M_TBL` are
removed from `include/mruby/class.h`.
2018-08-06 10:15:55 +09:00
Yukihiro "Matz" Matsumoto
005ccd9c7e
Small refactoring of flodivmod().
2018-08-06 10:15:55 +09:00
Yukihiro "Matz" Matsumoto
708d6a4964
Merge pull request #4077 from dearblue/fix-wordboxing-symbol
...
Fix to sizeof(mrb_value) is 4 bytes with MRB_WORD_BOXING on 32-bit mode
2018-08-06 10:15:34 +09:00
dearblue
ca01c8792d
Fix mrb_value size with MRB_WORD_BOXING on 32-bit mode
2018-08-05 20:33:44 +09:00
Yukihiro "Matz" Matsumoto
4713cd9eb7
Simply use snprintf instead of custom fmt_fp,
...
Unless `MRB_DISABLE_STDIO` is set. `snprintf` is used anyway
if mruby is configured to use `stdio`. This change reduces 8KB
of program size on the Linux box.
2018-08-01 16:50:44 +09:00
Yukihiro "Matz" Matsumoto
b9817b00a4
Remove nregs member from mrb_callinfo.
...
This means reducing one word per a call frame.
2018-08-01 13:18:32 +09:00
Yukihiro "Matz" Matsumoto
e89cc9b9fa
Should update ci->env to share the environment; fix #4073
2018-08-01 10:08:40 +09:00
Yukihiro "Matz" Matsumoto
d886676690
Merge pull request #4074 from znz/patch-1
...
Remove unmatched quotation mark
2018-08-01 09:26:23 +09:00
Kazuhiro NISHIYAMA
64748691de
Remove unmatched quotation mark
2018-07-31 22:09:45 +09:00
Yukihiro "Matz" Matsumoto
beb6e5c299
Bytecode support for mrdb.
2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto
889f0f5f36
Add test case corresponding to 53e2723.
2018-07-31 17:27:59 +09:00
Yukihiro "Matz" Matsumoto
8558627b9b
Reorganize flags values for classes; fix #3975
...
Renamed flag macro names as well:
`MRB_FLAG_IS_FROZEN` -> `MRB_FL_OBJ_FROZEN`
`MRB_FLAG_IS_PREPENDED` -> `MRB_FL_CLASS_IS_PREPENDED`
`MRB_FLAG_IS_ORIGIN` -> `MRB_FL_CLASS_IS_ORIGIN`
`MRB_FLAG_IS_INHERITED` -> `MRB_FL_CLASS_IS_INHERITED`
2018-07-31 16:48:50 +09:00
Yukihiro "Matz" Matsumoto
180f39bf4c
Check size of the integer multiply before actual overflow; fix #4062
2018-07-31 16:14:18 +09:00
Yukihiro "Matz" Matsumoto
4ce9058f64
Describe the difference of the keyword argument behavior.
...
The implementation of keyword arguments is heavily rely on the prototype
made by @take-cheeze in #3629 .
2018-07-31 03:26:53 +09:00
Yukihiro "Matz" Matsumoto
e27565152f
Removed merge hiccups in doc/opcode.md.
2018-07-31 03:20:27 +09:00
Yukihiro "Matz" Matsumoto
43173e1299
Removed unused instruction: OP_KDICT.
2018-07-31 03:20:00 +09:00
Yukihiro "Matz" Matsumoto
53e2723fae
Fixed a small bug in keyword argument parsing.
...
def m(a=1,**k) p [a,k] end
m(a: 1)
2018-07-31 03:14:42 +09:00
Yukihiro "Matz" Matsumoto
8c9e712784
Keyword argument implemented.
2018-07-30 22:58:01 +09:00
Yukihiro "Matz" Matsumoto
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +09:00
Yukihiro "Matz" Matsumoto
b09d2eb900
Kernel#instance_eval should define singleton methods; fix #4069
2018-07-23 18:26:24 +09:00
Tomoyuki Sahara
cb42c98757
Merge pull request #4072 from katzer/fix/unsupported_servname
...
[mruby-socket] Network services might not be available
2018-07-21 20:07:37 +09:00
Sebastián Katzer
0bc8d1979c
Network services might not be available
2018-07-21 10:18:22 +02:00
Yukihiro "Matz" Matsumoto
e3bc680d98
Merge pull request #4068 from yurie/mrbc
...
add mrbc option `--remove-lv`
2018-07-11 15:09:57 +09:00
yuri
a921b936d6
move declaration of mrb_irep_remove_lv from dump.h to irep.h
2018-07-11 14:14:12 +09:00
yuri
5fef38e4c7
move mrb_irep_remove_lv to codegen.c in mruby-compiler
2018-07-10 15:44:25 +09:00
yuri
dabb20ddbb
add mrbc option --remove-lv
...
* refactor: move `irep_remove_lv` from `mruby-bin-strip` gem to src/dump and rename to `mrb_irep_remove_lv`
* add: mrbc option `--remove-lv` to remove LVAR section
2018-07-10 01:42:33 +09:00
Yukihiro "Matz" Matsumoto
ea435f99da
Merge pull request #4067 from katzer/patch-1
...
[mruby-test] Fix task name is not necessarily a valid path
2018-07-09 08:19:12 +09:00
Sebastián Katzer
b1f1fe2f81
Fix task name is not necessarily a valid path
...
Errno::ENOENT: No such file or directory @ dir_s_mkdir - mruby:Z:/Documents
2018-07-08 13:51:00 +02:00
Yukihiro "Matz" Matsumoto
17c9e65603
Merge pull request #4066 from duangsuse/master
...
Added ~/Android/Sdk/ndk-bundle as default NDK home
2018-07-04 22:12:41 +09:00
duangsuse
06428059f6
Add ~/Android/Sdk/ndk-bundle as default NDK home
2018-07-04 19:33:11 +08:00
Yukihiro "Matz" Matsumoto
5bb3f60e49
Merge pull request #4064 from mame/mrb_without_float-for-mruby-io
...
Support MRB_WITHOUT_FLOAT to mruby-io
2018-07-02 11:00:35 +09:00
Yusuke Endoh
7917b7f8bf
Support MRB_WITHOUT_FLOAT to mruby-io
2018-07-02 10:47:56 +09:00
Yukihiro "Matz" Matsumoto
adb1eae912
Use mrb_raise() instead of mrb_raisef(); ref #4062
2018-06-28 22:40:24 +09:00
Yukihiro "Matz" Matsumoto
e60829405c
Merge pull request #4063 from graywolf/patch-1
...
Add information about Kernel#binding
2018-06-28 08:43:25 +09:00
W
3116d06003
Add information about Kernel#binding
2018-06-27 12:20:24 +00:00
Yukihiro "Matz" Matsumoto
695f29cd60
Add negative check in mrb_str_resize; fix #4062
2018-06-27 16:32:24 +09:00
Yukihiro "Matz" Matsumoto
7e79840587
initialize a local variable to avoid warning
2018-06-22 12:03:52 +09:00
Yukihiro "Matz" Matsumoto
351614bbdd
Merge pull request #4059 from take-cheeze/parallel_tests
...
Run tests parallelly for each target.
2018-06-22 12:02:09 +09:00
Yukihiro "Matz" Matsumoto
864a998c24
Merge pull request #4058 from take-cheeze/exp_sleep
...
Increase sleep duration exponentially instead of `Thread.pass`.
2018-06-22 12:01:33 +09:00
take-cheeze
eaf463ada3
Run tests parallelly for each target.
2018-06-22 11:43:14 +09:00
take-cheeze
48ba7c7bb0
Increase sleep duration exponentially instead of Thread.pass.
2018-06-22 11:41:12 +09:00
Yukihiro "Matz" Matsumoto
3671404391
Merge pull request #4053 from take-cheeze/use_transfer
...
Use Fiber#transfer instead in minirake.
2018-06-22 10:26:37 +09:00
Yukihiro "Matz" Matsumoto
410a5031fc
Merge pull request #4057 from take-cheeze/use_thread_pass
...
Use `Thread.pass` instead of sleeping.
2018-06-22 10:19:16 +09:00
take-cheeze
61e8f831dd
Use Thread.pass instead of sleeping.
2018-06-22 09:29:59 +09:00
Yukihiro "Matz" Matsumoto
36e1796e41
Merge branch 'master' into use_transfer
2018-06-22 07:23:50 +09:00
Yukihiro "Matz" Matsumoto
640fca3276
Merge pull request #4056 from take-cheeze/fix_rake_jobs
...
Fix job waiter of minirake.
2018-06-22 07:18:01 +09:00
Yukihiro "Matz" Matsumoto
485efd9253
Merge pull request #4054 from take-cheeze/show_rake_bt
...
Show minirake backtrace in verbose mode.
2018-06-22 07:16:48 +09:00
take-cheeze
7c246cb9db
Fix job waiter.
2018-06-21 12:45:55 +09:00
take-cheeze
acd04ad519
Support verbose mode in bintest.
2018-06-21 11:33:34 +09:00
take-cheeze
c90dbd12ef
Show minirake backtrace in verbose mode.
2018-06-21 11:29:50 +09:00
take-cheeze
6f35b07fab
Use Fiber#transfer instead in minirake.
2018-06-21 11:26:55 +09:00
Yukihiro "Matz" Matsumoto
fd9617cad0
Merge pull request #4052 from take-cheeze/fix_mtime_test
...
Use temporary file name for `File#mtime` test to avoid conflicts.
2018-06-20 23:19:52 +09:00
Yukihiro "Matz" Matsumoto
1829b76929
Merge pull request #4051 from take-cheeze/para_rake
...
Make minirake parallel.
2018-06-20 22:09:54 +09:00
take-cheeze
7bb2fc70f2
Set jobs to 4 since it have 2 CPUs.
2018-06-20 21:44:23 +09:00
take-cheeze
8f808cc9b1
Use temporary name for File#mtime test to avoid conflicts.
2018-06-20 21:42:48 +09:00
take-cheeze
33f72bb038
disable sudo.
2018-06-20 21:34:03 +09:00
take-cheeze
c3ac33d9cd
Make minirake parallel.
2018-06-20 20:51:24 +09:00
Yukihiro "Matz" Matsumoto
cfed6e3a4b
Merge pull request #4050 from take-cheeze/fix_build_script
...
Fix build scripts.
2018-06-20 20:42:53 +09:00
Yukihiro "Matz" Matsumoto
1a9195285c
Merge pull request #4049 from take-cheeze/fix_mirb_leak
...
Fix memory leaks in mirb.
2018-06-20 19:13:43 +09:00
take-cheeze
b8fec13cab
Make codacy happy.
2018-06-20 18:29:11 +09:00
take-cheeze
1d7c69a7cb
Fix dependencies.
2018-06-20 18:23:08 +09:00
take-cheeze
a212428fed
Comment out unused variable.
2018-06-20 18:22:50 +09:00
take-cheeze
633599a2cb
Fix forgotten argument passing.
2018-06-20 18:21:57 +09:00
take-cheeze
dfddc6a09f
Fix dependencies.
2018-06-20 18:21:33 +09:00
take-cheeze
e050cfb349
Add forgotten mkdir_ps.
2018-06-20 18:20:26 +09:00
take-cheeze
26d143bda8
Fix memory leaks in mirb.
2018-06-20 18:16:25 +09:00
Yukihiro "Matz" Matsumoto
f29bc4607a
Add test_dependency from mruby-io to mruby-time.
2018-06-20 15:24:46 +09:00
Yukihiro "Matz" Matsumoto
54cd2623b3
Turn off enable_debug flag in build_config.rb by default.
...
This will improve the default performance of mruby; fix #4045
2018-06-20 15:24:46 +09:00
Yukihiro "Matz" Matsumoto
58d819f317
Merge pull request #4048 from kou/export-mrb-utf8-locale
...
Export mrb_utf8_from_locale() and mrb_locale_from_utf8()
2018-06-20 13:39:59 +09:00
Kouhei Sutou
e38d1d278b
Export mrb_utf8_from_locale() and mrb_locale_from_utf8()
2018-06-20 11:45:15 +09:00
Yukihiro "Matz" Matsumoto
5e7ced0785
Merge pull request #4047 from kou/stop-to-use-freed-value
...
Stop to use freed value
2018-06-19 19:33:37 +09:00
Yukihiro "Matz" Matsumoto
47413d0507
Merge pull request #4046 from kou/fix-wrong-free-function
...
Fix wrong free function
2018-06-19 19:32:18 +09:00
Kouhei Sutou
33c8c8f8a6
Stop to use freed value
2018-06-19 17:27:34 +09:00
Kouhei Sutou
fb9358206e
Fix wrong free function
...
mrb_locale_free() should be used for the return value of
mrb_locale_from_utf8().
2018-06-19 17:25:38 +09:00
Yukihiro "Matz" Matsumoto
a9abf65f03
Fixed wrong usages of mrb_raisef(); ref #4043
...
`mrb_raisef()` only takes `%S` specifier. If you don't have extra
arguments, use `mrb_raise()`.
2018-06-15 07:47:18 +09:00
Yukihiro "Matz" Matsumoto
70600c3ba8
Resolve sign comparison warning; ref #4044
2018-06-14 14:16:04 +09:00
Tomoyuki Sahara
5340d39ed4
Merge pull request #4044 from iij/fixes-from-iij-socket
...
incorporate fixes from iij/socket
2018-06-14 13:58:48 +09:00
Tomoyuki Sahara
af8020e7fd
sa_family_t is not defined on windows.
2018-06-14 13:52:37 +09:00
Tomoyuki Sahara
2eeac91098
set sockaddr_un.sun_len on the systems that have sockaddr.sa_len.
...
If your system has sa_len but is not BSD-derived, define HAVE_SA_LEN=1
on mrbgem.rake or build_config.rb.
2018-06-14 13:36:01 +09:00
Tomoyuki Sahara
5013d2b20f
struct sockaddr_un can be truncated.
...
When we have "struct sockaddr_un *s_un", we could not assume *s_un
points to a memory region which size is at least sizeof(*s_un).
Even worse, it may be shorter than sizeof(struct sockaddr) on some
systems.
2018-06-14 13:28:32 +09:00
Tomoyuki Sahara
3618556a95
struct sockaddr_un can be shorter than struct sockaddr.
...
ref: https://github.com/iij/mruby-socket/issues/45
2018-06-14 13:25:57 +09:00
Yukihiro "Matz" Matsumoto
97933665b6
Restore GC arena after raised exceptions; ref #4042
2018-06-14 11:42:34 +09:00
Yukihiro "Matz" Matsumoto
ba090a46af
Need to add a write barrier for ranges; fix #4042
...
Ranges are almost immutable but `initialize` and `initialize_copy`
modify the receiver so that we need to add a write barrier.
2018-06-14 11:25:12 +09:00
Yukihiro "Matz" Matsumoto
a7f77fefa9
Check for switching to uninitialized fiber; fix #4041
...
The problem was caused by `Fiber.current.resume'.
2018-06-14 11:15:49 +09:00
Yukihiro "Matz" Matsumoto
896de5532b
Merge pull request #4043 from take-cheeze/fix_test_dep
...
Fix unnecessary rebuild of tests.
2018-06-14 10:13:35 +09:00
take-cheeze
f715f2ddea
Fix unnecessary rebuild of tests.
2018-06-13 23:32:08 +09:00
Yukihiro "Matz" Matsumoto
23a4e7149d
Revert "No longer need to insert write barriers for fibers."
...
This reverts commit c6736357a7 .
The assumption was wrong and caused the issue; fix #4020
2018-06-11 14:50:42 +09:00
Yukihiro "Matz" Matsumoto
a9b740b36b
Retrieve b operand from the instruction (for debugging); ref #4020
2018-06-11 14:50:03 +09:00
Yukihiro "Matz" Matsumoto
faa4eaf680
mrb_class_real() did not work for BasicObject; fix #4037
2018-06-08 14:13:06 +09:00
Yukihiro "Matz" Matsumoto
55edae0226
Allow Object#clone to copy frozen status only; fix #4036
...
Copying all flags from the original object may overwrite the clone's
flags e.g. the embedded flag.
2018-06-07 16:17:00 +09:00
Yukihiro "Matz" Matsumoto
cfd0c93d7d
Merge pull request #4035 from katzer/patch-1
...
[mruby-socket] Declare inet_ntop and inet_pton as static
2018-06-07 16:03:14 +09:00
Yukihiro "Matz" Matsumoto
55dcdd26cc
Merge pull request #4039 from i110/i110/fix-broken-lexical-variables
...
fix broken lexical variables
2018-06-07 16:02:30 +09:00
Yukihiro "Matz" Matsumoto
778500563a
Extend stack when pushing arguments that does not fit in; fix #4038
2018-06-07 15:59:00 +09:00
Yukihiro "Matz" Matsumoto
ff0a4f7867
Export stack_extend function (renamed mrb_stack_extend); fix #3219
...
This change is required to support #4038 .
2018-06-07 15:55:20 +09:00
Ichito Nagata
1dbeda5c9c
add test for eval
2018-06-06 15:35:41 +09:00
Ichito Nagata
c2b2bec9e2
Revert "Fix heap use after free on mruby-aws-sigv4."
...
This reverts commit b8869498b7 .
2018-06-06 15:04:58 +09:00
Sebastián Katzer
e7a4699135
Declare inet_ntop and inet_pton as static
...
To avoid conflicts with multiple definitions of inet_ntop and inet_pton if compiled with # define _WIN32_WINNT _WIN32_WINNT_VISTA
C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libWs2_32.a(dghfs00169.o):(.text+0x0): multiple definition of `inet_pton'
722C:/projects/iss/mruby/build/host/lib/libmruby.a(socket.o):C:/projects/iss/mruby/mrbgems/mruby-socket/src/socket.c:80: first defined here
define _WIN32_WINNT _WIN32_WINNT_VISTA
2018-06-05 15:59:12 +02:00
Ichito Nagata
2af92d0ebc
Let inspect recursion do the right thing
2018-06-04 11:25:10 +09:00
Yukihiro "Matz" Matsumoto
aa5c5de4fd
Merge pull request #4033 from i110/i110/fix-envadjust
...
fix env->stack misadjusting: fix #4029
2018-06-03 20:54:12 +09:00
Ichito Nagata
edaa7a1ba1
fix env->stack misadjusting
2018-06-03 19:40:33 +09:00
Yukihiro "Matz" Matsumoto
395260747a
Instead of defining Hash#dup, we should define Hash#initialize_copy.
...
`Hash#clone` did not work properly; fix #4030
2018-06-01 22:40:42 +09:00
Yukihiro "Matz" Matsumoto
f408143c28
The clone method should copy object status (e.g. frozen) too; #4030
2018-06-01 22:39:40 +09:00
Yukihiro "Matz" Matsumoto
7ed164ba89
Merge pull request #4031 from i110/i110/hash_default
...
let Hash#merge keep ifnone value
2018-06-01 20:29:45 +09:00
Ichito Nagata
4a2b055cdd
let Hash#merge keep ifnone value
2018-06-01 12:48:17 +09:00
Yukihiro "Matz" Matsumoto
b64ce17852
Should not call initialize_copy for TT_ICLASS; fix #4027
...
Since `TT_ICLASS` is a internal object that should never be revealed
to Ruby world.
2018-05-30 17:05:40 +09:00
Yukihiro "Matz" Matsumoto
1dddc2f712
Clear __classname__ of duped class/module; ref #4027
2018-05-30 17:05:05 +09:00
Yukihiro "Matz" Matsumoto
14c21793a0
Check if the exception is frozen; fix #4025
...
`exc_debug_info()` and `mrb_keep_backtrace()` raise `FrozenError`
if the exception is frozen and lead to infinite loop.
2018-05-23 08:30:50 +09:00
Yukihiro "Matz" Matsumoto
c8fb7453fc
Add then alias to yield_self.
...
`then' was added in CRuby 2.6.
2018-05-23 08:30:50 +09:00
Yukihiro "Matz" Matsumoto
a7c8575fe3
Merge pull request #4023 from iwamatsu/fix-upstream
...
Fix test of mruby-pack with big-endian CPUs
2018-05-11 10:34:01 +09:00
Nobuhiro Iwamatsu
0759647f06
Fix test of mruby-pack with big-endian CPUs
...
When running the mruby-pack test with big endian, test data is incorrect,
so it will fail with "i" and "I".
------
Fail: pack/unpack "i" (mrbgems: mruby-pack)
- Assertion[1] Failed: Expected to be equal
Expected: "\xff\xff\xc7\xcf"
Actual: "\xff\xff\xcf\xc7"
- Assertion[2] Failed: Expected to be equal
Expected: [-12345]
Actual: [-14385]
Fail: pack/unpack "I" (mrbgems: mruby-pack)
- Assertion[1] Failed: Expected to be equal
Expected: "\x00\x0090"
Actual: "\x00\x0009"
- Assertion[2] Failed: Expected to be equal
Expected: [12345]
Actual: [14640]
------
This will fix the test data at big-endian.
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org >
2018-05-10 12:54:08 +09:00
Yukihiro "Matz" Matsumoto
bda88bdbea
Merge pull request #4022 from mimaki/mruby-r-option
...
Add `-r` option for `mruby` and `mirb`. (mrbgem is not supported)
2018-05-09 18:31:34 +08:00
Hiroshi Mimaki
e76492c776
Fix CI build errors and warnings.
2018-05-08 09:55:09 +09:00
Hiroshi Mimaki
d973a8ebc4
Add -r option for mruby and mirb.
2018-05-07 18:17:50 +09:00
Yukihiro "Matz" Matsumoto
fc247449e2
Merge pull request #4017 from mimaki/mruby-d-option
...
Add `-d` option for `mruby` and `mirb`.
2018-05-07 14:31:19 +08:00
Hiroshi Mimaki
0c01afc3c9
Fix CI build errors and warnings.
2018-05-07 12:23:32 +09:00
Yukihiro "Matz" Matsumoto
72581696d3
env referred from top-level callinfo should not be unshared; fix #4019
...
Because `mirb` keeps top-level environment across each iteration.
2018-05-03 15:15:30 +09:00
Yukihiro "Matz" Matsumoto
2d4c092de7
Need to call mrb_str_modify() in mrb_str_cat_str(); fix #4018
...
If `str` and `str2` are the same string object `str->ptr` may be
rewritten by `mrb_str_modify()`.
2018-05-02 22:50:55 +09:00
Hiroshi Mimaki
1d16646506
Add -d option for mruby and mirb.
2018-05-02 20:52:02 +09:00
Yukihiro "Matz" Matsumoto
028e34d345
Update MRB_FLO_TO_STR_FMT to "%.16g"; fix #4016
2018-05-01 17:21:01 +09:00
Yukihiro "Matz" Matsumoto
2a38eb9325
Check the return value from mrb_get_datatype(); fix #4009
...
The return value (void*) may be NULL. Avoid using `mrb_get_datatype()`
directly and use `io_get_open_fptr()` instead.
2018-05-01 13:29:08 +09:00
Yukihiro "Matz" Matsumoto
a8122a9d56
Fix stack position in multiple assignment; fix #4008
...
This was caused by a patch from #2684 .
2018-05-01 12:25:04 +09:00
Yukihiro "Matz" Matsumoto
59c8fdd651
Update OP_APOST description; ref #4008
2018-04-28 15:36:23 +09:00
Yukihiro "Matz" Matsumoto
0fee6e1ee9
Fix broken support of MRB_WITHOUT_FLOAT; fix #4015
2018-04-28 15:15:28 +09:00
Yukihiro "Matz" Matsumoto
50a9c5d7c7
Update the patch to not use funcall in C; ref #4013
2018-04-28 11:26:23 +09:00
kimu_shu
4b29abc565
Fix Enumerable#hash on non 32-bit integer conf.
2018-04-28 11:26:23 +09:00
Yukihiro "Matz" Matsumoto
84b499d02b
Merge pull request #4014 from mruby/stable
...
Set the mruby-1.4.1 release date to `2018-4-27`.
2018-04-28 10:08:56 +09:00
Yukihiro "Matz" Matsumoto
b956c0f43c
Merge pull request #4012 from take-cheeze/fix_heap_use_after_free
...
Fix heap use after free on mruby-aws-sigv4.
2018-04-28 10:08:20 +09:00
Takeshi Watanabe
b8869498b7
Fix heap use after free on mruby-aws-sigv4.
2018-04-27 10:45:59 +09:00
Yukihiro "Matz" Matsumoto
1b261382a0
Merge pull request #4011 from kou/fix-gc-env-children
...
Fix wrong the number of marked objects of MRB_TT_ENV in gray mark phase
2018-04-26 23:00:25 +09:00
Kouhei Sutou
4194fe9d65
Fix wrong the number of marked objects of MRB_TT_ENV in gray mark phase
...
If MRB_TT_ENV has stack shared flag or bidx flag, flags is too large
than the real stack size.
2018-04-26 15:25:36 +09:00
Yukihiro "Matz" Matsumoto
1c66d42e47
Merge pull request #4010 from take-cheeze/fix_ary_replace_leak
...
Fix array replace leak error in mruby-uri.
2018-04-25 15:59:56 +09:00
Takeshi Watanabe
e66c990234
Fix array replace leak error in mruby-uri.
2018-04-25 13:27:00 +09:00
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