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