summaryrefslogtreecommitdiff
path: root/iseq.h
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-16 07:59:10 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-16 07:59:10 +0000
commit94c40622f58348a65df51b39a2db784b70a50f66 (patch)
treee1ba0ef81ec14a50e760f7974d2759a792181079 /iseq.h
parenta14a67978715dcfa53a1d052545cc6ee99dda862 (diff)
Revert "Add direct marking on iseq operands"
This reverts commit r62706. It causes SEGV on i686-linux (debian) and armv7l-linux-eabihf: http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180309T204300Z.diff.html.gz http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180309T211706Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.h')
-rw-r--r--iseq.h38
1 files changed, 28 insertions, 10 deletions
diff --git a/iseq.h b/iseq.h
index a39d827..0c316e2 100644
--- a/iseq.h
+++ b/iseq.h
@@ -28,25 +28,44 @@ rb_call_info_kw_arg_bytes(int keyword_len)
return sizeof(struct rb_call_info_kw_arg) + sizeof(VALUE) * (keyword_len - 1);
}
-#define ISEQ_COVERAGE(iseq) iseq->body->variable.coverage
-#define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &iseq->body->variable.coverage, cov)
+enum iseq_mark_ary_index {
+ ISEQ_MARK_ARY_COVERAGE,
+ ISEQ_MARK_ARY_FLIP_CNT,
+ ISEQ_MARK_ARY_ORIGINAL_ISEQ,
+ ISEQ_MARK_ARY_INITIAL_SIZE
+};
+
+static inline VALUE
+iseq_mark_ary_create(int flip_cnt)
+{
+ VALUE ary = rb_ary_tmp_new(ISEQ_MARK_ARY_INITIAL_SIZE);
+ rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_COVERAGE */
+ rb_ary_push(ary, INT2FIX(flip_cnt)); /* ISEQ_MARK_ARY_FLIP_CNT */
+ rb_ary_push(ary, Qnil); /* ISEQ_MARK_ARY_ORIGINAL_ISEQ */
+ return ary;
+}
+
+#define ISEQ_MARK_ARY(iseq) (iseq)->body->mark_ary
+
+#define ISEQ_COVERAGE(iseq) RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE)
+#define ISEQ_COVERAGE_SET(iseq, cov) RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_COVERAGE, cov)
#define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES)
#define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES)
-#define ISEQ_FLIP_CNT(iseq) (iseq)->body->variable.flip_count
+#define ISEQ_FLIP_CNT(iseq) FIX2INT(RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT))
static inline int
ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
{
- int cnt = iseq->body->variable.flip_count;
- iseq->body->variable.flip_count += 1;
+ int cnt = ISEQ_FLIP_CNT(iseq);
+ RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_FLIP_CNT, INT2FIX(cnt+1));
return cnt;
}
static inline VALUE *
ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
{
- VALUE str = iseq->body->variable.original_iseq;
+ VALUE str = RARRAY_AREF(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ);
if (RTEST(str)) return (VALUE *)RSTRING_PTR(str);
return NULL;
}
@@ -54,14 +73,14 @@ ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
static inline void
ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq)
{
- RB_OBJ_WRITE(iseq, &iseq->body->variable.original_iseq, Qnil);
+ RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, Qnil);
}
static inline VALUE *
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
{
VALUE str = rb_str_tmp_new(size * sizeof(VALUE));
- RB_OBJ_WRITE(iseq, &iseq->body->variable.original_iseq, str);
+ RARRAY_ASET(ISEQ_MARK_ARY(iseq), ISEQ_MARK_ARY_ORIGINAL_ISEQ, str);
return (VALUE *)RSTRING_PTR(str);
}
@@ -75,8 +94,6 @@ ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
#define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
#define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
-#define ISEQ_TRANSLATED IMEMO_FL_USER3
-#define ISEQ_MARKABLE_ISEQ IMEMO_FL_USER4
struct iseq_compile_data {
/* GC is needed */
@@ -156,6 +173,7 @@ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
VALUE exception, VALUE body);
/* iseq.c */
+void rb_iseq_add_mark_object(const rb_iseq_t *iseq, VALUE obj);
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
struct st_table *ruby_insn_make_insn_table(void);