summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:03:42 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:03:42 +0000
commit198ff42258d9bfde8b2056d923510c52c957b5a1 (patch)
tree88b52dc706d767cd39f6bd26d00c33adf5cf0376 /internal.h
parent873d57347fca4fc7f407c2bca45f90797ab6f864 (diff)
downloadruby-198ff42258d9bfde8b2056d923510c52c957b5a1.tar.gz
support theap for T_STRUCT.
* struct.c: members memory can use theap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index b680c8c79b..3baee61ee3 100644
--- a/internal.h
+++ b/internal.h
@@ -698,14 +698,18 @@ extern void ruby_init_setproctitle(int argc, char *argv[]);
#define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
#define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
#define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
+
enum {
RSTRUCT_EMBED_LEN_MAX = 3,
RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
+ RSTRUCT_TRANSIENT_FLAG = FL_USER3,
RSTRUCT_ENUM_END
};
+#define RSTRUCT_TRANSIENT_P(st) FL_TEST_RAW((obj), RSTRUCT_TRANSIENT_FLAG)
+
struct RStruct {
struct RBasic basic;
union {
@@ -746,6 +750,13 @@ rb_struct_const_ptr(VALUE st)
RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
}
+static inline const VALUE *
+rb_struct_const_heap_ptr(VALUE st)
+{
+ /* TODO: check embed on debug mode */
+ return RSTRUCT(st)->as.heap.ptr;
+}
+
/* class.c */
struct rb_deprecated_classext_struct {