Switching to g++ and corresponding changes according to C++ requirements.
This commit is contained in:
+12
-7
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,11 +16,14 @@
|
||||
#include "globals.h"
|
||||
#include "mem-allocator.h"
|
||||
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
extern int printf (__const char *__restrict __format, ...);
|
||||
extern void *memset (void *__s, int __c, size_t __n);
|
||||
extern "C"
|
||||
{
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
extern int printf (__const char *__restrict __format, ...);
|
||||
extern void *memset (void *__s, int __c, size_t __n);
|
||||
}
|
||||
|
||||
// Heap size is 32K
|
||||
#define test_heap_size (32 * 1024)
|
||||
@@ -101,7 +104,9 @@ main( int __unused argc,
|
||||
for ( uint32_t j = 0; j < test_sub_iters; j++ )
|
||||
{
|
||||
size_t size = (unsigned int) rand() % ( test_threshold_block_size );
|
||||
ptrs[j] = mem_heap_alloc_block( size, ( rand() % 2 ) ? MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
||||
ptrs[j] = (uint8_t*) mem_heap_alloc_block (size,
|
||||
(rand() % 2) ?
|
||||
MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
||||
sizes[j] = size;
|
||||
|
||||
JERRY_ASSERT(size == 0 || ptrs[j] != NULL);
|
||||
|
||||
+17
-9
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,11 +20,14 @@
|
||||
#include "mem-pool.h"
|
||||
#include "mem-poolman.h"
|
||||
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
extern int printf (__const char *__restrict __format, ...);
|
||||
extern void *memset (void *__s, int __c, size_t __n);
|
||||
extern "C"
|
||||
{
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
extern int printf (__const char *__restrict __format, ...);
|
||||
extern void *memset (void *__s, int __c, size_t __n);
|
||||
}
|
||||
|
||||
// Iterations count
|
||||
const uint32_t test_iters = 64;
|
||||
@@ -32,6 +35,11 @@ const uint32_t test_iters = 64;
|
||||
// Subiterations count
|
||||
const uint32_t test_max_sub_iters = 1024;
|
||||
|
||||
#define TEST_POOL_SPACE_SIZE (sizeof (mem_pool_state_t) + (1ull << MEM_POOL_MAX_CHUNKS_NUMBER_LOG) * MEM_POOL_CHUNK_SIZE)
|
||||
uint8_t test_pool [TEST_POOL_SPACE_SIZE] __attribute__((aligned(MEM_ALIGNMENT)));
|
||||
|
||||
uint8_t* ptrs[test_max_sub_iters];
|
||||
|
||||
int
|
||||
main( int __unused argc,
|
||||
char __unused **argv)
|
||||
@@ -43,13 +51,13 @@ main( int __unused argc,
|
||||
|
||||
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||
{
|
||||
uint8_t test_pool[MEM_POOL_SIZE] __attribute__((aligned(MEM_ALIGNMENT)));
|
||||
mem_pool_state_t* pool_p = (mem_pool_state_t*) test_pool;
|
||||
|
||||
mem_pool_init( pool_p, MEM_POOL_SIZE);
|
||||
JERRY_ASSERT (MEM_POOL_SIZE <= TEST_POOL_SPACE_SIZE);
|
||||
|
||||
mem_pool_init (pool_p, MEM_POOL_SIZE);
|
||||
|
||||
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
||||
uint8_t* ptrs[subiters];
|
||||
|
||||
for ( size_t j = 0; j < subiters; j++ )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,9 +25,12 @@
|
||||
#include "mem-pool.h"
|
||||
#include "mem-poolman.h"
|
||||
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
extern "C"
|
||||
{
|
||||
extern void srand (unsigned int __seed);
|
||||
extern int rand (void);
|
||||
extern long int time (long int *__timer);
|
||||
}
|
||||
|
||||
// Iterations count
|
||||
const uint32_t test_iters = 16384;
|
||||
@@ -35,6 +38,8 @@ const uint32_t test_iters = 16384;
|
||||
// Subiterations count
|
||||
const uint32_t test_max_sub_iters = 32;
|
||||
|
||||
uint8_t *ptrs[test_max_sub_iters];
|
||||
|
||||
int
|
||||
main( int __unused argc,
|
||||
char __unused **argv)
|
||||
@@ -50,7 +55,6 @@ main( int __unused argc,
|
||||
{
|
||||
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
||||
|
||||
uint8_t *ptrs[subiters];
|
||||
for ( size_t j = 0; j < subiters; j++ )
|
||||
{
|
||||
ptrs[j] = mem_pools_alloc();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,13 +37,15 @@ main( int __unused argc,
|
||||
parser_parse_program ();
|
||||
parser_free ();
|
||||
|
||||
if (!opcodes_equal(deserialize_bytecode (), (opcode_t[]) {
|
||||
[0] = getop_reg_var_decl (128, 129), // var tmp128 .. tmp129;
|
||||
[1] = getop_var_decl (0), // var a;
|
||||
[2] = getop_assignment (129, 1, 1), // tmp129 = 1: SMALLINT;
|
||||
[3] = getop_assignment (0, 6, 129), // a = tmp129 : TYPEOF(tmp129);
|
||||
[4] = getop_exitval (0) // exit 0;
|
||||
}, 5))
|
||||
opcode_t opcodes[] = {
|
||||
getop_reg_var_decl (128, 129), // var tmp128 .. tmp129;
|
||||
getop_var_decl (0), // var a;
|
||||
getop_assignment (129, 1, 1), // tmp129 = 1: SMALLINT;
|
||||
getop_assignment (0, 6, 129), // a = tmp129 : TYPEOF(tmp129);
|
||||
getop_exitval (0) // exit 0;
|
||||
};
|
||||
|
||||
if (!opcodes_equal((const opcode_t *) deserialize_bytecode (), opcodes, 5))
|
||||
{
|
||||
is_ok = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user