Files
mruby-mruby/doc/mruby3.md
T
KOBAYASHI Shuji 81c2108819 Revert MRUBY_TARGET mechanism; ref #5096
* In explanation of mruby, the expression `build_config.rb` is frequently
  used including official documents, so I think that it will not make sense
  if the file is no longer used.
* The `MRUBY_TARGET` mechanism seems to have little improvement, so I don't
  think it should be changed to avoid unnecessary confusion.
* `MRUBY_TARGET` and `MRuby.targets` represent somewhat different things,
  so using the same term "target" is a bit confusing.

The mechanism that can be written short when using a file under
`build_config` (renamed from `target`) directory remains
(`build_config/${MRUBY_CONFIG}.rb` is used if the path specified
in `MRUBY_CONFIG` doesn't exist).
2020-10-19 15:03:22 +09:00

2.4 KiB

User visible changes in mruby3

Build System

presym target

The first compilation of mruby may require generation of a static symbol table named build/presym. You can generate the table by rake gensym.

build_config directory

Typical build configuration files are located in build_config directory. For examples:

  • host-gprof: compiles with gprof for performance tuning
  • host-m32: compiles in gcc 32bit mode on 64bit platforms
  • boxing: compiles all three boxing options
  • clang-asan: compiles with clang's Address Sanitizer

build_config/${MRUBY_CONFIG}.rb is used if the path specified in MRUBY_CONFIG doesn't exist, so you can specify it as rake MRUBY_CONFIG=boxing.

Build Configuration Contribution

When you write a new build configuration description, please contribute. We welcome your contribution as a GitHub pull-request.

Language Changes

New Syntax

We have ported some new syntax from CRuby.

  • R-assignment (12 => x)
  • Numbered block parameter (x.map{_1 * 2})
  • End-less def (def double(x) = x*2)

Configuration Options Changed

Some configuration macro names are changed for consistency

MRB_NO_FLOAT

Changed from MRB_WITHOUT_FLOAT to conform USE_XXX naming convention.

MRB_USE_FLOAT32

Changed from MRB_USE_FLOAT to make sure float here means using single precision float, and not the opposite of MRB_NO_FLOAT.

MRB_USE_METHOD_T_STRUCT

Changed from MRB_METHOD_T_STRUCT.

To use struct version of mrb_method_t. More portable but consumes more memory. Turned on by default on 32bit platforms.

MRB_NO_BOXING

Uses struct to represent mrb_value. Consumes more memory but easier to inveticate the internal and to debug. It used to be default mrb_value representation. Now the default is MRB_WORD_BOXING.

MRB_WORD_BOXING

Pack mrb_value in an intptr_t integer. Consumes less memory compared to MRB_NO_BOXING especially on 32 bit platforms. Fixnum size is 31 bits so some integer values does not fit in Fixnum integers.

MRB_NAN_BOXING

Pack mrb_value in a floating pointer number. Nothing changed from previous versions.

MRB_USE_MALLOC_TRIM

Call malloc_trim(0) from mrb_full_gc() if this macro is defined. If you are using glibc malloc, this macro could reduce memory consumption.

Internal Changes

Random now use xoshiro128++.

For better and faster random number generation.