layout | title | date | categories |
---|---|---|---|
post |
mruby 3.0.0 released |
2021-03-04 16:00:00 -0800 |
releases |
We are announcing the first stable release of mruby 3.0 series - mruby 3.0.0.
With mruby 3.0, the memory used of the mruby VM has been significantly reduced, and we have succeeded in significantly saving memory. Previous versions required several hundred KB of RAM, but mruby 3.0 can launch an application with about 100 KB of RAM.
Describes the new features and changes in mruby 3.0.
The main changes in mruby 3.0 are also described in doc/mruby3.md.
- Implement endless-def. Ruby:Feature#16746
- Replace
R-assignment
bysingle-line pattern matching
. Ruby:Feature#15921 - Support squiggly heredocs. #5246
- Add new C APIs
mrbc_cleanup_local_variables()
- Clean up local variables on mrbc_context. #4931- Add functions that take symbols as arguments.
mrb_define_singleton_method_id()
mrb_define_class_method_id()
mrb_define_module_function_id()
mrb_undef_method_id()
mrb_undef_class_method_id()
mrb_define_const_id()
mrb_funcall_id()
- Add functions for symbol checking that return mrb_sym value.
mrb_intern_check()
mrb_intern_check_cstr()
mrb_intern_check_str()
mrb_fiber_resume()
- Allow context switch from C module.
- Preallocate Symbols
The mruby 3.0 can now significantly reduce RAM usage by allocating symbols to static memory area at compile time. See doc/guides/symbol.md for more information. - Reduce memory usage of Hash objects. f2d8db39
- Reduce memory usage when calling methods. #5272
The old build configuration file build_config.rb
has been reconfigured to a file in the build_config
directory.
For example, the following typical build configuration is available.
default
: the default configurationhost-gprof
: compiles withgprof
for performance tuninghost-m32
: compiles in gcc 32bit mode on 64bit platformsboxing
: compiles all three boxing optionsclang-asan
: compiles with clang's Address Sanitizer
You can specify the mruby build configuration by building mruby with the rake
build, specifying the build configuration file in the environment variable MRUBY_CONFIG
.
- Add new libraries.
- Add
Array.new([])
initialization. (mruby-array) - Add
Hash#except
(mruby-hash-ext) - Update
IO#popen
to use keyword arguments. (mruby-io) - Make
Module#include
andModule#prepend
behave like Ruby 3.0. 3972df57
- Allow to mixed and specify
*.rb
and*.mrb
inmruby
interpreter. a045b6b8 - Add
irep
C struct dump frommrbc
with-S
option.
- Add new specifier
c
tomrb_get_args()
for receive Class/Module.
Due to improvements in the binary format, mruby binaries are no longer backward compatible.
To run the mruby binaries on mruby 3.0, recompile with the mruby 3.0 mrbc
.
- Upgrade mruby VM version
RITE_VM_VER
to0300
(means mruby 3.0). - Upgrade mruby binary version
RITE_BINARY_FORMAT_VER
to0200
.
Integer
has been changed to a specification similar to CRuby.
- Integrate
Fixnum
andInteger
. - Remove
Integral
. int / int -> int
- Add APIs for
Integer
. APIs forFixnum
(mrb_fixnum_xxx()
) is also left for compatibility.mrb_fixnum()
->mrb_integer()
mrb_fixnum_value()
->mrb_int_value()
mrb_fixnum_p()
->mrb_integer_p()
- Fix take over file scope variables with
mruby
andmirb
command. #4933 - Fix performing
block_given?
from inside an orphan block always returns false. #5039 - Fix segmentation fault in Mruby interpreter making it crash #5046
- Fix splat operator to frozen Array raises FrozenError. #5067
- Fix wrong behavior of File.extname when the filename starts or ends with a period. (mruby-io) #5077
- Fix #parameters mistakes keyword "splat" for a block parameter. #5066
- Fix mruby-io doesn't work in processes started as Windows service. #5114
- Fix resuming fiber from C seems to loop infinitely. #5261
- Fix invalid UTF-8 string length. #5269
- Fix avoid syntax error when EXPR_MID appears in conditional operator. #5290
- Fix symbols like numbered parameters in blocks get a syntax error. #5295
- Avoid infinite loops when converting objects to strings. 01a8d849
- Fix module order of
#include
. ruby-bug:7844
We have done 983 commits to 274 files with 16,929 additions and 11,685 deletions since mruby 2.1.2. For more detail of the updates, see Commit Log.
Thanks to all the contributors who have worked on bug fixes and improvements in the release of mruby 3.0.0
.