| Age | Commit message (Collapse) | Author |
|
|
|
The basic idea of this change is from @dearblue.
Note: the arguments of `mrb_str_pool()` have changed, but the function
is provided for internal use (No `MRB_API`). So basically you don't have
to worry about the change.
|
|
linked programs
In lld linked programs, .rodata comes before .text, thus mrb_ro_data_p
will return false for strings in .rodata. Change the lower bound from
_etext to __ehdr_start to catch these cases. This works for ld.bfd, gold
and lld, and it does not have false positives even if .init_array does
not exist.
Remove the branch that uses _edata: strings in .data can be modified so
this is semantically incorrect. Delete the __APPLE__ branch (its
manpages say get_etext() and get_edata() are strongly discouraged).
.init_array has been adopted by most ELF platforms to supersede .ctors.
Neither _etext nor _edata is used, so rename MRB_USE_ETEXT_EDATA to
MRB_USE_EHDR_START.
|
|
|
|
Read irep from buffers
|
|
Because it is not currently output by `mrbc`.
|
|
`MRB_USE_CUSTOM_RO_DATA_P`
|
|
Add new functions (with `MRB_API`):
- `mrb_read_irep_buf()`
- `mrb_load_irep_buf()`
- `mrb_load_irep_buf_cxt()`
|
|
|
|
|
|
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342.
This changes small incompatible changes in function prototypes:
* `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.
I believe above functions are almost internal, and no third-party
mrbgem use them.
|
|
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).
|
|
|
|
|
|
|
|
|
|
closes #3997.
|
|
|
|
|
|
|
|
|
|
ref #3215
If a function (such as mrb_read_irep_file()) is declared without MRB_API
in header file (such as include/mruby/dump.h), implementation of the
function in source file (such as src/load.c) should also defined without
MRB_API.
If MRB_API is mismatch, Visual C++ reports link error with C2375 error
code: https://msdn.microsoft.com/en-us/library/5k6kw95a.aspx
|
|
|
|
|
|
GitHub: fix #2902, #2917
The current implementation traverses stack to retrieve backtrace. But
stack will be changed when some operations are occurred. It means that
backtrace may be broken after some operations.
This change (1) saves the minimum information to retrieve backtrace when
exception is raised and (2) restores backtrace from the minimum
information when backtrace is needed. It reduces overhead for creating
backtrace Ruby objects.
The space for the minimum information is reused by multiple
exceptions. So memory allocation isn't occurred for each exception.
|
|
|
|
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
|
|
|
|
src/load.c: fix size error macros
|
|
Previously there wasn't a way to trigger the useful definition, but it
is needed and that in every case to check for integer overflow due to
multiplication and faulty/modified binary files.
Also change existing code to a calloc()-like parameter order.
|
|
It's only used once and in that case it isn't necessary anyway, since
size_t must be at least 32 bits wide and
the max. length of a filename is UINT16_MAX.
|
|
|
|
buf_size has to be greater than header_size, otherwise subtracting
header_size from buf_size will cause an integer underflow.
Being equal to header_size is fine, however useless, so quit early.
|
|
Convert mrb_read_irep_file() to use goto like read_section_lv() and
read_section_debug() already do.
|
|
`mruby -b` now accepts both big/little endian mrb (compiled binary) files.
`mrbc` generates mrb files in big endian for .mrb files and in native endian
for C files (with -B option specified) by default. If you are cross compiling,
you need to specify target endian by -e/-E options if it is different from
host endian.
|
|
SIZE_MAX < UINT32_MAX is false on Win32 / Win64.
|
|
|
|
|
|
Add padding bytes before iseq block that may be used as mrb_code[].
Note that dumped mrb format has changed.
Based on a patch from kimu_shu <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
for mrbtest
|
|
read_irep_record_1() and read_irep_record() may return NULL.
|
|
|
|
remove unnecessary CHAR_BIT != 8 check
|
|
|