added MOO_METHOD_PREAMBLE_FLAG_DUAL and set it on in a method preamble for a dual method

This commit is contained in:
hyunghwan.chung 2017-04-26 15:44:57 +00:00
parent 6fe65f66fc
commit be57cffbe6
2 changed files with 7 additions and 5 deletions

View File

@ -6015,6 +6015,7 @@ static int add_compiled_method (moo_t* moo)
/*if (moo->c->mth.variadic) */ /*if (moo->c->mth.variadic) */
preamble_flags |= 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)); MOO_ASSERT (moo, MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(preamble_index));

View File

@ -586,8 +586,8 @@ struct moo_method_t
#endif #endif
/* The preamble field is composed of: /* The preamble field is composed of:
* 2-bit flag * 3-bit flag
* 6-bit code * 5-bit code (0 to 31)
* 16-bit index * 16-bit index
* *
* The code can be one of the following values: * 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 */ /* 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_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) >> 2) #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_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 */ /* preamble codes */
#define MOO_METHOD_PREAMBLE_NONE 0 #define MOO_METHOD_PREAMBLE_NONE 0
@ -638,6 +638,7 @@ struct moo_method_t
/* preamble flags */ /* preamble flags */
#define MOO_METHOD_PREAMBLE_FLAG_VARIADIC (1 << 0) #define MOO_METHOD_PREAMBLE_FLAG_VARIADIC (1 << 0)
#define MOO_METHOD_PREAMBLE_FLAG_LIBERAL (1 << 1) #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, /* NOTE: if you change the number of instance variables for moo_context_t,
* you need to change the defintion of BlockContext and MethodContext. * you need to change the defintion of BlockContext and MethodContext.