From be57cffbe6f3e3403d98c11828b00f8abf33811e Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 26 Apr 2017 15:44:57 +0000 Subject: [PATCH] added MOO_METHOD_PREAMBLE_FLAG_DUAL and set it on in a method preamble for a dual method --- moo/lib/comp.c | 1 + moo/lib/moo.h | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 88f0c74..b2b3cdf 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -6015,6 +6015,7 @@ static int add_compiled_method (moo_t* moo) /*if (moo->c->mth.variadic) */ preamble_flags |= moo->c->mth.variadic; + if (moo->c->mth.type == MOO_METHOD_DUAL) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_DUAL; MOO_ASSERT (moo, MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(preamble_index)); diff --git a/moo/lib/moo.h b/moo/lib/moo.h index c20c5d0..b12080b 100644 --- a/moo/lib/moo.h +++ b/moo/lib/moo.h @@ -586,8 +586,8 @@ struct moo_method_t #endif /* The preamble field is composed of: - * 2-bit flag - * 6-bit code + * 3-bit flag + * 5-bit code (0 to 31) * 16-bit index * * The code can be one of the following values: @@ -608,10 +608,10 @@ struct moo_method_t */ /* NOTE: changing preamble code bit structure requires changes to CompiledMethod>>preambleCode */ -#define MOO_METHOD_MAKE_PREAMBLE(code,index,flags) ((((moo_ooi_t)index) << 8) | ((moo_ooi_t)code << 2) | flags) -#define MOO_METHOD_GET_PREAMBLE_CODE(preamble) ((((moo_ooi_t)preamble) & 0xFF) >> 2) +#define MOO_METHOD_MAKE_PREAMBLE(code,index,flags) ((((moo_ooi_t)index) << 8) | ((moo_ooi_t)code << 3) | flags) +#define MOO_METHOD_GET_PREAMBLE_CODE(preamble) ((((moo_ooi_t)preamble) & 0xFF) >> 3) #define MOO_METHOD_GET_PREAMBLE_INDEX(preamble) (((moo_ooi_t)preamble) >> 8) -#define MOO_METHOD_GET_PREAMBLE_FLAGS(preamble) (((moo_ooi_t)preamble) & 0x3) +#define MOO_METHOD_GET_PREAMBLE_FLAGS(preamble) (((moo_ooi_t)preamble) & 0x7) /* preamble codes */ #define MOO_METHOD_PREAMBLE_NONE 0 @@ -638,6 +638,7 @@ struct moo_method_t /* preamble flags */ #define MOO_METHOD_PREAMBLE_FLAG_VARIADIC (1 << 0) #define MOO_METHOD_PREAMBLE_FLAG_LIBERAL (1 << 1) +#define MOO_METHOD_PREAMBLE_FLAG_DUAL (1 << 2) /* NOTE: if you change the number of instance variables for moo_context_t, * you need to change the defintion of BlockContext and MethodContext.