Yukihiro "Matz" Matsumoto
63d4e8eca2
Fix a bug in find_symbol(); fix #5192
2020-11-26 13:18:45 +09:00
Yukihiro "Matz" Matsumoto
7150c67539
Make OP_JMP* operand address to be relative.
...
Jump target address is `operand (16bit)` + `address of next instruction`.
In addition, `ilen` was made `uint32_t` so that `iseq` length limitation
of 65536 is removed. Only jump target address should be within signed
16bit (-32768 .. 32767).
2020-11-26 10:34:31 +09:00
Yukihiro "Matz" Matsumoto
6dedd6a940
Fix Symbol.all_symbols to include preallocated symbols; ref #5116
2020-11-26 10:33:15 +09:00
Yukihiro "Matz" Matsumoto
66f2e733e5
Symbols should work with MRB_USE_ALL_SYMBOLS; fix #5116
2020-11-26 10:32:19 +09:00
Yukihiro "Matz" Matsumoto
a33f9d7b65
Small refactoring regarding symbols for clarity.
2020-11-26 09:42:08 +09:00
Yukihiro "Matz" Matsumoto
50b57f6ff1
Include mruby.h instead of mrbconf.h directly.
2020-11-26 09:14:12 +09:00
Yukihiro "Matz" Matsumoto
2daf1987f9
Avoid memory leak when mrb_read_irep() fails.
2020-11-26 09:04:30 +09:00
Yukihiro "Matz" Matsumoto
71f9add1c5
Move inline iseq in array.c to array.rb.
...
There's no efficiency difference since `cdump` is implemented.
2020-11-25 23:14:38 +09:00
Yukihiro "Matz" Matsumoto
fba7874a68
Replace mere enable_debug by clearer conf.enable_debug [ci skip]
2020-11-25 21:42:10 +09:00
Yukihiro "Matz" Matsumoto
6e17122c6d
Merge pull request #5190 from shuujii/allow-compiler-name-in-build-log-to-be-customized
...
Allow compiler name in build log to be customized
2020-11-25 15:31:39 +09:00
KOBAYASHI Shuji
038bad2f41
Allow compiler name in build log to be customized
...
For example, in the case of the C++ compiler, it is output as
`CXX build/host/src/gc.cxx -> build/host/src/gc.cxx.o` (FYI, in the case
of `enable_cxx_abi`, it outputs `CC ...` because the option to compile as
C++ is added to C compiler).
2020-11-25 15:11:36 +09:00
Yukihiro "Matz" Matsumoto
6a284872ce
Merge pull request #5189 from shuujii/fix-C-source-compilation-with-MRB_USE_ALL_SYMBOLS
...
Fix C source compilation with `MRB_USE_ALL_SYMBOLS`; ref #5187
2020-11-25 14:33:03 +09:00
KOBAYASHI Shuji
a7b50be35b
Fix C source compilation with MRB_USE_ALL_SYMBOLS; ref #5187
...
However, compiling by `mrbc` fails with another issue (#5116 ).
2020-11-25 10:17:52 +09:00
Yukihiro "Matz" Matsumoto
fc98aa290f
Remove no longer used `MRB_IV_SEGMENT_SIZE; close #5188 [ci skip]
2020-11-25 08:31:10 +09:00
Yukihiro "Matz" Matsumoto
40235f3050
Use more mrb_int_value() instead of mrb_fixnum_value().
2020-11-24 20:52:25 +09:00
Yukihiro "Matz" Matsumoto
2e30c68562
Move MRB_NO_FLOAT detection in mruby-math; #5185
2020-11-24 20:43:56 +09:00
Yukihiro "Matz" Matsumoto
4d21a68d35
Add #include <mrbconf.h> at the head of fmt_fp.c; #5185
2020-11-24 20:01:24 +09:00
Yukihiro "Matz" Matsumoto
9e114fc913
Merge pull request #5186 from shuujii/optimize-presym_find
...
Optimize `presym_find`
2020-11-24 16:58:09 +09:00
Yukihiro "Matz" Matsumoto
e55abd2390
Fix compiler errors from MRB_NO_FLOAT; #5185
...
Also added `no-float.rb` target in `build_config`.
2020-11-24 16:54:39 +09:00
KOBAYASHI Shuji
db00fb238b
Optimize presym_find
...
Chang to compare string length first.
### Benchmark
#### Code
* https://github.com/shuujii/mruby-presym_find-benchmark
#### Result
```console
Previous: 10.240772M i/s (25M times in 2.441222s)
New: 16.412985M i/s (25M times in 1.523184s)
```
2020-11-24 16:30:52 +09:00
Yukihiro "Matz" Matsumoto
36e3c4404a
Should not use mrb_float if MRB_NO_FLOAT is defined; fix #5185
2020-11-24 13:50:15 +09:00
Yukihiro "Matz" Matsumoto
67f3626b5c
Merge pull request #5178 from abinoam/fix_mruby_config_setting
...
Fix #5177 by setting MRUBY_CONFIG early
2020-11-24 09:44:21 +09:00
Abinoam Praxedes Marques Junior
4803c872e2
Fix #5177 - set MRUBY_CONFIG early
2020-11-23 15:18:22 -03:00
Yukihiro "Matz" Matsumoto
e4e4eeb0c3
Merge pull request #5184 from dearblue/embedded-directive
...
Avoid warnings from clang's "-Wembedded-directive"
2020-11-23 22:07:48 +09:00
dearblue
3a92a4e3d8
Avoid warnings from clang's "-Wembedded-directive"
...
If it gives clang-11.0 `-Wembedded-directive`, a warning will be reported in `include/mruby/boxing_nan.h`.
```
include/mruby/boxing_nan.h:48:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
include/mruby/boxing_nan.h:52:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
```
The cause of this is #5117 .
ref. e993b83c50
2020-11-23 21:22:50 +09:00
Yukihiro "Matz" Matsumoto
6f53e2c059
Merge pull request #5180 from wataash/fix-unintended-variable-shadowing
...
Fix unintended variable shadowing
2020-11-23 17:05:27 +09:00
Yukihiro "Matz" Matsumoto
c6c0b796e1
Merge pull request #5181 from shuujii/raise-an-exception-instead-of-exiting-when-mrbc-fails
...
Raise an exception instead of exiting when `mrbc` fails
2020-11-23 17:02:44 +09:00
Yukihiro "Matz" Matsumoto
b1ee892818
Merge pull request #5183 from shuujii/change-output-condition-in-_pp
...
Change output condition in `_pp`
2020-11-23 17:01:59 +09:00
Yukihiro "Matz" Matsumoto
e6b06eafb3
Merge pull request #5182 from shuujii/use-local-variables-instead-of-top-level-constants-in-boxing.rb
...
Use local variables instead of top level constants in `boxing.rb` [ci skip]
2020-11-23 17:01:01 +09:00
KOBAYASHI Shuji
2f85290065
Change output condition in _pp
...
* Output even with `rake -v` (to help debugging)
* Not output when `rake -s`
2020-11-23 16:50:15 +09:00
KOBAYASHI Shuji
0d8b1eaee5
Use local variables instead of top level constants in boxing.rb [ci skip]
2020-11-23 16:35:36 +09:00
KOBAYASHI Shuji
2b0f908017
Raise an exception instead of exiting when mrbc fails
2020-11-23 16:32:10 +09:00
Wataru Ashihara
01dc2265ff
Fix unintended variable shadowing
2020-11-23 14:48:14 +09:00
Yukihiro "Matz" Matsumoto
39a11f323e
Remove mrb_str_buf_new() and MRB_STR_BUF_MIN_SIZE; close #5171
2020-11-22 22:54:21 +09:00
Yukihiro "Matz" Matsumoto
abdd006df3
Strictly speaking NULL + 0 is a undefined behavior; ref #5157
2020-11-22 22:44:22 +09:00
Yukihiro "Matz" Matsumoto
2d9bf22730
Merge pull request #5173 from shuujii/refine-build-log-for-generated-files
...
Refine build log for generated files
2020-11-22 22:38:33 +09:00
Yukihiro "Matz" Matsumoto
17532874a8
Merge pull request #5174 from dearblue/doc
...
Add brief explanation about `bin/mruby`; ref #5157 [ci skip]
2020-11-22 22:37:29 +09:00
dearblue
a67b88e223
Add brief explanation about bin/mruby; ref #5157 [ci skip]
2020-11-22 20:49:59 +09:00
KOBAYASHI Shuji
2a97e97db4
Refine build log for generated files
...
* Output `GEN` log for generated files
* `MRBC` log is outputted one for each `mrbc` execution
#### Before this patch:
```console
CC src/array.c -> build/host/src/array.o
(snip)
GEN mrblib/*.rb -> build/host/mrblib/mrblib.c
MRBC mrblib/00class.rb
MRBC mrblib/10error.rb
(snip)
CC mrbgems/mruby-time/src/time.c -> build/host/mrbgems/mruby-time/src/time.o
MRBC mrbgems/mruby-time/mrblib/time.rb
(snip)
CC mrbgems/mruby-socket/test/sockettest.c -> build/host/mrbgems/mruby-socket/test/sockettest.o
MRBC mrbgems/mruby-socket/test/addrinfo.rb
MRBC mrbgems/mruby-socket/test/basicsocket.rb
(snip)
```
#### After this patch:
```console
GEN build/presym
GEN build/presym.inc
CC src/array.c -> build/host/src/array.o
(snip)
GEN mrblib/*.rb -> build/host/mrblib/mrblib.c
MRBC mrblib/00class.rb
mrblib/10error.rb
(snip)
CC mrbgems/mruby-time/src/time.c -> build/host/mrbgems/mruby-time/src/time.o
GEN build/host/mrbgems/mruby-time/gem_init.c
MRBC mrbgems/mruby-time/mrblib/time.rb
(snip)
CC mrbgems/mruby-socket/test/sockettest.c -> build/host/mrbgems/mruby-socket/test/sockettest.o
GEN build/host/mrbgems/mruby-socket/gem_test.c
MRBC mrbgems/mruby-socket/test/addrinfo.rb
MRBC mrbgems/mruby-socket/test/basicsocket.rb
(snip)
```
2020-11-22 20:31:01 +09:00
Yukihiro "Matz" Matsumoto
76b036a627
Merge pull request #5172 from shuujii/move-global-function-for-build-to-lib-mruby-core_ext.rb
...
Move global function for build to `lib/mruby/core_ext.rb`
2020-11-22 18:03:29 +09:00
Yukihiro "Matz" Matsumoto
ac2dfa8c47
Merge pull request #5170 from dearblue/gcmark
...
Fix GC mark leaks for `MRB_TT_BREAK`; fix #5168
2020-11-22 18:00:53 +09:00
KOBAYASHI Shuji
1c7a1926a3
Move global function for build to lib/mruby/core_ext.rb
...
Because `_pp` is originally defined in `lib/mruby/core_ext.rb`, other global
functions are moved to the file.
2020-11-22 16:53:13 +09:00
dearblue
fd3576e888
Fix GC mark leaks for MRB_TT_BREAK; fix #5168
2020-11-22 15:09:01 +09:00
Yukihiro "Matz" Matsumoto
1cd8b4c933
Merge pull request #5169 from shuujii/fix-size-of-local-variable-array-in-struct-dumped-file
...
Fix size of local variable array in struct dumped file
2020-11-22 14:41:48 +09:00
KOBAYASHI Shuji
1864816d1e
Fix size of local variable array in struct dumped file
2020-11-22 13:32:45 +09:00
Yukihiro "Matz" Matsumoto
e02d0ff78c
Merge pull request #5167 from dearblue/singleton-method
...
Improved `Object#define_singleton_method`
2020-11-22 00:02:34 +09:00
Yukihiro "Matz" Matsumoto
049e749c8b
Merge pull request #5166 from shuujii/rename-MRB_ENABLE-DISABLE_-to-MRB_USE-NO_
...
Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163
2020-11-21 23:59:32 +09:00
dearblue
b2bfcabae2
Improved Object#define_singleton_method
...
Integrate the implementation with `Module#define_method`.
- Introduce the internal function `mrb_mod_define_method_m()` (no static)
- The `Object#define_singleton_method` method can now accept a second argument
2020-11-21 22:31:13 +09:00
KOBAYASHI Shuji
3d056d084a
Rename MRB_{ENABLE,DISABLE}_ to MRB_{USE,NO}_; close #5163
...
| Previous Name | New Name |
|------------------------------|-------------------------|
| MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS |
| MRB_ENABLE_SYMBOLL_ALL | MRB_USE_ALL_SYMBOLS |
| MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI |
| MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION |
| MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK |
| MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING |
| MRB_DISABLE_STDIO | MRB_NO_STDIO |
| ENABLE_LINENOISE | MRB_USE_LINENOISE |
| ENABLE_READLINE | MRB_USE_READLINE |
| DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE |
| DISABLE_GEMS | MRB_NO_GEMS |
* `MRB_ENABLE_SYMBOLL_ALL` seems to be a typo, so it is fixed.
* `MRB_` prefix is added to those without.
* The previous names can also be used for compatibility.
2020-11-21 21:14:40 +09:00
Yukihiro "Matz" Matsumoto
544784effd
Merge pull request #5157 from dearblue/detect-rb-mrb
...
Allow to mixed and specify `*.rb` and `*.mrb` in `bin/mruby`
2020-11-21 19:22:49 +09:00