Use RBasic padding for embedded string on 64-bit CPU

On 64-bit CPU, there is padding in `RBasic`, so reorder the fields and use
it as buffer of embedded string. This change allows 4 more bytes to be
embedded on 64-bit CPU.

However, an incompatibility will occur if `RString::as::ary` is accessed
directly because `RString` structure has changed.
This commit is contained in:
KOBAYASHI Shuji
2019-08-20 18:49:55 +09:00
parent b836fd05dd
commit 8157672a29
4 changed files with 15 additions and 10 deletions
+3 -3
View File
@@ -8,11 +8,11 @@
#define MRUBY_OBJECT_H
#define MRB_OBJECT_HEADER \
struct RClass *c; \
struct RBasic *gcnext; \
enum mrb_vtype tt:8; \
uint32_t color:3; \
uint32_t flags:21; \
struct RClass *c; \
struct RBasic *gcnext
uint32_t flags:21
#define MRB_FLAG_TEST(obj, flag) ((obj)->flags & (flag))