mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Merge branch 'master' of git-server:jerry
This commit is contained in:
commit
74a0f470d2
12
Makefile
12
Makefile
@ -68,18 +68,18 @@ SIZE = $(CROSS_COMPILE)size
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
|
||||
# General flags
|
||||
CFLAGS ?= $(INCLUDES) -std=c99 -m32 #-fdiagnostics-color=always
|
||||
#CFLAGS += -Wall -Wextra -Wpedantic -Wlogical-op -Winline
|
||||
#CFLAGS += -Wformat-nonliteral -Winit-self -Wstack-protector
|
||||
#CFLAGS += -Wconversion -Wsign-conversion -Wformat-security
|
||||
#CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS ?= $(INCLUDES) -std=c99 #-fdiagnostics-color=always
|
||||
CFLAGS += -Wall -Wextra -Wpedantic -Wlogical-op -Winline
|
||||
CFLAGS += -Wformat-nonliteral -Winit-self -Wstack-protector
|
||||
CFLAGS += -Wconversion -Wsign-conversion -Wformat-security
|
||||
CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
# Flags for MCU
|
||||
MCU_CFLAGS += -mlittle-endian -mcpu=cortex-m4 -march=armv7e-m -mthumb
|
||||
MCU_CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
MCU_CFLAGS += -ffunction-sections -fdata-sections
|
||||
|
||||
DEBUG_OPTIONS = -g3 -O0 -DJERRY_NDEBUG# -fsanitize=address
|
||||
DEBUG_OPTIONS = -g3 -O0 # -fsanitize=address
|
||||
RELEASE_OPTIONS = -Os -Werror -DJERRY_NDEBUG
|
||||
|
||||
DEFINES = -DMEM_HEAP_CHUNK_SIZE=256 -DMEM_HEAP_AREA_SIZE=32768 -DMEM_STATS
|
||||
|
||||
@ -55,7 +55,11 @@ typedef signed int int32_t;
|
||||
*/
|
||||
#define JERRY_STATIC_ASSERT_GLUE_( a, b ) a ## b
|
||||
#define JERRY_STATIC_ASSERT_GLUE( a, b ) JERRY_STATIC_ASSERT_GLUE_( a, b )
|
||||
#define JERRY_STATIC_ASSERT( x ) typedef char JERRY_STATIC_ASSERT_GLUE( static_assertion_failed_, __LINE__) [ ( x ) ? 1 : -1 ]
|
||||
#define JERRY_STATIC_ASSERT( x ) typedef char JERRY_STATIC_ASSERT_GLUE( static_assertion_failed_, __LINE__) [ ( x ) ? 1 : -1 ] __unused
|
||||
|
||||
#define CALL_PRAGMA(x) _Pragma (#x)
|
||||
#define TODO(x) CALL_PRAGMA(message ("TODO - " #x))
|
||||
#define FIXME(x) CALL_PRAGMA(message ("FIXME - " #x))
|
||||
|
||||
/**
|
||||
* Variable that must not be referenced.
|
||||
|
||||
@ -96,9 +96,9 @@ typedef struct
|
||||
*/
|
||||
mem_HeapState_t mem_Heap;
|
||||
|
||||
static inline size_t mem_get_block_chunks_count( const mem_BlockHeader_t *block_header_p);
|
||||
static inline size_t mem_get_block_data_space_size( const mem_BlockHeader_t *block_header_p);
|
||||
static inline size_t mem_get_block_chunks_count_from_data_size( size_t block_allocated_size);
|
||||
static size_t mem_get_block_chunks_count( const mem_BlockHeader_t *block_header_p);
|
||||
static size_t mem_get_block_data_space_size( const mem_BlockHeader_t *block_header_p);
|
||||
static size_t mem_get_block_chunks_count_from_data_size( size_t block_allocated_size);
|
||||
|
||||
static void mem_InitBlockHeader( uint8_t *pFirstChunk,
|
||||
size_t sizeInChunks,
|
||||
@ -119,7 +119,7 @@ static void mem_HeapStatFreeBlock( mem_BlockHeader_t *block_header_p);
|
||||
static void mem_HeapStatFreeBlockSplit( void);
|
||||
static void mem_HeapStatFreeBlockMerge( void);
|
||||
#else /* !MEM_STATS */
|
||||
# define mem_InitStats()
|
||||
# define mem_HeapStatInit()
|
||||
# define mem_HeapStatAllocBlock( v)
|
||||
# define mem_HeapStatFreeBlock( v)
|
||||
# define mem_HeapStatFreeBlockSplit()
|
||||
@ -131,7 +131,7 @@ static void mem_HeapStatFreeBlockMerge( void);
|
||||
*
|
||||
* @return chunks count
|
||||
*/
|
||||
static inline size_t
|
||||
static size_t
|
||||
mem_get_block_chunks_count( const mem_BlockHeader_t *block_header_p) /**< block header */
|
||||
{
|
||||
JERRY_ASSERT( block_header_p != NULL );
|
||||
@ -158,7 +158,7 @@ mem_get_block_chunks_count( const mem_BlockHeader_t *block_header_p) /**< block
|
||||
*
|
||||
* @return size of block area that can be used to store data
|
||||
*/
|
||||
static inline size_t
|
||||
static size_t
|
||||
mem_get_block_data_space_size( const mem_BlockHeader_t *block_header_p) /**< block header */
|
||||
{
|
||||
return mem_get_block_chunks_count( block_header_p) * MEM_HEAP_CHUNK_SIZE - sizeof (mem_BlockHeader_t);
|
||||
@ -169,7 +169,7 @@ mem_get_block_data_space_size( const mem_BlockHeader_t *block_header_p) /**< blo
|
||||
*
|
||||
* @return chunks count
|
||||
*/
|
||||
static inline size_t
|
||||
static size_t
|
||||
mem_get_block_chunks_count_from_data_size( size_t block_allocated_size) /**< size of block's allocated area */
|
||||
{
|
||||
return JERRY_ALIGNUP( sizeof (mem_BlockHeader_t) + block_allocated_size, MEM_HEAP_CHUNK_SIZE) / MEM_HEAP_CHUNK_SIZE;
|
||||
|
||||
@ -65,13 +65,28 @@ static void mem_PoolsStatFreePool( mem_PoolChunkType_t);
|
||||
static void mem_PoolsStatAllocChunk( mem_PoolChunkType_t);
|
||||
static void mem_PoolsStatFreeChunk( mem_PoolChunkType_t);
|
||||
#else /* !MEM_STATS */
|
||||
# define mem_PoolsStatsInit()
|
||||
# define mem_PoolsStatAllocPool()
|
||||
# define mem_PoolsStatsFreePool()
|
||||
# define mem_PoolsStatAllocChunk()
|
||||
# define mem_PoolsStatFreeChunk()
|
||||
# define mem_PoolsStatInit()
|
||||
# define mem_PoolsStatAllocPool(v)
|
||||
# define mem_PoolsStatFreePool(v)
|
||||
# define mem_PoolsStatAllocChunk(v)
|
||||
# define mem_PoolsStatFreeChunk(v)
|
||||
#endif /* !MEM_STATS */
|
||||
|
||||
/**
|
||||
* Get chunk size from chunk type.
|
||||
*
|
||||
* @return size (in bytes) of chunk of specified type
|
||||
*/
|
||||
size_t
|
||||
mem_GetChunkSize( mem_PoolChunkType_t chunkType) /**< chunk type */
|
||||
{
|
||||
uint32_t chunkTypeId = (uint32_t) chunkType;
|
||||
|
||||
JERRY_ASSERT( chunkTypeId < MEM_POOL_CHUNK_TYPE__COUNT );
|
||||
|
||||
return ( 1u << ( chunkTypeId + 2 ) );
|
||||
} /* mem_GetChunkSize */
|
||||
|
||||
/**
|
||||
* Initialize pool manager
|
||||
*/
|
||||
|
||||
@ -51,21 +51,7 @@ typedef enum {
|
||||
((size) == 64 ? MEM_POOL_CHUNK_TYPE_64 : \
|
||||
jerry_UnreferencedExpression)))))
|
||||
|
||||
/**
|
||||
* Get chunk size from chunk type.
|
||||
*
|
||||
* @return size (in bytes) of chunk of specified type
|
||||
*/
|
||||
static inline size_t
|
||||
mem_GetChunkSize( mem_PoolChunkType_t chunkType) /**< chunk type */
|
||||
{
|
||||
uint32_t chunkTypeId = (uint32_t) chunkType;
|
||||
|
||||
JERRY_ASSERT( chunkTypeId < MEM_POOL_CHUNK_TYPE__COUNT );
|
||||
|
||||
return ( 1u << ( chunkTypeId + 2 ) );
|
||||
} /* mem_GetChunkSize */
|
||||
|
||||
extern size_t mem_GetChunkSize( mem_PoolChunkType_t chunkType);
|
||||
|
||||
extern void mem_PoolsInit(void);
|
||||
extern uint8_t* mem_PoolsAlloc(mem_PoolChunkType_t chunkType);
|
||||
|
||||
@ -32,12 +32,12 @@ gen_bytecode ()
|
||||
wait(500);
|
||||
}
|
||||
*/
|
||||
// save_op_data (0, getop_loop_inf (1));
|
||||
// save_op_data (1, getop_call_1 (0, 12));
|
||||
// save_op_data (2, getop_call_1 (0, 13));
|
||||
// save_op_data (3, getop_call_1 (0, 14));
|
||||
// save_op_data (4, getop_call_1 (0, 15));
|
||||
// save_op_data (5, getop_jmp (0));
|
||||
// save_op_data (0, getop_loop_inf (1));
|
||||
// save_op_data (1, getop_call_1 (0, 12));
|
||||
// save_op_data (2, getop_call_1 (0, 13));
|
||||
// save_op_data (3, getop_call_1 (0, 14));
|
||||
// save_op_data (4, getop_call_1 (0, 15));
|
||||
// save_op_data (5, getop_jmp (0));
|
||||
|
||||
#ifdef __MCU
|
||||
// It's mandatory to restart app!
|
||||
@ -64,7 +64,7 @@ run_int ()
|
||||
|
||||
while (true)
|
||||
{
|
||||
run_int_from_pos(&int_data);
|
||||
run_int_from_pos (&int_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,10 +31,10 @@ opfunc __opfuncs[LAST_OP];
|
||||
|
||||
struct __int_data
|
||||
{
|
||||
int pos;
|
||||
int pos; /**< current opcode to execute */
|
||||
ecma_Object_t *pThisBinding; /**< this binding for current context */
|
||||
ecma_Object_t *pLexEnv; /**< current lexical environment */
|
||||
int *root_op_addr;
|
||||
int *root_op_addr; /**< pointer to first opcode saved */
|
||||
};
|
||||
|
||||
void gen_bytecode (void);
|
||||
|
||||
@ -77,7 +77,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: Call parser
|
||||
TODO(Call parser);
|
||||
|
||||
//gen_bytecode (generated_source);
|
||||
//gen_bytecode ();
|
||||
|
||||
@ -93,8 +93,10 @@ main( int __unused argc,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MEM_STATS
|
||||
mem_PoolsStats_t stats;
|
||||
mem_PoolsGetStats( &stats);
|
||||
#endif /* MEM_STATS */
|
||||
|
||||
__printf("Pools stats:\n");
|
||||
for(mem_PoolChunkType_t type = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user