diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-06 10:52:27 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-06 10:52:27 +0000 |
commit | d3aad1592213ed2c6ade84b09119c9fce46d185e (patch) | |
tree | 5c15f5ba159d11a06b18fd49a5c229ffb8c84fc2 /iseq.h | |
parent | e39a83a150dba2021f519186b3908edd65a7cba6 (diff) |
Return same ISeq object for one src.
* iseq.c: before this patch, RubyVM::InstructionSequence.of(src) (ISeq in
short) returns different ISeq (wrapper) objects point to one ISeq internal
object. This patch changes this behavior to cache created ISeq (wrapper)
objects and return same ISeq object for an internal ISeq object.
* iseq.h (ISEQ_EXECUTABLE_P): introduced to check executable ISeq objects.
* iseq.h (ISEQ_COMPILE_DATA_ALLOC): reordr setting flag line to avoid
ISEQ_USE_COMPILE_DATA but compiled_data == NULL case.
* vm_core.h (rb_iseq_t): introduce `rb_iseq_t::wrapper` and
`rb_iseq_t::aux::exec`. Move `rb_iseq_t::local_hooks` to
`rb_iseq_t::aux::exec::local_hooks`.
* test/ruby/test_iseq.rb: add ISeq.of() tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.h')
-rw-r--r-- | iseq.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -83,6 +83,8 @@ ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size) #define ISEQ_TRANSLATED IMEMO_FL_USER3 #define ISEQ_MARKABLE_ISEQ IMEMO_FL_USER4 +#define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW((iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0) + struct iseq_compile_data { /* GC is needed */ const VALUE err_info; @@ -126,8 +128,8 @@ ISEQ_COMPILE_DATA(const rb_iseq_t *iseq) static inline void ISEQ_COMPILE_DATA_ALLOC(rb_iseq_t *iseq) { - iseq->flags |= ISEQ_USE_COMPILE_DATA; iseq->aux.compile_data = ZALLOC(struct iseq_compile_data); + iseq->flags |= ISEQ_USE_COMPILE_DATA; } static inline void |