@@ -453,8 +453,8 @@ jerry_parse_common (void *source_p, /**< script source */
453
453
ecma_object_t * object_p = ecma_create_object (NULL , sizeof (ecma_extended_object_t ), ECMA_OBJECT_TYPE_CLASS );
454
454
455
455
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
456
- ext_object_p -> u .cls .type = ECMA_OBJECT_CLASS_SCRIPT ;
457
- ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p -> u . cls . u3 . value , bytecode_data_p );
456
+ ext_object_p -> u .cls .head . type = ECMA_OBJECT_CLASS_SCRIPT ;
457
+ ECMA_SET_INTERNAL_VALUE_POINTER (ecma_object_cls_general ( ext_object_p ) -> value , bytecode_data_p );
458
458
459
459
return ecma_make_object_value (object_p );
460
460
} /* jerry_parse_common */
@@ -541,7 +541,8 @@ jerry_run (const jerry_value_t script) /**< script or module to run */
541
541
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
542
542
543
543
const ecma_compiled_code_t * bytecode_data_p ;
544
- bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ext_object_p -> u .cls .u3 .value );
544
+ bytecode_data_p =
545
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ecma_object_cls_general (ext_object_p )-> value );
545
546
546
547
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p -> status_flags ) == CBC_FUNCTION_SCRIPT );
547
548
@@ -638,7 +639,7 @@ jerry_module_evaluate (const jerry_value_t module) /**< root module */
638
639
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
639
640
}
640
641
641
- if (module_p -> header .u .cls .u1 . module_state != JERRY_MODULE_STATE_LINKED )
642
+ if (module_p -> header .u .cls .module . state != JERRY_MODULE_STATE_LINKED )
642
643
{
643
644
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE ));
644
645
}
@@ -670,7 +671,7 @@ jerry_module_state (const jerry_value_t module) /**< module object */
670
671
return JERRY_MODULE_STATE_INVALID ;
671
672
}
672
673
673
- return (jerry_module_state_t ) module_p -> header .u .cls .u1 . module_state ;
674
+ return (jerry_module_state_t ) module_p -> header .u .cls .module . state ;
674
675
#else /* !JERRY_MODULE_SYSTEM */
675
676
JERRY_UNUSED (module );
676
677
@@ -818,8 +819,8 @@ jerry_module_namespace (const jerry_value_t module) /**< module */
818
819
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
819
820
}
820
821
821
- if (module_p -> header .u .cls .u1 . module_state < JERRY_MODULE_STATE_LINKED
822
- || module_p -> header .u .cls .u1 . module_state > JERRY_MODULE_STATE_EVALUATED )
822
+ if (module_p -> header .u .cls .module . state < JERRY_MODULE_STATE_LINKED
823
+ || module_p -> header .u .cls .module . state > JERRY_MODULE_STATE_EVALUATED )
823
824
{
824
825
return jerry_throw_sz (JERRY_ERROR_RANGE , ecma_get_error_msg (ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE ));
825
826
}
@@ -952,7 +953,7 @@ jerry_native_module (jerry_native_module_evaluate_cb_t callback, /**< evaluation
952
953
953
954
ecma_module_t * module_p = ecma_module_create ();
954
955
955
- module_p -> header .u .cls .u2 . module_flags |= ECMA_MODULE_IS_NATIVE ;
956
+ module_p -> header .u .cls .module . flags |= ECMA_MODULE_IS_NATIVE ;
956
957
module_p -> scope_p = scope_p ;
957
958
module_p -> local_exports_p = local_exports_p ;
958
959
module_p -> u .callback = callback ;
@@ -993,7 +994,7 @@ jerry_native_module_get (const jerry_value_t native_module, /**< a native module
993
994
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
994
995
}
995
996
996
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name ))
997
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name ))
997
998
{
998
999
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG ));
999
1000
}
@@ -1038,7 +1039,7 @@ jerry_native_module_set (jerry_value_t native_module, /**< a native module objec
1038
1039
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_NOT_MODULE ));
1039
1040
}
1040
1041
1041
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name )
1042
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ) || !ecma_is_value_string (export_name )
1042
1043
|| ecma_is_value_exception (value ))
1043
1044
{
1044
1045
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG ));
@@ -1534,8 +1535,8 @@ jerry_object_type (const jerry_value_t value) /**< input value to check */
1534
1535
case ECMA_OBJECT_TYPE_CLASS :
1535
1536
case ECMA_OBJECT_TYPE_BUILT_IN_CLASS :
1536
1537
{
1537
- JERRY_ASSERT (ext_obj_p -> u .cls .type < ECMA_OBJECT_CLASS__MAX );
1538
- return jerry_class_object_type [ext_obj_p -> u .cls .type ];
1538
+ JERRY_ASSERT (ext_obj_p -> u .cls .head . type < ECMA_OBJECT_CLASS__MAX );
1539
+ return jerry_class_object_type [ext_obj_p -> u .cls .head . type ];
1539
1540
}
1540
1541
case ECMA_OBJECT_TYPE_ARRAY :
1541
1542
case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY :
@@ -1644,7 +1645,7 @@ jerry_iterator_type (const jerry_value_t value) /**< input value to check */
1644
1645
1645
1646
if (ecma_get_object_type (obj_p ) == ECMA_OBJECT_TYPE_CLASS )
1646
1647
{
1647
- switch (ext_obj_p -> u .cls .type )
1648
+ switch (ext_obj_p -> u .cls .head . type )
1648
1649
{
1649
1650
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR :
1650
1651
{
@@ -3610,7 +3611,7 @@ jerry_object_set_internal (jerry_value_t object, /**< object value */
3610
3611
internal_object_p = ecma_create_object (NULL , sizeof (ecma_extended_object_t ), ECMA_OBJECT_TYPE_CLASS );
3611
3612
{
3612
3613
ecma_extended_object_t * container_p = (ecma_extended_object_t * ) internal_object_p ;
3613
- container_p -> u .cls .type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT ;
3614
+ container_p -> u .cls .head . type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT ;
3614
3615
}
3615
3616
3616
3617
value_p -> value = ecma_make_object_value (internal_object_p );
@@ -4141,7 +4142,7 @@ jerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test */
4141
4142
if (object_type == ECMA_OBJECT_TYPE_CLASS )
4142
4143
{
4143
4144
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
4144
- switch (ext_object_p -> u .cls .type )
4145
+ switch (ext_object_p -> u .cls .head . type )
4145
4146
{
4146
4147
/* An object's internal property object should not be iterable by foreach. */
4147
4148
case ECMA_OBJECT_CLASS_INTERNAL_OBJECT :
@@ -5647,16 +5648,17 @@ jerry_source_info (const jerry_value_t value) /**< jerry api value */
5647
5648
ecma_extended_object_t * ext_object_p = (ecma_extended_object_t * ) object_p ;
5648
5649
const ecma_compiled_code_t * bytecode_p = NULL ;
5649
5650
5650
- if (ext_object_p -> u .cls .type == ECMA_OBJECT_CLASS_SCRIPT )
5651
+ if (ext_object_p -> u .cls .head . type == ECMA_OBJECT_CLASS_SCRIPT )
5651
5652
{
5652
- bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ext_object_p -> u .cls .u3 .value );
5653
+ bytecode_p =
5654
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t , ecma_object_cls_general (ext_object_p )-> value );
5653
5655
}
5654
5656
#if JERRY_MODULE_SYSTEM
5655
- else if (ext_object_p -> u .cls .type == ECMA_OBJECT_CLASS_MODULE )
5657
+ else if (ext_object_p -> u .cls .head . type == ECMA_OBJECT_CLASS_MODULE )
5656
5658
{
5657
5659
ecma_module_t * module_p = (ecma_module_t * ) object_p ;
5658
5660
5659
- if (!(module_p -> header .u .cls .u2 . module_flags & ECMA_MODULE_IS_NATIVE ))
5661
+ if (!(module_p -> header .u .cls .module . flags & ECMA_MODULE_IS_NATIVE ))
5660
5662
{
5661
5663
bytecode_p = module_p -> u .compiled_code_p ;
5662
5664
}
@@ -5987,7 +5989,7 @@ jerry_arraybuffer_external (uint8_t *buffer_p, /**< the backing store used by th
5987
5989
5988
5990
if (buffer_p != NULL )
5989
5991
{
5990
- arraybuffer_pointer_p -> extended_object .u .cls .u1 . array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
5992
+ arraybuffer_pointer_p -> extended_object .u .cls .arraybuffer . flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
5991
5993
arraybuffer_pointer_p -> buffer_p = buffer_p ;
5992
5994
}
5993
5995
}
@@ -6075,7 +6077,7 @@ jerry_shared_arraybuffer_external (uint8_t *buffer_p, /**< the backing store use
6075
6077
6076
6078
if (buffer_p != NULL )
6077
6079
{
6078
- shared_arraybuffer_pointer_p -> extended_object .u .cls .u1 . array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
6080
+ shared_arraybuffer_pointer_p -> extended_object .u .cls .arraybuffer . flags |= ECMA_ARRAYBUFFER_ALLOCATED ;
6079
6081
shared_arraybuffer_pointer_p -> buffer_p = buffer_p ;
6080
6082
}
6081
6083
}
@@ -6523,7 +6525,7 @@ jerry_dataview_buffer (const jerry_value_t value, /**< DataView to get the array
6523
6525
6524
6526
if (byte_length != NULL )
6525
6527
{
6526
- * byte_length = dataview_p -> header .u .cls .u3 .length ;
6528
+ * byte_length = dataview_p -> header .u .cls .dataview .length ;
6527
6529
}
6528
6530
6529
6531
ecma_object_t * arraybuffer_p = dataview_p -> buffer_p ;
@@ -7024,7 +7026,7 @@ jerry_container_type (const jerry_value_t value) /**< the container object */
7024
7026
7025
7027
if (ecma_object_class_is (obj_p , ECMA_OBJECT_CLASS_CONTAINER ))
7026
7028
{
7027
- switch (((ecma_extended_object_t * ) obj_p )-> u .cls .u2 . container_id )
7029
+ switch (((ecma_extended_object_t * ) obj_p )-> u .cls .container . id )
7028
7030
{
7029
7031
case LIT_MAGIC_STRING_MAP_UL :
7030
7032
{
@@ -7095,10 +7097,10 @@ jerry_container_to_array (const jerry_value_t value, /**< the container or itera
7095
7097
7096
7098
* is_key_value_p = false;
7097
7099
7098
- if (ext_obj_p -> u .cls .type == ECMA_OBJECT_CLASS_MAP_ITERATOR
7099
- || ext_obj_p -> u .cls .type == ECMA_OBJECT_CLASS_SET_ITERATOR )
7100
+ if (ext_obj_p -> u .cls .head . type == ECMA_OBJECT_CLASS_MAP_ITERATOR
7101
+ || ext_obj_p -> u .cls .head . type == ECMA_OBJECT_CLASS_SET_ITERATOR )
7100
7102
{
7101
- ecma_value_t iterated_value = ext_obj_p -> u .cls .u3 . iterated_value ;
7103
+ ecma_value_t iterated_value = ext_obj_p -> u .cls .iterator . value ;
7102
7104
7103
7105
if (ecma_is_value_empty (iterated_value ))
7104
7106
{
@@ -7107,27 +7109,29 @@ jerry_container_to_array (const jerry_value_t value, /**< the container or itera
7107
7109
7108
7110
ecma_extended_object_t * map_object_p = (ecma_extended_object_t * ) (ecma_get_object_from_value (iterated_value ));
7109
7111
7110
- ecma_collection_t * container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , map_object_p -> u .cls .u3 .value );
7112
+ ecma_collection_t * container_p =
7113
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , map_object_p -> u .cls .container .value );
7111
7114
entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p );
7112
- index = ext_obj_p -> u .cls .u2 . iterator_index ;
7115
+ index = ext_obj_p -> u .cls .iterator . index ;
7113
7116
7114
- entry_size = ecma_op_container_entry_size (map_object_p -> u .cls .u2 . container_id );
7117
+ entry_size = ecma_op_container_entry_size (map_object_p -> u .cls .container . id );
7115
7118
start_p = ECMA_CONTAINER_START (container_p );
7116
7119
7117
- iterator_kind = ext_obj_p -> u .cls .u1 . iterator_kind ;
7120
+ iterator_kind = ext_obj_p -> u .cls .iterator . kind ;
7118
7121
}
7119
7122
else if (jerry_container_type (value ) != JERRY_CONTAINER_TYPE_INVALID )
7120
7123
{
7121
- ecma_collection_t * container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , ext_obj_p -> u .cls .u3 .value );
7124
+ ecma_collection_t * container_p =
7125
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t , ext_obj_p -> u .cls .container .value );
7122
7126
entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p );
7123
- entry_size = ecma_op_container_entry_size (ext_obj_p -> u .cls .u2 . container_id );
7127
+ entry_size = ecma_op_container_entry_size (ext_obj_p -> u .cls .container . id );
7124
7128
7125
7129
index = 0 ;
7126
7130
iterator_kind = ECMA_ITERATOR_KEYS ;
7127
7131
start_p = ECMA_CONTAINER_START (container_p );
7128
7132
7129
- if (ext_obj_p -> u .cls .u2 . container_id == LIT_MAGIC_STRING_MAP_UL
7130
- || ext_obj_p -> u .cls .u2 . container_id == LIT_MAGIC_STRING_WEAKMAP_UL )
7133
+ if (ext_obj_p -> u .cls .container . id == LIT_MAGIC_STRING_MAP_UL
7134
+ || ext_obj_p -> u .cls .container . id == LIT_MAGIC_STRING_WEAKMAP_UL )
7131
7135
{
7132
7136
iterator_kind = ECMA_ITERATOR_ENTRIES ;
7133
7137
}
@@ -7192,7 +7196,7 @@ jerry_container_op (jerry_container_op_t operation, /**< container operation */
7192
7196
{
7193
7197
return jerry_throw_sz (JERRY_ERROR_TYPE , ecma_get_error_msg (ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT ));
7194
7198
}
7195
- uint16_t type = ((ecma_extended_object_t * ) obj_p )-> u .cls .u2 . container_id ;
7199
+ uint16_t type = ((ecma_extended_object_t * ) obj_p )-> u .cls .container . id ;
7196
7200
ecma_extended_object_t * container_object_p = ecma_op_container_get_object (container , type );
7197
7201
7198
7202
if (container_object_p == NULL )
0 commit comments