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
Yukihiro "Matz" Matsumoto
320f0711f0
remove -Wsign-compare warnings
2014-04-25 02:33:33 +09:00
Yukihiro "Matz" Matsumoto
306b1d3c51
Merge pull request #1948 from monaka/pr-remove-unused-null-check
...
Remove redundant NULL checks.
2014-03-26 13:32:18 +09:00
Masaki Muranaka
dcff9012e3
Remove redundant NULL checks.
...
mrb_malloc causes an exception when memory was empty.
2014-03-26 11:21:20 +09:00
Yukihiro "Matz" Matsumoto
bfd2a539ed
add new function mrb_toplevel_run to prevent running through C function boudaries on exceptions; close #1942
2014-03-26 01:09:09 +09:00
Yukihiro "Matz" Matsumoto
72c274473b
remove size_t cast in mrb_assert() since ((size_t)n <= SIZE_MAX) is always true
2014-03-19 09:07:59 +09:00
Yukihiro "Matz" Matsumoto
3e24e06b29
add a space after C reserved words
2014-03-18 23:57:29 +09:00
Yukihiro "Matz" Matsumoto
c476c1b528
symbol length type to be mrb_int
2014-03-15 15:43:40 +09:00
take_cheeze
bbb7ba46b2
don't use of anonymous unions
2014-03-11 22:01:00 +09:00
Masaki Muranaka
270d25bf2d
Make type casts safer.
2014-03-08 15:53:59 +09:00
cubicdaiya
019d15c3ee
Use mrb_exc_new_str_lit widely
2014-03-04 02:45:53 +09:00
take_cheeze
78915f9601
support c++ exception
2014-03-01 20:05:29 +09:00
cubicdaiya
67de10bfcb
use C style comments instead of C++ style comments
...
According to CONTRIBUTING.md,
Don't use C++ style comments
/* This is the prefered comment style */
Use C++ style comments only for temporary comment e.g. commenting out some code lines.
2014-03-01 03:31:45 +09:00
cremno
18433731ed
remove various preprocessor conditionals
...
- HAVE_IEEEFP_H is nowhere defined or needed at all
- FreeBSD < 4 is unsupported since years
- MSVC workaround (around what exactly?)
2014-01-02 07:33:33 +01:00
Yukihiro "Matz" Matsumoto
b72f3f92f7
use static symbols for debug filename info
2013-12-25 14:52:13 +09:00