54 Commits

Author SHA1 Message Date
Rory OConnell 69bc477b43 Adding warnings for mrb_load functions leaking RProc objects 2020-05-19 01:07:49 -07:00
Yukihiro "Matz" Matsumoto b5e2d208b9 Merge pull request #4636 from davidsiaw/doxygen
Generate doxygen docs for mruby
2019-08-19 07:29:46 +09:00
David Siaw b5299b1c58 fix up documentation for values 2019-08-18 20:12:44 +09:00
dearblue 279c21b816 Prohibit changes to iseq in principle 2019-08-18 15:00:32 +09:00
dearblue 8f6f36f654 Add mruby binary loader functions from buffer memory
Add new functions (with `MRB_API`):
- `mrb_read_irep_buf()`
- `mrb_load_irep_buf()`
- `mrb_load_irep_buf_cxt()`
2019-04-24 22:56:39 +09:00
Rob Fors c9a66d4c41 Update documentation to mrb_load_irep 2018-11-20 21:27:03 -05: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
Yukihiro "Matz" Matsumoto 500bd38dfe uint16_t is too small for reference count; fix #4093
Use `uint32_t` instead. Theoretically `uint32_t` can overflow as well,
but I think it is sufficient size for embeddable Ruby VM.
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto beb6e5c299 Bytecode support for mrdb. 2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto 891839b976 New bytecode implementation of mruby VM. 2018-07-30 22:57:54 +09:00
yuri a921b936d6 move declaration of mrb_irep_remove_lv from dump.h to irep.h 2018-07-11 14:14:12 +09:00
Yukihiro "Matz" Matsumoto 93f5f22577 Heavily refactored how lexical scope links are implemented; fix #3821
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.

This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto 473b7d0efd Cut links from irep in heaps finalization. 2017-09-29 00:18:55 +09:00
Yukihiro "Matz" Matsumoto 3acaa44a70 Restructure irep->outer chain; fix #3804
Instead of `irep -> proc` chain, we use `irep -> irep` chain to
avoid GC bugs like #3804. We added `target_class` reference to
`mrb_irep` struct. That means one more word consumption per `irep`.
2017-09-04 06:51:31 +09:00
Yukihiro "Matz" Matsumoto 8bf492f127 Reduce integer type mismatch warnings in VC. 2017-08-12 09:35:35 +09:00
Yukihiro "Matz" Matsumoto 9e10afe1d0 Implements `Module::nesting' (15.2.2.3.2); ref #600, #3200 2017-08-01 15:37:21 +09:00
Yukihiro "Matz" Matsumoto f0f095bc13 Fix a double free problem in codegen.c; fix #3378
This issue was first reported by https://hackerone.com/geeknik
The fix was proposed by @titanous
2017-01-23 16:53:31 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Tatsuhiko Kubo 5fa30aeaea Fix mismatches for MRB_API declarations. 2014-08-29 01:06:22 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto f0b86f36c3 move mrb_irep_remove_lv from etc.c to mruby-bin-strip gem 2014-05-15 17:13:16 +09:00
take_cheeze 30e0dc7956 Support LVAR section removing. 2014-05-15 15:08:30 +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 3244ddf0c3 presreve local variables names in irep->lv 2014-04-28 07:29:37 +09:00
Miura Hideki 54c5b12fb7 irep->pool struct pool -> mrb_value 2013-11-19 20:38:02 +09:00
Yukihiro "Matz" Matsumoto 04a2c58e94 add new function mrb_load_irep_file_cxt() and simplifies mruby.c 2013-11-15 10:49:40 +09:00
Yukihiro "Matz" Matsumoto 71354b91cb enum mrb_vtype varies on compile time configuration, namely MRB_NAN_BOXING 2013-11-15 02:45:52 +09:00
Yukihiro "Matz" Matsumoto de790bdc27 allow irep to be GCed 2013-11-08 20:39:50 +09:00
Yukihiro "Matz" Matsumoto 677a2ac226 irep->pool not to be GCed 2013-11-07 04:20:46 +09:00
Yukihiro "Matz" Matsumoto e92d4e2680 modified to use irep->reps to reference child ireps. preparation for
removing irep array from mrb_state.  note that instructions OP_LAMBDA,
OP_EXEC and OP_EPUSH are incompatible, and dumped mrb format has changed.
2013-11-07 03:54:22 +09:00
take_cheeze 3d1fffbd6b support multiple filename in irep 2013-09-02 00:48:06 +09:00
Jun Hiroe f05580f1bc Add comments. 2013-07-15 01:52:47 +09:00
kurodash 7b7bffd5a8 Fixed irep index overflows, when defining new closure.
Issue #1137.
In the present implementation, when calling mrb_load_string continuously, irep is not released.
Therefore, a 16-bit index was overflowing.
2013-04-12 16:32:07 +09:00
Masaki Muranaka 2b6e9ee556 Modify the type of line-number to uint16_t. Type short is not portable. And it cannot be more than UINT16_MAX because of the mrbc binary format. 2013-03-29 16:26:00 +09:00
Yukihiro Matz Matsumoto a0f6e4d58e resolve conflict from #964 2013-03-27 00:52:24 +09:00
Masaki Muranaka 5f992f8712 Remove bit-fields. They doesn't reduce memory on major environments. 2013-03-15 15:56:23 +09:00
Masaki Muranaka 5bed51e584 Don't use int. It decreases portability. Use size_t as array index and length. It avoids overflow in the extreme situations. 2013-03-09 00:35:58 +09:00
Yuichiro MASUI d1a4958bfc Fixed to uint8_t 2013-03-08 21:46:48 +09:00
Yuichiro MASUI 2842583678 New mrb format. The detail is in https://github.com/mruby/mruby/issues/944 2013-03-08 03:14:21 +09:00
Yukihiro Matz Matsumoto c02c264be2 prototype refactoring on mrb_load_irep(); close #647 2012-12-19 20:44:30 +09:00
Yukihiro Matz Matsumoto d042e16171 move prototype for mrb_load_irep to mruby/irep.h; close #569 2012-12-07 17:48:16 +09:00
Yukihiro Matz Matsumoto f486774352 refactor and move irep malloc away to mrb_add_irep() 2012-12-07 15:57:40 +09:00
Yukihiro Matsumoto 70abbb423a should not free() static iseq from cdump 2012-10-17 02:57:40 +09:00
Yukihiro Matsumoto f114916610 source position added to exception representation 2012-08-31 15:58:33 +09:00
Yukihiro Matsumoto 3e924e887f save debugging lineno info in irep 2012-08-31 11:12:33 +09:00
Yukihiro Matsumoto 950204bc4d remove flags from irep 2012-08-29 11:45:36 +09:00