-
Notifications
You must be signed in to change notification settings - Fork 683
Rearrange fields of ecma_property_t to be naturally aligned. #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,16 +82,6 @@ typedef enum | |
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma values */ | ||
} ecma_simple_value_t; | ||
|
||
/** | ||
* Type of ecma-property | ||
*/ | ||
typedef enum | ||
{ | ||
ECMA_PROPERTY_NAMEDDATA, /**< named data property */ | ||
ECMA_PROPERTY_NAMEDACCESSOR, /**< named accessor property */ | ||
ECMA_PROPERTY_INTERNAL /**< internal property */ | ||
} ecma_property_type_t; | ||
|
||
/** | ||
* Description of an ecma value | ||
* | ||
|
@@ -213,84 +203,78 @@ typedef enum | |
} ecma_property_configurable_value_t; | ||
|
||
/** | ||
* Width of internal property type field's width | ||
* Property's flag list. | ||
*/ | ||
#define ECMA_PROPERTY_INTERNAL_PROPERTY_TYPE_WIDTH (5) | ||
typedef enum | ||
{ | ||
ECMA_PROPERTY_FLAG_NAMEDDATA = 1u << 0, /**< property is named data */ | ||
ECMA_PROPERTY_FLAG_NAMEDACCESSOR = 1u << 1, /**< property is named accessor */ | ||
ECMA_PROPERTY_FLAG_INTERNAL = 1u << 2, /**< property is internal property */ | ||
ECMA_PROPERTY_FLAG_CONFIGURABLE = 1u << 3, /**< property is configurable */ | ||
ECMA_PROPERTY_FLAG_ENUMERABLE = 1u << 4, /**< property is enumerable */ | ||
ECMA_PROPERTY_FLAG_WRITABLE = 1u << 5, /**< property is writable */ | ||
ECMA_PROPERTY_FLAG_LCACHED = 1u << 6, /**< property is lcached */ | ||
} ecma_property_flags_t; | ||
|
||
/** | ||
* Pair of pointers - to property's getter and setter | ||
*/ | ||
typedef struct | ||
{ | ||
__extension__ mem_cpointer_t getter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to getter object */ | ||
__extension__ mem_cpointer_t setter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to setter object */ | ||
mem_cpointer_t getter_p; /**< pointer to getter object */ | ||
mem_cpointer_t setter_p; /**< pointer to setter object */ | ||
} ecma_getter_setter_pointers_t; | ||
|
||
/** | ||
* Description of ecma-property | ||
*/ | ||
typedef struct __attr_packed___ ecma_property_t | ||
typedef struct ecma_property_t | ||
{ | ||
/** Property's type (ecma_property_type_t) */ | ||
unsigned int type : 2; | ||
|
||
/** Compressed pointer to next property */ | ||
__extension__ mem_cpointer_t next_property_p : ECMA_POINTER_FIELD_WIDTH; | ||
mem_cpointer_t next_property_p; | ||
|
||
/** Property's flags (ecma_property_flags_t) */ | ||
uint8_t flags; | ||
|
||
/** Property's details (depending on Type) */ | ||
/** Property's header part (depending on Type) */ | ||
union | ||
{ | ||
/** Description of named data property */ | ||
struct __attr_packed___ ecma_named_data_property_t | ||
{ | ||
/** Value */ | ||
__extension__ ecma_value_t value : ECMA_VALUE_SIZE; | ||
/** Named data property value upper bits */ | ||
uint8_t named_data_property_value_high; | ||
/** Internal property type */ | ||
uint8_t internal_property_type; | ||
} h; | ||
|
||
/** Property's value part (depending on Type) */ | ||
union | ||
{ | ||
/** Description of named data property (second part) */ | ||
struct | ||
{ | ||
/** Compressed pointer to property's name (pointer to String) */ | ||
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH; | ||
|
||
/** Flag indicating whether the property is registered in LCache */ | ||
unsigned int is_lcached : 1; | ||
|
||
/** Attribute 'Writable' (ecma_property_writable_value_t) */ | ||
unsigned int writable : 1; | ||
|
||
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */ | ||
unsigned int enumerable : 1; | ||
mem_cpointer_t name_p; | ||
|
||
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */ | ||
unsigned int configurable : 1; | ||
/** Lower 16 bits of value */ | ||
uint16_t value_low; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this layout, we are expecting that the value of a named data property fits into 8+16 bits. Right now, this is true, but it would be good to check somehow that |
||
} named_data_property; | ||
|
||
/** Description of named accessor property */ | ||
struct __attr_packed___ ecma_named_accessor_property_t | ||
/** Description of named accessor property (second part) */ | ||
struct | ||
{ | ||
/** Compressed pointer to property's name (pointer to String) */ | ||
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH; | ||
|
||
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */ | ||
unsigned int enumerable : 1; | ||
|
||
/** Attribute 'Configurable' (ecma_property_configurable_value_t) */ | ||
unsigned int configurable : 1; | ||
|
||
/** Flag indicating whether the property is registered in LCache */ | ||
unsigned int is_lcached : 1; | ||
mem_cpointer_t name_p; | ||
|
||
/** Compressed pointer to pair of pointers - to property's getter and setter */ | ||
__extension__ mem_cpointer_t getter_setter_pair_cp : ECMA_POINTER_FIELD_WIDTH; | ||
mem_cpointer_t getter_setter_pair_cp; | ||
} named_accessor_property; | ||
|
||
/** Description of internal property */ | ||
struct __attr_packed___ ecma_internal_property_t | ||
/** Description of internal property (second part) */ | ||
struct | ||
{ | ||
/** Internal property's type */ | ||
unsigned int type : ECMA_PROPERTY_INTERNAL_PROPERTY_TYPE_WIDTH; | ||
|
||
/** Value (may be a compressed pointer) */ | ||
uint32_t value; | ||
} internal_property; | ||
} u; | ||
} v; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer a real name for this. |
||
} ecma_property_t; | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto,
header
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the names will be too long, and in some cases it is easy to reach the 120 char.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then leave as is.