Warning fixes.
ISO C99 doesn’t support unnamed structs/unions. Comparison of distinct pointer types lacks a cast. Dereferencing type-punned pointer will break strict-aliasing rules. Type of bit-field ‘ext’ is a GCC extension. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
@@ -294,8 +294,8 @@ typedef enum
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mem_cpointer_t getter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to getter object */
|
||||
mem_cpointer_t setter_p : ECMA_POINTER_FIELD_WIDTH; /**< pointer to setter object */
|
||||
__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 */
|
||||
} ecma_getter_setter_pointers_t;
|
||||
|
||||
/**
|
||||
@@ -307,7 +307,7 @@ typedef struct __attr_packed___ ecma_property_t
|
||||
unsigned int type : 2;
|
||||
|
||||
/** Compressed pointer to next property */
|
||||
mem_cpointer_t next_property_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t next_property_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Property's details (depending on Type) */
|
||||
union
|
||||
@@ -316,10 +316,10 @@ typedef struct __attr_packed___ ecma_property_t
|
||||
struct __attr_packed___ ecma_named_data_property_t
|
||||
{
|
||||
/** Value */
|
||||
ecma_value_t value : ECMA_VALUE_SIZE;
|
||||
__extension__ ecma_value_t value : ECMA_VALUE_SIZE;
|
||||
|
||||
/** Compressed pointer to property's name (pointer to String) */
|
||||
mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Flag indicating whether the property is registered in LCache */
|
||||
unsigned int is_lcached : 1;
|
||||
@@ -338,7 +338,7 @@ typedef struct __attr_packed___ ecma_property_t
|
||||
struct __attr_packed___ ecma_named_accessor_property_t
|
||||
{
|
||||
/** Compressed pointer to property's name (pointer to String) */
|
||||
mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t name_p : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Attribute 'Enumerable' (ecma_property_enumerable_value_t) */
|
||||
unsigned int enumerable : 1;
|
||||
@@ -350,7 +350,7 @@ typedef struct __attr_packed___ ecma_property_t
|
||||
unsigned int is_lcached : 1;
|
||||
|
||||
/** Compressed pointer to pair of pointers - to property's getter and setter */
|
||||
mem_cpointer_t getter_setter_pair_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t getter_setter_pair_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
} named_accessor_property;
|
||||
|
||||
/** Description of internal property */
|
||||
@@ -795,10 +795,10 @@ typedef struct ecma_string_t
|
||||
lit_cpointer_t lit_cp;
|
||||
|
||||
/** Compressed pointer to an ecma_collection_header_t */
|
||||
mem_cpointer_t collection_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t collection_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Compressed pointer to an ecma_number_t */
|
||||
mem_cpointer_t number_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t number_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** UInt32-represented number placed locally in the descriptor */
|
||||
uint32_t uint32_number;
|
||||
|
||||
@@ -978,7 +978,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
|
||||
{
|
||||
case ECMA_STRING_CONTAINER_LIT_TABLE:
|
||||
{
|
||||
JERRY_ASSERT (string1_p->u.lit_cp.packed_value != string2_p->u.lit_cp.packed_value);
|
||||
JERRY_ASSERT (string1_p->u.lit_cp.u.packed_value != string2_p->u.lit_cp.u.packed_value);
|
||||
return false;
|
||||
}
|
||||
case ECMA_STRING_CONTAINER_MAGIC_STRING:
|
||||
|
||||
@@ -1388,7 +1388,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||
|
||||
for (uint32_t i = const_literal_end; i < literal_end; i++)
|
||||
{
|
||||
mem_cpointer_t bytecode_cpointer = literal_start_p[i].value.base_cp;
|
||||
mem_cpointer_t bytecode_cpointer = literal_start_p[i].u.value.base_cp;
|
||||
ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
|
||||
bytecode_cpointer);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
|
||||
indx++)
|
||||
{
|
||||
// i.
|
||||
if (literal_p[indx].packed_value == MEM_CP_NULL)
|
||||
if (literal_p[indx].u.packed_value == MEM_CP_NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
ecma_value_t base;
|
||||
|
||||
/** referenced name */
|
||||
mem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
__extension__ mem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** strict reference flag */
|
||||
unsigned int is_strict : 1;
|
||||
|
||||
@@ -118,12 +118,10 @@ typedef struct jerry_api_value_t
|
||||
|
||||
uint32_t v_uint32; /**< number converted 32-bit unsigned integer */
|
||||
|
||||
union
|
||||
{
|
||||
jerry_api_string_t *v_string; /**< pointer to a JS string */
|
||||
jerry_api_object_t *v_object; /**< pointer to a JS object */
|
||||
};
|
||||
};
|
||||
jerry_api_string_t *v_string; /**< pointer to a JS string */
|
||||
jerry_api_object_t *v_object; /**< pointer to a JS object */
|
||||
|
||||
} u;
|
||||
} jerry_api_value_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,9 +26,9 @@ typedef struct
|
||||
{
|
||||
uint32_t last_compiled_code_offset; /**< offset of the last compiled code */
|
||||
uint32_t lit_table_size; /**< size of literal table */
|
||||
uint32_t is_run_global : 1; /**< flag, indicating whether the snapshot
|
||||
* was dumped as 'Global scope'-mode code (true)
|
||||
* or as eval-mode code (false) */
|
||||
__extension__ uint32_t is_run_global : 1; /**< flag, indicating whether the snapshot
|
||||
* was dumped as 'Global scope'-mode code (true)
|
||||
* or as eval-mode code (false) */
|
||||
} jerry_snapshot_header_t;
|
||||
|
||||
/**
|
||||
|
||||
+34
-34
@@ -205,7 +205,7 @@ jerry_api_value_is_object (const jerry_api_value_t *value_p) /**< pointer to api
|
||||
bool
|
||||
jerry_api_value_is_function (const jerry_api_value_t *value_p) /**< pointer to api value */
|
||||
{
|
||||
return jerry_api_value_is_object (value_p) && jerry_api_is_function (value_p->v_object);
|
||||
return jerry_api_value_is_object (value_p) && jerry_api_is_function (value_p->u.v_object);
|
||||
} /* jerry_api_value_is_function */
|
||||
|
||||
/**
|
||||
@@ -217,7 +217,7 @@ bool
|
||||
jerry_api_get_boolean_value (const jerry_api_value_t *value_p) /**< pointer to api value */
|
||||
{
|
||||
JERRY_ASSERT (jerry_api_value_is_boolean (value_p));
|
||||
return value_p->v_bool;
|
||||
return value_p->u.v_bool;
|
||||
} /* jerry_api_get_boolean_value */
|
||||
|
||||
/**
|
||||
@@ -237,15 +237,15 @@ jerry_api_get_number_value (const jerry_api_value_t *value_p) /**< pointer to ap
|
||||
JERRY_ASSERT (jerry_api_value_is_number (value_p));
|
||||
if (value_p->type == JERRY_API_DATA_TYPE_UINT32)
|
||||
{
|
||||
return value_p->v_uint32;
|
||||
return value_p->u.v_uint32;
|
||||
}
|
||||
else if (value_p->type == JERRY_API_DATA_TYPE_FLOAT32)
|
||||
{
|
||||
return value_p->v_float32;
|
||||
return value_p->u.v_float32;
|
||||
}
|
||||
else
|
||||
{
|
||||
return value_p->v_float64;
|
||||
return value_p->u.v_float64;
|
||||
}
|
||||
} /* jerry_api_get_number_value */
|
||||
|
||||
@@ -258,7 +258,7 @@ jerry_api_string_t *
|
||||
jerry_api_get_string_value (const jerry_api_value_t *value_p) /**< pointer to api value */
|
||||
{
|
||||
JERRY_ASSERT (jerry_api_value_is_string (value_p));
|
||||
return value_p->v_string;
|
||||
return value_p->u.v_string;
|
||||
} /* jerry_api_get_string_value */
|
||||
|
||||
/**
|
||||
@@ -270,7 +270,7 @@ jerry_api_object_t *
|
||||
jerry_api_get_object_value (const jerry_api_value_t *value_p) /**< pointer to api value */
|
||||
{
|
||||
JERRY_ASSERT (jerry_api_value_is_object (value_p));
|
||||
return value_p->v_object;
|
||||
return value_p->u.v_object;
|
||||
} /* jerry_api_get_object_value */
|
||||
|
||||
/**
|
||||
@@ -318,7 +318,7 @@ jerry_api_create_boolean_value (bool value) /**< bool value from which a jerry_a
|
||||
{
|
||||
jerry_api_value_t jerry_val;
|
||||
jerry_val.type = JERRY_API_DATA_TYPE_BOOLEAN;
|
||||
jerry_val.v_bool = value;
|
||||
jerry_val.u.v_bool = value;
|
||||
return jerry_val;
|
||||
} /* jerry_api_create_boolean_value */
|
||||
|
||||
@@ -332,7 +332,7 @@ jerry_api_create_number_value (double value) /**< double value from which a jerr
|
||||
{
|
||||
jerry_api_value_t jerry_val;
|
||||
jerry_val.type = JERRY_API_DATA_TYPE_FLOAT64;
|
||||
jerry_val.v_float64 = value;
|
||||
jerry_val.u.v_float64 = value;
|
||||
return jerry_val;
|
||||
} /* jerry_api_create_number_value */
|
||||
|
||||
@@ -345,7 +345,7 @@ jerry_api_create_object_value (jerry_api_object_t *value) /**< jerry_api_object_
|
||||
{
|
||||
jerry_api_value_t jerry_val;
|
||||
jerry_val.type = JERRY_API_DATA_TYPE_OBJECT;
|
||||
jerry_val.v_object = value;
|
||||
jerry_val.u.v_object = value;
|
||||
return jerry_val;
|
||||
} /* jerry_api_create_object_value */
|
||||
|
||||
@@ -358,7 +358,7 @@ jerry_api_create_string_value (jerry_api_string_t *value) /**< jerry_api_string_
|
||||
{
|
||||
jerry_api_value_t jerry_val;
|
||||
jerry_val.type = JERRY_API_DATA_TYPE_STRING;
|
||||
jerry_val.v_string = value;
|
||||
jerry_val.u.v_string = value;
|
||||
return jerry_val;
|
||||
} /* jerry_api_create_string_value */
|
||||
|
||||
@@ -391,7 +391,7 @@ jerry_api_convert_ecma_value_to_api_value (jerry_api_value_t *out_value_p, /**<
|
||||
else if (ecma_is_value_boolean (value))
|
||||
{
|
||||
out_value_p->type = JERRY_API_DATA_TYPE_BOOLEAN;
|
||||
out_value_p->v_bool = ecma_is_value_true (value);
|
||||
out_value_p->u.v_bool = ecma_is_value_true (value);
|
||||
}
|
||||
else if (ecma_is_value_number (value))
|
||||
{
|
||||
@@ -399,10 +399,10 @@ jerry_api_convert_ecma_value_to_api_value (jerry_api_value_t *out_value_p, /**<
|
||||
|
||||
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
|
||||
out_value_p->type = JERRY_API_DATA_TYPE_FLOAT32;
|
||||
out_value_p->v_float32 = *num;
|
||||
out_value_p->u.v_float32 = *num;
|
||||
#elif CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64
|
||||
out_value_p->type = JERRY_API_DATA_TYPE_FLOAT64;
|
||||
out_value_p->v_float64 = *num;
|
||||
out_value_p->u.v_float64 = *num;
|
||||
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
|
||||
}
|
||||
else if (ecma_is_value_string (value))
|
||||
@@ -410,7 +410,7 @@ jerry_api_convert_ecma_value_to_api_value (jerry_api_value_t *out_value_p, /**<
|
||||
ecma_string_t *str = ecma_get_string_from_value (value);
|
||||
|
||||
out_value_p->type = JERRY_API_DATA_TYPE_STRING;
|
||||
out_value_p->v_string = ecma_copy_or_ref_ecma_string (str);
|
||||
out_value_p->u.v_string = ecma_copy_or_ref_ecma_string (str);
|
||||
}
|
||||
else if (ecma_is_value_object (value))
|
||||
{
|
||||
@@ -418,7 +418,7 @@ jerry_api_convert_ecma_value_to_api_value (jerry_api_value_t *out_value_p, /**<
|
||||
ecma_ref_object (obj);
|
||||
|
||||
out_value_p->type = JERRY_API_DATA_TYPE_OBJECT;
|
||||
out_value_p->v_object = obj;
|
||||
out_value_p->u.v_object = obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -453,14 +453,14 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
}
|
||||
case JERRY_API_DATA_TYPE_BOOLEAN:
|
||||
{
|
||||
*out_value_p = ecma_make_simple_value (api_value_p->v_bool ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
*out_value_p = ecma_make_simple_value (api_value_p->u.v_bool ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
break;
|
||||
}
|
||||
case JERRY_API_DATA_TYPE_FLOAT32:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = (ecma_number_t) (api_value_p->v_float32);
|
||||
*num = (ecma_number_t) (api_value_p->u.v_float32);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
@@ -469,7 +469,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
case JERRY_API_DATA_TYPE_FLOAT64:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = (ecma_number_t) (api_value_p->v_float64);
|
||||
*num = (ecma_number_t) (api_value_p->u.v_float64);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
@@ -478,7 +478,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
case JERRY_API_DATA_TYPE_UINT32:
|
||||
{
|
||||
ecma_number_t *num = ecma_alloc_number ();
|
||||
*num = (ecma_number_t) (api_value_p->v_uint32);
|
||||
*num = (ecma_number_t) (api_value_p->u.v_uint32);
|
||||
|
||||
*out_value_p = ecma_make_number_value (num);
|
||||
|
||||
@@ -486,7 +486,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
}
|
||||
case JERRY_API_DATA_TYPE_STRING:
|
||||
{
|
||||
ecma_string_t *str_p = ecma_copy_or_ref_ecma_string (api_value_p->v_string);
|
||||
ecma_string_t *str_p = ecma_copy_or_ref_ecma_string (api_value_p->u.v_string);
|
||||
|
||||
*out_value_p = ecma_make_string_value (str_p);
|
||||
|
||||
@@ -494,7 +494,7 @@ jerry_api_convert_api_value_to_ecma_value (ecma_value_t *out_value_p, /**< out:
|
||||
}
|
||||
case JERRY_API_DATA_TYPE_OBJECT:
|
||||
{
|
||||
ecma_object_t *obj_p = api_value_p->v_object;
|
||||
ecma_object_t *obj_p = api_value_p->u.v_object;
|
||||
|
||||
ecma_ref_object (obj_p);
|
||||
|
||||
@@ -654,11 +654,11 @@ jerry_api_release_value (jerry_api_value_t *value_p) /**< API value */
|
||||
|
||||
if (value_p->type == JERRY_API_DATA_TYPE_STRING)
|
||||
{
|
||||
jerry_api_release_string (value_p->v_string);
|
||||
jerry_api_release_string (value_p->u.v_string);
|
||||
}
|
||||
else if (value_p->type == JERRY_API_DATA_TYPE_OBJECT)
|
||||
{
|
||||
jerry_api_release_object (value_p->v_object);
|
||||
jerry_api_release_object (value_p->u.v_object);
|
||||
}
|
||||
} /* jerry_api_release_value */
|
||||
|
||||
@@ -2040,14 +2040,14 @@ jerry_snapshot_set_offsets (uint8_t *buffer_p, /**< buffer */
|
||||
{
|
||||
lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;
|
||||
|
||||
if (literal_start_p[i].packed_value != MEM_CP_NULL)
|
||||
if (literal_start_p[i].u.packed_value != MEM_CP_NULL)
|
||||
{
|
||||
while (current_p->literal_id.packed_value != literal_start_p[i].packed_value)
|
||||
while (current_p->literal_id.u.packed_value != literal_start_p[i].u.packed_value)
|
||||
{
|
||||
current_p++;
|
||||
}
|
||||
|
||||
literal_start_p[i].packed_value = (uint16_t) current_p->literal_offset;
|
||||
literal_start_p[i].u.packed_value = (uint16_t) current_p->literal_offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2055,13 +2055,13 @@ jerry_snapshot_set_offsets (uint8_t *buffer_p, /**< buffer */
|
||||
{
|
||||
compiled_code_map_entry_t *current_p = snapshot_map_entries_p;
|
||||
|
||||
while (current_p->compiled_code_cp != literal_start_p[i].value.base_cp)
|
||||
while (current_p->compiled_code_cp != literal_start_p[i].u.value.base_cp)
|
||||
{
|
||||
current_p = ECMA_GET_NON_NULL_POINTER (compiled_code_map_entry_t,
|
||||
current_p->next_cp);
|
||||
}
|
||||
|
||||
literal_start_p[i].packed_value = (uint16_t) current_p->offset;
|
||||
literal_start_p[i].u.packed_value = (uint16_t) current_p->offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2315,9 +2315,9 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
|
||||
{
|
||||
lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;
|
||||
|
||||
if (literal_start_p[i].packed_value != 0)
|
||||
if (literal_start_p[i].u.packed_value != 0)
|
||||
{
|
||||
while (current_p->literal_offset != literal_start_p[i].packed_value)
|
||||
while (current_p->literal_offset != literal_start_p[i].u.packed_value)
|
||||
{
|
||||
current_p++;
|
||||
}
|
||||
@@ -2328,12 +2328,12 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
|
||||
|
||||
for (uint32_t i = const_literal_end; i < literal_end; i++)
|
||||
{
|
||||
size_t literal_offset = ((size_t) literal_start_p[i].packed_value) << MEM_ALIGNMENT_LOG;
|
||||
size_t literal_offset = ((size_t) literal_start_p[i].u.packed_value) << MEM_ALIGNMENT_LOG;
|
||||
|
||||
if (literal_offset == offset)
|
||||
{
|
||||
/* Self reference */
|
||||
ECMA_SET_NON_NULL_POINTER (literal_start_p[i].value.base_cp,
|
||||
ECMA_SET_NON_NULL_POINTER (literal_start_p[i].u.value.base_cp,
|
||||
bytecode_p);
|
||||
}
|
||||
else
|
||||
@@ -2344,7 +2344,7 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
|
||||
lit_map_p,
|
||||
copy_bytecode);
|
||||
|
||||
ECMA_SET_NON_NULL_POINTER (literal_start_p[i].value.base_cp,
|
||||
ECMA_SET_NON_NULL_POINTER (literal_start_p[i].u.value.base_cp,
|
||||
literal_bytecode_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
# define __attr_pure___ __attribute__((pure))
|
||||
#endif /* !__attr_pure___ */
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __extension__
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
@@ -570,7 +570,7 @@ lit_literal_exists (lit_literal_t lit) /**< literal to check for existence */
|
||||
lit_literal_t
|
||||
lit_get_literal_by_cp (rcs_cpointer_t lit_cp) /**< compressed pointer to literal */
|
||||
{
|
||||
JERRY_ASSERT (lit_cp.packed_value != MEM_CP_NULL);
|
||||
JERRY_ASSERT (lit_cp.u.packed_value != MEM_CP_NULL);
|
||||
lit_literal_t lit = rcs_cpointer_decompress (lit_cp);
|
||||
JERRY_ASSERT (lit_literal_exists (lit));
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lit_utf8_size_t offset : LIT_ITERATOR_OFFSET_WIDTH; /** offset to utf-8 char */
|
||||
__extension__ lit_utf8_size_t offset : LIT_ITERATOR_OFFSET_WIDTH; /** offset to utf-8 char */
|
||||
bool is_non_bmp_middle: 1; /** flag indicating that current position of the iterator is the middle of
|
||||
* 4-byte char */
|
||||
} lit_utf8_iterator_pos_t;
|
||||
|
||||
@@ -760,7 +760,7 @@ mem_heap_get_chunked_block_start (void *ptr) /**< pointer into a block */
|
||||
JERRY_STATIC_ASSERT ((MEM_HEAP_CHUNK_SIZE & (MEM_HEAP_CHUNK_SIZE - 1u)) == 0);
|
||||
JERRY_STATIC_ASSERT (((uintptr_t) mem_heap.area % MEM_HEAP_CHUNK_SIZE) == 0);
|
||||
|
||||
JERRY_ASSERT (mem_heap.area <= ptr && ptr < (uint8_t *) mem_heap.area + MEM_HEAP_AREA_SIZE);
|
||||
JERRY_ASSERT (mem_heap.area <= (uint8_t *) ptr && (uint8_t *) ptr < (uint8_t *) mem_heap.area + MEM_HEAP_AREA_SIZE);
|
||||
|
||||
uintptr_t uintptr = (uintptr_t) ptr;
|
||||
uintptr_t uintptr_chunk_aligned = JERRY_ALIGNDOWN (uintptr, MEM_HEAP_CHUNK_SIZE);
|
||||
|
||||
@@ -1572,7 +1572,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
|
||||
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
|
||||
{
|
||||
if (literal_p->type == LEXER_NUMBER_LITERAL
|
||||
&& literal_p->u.value.value.base_cp == lit_cp.value.base_cp)
|
||||
&& literal_p->u.value.u.value.base_cp == lit_cp.u.value.base_cp)
|
||||
{
|
||||
context_p->lit_object.literal_p = literal_p;
|
||||
context_p->lit_object.index = (uint16_t) literal_index;
|
||||
|
||||
@@ -535,7 +535,7 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
|
||||
else if ((literal_p->type == LEXER_FUNCTION_LITERAL)
|
||||
|| (literal_p->type == LEXER_REGEXP_LITERAL))
|
||||
{
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[literal_p->prop.index].value.base_cp,
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[literal_p->prop.index].u.value.base_cp,
|
||||
literal_p->u.bytecode_p);
|
||||
}
|
||||
else
|
||||
@@ -579,7 +579,7 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
|
||||
JERRY_ASSERT (literal_p != NULL
|
||||
&& literal_p->type == LEXER_FUNCTION_LITERAL);
|
||||
init_index = literal_p->prop.index;
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[literal_p->prop.index].value.base_cp,
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[literal_p->prop.index].u.value.base_cp,
|
||||
literal_p->u.bytecode_p);
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
|
||||
if (context_p->status_flags & PARSER_NAMED_FUNCTION_EXP)
|
||||
{
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[const_literal_end].value.base_cp,
|
||||
ECMA_SET_NON_NULL_POINTER (literal_pool_p[const_literal_end].u.value.base_cp,
|
||||
compiled_code_p);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@ rcs_cpointer_t
|
||||
rcs_cpointer_compress (rcs_record_t *pointer) /**< pointer to compress */
|
||||
{
|
||||
rcs_cpointer_t cpointer;
|
||||
cpointer.packed_value = 0;
|
||||
cpointer.u.packed_value = 0;
|
||||
|
||||
uintptr_t base_pointer = JERRY_ALIGNDOWN ((uintptr_t) pointer, MEM_ALIGNMENT);
|
||||
|
||||
if ((void *) base_pointer == NULL)
|
||||
{
|
||||
cpointer.value.base_cp = MEM_CP_NULL;
|
||||
cpointer.u.value.base_cp = MEM_CP_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpointer.value.base_cp = mem_compress_pointer ((void *) base_pointer) & MEM_CP_MASK;
|
||||
cpointer.u.value.base_cp = mem_compress_pointer ((void *) base_pointer) & MEM_CP_MASK;
|
||||
}
|
||||
|
||||
#if MEM_ALIGNMENT_LOG > RCS_DYN_STORAGE_LENGTH_UNIT_LOG
|
||||
@@ -55,7 +55,7 @@ rcs_cpointer_compress (rcs_record_t *pointer) /**< pointer to compress */
|
||||
RCS_DYN_STORAGE_LENGTH_UNIT_LOG,
|
||||
MEM_ALIGNMENT_LOG - RCS_DYN_STORAGE_LENGTH_UNIT_LOG);
|
||||
|
||||
cpointer.value.ext = ext_part & ((1ull << (MEM_ALIGNMENT_LOG - RCS_DYN_STORAGE_LENGTH_UNIT_LOG)) - 1);
|
||||
cpointer.u.value.ext = ext_part & ((1ull << (MEM_ALIGNMENT_LOG - RCS_DYN_STORAGE_LENGTH_UNIT_LOG)) - 1);
|
||||
#endif /* MEM_ALIGNMENT > RCS_DYN_STORAGE_LENGTH_UNIT_LOG */
|
||||
JERRY_ASSERT (rcs_cpointer_decompress (cpointer) == pointer);
|
||||
|
||||
@@ -72,9 +72,9 @@ rcs_cpointer_decompress (rcs_cpointer_t compressed_pointer) /**< recordset-speci
|
||||
{
|
||||
uint8_t *base_pointer = NULL;
|
||||
|
||||
if (compressed_pointer.value.base_cp != MEM_CP_NULL)
|
||||
if (compressed_pointer.u.value.base_cp != MEM_CP_NULL)
|
||||
{
|
||||
base_pointer = (uint8_t *) mem_decompress_pointer (compressed_pointer.value.base_cp);
|
||||
base_pointer = (uint8_t *) mem_decompress_pointer (compressed_pointer.u.value.base_cp);
|
||||
}
|
||||
|
||||
uintptr_t diff = 0;
|
||||
@@ -84,7 +84,7 @@ rcs_cpointer_decompress (rcs_cpointer_t compressed_pointer) /**< recordset-speci
|
||||
* rcs_cpointer_compress
|
||||
*/
|
||||
|
||||
diff = (uintptr_t) compressed_pointer.value.ext << RCS_DYN_STORAGE_LENGTH_UNIT_LOG;
|
||||
diff = (uintptr_t) compressed_pointer.u.value.ext << RCS_DYN_STORAGE_LENGTH_UNIT_LOG;
|
||||
#endif /* MEM_ALIGNMENT_LOG > RCS_DYN_STORAGE_LENGTH_UNIT_LOG */
|
||||
rcs_record_t *rec_p = (rcs_record_t *) (base_pointer + diff);
|
||||
|
||||
@@ -99,6 +99,6 @@ rcs_cpointer_decompress (rcs_cpointer_t compressed_pointer) /**< recordset-speci
|
||||
rcs_cpointer_t rcs_cpointer_null_cp (void)
|
||||
{
|
||||
rcs_cpointer_t cp;
|
||||
cp.packed_value = MEM_CP_NULL;
|
||||
cp.u.packed_value = MEM_CP_NULL;
|
||||
return cp;
|
||||
} /* rcs_cpointer_null_cp */
|
||||
|
||||
@@ -34,16 +34,16 @@ typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
mem_cpointer_t base_cp : MEM_CP_WIDTH; /**< pointer to base of addressed area */
|
||||
__extension__ mem_cpointer_t base_cp : MEM_CP_WIDTH; /**< pointer to base of addressed area */
|
||||
#if MEM_ALIGNMENT_LOG > RCS_DYN_STORAGE_LENGTH_UNIT_LOG
|
||||
uint16_t ext : (MEM_ALIGNMENT_LOG - RCS_DYN_STORAGE_LENGTH_UNIT_LOG); /**< extension of the basic
|
||||
* compressed pointer
|
||||
* used for more detailed
|
||||
* addressing */
|
||||
__extension__ uint16_t ext : (MEM_ALIGNMENT_LOG - RCS_DYN_STORAGE_LENGTH_UNIT_LOG); /**< extension of the basic
|
||||
* compressed pointer
|
||||
* used for more detailed
|
||||
* addressing */
|
||||
#endif /* MEM_ALIGNMENT_LOG > RCS_DYN_STORAGE_LENGTH_UNIT_LOG */
|
||||
} value;
|
||||
uint16_t packed_value;
|
||||
};
|
||||
} u;
|
||||
} rcs_cpointer_t;
|
||||
|
||||
extern rcs_cpointer_t rcs_cpointer_compress (rcs_record_t *);
|
||||
|
||||
@@ -68,7 +68,7 @@ rcs_record_set_prev (rcs_record_set_t *rec_sec_p, /**< recordset */
|
||||
rcs_iterator_t it_ctx = rcs_iterator_create (rec_sec_p, rec_p);
|
||||
|
||||
rcs_iterator_skip (&it_ctx, RCS_DYN_STORAGE_LENGTH_UNIT);
|
||||
rcs_iterator_write (&it_ctx, &prev_cpointer.packed_value, sizeof (uint16_t));
|
||||
rcs_iterator_write (&it_ctx, &prev_cpointer.u.packed_value, sizeof (uint16_t));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ rcs_record_set_prev (rcs_record_set_t *rec_sec_p, /**< recordset */
|
||||
}
|
||||
|
||||
rcs_cpointer_t cpointer = rcs_cpointer_compress (prev_p);
|
||||
rcs_record_set_field (rec_p, begin_pos, RCS_CPOINTER_WIDTH, cpointer.packed_value);
|
||||
rcs_record_set_field (rec_p, begin_pos, RCS_CPOINTER_WIDTH, cpointer.u.packed_value);
|
||||
} /* rcs_record_set_prev */
|
||||
|
||||
/**
|
||||
@@ -239,10 +239,10 @@ rcs_record_get_pointer (rcs_record_t *rec_p, /**< record */
|
||||
|
||||
uint16_t value = (uint16_t) rcs_record_get_field (rec_p, field_pos, field_width);
|
||||
|
||||
JERRY_ASSERT (sizeof (cpointer) == sizeof (cpointer.value));
|
||||
JERRY_ASSERT (sizeof (value) == sizeof (cpointer.value));
|
||||
JERRY_ASSERT (sizeof (cpointer) == sizeof (cpointer.u.value));
|
||||
JERRY_ASSERT (sizeof (value) == sizeof (cpointer.u.value));
|
||||
|
||||
cpointer.packed_value = value;
|
||||
cpointer.u.packed_value = value;
|
||||
|
||||
return rcs_cpointer_decompress (cpointer);
|
||||
} /* rcs_record_get_pointer */
|
||||
@@ -279,7 +279,7 @@ rcs_record_get_prev (rcs_record_set_t *rec_sec_p, /**< recordset */
|
||||
rcs_iterator_t it_ctx = rcs_iterator_create (rec_sec_p, rec_p);
|
||||
|
||||
rcs_iterator_skip (&it_ctx, RCS_DYN_STORAGE_LENGTH_UNIT);
|
||||
rcs_iterator_read (&it_ctx, &cpointer.packed_value, sizeof (uint16_t));
|
||||
rcs_iterator_read (&it_ctx, &cpointer.u.packed_value, sizeof (uint16_t));
|
||||
|
||||
return rcs_cpointer_decompress (cpointer);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
ecma_collection_chunk_t *chunk_p = MEM_CP_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
|
||||
current);
|
||||
|
||||
ecma_free_value (*(ecma_value_t *) chunk_p->data, true);
|
||||
lit_utf8_byte_t *data_ptr = chunk_p->data;
|
||||
ecma_free_value (*(ecma_value_t *) data_ptr, true);
|
||||
|
||||
current = chunk_p->next_chunk_cp;
|
||||
ecma_dealloc_collection_chunk (chunk_p);
|
||||
|
||||
+5
-3
@@ -281,7 +281,7 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
lit_cpointer_t lit_cp) /**< literal */
|
||||
{
|
||||
ecma_compiled_code_t *bytecode_p = ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
|
||||
lit_cp.value.base_cp);
|
||||
lit_cp.u.value.base_cp);
|
||||
bool is_function = ((bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION) != 0);
|
||||
|
||||
if (is_function)
|
||||
@@ -1859,7 +1859,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
JERRY_ASSERT (VM_GET_CONTEXT_TYPE (context_top_p[-1]) == VM_CONTEXT_FOR_IN);
|
||||
|
||||
result = *(ecma_value_t *) chunk_p->data;
|
||||
lit_utf8_byte_t *data_ptr = chunk_p->data;
|
||||
result = *(ecma_value_t *) data_ptr;
|
||||
context_top_p[-2] = chunk_p->next_chunk_cp;
|
||||
|
||||
ecma_dealloc_collection_chunk (chunk_p);
|
||||
@@ -1882,7 +1883,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
ecma_collection_chunk_t *chunk_p = MEM_CP_GET_NON_NULL_POINTER (ecma_collection_chunk_t, stack_top_p[-2]);
|
||||
|
||||
ecma_string_t *prop_name_p = ecma_get_string_from_value (*(ecma_value_t *) chunk_p->data);
|
||||
lit_utf8_byte_t *data_ptr = chunk_p->data;
|
||||
ecma_string_t *prop_name_p = ecma_get_string_from_value (*(ecma_value_t *) data_ptr);
|
||||
|
||||
if (ecma_op_object_get_property (ecma_get_object_from_value (stack_top_p[-3]),
|
||||
prop_name_p) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user