| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Also fixed the size calculation of `irep` dump, that could cause memory
corruption.
|
|
Those types are `uint16_t` in definition. Also we no longer need padding
for `iseq`.
|
|
The fix was proposed by @dearblue
|
|
|
|
Since `%u` of `mrb_sym` may be its MSB turned on.
|
|
|
|
From human readable (ASCII) string representation to binary dump of
IEEE754 in little endian.
|
|
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT`
- `MRB_USE_FLOAT` => `MRB_USE_FLOAT32`
The former is to use `USE_XXX` naming convention. The latter is to make
sure `float` is 32bit float and not floating point number in general.
|
|
|
|
|
|
The catch handler table is combined with iseq block.
This is to prevent the structure from growing by adding a field for the
catch handler table to the `mrb_irep` structure.
"iseq block" and "catch handler table":
[number of catch handler table (2 bytes)]
[number of byte code (4 bytes)]
[iseq (any bytes)]
[catch handlers (multiple of 7 bytes)]
catch handler:
[catch type (1 byte)]
[begin offset (2 bytes)]
[end offset (2 bytes)]
[target offset (2 bytes)]
catch type: enum mrb_catch_type (0 = rescue, 1 = ensure)
begin offset: Includes the specified instruction address
end offset: Does not include the specified instruction address
target offset: replaces pc with the specified instruction address
This table is not expanded by `read_irep_record_1()`.
The necessary elements are expanded one by one when used.
|
|
Which is caused by `MRB_NAN_BOXING`.
|
|
|
|
The minor versions should be upper compatible. So mere opcode, section
addition can be done without breaking compiled binary.
|
|
|
|
|
|
|
|
|
|
- `MRB_64BIT`: the size of a pointer is 64 bits
- `MRB_INT64`: the size of `mrb_int` is 64 bits
|
|
|
|
|
|
Type `mrbc -S -B<init> -o<outfile> <rbfiles...>` to generate the C
source code that holds compiled `mrb_irep`.
Appending the following code to the bottom of the generated code,
`mruby` executes the compiled code:
```C
int
main()
{
mrb_state *mrb = mrb_open();
struct RProc *p = mrb_proc_new(mrb, &init_irep);
mrb_vm_run(mrb, p, mrb_top_self(mrb), 0);
mrb_close(mrb);
return 0;
}
```
Eventually static compile should use this representation, instead
of `uint8_t` array that holds `mrb` data, so that we can skip
interpreting `mrb` data.
|
|
We no longer need 4 bytes alignment after we moved to the byte oriented
instructions.
|
|
Changes:
- `pool format is completely replaced
- supported types: `STR`, `INT32`, `INT64`, `FLOAT`
- `FLOAT` may be replaced by binary representation in the future
- insert `NUL` after string literals in `mrb` files
- `irep->pool` no longer store values in `mrb_value`
- instead it stores in `mrb_pool_value`
- less allocation
- `mrb_irep` can be stored in ROM
|
|
But we need more work:
- recursive `irep` dump (`irep->reps`)
- pool values dump (`irep->pool`)
|
|
- `pool`
- `syms`
- `reps`
|
|
The `FLAG_BYTEORDER_NATIVE` and `FLAG_BYTEORDER_NONATIVE` are no longer
needed.
|
|
Since `mruby 2.0`, compiled bytecode no longer depends on the
endian of the machine.
|
|
|
|
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
|
|
`%g` use shorter representation than `%e`.
|
|
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`)
|
|
This patch slightly reduce memory consumption (2% for my test).
|
|
|
|
|
|
|
|
|
|
to 'uint16_t', possible loss of data
|
|
to 'uint16_t', possible loss of data
|
|
|
|
|
|
|
|
Otherwise, C++ compilers will skip this constant when producing object files.
|
|
|
|
|
|
changes:
* rename DISABLE_STDIO -> MRB_DISABLE_STDIO
* rename ENABLE_DEBUG -> MRB_ENABLE_DEBUG_HOOK
* no more opposite macro definitions (e.g. ENABLE_STDIO, DISABLE_DEBUG).
* rewrite above macro references throughout the code.
* update documents
|
|
IEC 60559 single format has 6 to 9 significant decimal digits precision.
However the printf conversion specifier e (and E, of course) already
writes 1 digit - the one before the decimal point - and precision
specifies the number of digits to write after the decimal point.
|