We are announcing the first stable release of mruby 3.3 series - mruby 3.3.0.
Describes the new features and changes in mruby 3.3.
The main changes in mruby 3.3 are also described in doc/mruby3.3.md.
mruby3.3
from mruby3.2
“NOTE:” are changes to be aware of.
super
(2ad3f0e)callee
method work differently with aliases in mruby (f2dc76e)Kernel#respond_to_missing?
method (347586e)_inspect
method (inspect
with recursive check) is removed
(e2bbf75, 5cb0c74, 113565a,
0713f2a, 6ae6b63, fc9fffc)__printstr__
method is removed; use print
instead
(acecee0, 192e6e3)String#bytesplice
(5274647, a2e2e83)return
in blocks to cross C boundaries (#6125)docker-compose build
for example. (#5961)MRB_NO_DIRECT_THREADING
with MRB_USE_VM_SWITCH_DISPATCH
(#5902)mrb_default_allocf
can be overridden by the application (34c5d96)mrb_open_allocf
will be deprecated (cfee5c2)mrb_vm_ci_env_clear()
function with MRB_API
(#5945)mrb_check_frozen_value()
(ccdf75c)mrb_bug()
(82a48bd) mrb_raise()
series.mrbc_
prefix for compiler context (c5e3cbe) Class#allocate
to be prohibited
(#5979, #6122, #6123) #allocate
, use MRB_UNDEF_ALLOCATOR()
.
This is also automatically applied when the subclass is created, but to explicitly allow it, use MRB_DEFINE_ALLOCATOR()
.mruby-bin-debugger
) (#5966)--cxx
, --cxxflags
, --as
, --asflags
, --objc
, --objcflags
(#6054)mruby-binding-core
of mruby3.2 (11af5db) mruby-binding-core
of mruby 3.2, replace it with mruby-binding
.Binding#initialize_copy
method (#5517)Kernel#binding
responds only to calls from Ruby (#5981)obj
, args
, kwd
, meth
, fib
. (735fa24)mruby-binding
of mruby3.2 (501b22a, #5989) mruby-binding
of mruby 3.2, replace it with mruby-eval
.mrb_fiber_new()
with MRB_API
(#6097)Fiber#resume
from C (#6106)Fiber#to_s
format changed (#6105)IO.open
(#6081)Method#to_s
format changed (f5bc82f, 02f189c)int.pow(n,m)
to take bigint as exponential (d482eab)j
, J
, b
, B
, #
(2a1e3a5, e7021f1, e17f325)Range#overlap?
(384d0e2)String#valid_encoding?
method (eabe2d9)rake install
task (#5928) mruby/bin/
directory by default are now symbolic links (batch files on Windows).
If previously relied on those executables, should be replaced with direct references to the entity created under the build directory (e.g. mruby/build/host/bin/
).deep_clean
(#6032, 1e38569)mrb_f_raise()
is now an internal function
(#5923, #6070)mrb_make_exception()
is now an internal function with different parameters
(431f83e, 78137f3)File#path
method no longer uses the #to_path
method for implicit conversion
(d86c4a7)ensure
section is not executed if the function exits via a return in a procOP_RETURN_BLK
called directly under C functionmrb_fiber_resume()
and Fiber#transfer
MRB_NO_DIRECT_THREADING
with MRB_USE_VM_SWITCH_DISPATCH
mrb_f_raise()
from MRB_API
rake install
REnv
objectsKernel#binding
responds only to calls from Rubybin/mruby-config
Fiber#to_s
methodClass#allocate
in a different wayMRB_FL_UNDEF_ALLOCATE
in subclassesOP_RETURN_BLK
to cross C boundariesOP_RETURN_BLK
called directly under C functiondreamcast_shelf build config
: complete overhaulmrb_fiber_resume()
and Fiber#transfer
We have done 763 commits to 232 files with 8,871 additions and 5,978 deletions since mruby 3.2.0. 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.3.0
.
Common I/O API Guidelines for mruby and mruby/c have been established and released.
We have established the Common I/O API Guidelines(hereinafter referred to as “Guidelines”) for mruby and mruby/c. This initiative enhances the portability of programs across different microcontrollers (hereinafter referred to as “MCUs”) and improves the reusability of various sensors and I/O control libraries. When utilizing mruby and mruby/c in the future, we sincerely hope that you will refer to these Guidelines.
Additionally, we would like to introduce libraries developed by enthusiastic contributors for MCUs that have been made available. If there are MCU libraries not listed below and you have created your own, we encourage you to inform us through the inquiry so that we can include it in our introductions.
https://github.com/mruby/microcontroller-peripheral-interface-guide
]]>We are announcing the first stable release of mruby 3.2 series - mruby 3.2.0.
Describes the new features and changes in mruby 3.2.
The main changes in mruby 3.2 are also described in doc/mruby3.2.md.
a::B = c
should evaluate a
then c
.*
, **
, &
can be passed for forwarding.mruby-bigint
gem.OP_ARYDUP
was renamed to OP_ARYSPLAT
. The instruction name
was changed but instruction number and basic behavior have not
changed (except that ARYDUP nil
makes []
).mruby
-b
only specifies the script is the binary. The files loaded by -r
are not affected by the option.mruby
now loads complied binary if the suffix is .mrb
.mrbc
--no-optimize
option to disable optimization.Class#subclasses
method.Module#undefined_instance_methods
method.mrb_vm_run()
may detach top-level local variables referenced from blocksWhen the mrb_vm_run()
function (including mrb_top_run()
) is called,
the previous top-level local variables referenced from blocks is detached under either of the following conditions.
stack_keep
parameter is given as 0.irep
to be executed is less than the number of previous top-level local variables.This change also affects API functions such as mrb_load_string()
and mrb_load_file()
.
The conditions under which the previous top-level local variables referenced from blocks is detached in these functions are as follows:
mrbc_context
pointer parameter, or the mrbc_context
pointer parameter is set to NULL
.mrbc_context
pointer is less than the number of previous top-level local variables.Intentional reliance on previous behavior may cause compatibility problems in your application.
Following CVEs are fixed.
We have done 1,243 commits to 270 files with 19,130 additions and 10,192 deletions since mruby 3.1.0. 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.2.0
.
We are announcing the first stable release of mruby 3.1 series - mruby 3.1.0.
Describes the new features and changes in mruby 3.1.
The main changes in mruby 3.1 are also described in doc/mruby3.1.md.
CRuby3.0 compatible keyword arguments are introduced. Keyword arguments are basically separated from ordinal arguments.
R-assignment
by single-line pattern matching
Ruby:Feature#15921Some configuration macros are available:
MRB_WORDBOX_NO_FLOAT_TRUNCATE
: by default, float values are packed in the word if possible, but define this macro to allocate float values in the heap.MRB_USE_RO_DATA_P_ETEXT
: define this macro if _etext
is available on your platform.MRB_NO_DEFAULT_RO_DATA_P
: define this macro to avoid using predefined mrb_ro_data_p()
functionWe have added several new build configurations in the build_config
directory.
cross-mingw-winetest.rb
cross-mingw.rb
nintendo_switch.rb
serenity.rb
minimal
: minimal configurationhost-f32
: compiles with mrb_float
as 32 bit float
host-nofloat
: compiles with no float configurationandroid_arm64_v8a.rb
: renamed from android_arm64-v8a.rb
Array#product
Array#repeated_combination
Array#repeated_permutation
Kernel#__ENCODING__
Random.bytes
Random#bytes
String#center
mrbgems/mruby-pack
now supports M
directive (Q encoding)mrbgems/mruby-pack
now supports X
directive (back-up by bytes)mrbgems/mruby-pack
now supports @
directive (absolute position)mrbgems/mruby-pack
now supports w
directive (BER compression)mruby-config
now supports --cc
and --ld
options.OP_
prefix from mruby -v
code dump output.OP_EXT{1,2,3}
by mrbc
with --no-ext-ops
option.c
to mrb_get_args()
for receive Class/Module.Kernel#printf
(mruby-sprintf
) Format specifiers %a
and %A
are removed.Kernel#puts
(mruby-print
) Now expand Array arguments.Due to improvements in the binary format, mruby binaries are no longer backward compatible.
To run the mruby binaries on mruby 3.1, recompile with the mruby 3.1 mrbc
.
RITE_VM_VER
to 0300
(means mruby 3.0 or after).RITE_BINARY_FORMAT_VER
to 0300
.mruby3.0
removed OP_EXT1
, OP_EXT2
, OP_EXT3
for operand extension. But the operand size limitations was too tight for real-world application.
mruby3.1
reintroduces those extension instructions.
mruby3.1
removed following instructions.
OP_LOADL16
OP_LOADSYM16
OP_STRING16
OP_LAMBDA16
OP_BLOCK16
OP_METHOD16
OP_EXEC16
Those instructions are no longer needed by reintroduction of extension instructions.
OP_SENDV
OP_SENDVB
Those instructions for method calls with variable number of arguments are no longer needed. They are covered by OP_SEND
instruction with n=15
.
mruby3.1
introduces following new instructions.
OP_GETIDX
: takes 1 operands R[a][a+1]
OP_SETIDX
: takes 1 operands R[a][a+1]=R[a+2]
OP_SSEND
: takes 3 operands a=self.b(c...)
; see OP_SEND
OP_SSENDB
: takes 3 operands a=self.b(c...){...}
; see OP_SEND
OP_SYMBOL
: takes 2 operands R[a] = intern(Pool[b])
OP_GETIDX
and OP_SETIDX
Execute obj[int]
and obj[int] = value
respectively, where obj
is string|array|hash
.
OP_SSEND
and OP_SSENDB
They are similar to OP_SEND
and OP_SENDB
respectively. They initialize the R[a]
by self
first so that we can skip one OP_LOADSELF
instruction for each call.
OP_SYMBOL
Extracts the character string placed in the pool as a symbol.
OP_SEND
and OP_SENDB
Method calling instructions are unified. Now OP_SEND
and OP_SENDB
(method call with a block) can support both splat arguments and keyword arguments as well.
The brief description of the instructions:
OP_SEND |
BBB | R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1],R[a+n+2]..nk) c=n|nk<<4 |
OP_SENDB |
BBB | R[a] = R[a].call(Syms[b],R[a+1..n],R[a+n+1..nk],R[a+n+2..nk],&R[a+n+2*nk+2]) c=n|nk<<4 |
Operand C specifies the number of arguments. Lower 4 bits (n
) represents the number of ordinal arguments, and higher 4 bits (nk
) represents the number of keyword arguments.
When n == 15
, the method takes arguments packed in an array. When nk == 15
, the method takes keyword arguments are packed in a hash.
OP_ARYPUSH
Now takes 2 operands and pushes multiple entries to an array.
MRB_WORD_BOXING
now packs floating point numbers in the word, if the size of mrb_float
is equal or smaller than the size of mrb_int
by default.
If the size of mrb_float
and mrb_int
are same, the last 2 bits in the mrb_float
are trimmed and used as flags. If you need full precision, you need to define MRB_WORDBOX_NO_FLOAT_TRUNCATE
as described above.
Previous NaN boxing packs values in NaN representation, but pointer retrievals are far more frequent than floating point number references. So we add constant offset to NaN representation to clear higher bits of pointer representation. This representation is called “Favor Pointer” NaN Boxing.
Also, previous NaN boxing limit the size of mrb_int
to 4 bytes (32 bits) to fit in NaN values. Now we allocate integer values in the heap, if the value does not fit in the 32 bit range, just like we did in Word Boxing.
The code generator was updated to reduce the number of instructions, e.g.
a = 2 * 5
will be interpreted as
a = 10
In addition, we have improved peephole optimizations, for example:
GETIV R4 :@foo
MOVE R1 R4
to
GETIV R1 :@foo
String#hash
now use FNV1a
algorithmFor better and faster hash values.
method_added
hooks on method definitions; #2339time_zonename
26340a88Module.instance_eval
bug #5528M
packing bug bfe2bd49codegen_error()
#5603mrb_ary_shift_m
initialization bug 27d1e013super
#5628Following CVEs do not cause problems in this release. They are fixed in the later release.
We have done 1,076 commits to 287 files with 17,188 additions and 15,549 deletions since mruby 3.0.0. 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.1.0
.
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.
R-assignment
by single-line pattern matching
. Ruby:Feature#15921mrbc_cleanup_local_variables()
- Clean up local variables on mrbc_context. #4931mrb_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()
mrb_intern_check()
mrb_intern_check_cstr()
mrb_intern_check_str()
mrb_fiber_resume()
- Allow context switch from C module.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 with gprof
for performance tuninghost-m32
: compiles in gcc 32bit mode on 64bit platformsboxing
: compiles all three boxing optionsclang-asan
: compiles with clang’s Address SanitizerYou can specify the mruby build configuration by building mruby with the rake
build, specifying the build configuration file in the environment variable MRUBY_CONFIG
.
Array.new([])
initialization. (mruby-array)Hash#except
(mruby-hash-ext)IO#popen
to use keyword arguments. (mruby-io)Module#include
and Module#prepend
behave like Ruby 3.0. 3972df57*.rb
and *.mrb
in mruby
interpreter. a045b6b8irep
C struct dump from mrbc
with -S
option.c
to mrb_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
.
RITE_VM_VER
to 0300
(means mruby 3.0).RITE_BINARY_FORMAT_VER
to 0200
.Integer
has been changed to a specification similar to CRuby.
Fixnum
and Integer
.Integral
.int / int -> int
Integer
. APIs for Fixnum
(mrb_fixnum_xxx()
) is also left for compatibility.
mrb_fixnum()
-> mrb_integer()
mrb_fixnum_value()
-> mrb_int_value()
mrb_fixnum_p()
-> mrb_integer_p()
mruby
and mirb
command. #4933block_given?
from inside an orphan block always returns false. #5039#include
. ruby-bug:7844We 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
.
We are announcing the stable release of mruby 2.1 series - mruby 2.1.2.
Argument Forwarding
, which allows you to forward arguments in the form def foo(...)
.OP_LOADI16
instruction that loads a 16-bit integer into a register.0006
to 0007
.mruby-eval
mruby-complex
mruby-rational
MRB_DISABLE_STDIO
for mruby-pack
and mruby-sprintf
. #4954IO#pread
and IO#pwrite
on macOS.Kernel.#eval
to call method with the same name as a variable name without any arguments.IO#readchar
supports UTF-8 characters.-e
/ -E
options from mrbc
.mrb_float_to_str()
.mrb_equal()
.IO#readchar
returns a UTF-8 character fragment instead of EOFError
if EOF is reached in the middle of UTF-8 characters. (86271572)mrb_run()
from C APIs.mrb_io_s_select
. #4966mrb_vm_exec
. #4973Hash
methods are inconsistent with values
when hash has duplicate key. 181f7b97We have done 185 commits to 99 files with 14,883 additions and 1,653 deletions since mruby 2.1.1. For more detail of the updates, see Commit Log.
Thanks all the contributors who have worked on bug fix and improvements in the release of mruby 2.1.2
.
We are announcing the stable release of mruby 2.1 series - mruby 2.1.1.
Symbol#to_s
. (a367373f)#prepend_features
and #module_function
methods are not haves for class objects. (cc52fa66)Exception#inspect
. (d2f2f9db)true
/false
argument to Kernel#exit
. (mrbgems/mruby-exit) (d81e4d71)mruby
command. (9de7130a)--
(end of options) to mruby
command. (f4b528e0)mruby -v
immediately if no program is given for Ruby compatibility. (49653b81)RVALUE
size. (6cf99d12)File#size
and File#truncate
. (mrbgems/mruby-io) (6d9ac89f)IO#pread
and IO#pwrite
. (mrbgems/mruby-io) (4c6d524c)IO.open
. (mrbgems/mruby-io) (69619aee)minirake
. Use rake
for compilation.minirake
is left for compatibility, but it will be removed in the future. (de17f63)MRB_INT16
configuration option. (ff57c027)str_init_shared
. #4807mrb_ary_unshift_m
. #4808local_add_f
. #4810ensure
in Kernel#eval
script. #4833mrb_get_args()
. #4855String#to_f
should not allow hexdecimal format. #4924call
in backtrace inside a block outside a method. #4936mruby-io
in tmpdir when AF_UNIX cannot be created on cwd. #4981p->locals
may be NULL
when error occurs before the point. oss-fuzz: Issue 19886mrb_str_len_to_dbl
. oss-fuzz: Issue 19902git
command.MRB_FIXNUM_SHIFT
with MRB_WORD_BOXING
, MRB_INT32
and MRB_64BIT
.Exception
Exception#exception
.IO
(mrbgems/mruby-io)IO._popen
, IO.for_fd
, IO.select
, IO.sysopen
, IO.new
, IO#sysread
and IO#sysseek
.File
(mrbgems/mruby-io)File.umask
.Integer
Integer#ceil
, Integer#floor
, Integer#round
and Integer#truncate
.Kernel
BasicObject#instance_eval
, Kernel#integer
, Kernel#define_singleton_method
, Kernel#send
, Kernel#proc
, Kernel#sprintf
, Kernel#format
and Kernel#respond_to?
.Hash
Hash.new
and Hash#default
.Fiber
(mrbgems/mruby-fiber)Fiber.new
.We have done 321 commits to 134 files, 4,084 lines were added, 2,742 lines removed since mruby 2.1.0. For more detail of the updates, see Commit Log.
Stay Home and enjoy mruby 2.1.1
.
We are proudly announcing the stable release of mruby 2.0 series - mruby 2.1.0.
The mruby 2.1.0 has been enhanced with compatibility with Ruby 2 series, and some new features of Ruby 2.7 have been added.
Rational
and Complex
literals) (#4125)Array#intersection
method which returns a new array containing elements common to both arrays. (mrbgems/mruby-array-ext)Enumerable#filter_map
method which is a short hand for filter
+ map
in a single call. (mrbgems/mruby-enum-ext)Enumerable#tally
method which group and count elements of the collection. (mrbgems/mruby-enum-ext)Enumerator.produce
method which creates an infinite enumerator from any block. (mrbgems/mruby-enumerator)UnboundMethod#bind_call
method which call a method that overridden without allocation of intermediate Method object. (mruby-method)Module#name
, true#to_s
, false#to_s
return a frozen string. The returned string is always the same object.Array#difference
method:Array#difference
returns a new array that is a copy of the original array, removing any items that also appear in other_ary. (mrbgems/mruby-array-ext)mrbgems/mruby-rational
:Rational
class has been included into the core library, and rational numbers like 1/3
can be handled.mrbgems/mruby-complex
:Complex
class has been included into the core library to handle complex numbers.mrb_false_p(o)
mrb_true_p(o)
mrb_free_p(o)
mrb_object_p(o)
mrb_class_p(o)
mrb_module_p(o)
mrb_iclass_p(o)
mrb_sclass_p(o)
mrb_proc_p(o)
mrb_range_p(o)
mrb_file_p(o)
mrb_env_p(o)
mrb_data_p(o)
mrb_fiber_p(o)
mrb_istruct_p(o)
mrb_break_p(o)
MRB_API mrb_int mrb_cmp(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t); // mruby/dump.h
MRB_API mrb_value mrb_load_irep_buf(mrb_state*, const void*, size_t); // mruby/irep.h
MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*); // mruby/irep.h
MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
MRB_API mrb_value mrb_num_minus(mrb_state *mrb, mrb_value x, mrb_value y);
MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
MRB_API mrb_value mrb_int_value(mrb_state *mrb, mrb_float f);
MRB_API void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s);
MRB_API const char *mrb_string_cstr(mrb_state *mrb, mrb_value str);
mrb_ro_data_p()
(#4408)filter
aliases for Enumerable
and Hash
. (57a0132b)assert
(#4320)assert_match(pattern, str, msg=nil)
assert_not_match(pattern, str, msg=nil)
assert_raise_with_message(exc, exp_msg, msg = nil, &block
assert_raise_with_message_pattern(exc, exp_msg, msg = nil, &block)
assert_not_nil(target, msg)
irb
in Ruby, a local variable _
is added to store the last result.&.
at the beginning of the line (4124047c)mrb_get_args
using the format string :
.mrb_parser_dump
supports displaying NODE_DSYM
, NODE_WORDS
, NODE_SYMBOLS
and NODE_LITERAL_DELIM
.ArgumentError
by aspec
check. (30f37872)mrb_vfromat()
(#4608)assert
for mrbtest (#4540)MRUBY_RELEASE_DATE
(#4353)Class#new(*args, &block)
method.Module#class_variables
.RADIX
, MANT_DIG
, EPSILON
, DIG
, MIN_EXP
, MIN
, MIN_10_EXP
, MAX_EXP
, MAX
, MAX_10_EXP
)$1
..$9
from Kernel#global_variables
.m
).Integral#chr
(#4593)length
for IO should be in bytes, not in characters (8c90b5fc)There are three major breaking changes from mruby 2.0.1.
Array#append
and Array#prepend
from core to mrbgems/mruby-ary-ext
.Numeric#div
from mrbgems/mruby-numeric-ext
to the core.Integral#zero?
, Integral#nonzero?
, Integral#positive?
and Integral#negative)?
to Numeric
class.Numeric#__coerce_step_counter
to Integral
class.Kernel#instance_exec
, Kernel#equal?
and Kernel#instance_eval
to BasicObject
class.NilClass#to_h
to mrbgems/mruby-object-ext
from mrbgems/mruby-enum-ext
String#getbyte
, String#setbyte
and String#byteslice
to the core. (#4696)Kernel#global_variables
from core. This method is defined in mrbgems/mruby-metaprog
.Integral#chr
(Fixnum#chr
) to mrbgems/mruby-string-ext
.String#=~
and String#match
that requires Regexp
(fd37bc53)Symbol#to_s
return a frozen string. The returned string is always the same object. This feature will be reverted next mruby, because which reverted from Ruby 2.7..0
is removed from result of Float#to_s
and Float#inspect
. (9d08025b)mrb_sym2name()
-> mrb_sym_name()
mrb_sym2name_len()
-> mrb_sym_name_len()
mrb_sym2str()
-> mrb_sym_str()
MRB_API
from definitions (referenced from within libmruby
):mrb_instance_new()
, mrb_vm_define_class()
, mrb_vm_define_module()
struct RIstruct
is renamed to struct RIStruct
(e41f1574)mrb_fixnum_plus()
, mrb_fixnum_minus()
, mrb_fixnum_mul()
, and mrb_num_div()
. Use mrb_num_plus()
, mrb_num_minus()
, mrb_num_mul()
instead.ary
of struct RString
. struct RStringEmbed
is used for String embedding. (#4646)$/
. The current Ruby policy do not encourage Perl-ish global variables.MRB_TT_HAS_BASIC
macro. (#4728)flags
and mems
of struct mrb_state
. (0c5f26e0 and #4470)MRB_METHOD_TABLE_INLINE
and MRB_NO_INIT_ARRAY_START
. (2256bb07 and #4716)MRB_USE_ETEXT_EDATA
is deprecated (warned and ignored). instead, use MRB_USE_LINK_TIME_RO_DATA_P
. (#4716)SystemStackError
is raised from String#=~
. (#4363)mrb_top_run
calls; fix (#4384)Can't get cfunc env from non-cfunc proc.
(#4389)Fiber.yield
in method. (#4567)mrb_gc_unregister()
may access freed memory. (#4618)We have done 912 commits to 229 files, 12,006 lines were added, 5,382 lines removed since mruby 2.0.1. For more detail of the updates, see Commit Log.
Let’s try mruby 2.1.0
.
We are proudly announcing the stable release of mruby 2.0 series - mruby 2.0.1.
Enumerator::Chain
, Enumerable#chain
and Enumerator#+
.<<
and >>
to Proc
and Method
.String#to_str
, Integer#to_int
, Float#to_int
Float#to_s
#4225Module#<
, Module<=
, Module>
, Module>=
, Module<=>
info locals
command.MRB_API mrb_value mrb_ary_splice(mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl);
MRB_API void mrb_notimplement(mrb_state*);
MRB_API mrb_value mrb_vformat(mrb_state *mrb, const char *format, va_list ap);
MRB_API double mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck);
MRB_API mrb_value mrb_cstr_to_inum(mrb_state *mrb, const char *s, mrb_int base, mrb_bool badcheck);
MRB_API void mrb_hash_foreach(mrb_state *mrb, struct RHash *hash, mrb_hash_foreach_func *func, void *p);
MRB_API mrb_int mrb_hash_size(mrb_state *mrb, mrb_value hash);
MRB_API void mrb_iv_foreach(mrb_state *mrb, mrb_value obj, mrb_iv_foreach_func *func, void *p);
MRB_API mrb_time_at(mrb_state *mrb, double sec, double usec, enum mrb_timezone zone);
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
.
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
.
There are three major breaking changes from mruby 2.0.0
Developers must use following APIs for accessing attributes of RRange because RRange structure depends on boxing setting.
static
(MRB_API
was not needed):mrb_mod_module_function()
, mrb_obj_hash()
, mrb_str_len_to_inum()
, sym2name_len()
MRB_API
from definitions (referenced from within libmruby
):mrb_mod_cv_defined()
, mrb_mod_cv_get()
, mrb_f_send()
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.Kernel#class_defined?
which is not available in CRuby; #3829BYTE_ORDER
; fix #4190Symbol#size
for multi-byte characters with MRB_UTF8_STRING
.OP_ENTER
to blocks without parameters; fix #4175void_expr_error
; fix #4203 #4192sort
; ref #4307time_update_datetime
; fix #4308We have done 371 commits to 163 files, 2,397 lines were added, 1,570 lines removed since mruby 2.0.0. For more detail of the updates, see Commit Log.
Let’s try mruby 2.0.1
.
We are proudly announcing the first stable release of mruby 2.0 series – mruby 2.0.0.
This release includes the improvement of Ruby2.x compatibility and memory consumption.
Kernel#then
was added as Kernel#yield_self
(Ruby 2.6 Compatible)Array#to_h
can be called with a block (Ruby 2.6 Compatible)Array#union
was added (Ruby 2.6 Compatible)String#lines
can be called with a blockString#tr
, String#tr!
, String#tr_s
, String#tr_s!
, String#squeeze
, String#squeeze!
, String#count
, String#delete
, String#delete!
String#unpack1
was addedMeta-programming features are separated as a mrbgem. You need to link mruby-metaprog
to use meta-programming. (See Breaking Changes
for more detail)
matsumotory/mruby-sleep was bundled as a core library.
You can use Kernel#sleep
and Kernel#usleep
methods.
--remove-lv
option was added
By specifying --remove-lv
, mrbc suppress the generation of local variable information to be used for debugging in the compiled binary. It reduces the size of compiled mruby binary and memory consumption when loaded.-d
option was added
By specifying -d
, mruby execute the script in the debugging mode ($DEBUG=true).-r
option was added
By specifying -r library
, mruby loads the specified library before the execution.-d
option was added (Behaves as mruby -d
)-r
option was added (Behaves as mruby -r
)Several improvements were done in mruby 2.0.0 to reduce memory consumption:
--remove-lv
option was added to mruby compiler(mrbc)There are two major breaking changes from mruby 1.4.1
VM instruction format has been completely changed. The fixed width instruction until mruby 1.4.1 was abandoned. We chose variable length bytecode instructions in mruby 2.0. You need to recompile everything for mruby 2.0.
0005
0002
From the assumption that meta-programming features are not frequently used in embedded system development, we separated meta-programming features as a mebgem (mruby-metaprog
). The following methods have moved to mruby-metaprog
gem.
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, send
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 (Singleton Methods)
constants, nesting
to_int
and to_str
.to_int
or to_str
are no longer converted to Integers or Strings respectively. Those implicit conversions cause recursive VM calls and had been the source of many bugs.We have done 378 commits to 156 files, 7,949 lines were added, 5,430 lines removed since mruby1.4.1. For more detail of the updates, see Commit Log.