KOBAYASHI Shuji
68735d1261
Fix dump/load float leteral evaluate to infinity
...
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`)
2019-01-08 20:43:23 +09:00
Yukihiro "Matz" Matsumoto
61f49690e4
Remove filename&lines from mrb_irep struct.
...
This patch slightly reduce memory consumption (2% for my test).
2018-11-15 21:01:56 +09:00
take-cheeze
659c680a5b
Fix dump and load with endianess
2018-11-02 15:47:28 +09:00
Yukihiro "Matz" Matsumoto
471288f37d
Reduce integer casting warnings.
2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +09:00
Yukihiro "Matz" Matsumoto
0fee6e1ee9
Fix broken support of MRB_WITHOUT_FLOAT; fix #4015
2018-04-28 15:15:28 +09:00
Takeshi Watanabe
87ef6aeb02
Fallback to float when caompiled binary with 64bit compiler.
...
closes #3997 .
2018-04-17 22:59:07 +09:00
YAMAMOTO Masaya
acdc2d1f24
Add MRB_WITHOUT_FLOAT
2017-10-11 17:58:11 +09:00
Yukihiro "Matz" Matsumoto
c082249838
Exclude the top-level closure from each_object; fix #3793
2017-08-29 09:29:14 +09:00
Yukihiro "Matz" Matsumoto
8bf492f127
Reduce integer type mismatch warnings in VC.
2017-08-12 09:35:35 +09:00
Nobuyoshi Nakada
6511bfd79a
Removed trailing spaces
2016-09-28 12:29:41 +09:00
Kouhei Sutou
91bd3ebd32
Remove needless MRB_API
...
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
2016-09-25 21:47:49 +09:00
Yukihiro "Matz" Matsumoto
7a382e8bdf
Remove unnecessary MRB_API from read_irep related functions; ref #3215
2016-09-24 05:26:51 +09:00
Yukihiro "Matz" Matsumoto
f3cce24035
replace mrb_toplevel_run() by mrb_top_run()
2016-01-07 22:48:22 +09:00
Kouhei Sutou
a561bdb25f
Support backtrace after method calls
...
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.
2015-12-29 20:36:12 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto
4440566b95
DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014
...
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
2015-11-17 07:30:34 +09:00
Yukihiro "Matz" Matsumoto
7b5f8b0728
remove trailing spaces from bc9c47d5
2015-09-03 01:39:17 +09:00
Yukihiro "Matz" Matsumoto
b09f1712af
Merge pull request #2778 from cremno/fix-load-size-error-macros
...
src/load.c: fix size error macros
2015-04-30 12:19:09 +09:00
cremno
c579ab1c8b
always define SIZE_ERROR_MUL() macro
...
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.
2015-04-29 17:00:35 +02:00
cremno
aaf2615ed6
remove SIZE_ERROR() macro
...
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.
2015-04-29 16:41:45 +02:00
cremno
4a82b9391a
add more descriptive error message and fail earlier
2015-04-29 16:37:35 +02:00
cremno
091ce867c1
fix possible unsigned integer underflow
...
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.
2015-04-28 15:02:39 +02:00
cremno
0518ab22c4
unify error handling
...
Convert mrb_read_irep_file() to use goto like read_section_lv() and
read_section_debug() already do.
2015-04-28 14:40:22 +02:00
Yukihiro "Matz" Matsumoto
bc9c47d518
allow endian specification of mrb files by mrbc -e/-E
...
`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.
2015-02-02 09:34:24 +09:00
cremno
94f1ad6cc1
remove unnecessary _WIN32 preprocessor check
...
SIZE_MAX < UINT32_MAX is false on Win32 / Win64.
2014-11-25 02:04:30 +01:00
Yukihiro "Matz" Matsumoto
8a6e600562
avoid using rewind(3) to load mrb files
2014-11-04 14:05:36 +09:00
Yukihiro "Matz" Matsumoto
0e2ab2210c
read whole mrb file at once to calculate correct padding offset; ref #2630
2014-11-04 10:12:46 +09:00
Yukihiro "Matz" Matsumoto
be844f9284
Fix misaligned access when reading irep; close #2630
...
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 <alfvegardrisc@gmail.com >
2014-11-04 02:41:42 +09:00
Yukihiro "Matz" Matsumoto
ae1403004b
load.c to use mrb_ro_data_p()
2014-10-01 00:01:36 +09:00
Yukihiro "Matz" Matsumoto
3f70edbd16
support native byteorder in mrb files; ref 3492be
2014-09-05 11:09:44 +09:00
Yukihiro "Matz" Matsumoto
5b235a8bfa
condition refactoring in load.c
2014-09-05 10:55:09 +09:00
cremno
610d1d4afa
fix strict aliasing rule violation
2014-09-04 12:34:37 +02:00
Yukihiro "Matz" Matsumoto
32aee72d29
wrong iseq conversion flag
2014-09-04 18:28:56 +09:00
Yukihiro "Matz" Matsumoto
3492be401a
avoid iseq allocation from static irep binary. it reduces 424KB allocation for mrbtest
2014-09-04 17:16:34 +09:00
Tatsuhiko Kubo
ff9582833d
Fix error hanldlings in read_irep_record().
...
read_irep_record_1() and read_irep_record() may return NULL.
2014-08-19 17:42:20 +09:00
kkkkkt
9da37cdfd1
refactor mruby method(fix indent. remove temporary value, duplicate procedure)
2014-08-18 10:58:48 +09:00
Yukihiro "Matz" Matsumoto
37a75b096e
Merge pull request #2496 from cremno/remove-unnecessary-char_bit-check
...
remove unnecessary CHAR_BIT != 8 check
2014-08-04 10:44:05 +09:00
Yukihiro "Matz" Matsumoto
206f89e209
add MRB_API modifiers to mruby API functions
2014-08-04 00:47:08 +09:00
cremno
df21609a20
remove unnecessary CHAR_BIT != 8 check
...
mruby uses uint8_t which implies CHAR_BIT == 8.
2014-08-02 02:06:42 +02:00
mimaki
e52f1bd74e
Check mrbc_context is null
2014-05-21 17:12:03 +09:00
Yukihiro "Matz" Matsumoto
54c2dcf231
allow NULL (no variable) in lvar section of mrb format; fix #2294
...
This fix use UINT16_MAX for NULL symbol tag, that means maximum symbol length
is not UINT16_MAX-1.
2014-05-19 18:39:37 +09:00
yui-knk
45305686fe
Add a space aftre bracket.
2014-05-18 19:40:17 +09:00
Yukihiro "Matz" Matsumoto
9184d254e2
resize register number in LVAR section from 32bits to 16bits
2014-05-14 17:32:30 +09:00
Yukihiro "Matz" Matsumoto
10459a5eb2
Merge branch 'dump_lv' of https://github.com/take-cheeze/mruby into take-cheeze-dump_lv
2014-05-14 11:27:41 +09:00
Jun Hiroe
37d2690d0f
Refactor read_lineno_record_1() in load.c
2014-05-05 13:37:14 +09:00
take_cheeze
5073d14e28
Remove lv_len and use nlocals - 1 instead.
...
Check that `lv`'s length is always `nlocals - 1`.
2014-04-29 22:06:59 +09:00
take_cheeze
4c7f9897c2
Support local variables information dumping.
2014-04-29 20:47:50 +09:00
Yukihiro "Matz" Matsumoto
70a4cc6b08
codedump for binary mrb files as well
2014-04-29 19:05:49 +09:00
Yukihiro "Matz" Matsumoto
48f36d3f0e
better integer size assertion suggested by usak
2014-04-25 04:33:08 +09:00