WebAssembly Micro Runtime first version

This commit is contained in:
Wang Xin
2019-05-07 10:18:18 +08:00
parent 15aa50914b
commit a75a5f0f41
252 changed files with 33487 additions and 0 deletions

View File

@ -0,0 +1,84 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BH_ASSERT_H
#define _BH_ASSERT_H
#include "bh_config.h"
#include "bh_platform.h"
#ifdef BH_TEST
# ifndef BH_DEBUG
# error "BH_TEST should be defined under BH_DEBUG"
# endif
#endif
#ifdef BH_TEST
# if defined(WIN32) || defined(__linux__)
# else
# error "Test case can not run on the current platform"
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BH_DEBUG
extern void bh_assert_internal(int v, const char *file_name, int line_number, const char *expr_string);
#define bh_assert(expr) bh_assert_internal((int)(expr), __FILE__, __LINE__, # expr)
extern void bh_debug_internal(const char *file_name, int line_number, const char *fmt, ...);
#if defined(WIN32) || defined(EMU)
# define bh_debug(fmt, ...) bh_debug_internal(__FILE__, __LINE__, fmt, __VA_ARGS__)
#elif defined(__linux__)
/*# define bh_debug(...) bh_debug_internal(__FILE__, __LINE__, ## __VA_ARGS__)*/
# define bh_debug bh_debug_internal(__FILE__, __LINE__, "");printf
#elif defined(PLATFORM_SEC)
# define bh_debug(fmt, ...) bh_debug_internal(__FILE__, __LINE__, fmt, __VA_ARGS__)
#else
# error "Unsupported platform"
#endif
#else
#define bh_debug if(0)printf
#endif
#define bh_assert_abort(x) do { \
if (!x) \
abort(); \
} while (0)
#ifdef BH_TEST
# define BH_STATIC
#else
# define BH_STATIC static
#endif
#ifdef __cplusplus
}
#endif
#endif
/* Local Variables: */
/* mode:c */
/* c-basic-offset: 4 */
/* indent-tabs-mode: nil */
/* End: */

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file bh_config.h
* @date Tue Sep 13 14:53:17 2011
*
* @brief Configurations for different platforms and targets. Make
* sure all source files in Beihai project include this header file
* directly or indirectly.
*/
#ifndef BH_CONFIG
#include "config.h"
#endif /* end of BH_CONFIG */

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BH_DEFINITION_H
#define _BH_DEFINITION_H
#include "bh_config.h"
typedef enum {
BH_FAILED = -100,
BH_UNKOWN = -99,
BH_MAGIC_UNMATCH = -12,
BH_UNIMPLEMENTED = -11,
BH_INTR = -10,
BH_CLOSED = -9,
BH_BUFFER_OVERFLOW = -8, /* TODO: no used error, should remove*/
BH_NOT_SUPPORTED = -7,
BH_WEAR_OUT_VIOLATION = -6,
BH_NOT_FOUND = -5,
BH_INVALID_PARAMS = -4,
BH_ACCESS_DENIED = -3,
BH_OUT_OF_MEMORY = -2,
BH_INVALID = -1,
BH_SUCCESS = 0,
BH_TIMEOUT = 2
} bh_status;
#endif

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BH_PLATFORM_LOG
#define BH_PLATFORM_LOG
#include "bh_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
void bh_log_emit(const char *fmt, va_list ap);
int bh_fprintf(void *stream, const char *fmt, ...);
int bh_fflush(void *stream);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,409 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BH_THREAD_H
#define _BH_THREAD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "bh_config.h"
#include "bh_platform.h"
#define BH_MAX_THREAD 32
#define BH_MAX_TLS_NUM 2
#define BHT_ERROR (-1)
#define BHT_TIMED_OUT (1)
#define BHT_OK (0)
#define BHT_NO_WAIT 0x00000000
#define BHT_WAIT_FOREVER 0xFFFFFFFF
/**
* vm_thread_sys_init
* initiation function for beihai thread system. Invoked at the beginning of beihai intiation.
*
* @return BH_SUCCESS if succuess.
*/
int _vm_thread_sys_init(void);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_sys_init_instr(const char*func_name);
#define vm_thread_sys_init(void) vm_thread_sys_init_instr(__FUNCTION__)
#else
#define vm_thread_sys_init _vm_thread_sys_init
#endif
void vm_thread_sys_destroy(void);
/**
* This function creates a thread
*
* @param p_tid [OUTPUT] the pointer of tid
* @param start main routine of the thread
* @param arg argument passed to main routine
* @param stack_size bytes of stack size
*
* @return BH_SUCCESS if success.
*/
int _vm_thread_create(korp_tid *p_tid, thread_start_routine_t start, void *arg,
unsigned int stack_size);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_create_instr(korp_tid *p_tid, thread_start_routine_t start, void *arg, unsigned int stack_size, const char*func_name);
#define vm_thread_create(p_tid, start, arg, stack_size) vm_thread_create_instr(p_tid, start, arg, stack_size, __FUNCTION__)
#else
#define vm_thread_create _vm_thread_create
#endif
/**
* This function creates a thread
*
* @param p_tid [OUTPUT] the pointer of tid
* @param start main routine of the thread
* @param arg argument passed to main routine
* @param stack_size bytes of stack size
* @param prio the priority
*
* @return BH_SUCCESS if success.
*/
int _vm_thread_create_with_prio(korp_tid *p_tid, thread_start_routine_t start,
void *arg, unsigned int stack_size, int prio);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_create_with_prio_instr(korp_tid *p_tid, thread_start_routine_t start, void *arg, unsigned int stack_size, int prio, const char*func_name);
#define vm_thread_create_with_prio(p_tid, start, arg, stack_size) vm_thread_create_instr(p_tid, start, arg, stack_size, prio, __FUNCTION__)
#else
#define vm_thread_create_with_prio _vm_thread_create_with_prio
#endif
/**
* This function never returns.
*
* @param code not used
*/
void vm_thread_exit(void *code);
/**
* This function gets current thread id
*
* @return current thread id
*/
korp_tid _vm_self_thread(void);
#ifdef _INSTRUMENT_TEST_ENABLED
korp_tid vm_self_thread_instr(const char*func_name);
#define vm_self_thread(void) vm_self_thread_instr(__FUNCTION__)
#else
#define vm_self_thread _vm_self_thread
#endif
/**
* This function saves a pointer in thread local storage. One thread can only save one pointer.
*
* @param idx tls array index
* @param ptr pointer need save as TLS
*
* @return BH_SUCCESS if success
*/
int _vm_tls_put(unsigned idx, void *ptr);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_tls_put_instr(unsigned idx, void *ptr, const char*func_name);
#define vm_tls_put(idx, ptr) vm_tls_put_instr(idx, ptr, __FUNCTION__)
#else
#define vm_tls_put _vm_tls_put
#endif
/**
* This function gets a pointer saved in TLS.
*
* @param idx tls array index
*
* @return the pointer saved in TLS.
*/
void *_vm_tls_get(unsigned idx);
#ifdef _INSTRUMENT_TEST_ENABLED
void *vm_tls_get_instr(unsigned idx, const char*func_name);
#define vm_tls_get(idx) vm_tls_get_instr(idx, __FUNCTION__)
#else
#define vm_tls_get _vm_tls_get
#endif
#define vm_thread_testcancel(void)
/**
* This function creates a non-recursive mutex
*
* @param mutex [OUTPUT] pointer to mutex initialized.
*
* @return BH_SUCCESS if success
*/
int _vm_mutex_init(korp_mutex *mutex);
#ifdef INSTRUMENT_TEST_ENABLED
int vm_mutex_init_instr(korp_mutex *mutex, const char*func_name);
#define vm_mutex_init(mutex) vm_mutex_init_instr(mutex, __FUNCTION__)
#else
#define vm_mutex_init _vm_mutex_init
#endif
/**
* This function creates a recursive mutex
*
* @param mutex [OUTPUT] pointer to mutex initialized.
*
* @return BH_SUCCESS if success
*/
int _vm_recursive_mutex_init(korp_mutex *mutex);
#ifdef INSTRUMENT_TEST_ENABLED
int vm_recursive_mutex_init_instr(korp_mutex *mutex, const char*func_name);
#define vm_recursive_mutex_init(mutex) vm_recursive_mutex_init_instr(mutex, __FUNCTION__)
#else
#define vm_recursive_mutex_init _vm_recursive_mutex_init
#endif
/**
* This function destorys a mutex
*
* @param mutex pointer to mutex need destory
*
* @return BH_SUCCESS if success
*/
int _vm_mutex_destroy(korp_mutex *mutex);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_mutex_destroy_instr(korp_mutex *mutex, const char*func_name);
#define vm_mutex_destroy(mutex) vm_mutex_destroy_instr(mutex, __FUNCTION__)
#else
#define vm_mutex_destroy _vm_mutex_destroy
#endif
/**
* This function locks the mutex
*
* @param mutex pointer to mutex need lock
*
* @return Void
*/
void vm_mutex_lock(korp_mutex *mutex);
/**
* This function locks the mutex without waiting
*
* @param mutex pointer to mutex need lock
*
* @return BH_SUCCESS if success
*/
int vm_mutex_trylock(korp_mutex *mutex);
/**
* This function unlocks the mutex
*
* @param mutex pointer to mutex need unlock
*
* @return Void
*/
void vm_mutex_unlock(korp_mutex *mutex);
/**
* This function creates a semaphone
*
* @param sem [OUTPUT] pointer to semaphone
* @param c counter of semaphone
*
* @return BH_SUCCESS if success
*/
int _vm_sem_init(korp_sem *sem, unsigned int c);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_sem_init_instr(korp_sem *sem, unsigned int c, const char*func_name);
#define vm_sem_init(sem, c) vm_sem_init_instr(sem, c, __FUNCTION__)
#else
#define vm_sem_init _vm_sem_init
#endif
/**
* This function destroys a semaphone
*
* @param sem pointer to semaphone need destroy
*
* @return BH_SUCCESS if success
*/
int _vm_sem_destroy(korp_sem *sem);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_sem_destroy_instr(korp_sem *sem, const char*func_name);
#define vm_sem_destroy(sem) vm_sem_destroy_instr(sem, __FUNCTION__)
#else
#define vm_sem_destroy _vm_sem_destroy
#endif
/**
* This function performs wait operation on semaphone
*
* @param sem pointer to semaphone need perform wait operation
*
* @return BH_SUCCESS if success
*/
int _vm_sem_wait(korp_sem *sem);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_sem_wait_instr(korp_sem *sem, const char*func_name);
#define vm_sem_wait(sem) vm_sem_wait_instr(sem, __FUNCTION__)
#else
#define vm_sem_wait _vm_sem_wait
#endif
/**
* This function performs wait operation on semaphone with a timeout
*
* @param sem pointer to semaphone need perform wait operation
* @param mills wait milliseconds to return
*
* @return BH_SUCCESS if success
* @return BH_TIMEOUT if time out
*/
int _vm_sem_reltimedwait(korp_sem *sem, int mills);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_sem_reltimedwait_instr(korp_sem *sem, int mills, const char*func_name);
#define vm_sem_reltimedwait(sem, mills) vm_sem_reltimedwait_instr(sem, mills, __FUNCTION__)
#else
#define vm_sem_reltimedwait _vm_sem_reltimedwait
#endif
/**
* This function performs post operation on semaphone
*
* @param sem pointer to semaphone need perform post operation
*
* @return BH_SUCCESS if success
*/
int _vm_sem_post(korp_sem *sem);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_sem_post_instr(korp_sem *sem, const char*func_name);
#define vm_sem_post(sem) vm_sem_post_instr(sem, __FUNCTION__)
#else
#define vm_sem_post _vm_sem_post
#endif
/**
* This function creates a condition variable
*
* @param cond [OUTPUT] pointer to condition variable
*
* @return BH_SUCCESS if success
*/
int _vm_cond_init(korp_cond *cond);
#ifdef INSTRUMENT_TEST_ENABLED
int vm_cond_init_instr(korp_cond *cond, const char*func_name);
#define vm_cond_init(cond) vm_cond_init_instr(cond, __FUNCTION__)
#else
#define vm_cond_init _vm_cond_init
#endif
/**
* This function destorys condition variable
*
* @param cond pointer to condition variable
*
* @return BH_SUCCESS if success
*/
int _vm_cond_destroy(korp_cond *cond);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_cond_destroy_instr(korp_cond *cond, const char*func_name);
#define vm_cond_destroy(cond) vm_cond_destroy_instr(cond, __FUNCTION__)
#else
#define vm_cond_destroy _vm_cond_destroy
#endif
/**
* This function will block on a condition varible.
*
* @param cond pointer to condition variable
* @param mutex pointer to mutex to protect the condition variable
*
* @return BH_SUCCESS if success
*/
int _vm_cond_wait(korp_cond *cond, korp_mutex *mutex);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_cond_wait_instr(korp_cond *cond, korp_mutex *mutex, const char*func_name);
#define vm_cond_wait(cond, mutex) vm_cond_wait_instr(cond, mutex, __FUNCTION__)
#else
#define vm_cond_wait _vm_cond_wait
#endif
/**
* This function will block on a condition varible or return if time specified passes.
*
* @param cond pointer to condition variable
* @param mutex pointer to mutex to protect the condition variable
* @param mills milliseconds to wait
*
* @return BH_SUCCESS if success
*/
int _vm_cond_reltimedwait(korp_cond *cond, korp_mutex *mutex, int mills);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_cond_reltimedwait_instr(korp_cond *cond, korp_mutex *mutex, int mills, const char*func_name);
#define vm_cond_reltimedwait(cond, mutex, mills) vm_cond_reltimedwait_instr(cond, mutex, mills, __FUNCTION__)
#else
#define vm_cond_reltimedwait _vm_cond_reltimedwait
#endif
/**
* This function signals the condition variable
*
* @param cond condition variable
*
* @return BH_SUCCESS if success
*/
int _vm_cond_signal(korp_cond *cond);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_cond_signal_instr(korp_cond *cond, const char*func_name);
#define vm_cond_signal(cond) vm_cond_signal_instr(cond, __FUNCTION__)
#else
#define vm_cond_signal _vm_cond_signal
#endif
int _vm_cond_broadcast(korp_cond *cond);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_cond_broadcast_instr(korp_cond *cond, const char*func_name);
#define vm_cond_broadcast(cond) vm_cond_broadcast_instr(cond, __FUNCTION__)
#else
#define vm_cond_broadcast _vm_cond_broadcast
#endif
int _vm_thread_cancel(korp_tid thread);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_cancel_instr(korp_tid thread, const char*func_name);
#define vm_thread_cancel(thread) vm_thread_cancel_instr(thread, __FUNCTION__)
#else
#define vm_thread_cancel _vm_thread_cancel
#endif
int _vm_thread_join(korp_tid thread, void **value_ptr, int mills);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_join_instr(korp_tid thread, void **value_ptr, int mills, const char*func_name);
#define vm_thread_join(thread, value_ptr, mills) vm_thread_join_instr(thread, value_ptr, mills, __FUNCTION__)
#else
#define vm_thread_join _vm_thread_join
#endif
int _vm_thread_detach(korp_tid thread);
#ifdef _INSTRUMENT_TEST_ENABLED
int vm_thread_detach_instr(korp_tid thread, const char*func_name);
#define vm_thread_detach(thread) vm_thread_detach_instr(thread, __FUNCTION__)
#else
#define vm_thread_detach _vm_thread_detach
#endif
#ifdef __cplusplus
}
#endif
#endif /* #ifndef _BH_THREAD_H */

View File

@ -0,0 +1,98 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BH_TIME_H
#define _BH_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
#include "bh_config.h"
#include "bh_definition.h"
#include "bh_types.h"
#include "bh_platform.h"
/*
* This function returns milliseconds per tick.
* @return milliseconds per tick.
*/
extern uint64 _bh_time_get_tick_millisecond(void);
#ifdef _INSTRUMENT_TEST_ENABLED
extern uint64 bh_time_get_tick_millisecond_instr(const char*func_name);
#define bh_time_get_tick_millisecond() bh_time_get_tick_millisecond_instr(__FUNCTION__)
#else
#define bh_time_get_tick_millisecond _bh_time_get_tick_millisecond
#endif
/*
* This function returns milliseconds after boot.
* @return milliseconds after boot.
*/
extern uint64 _bh_time_get_boot_millisecond(void);
#ifdef _INSTRUMENT_TEST_ENABLED
extern uint64 bh_time_get_boot_millisecond_instr(const char*func_name);
#define bh_time_get_boot_millisecond() bh_time_get_boot_millisecond_instr(__FUNCTION__)
#else
#define bh_time_get_boot_millisecond _bh_time_get_boot_millisecond
#endif
extern uint32 bh_get_tick_sec();
#define bh_get_tick_ms _bh_time_get_boot_millisecond
/*
* This function returns GMT milliseconds since from 1970.1.1, AKA UNIX time.
* @return milliseconds since from 1970.1.1.
*/
extern uint64 _bh_time_get_millisecond_from_1970(void);
#ifdef _INSTRUMENT_TEST_ENABLED
extern uint64 bh_time_get_millisecond_from_1970_instr(const char*func_name);
#define bh_time_get_millisecond_from_1970() bh_time_get_millisecond_from_1970_instr(__FUNCTION__)
#else
#define bh_time_get_millisecond_from_1970 _bh_time_get_millisecond_from_1970
#endif
/**
* This function sets timezone with specific hours.
*
* @param hours represents the deviation (in hours) of the local time from GMT (can be a positive or a negative number)
* @param half_hour if true, adds half an hour to the local time calculation. For example, if hours=(+5) then the time will be GMT +5:30; if hours=(-5) then the time will be GMT -4:30.
* @param daylight_save if true, applies the daylight saving scheme when calculating the local time (adds one hour to the local time calculation)
*/
extern void bh_set_timezone(int hours, int half_hour, int daylight_save);
/**
* This functions returns the offset in seconds which needs to be added GMT to get the local time.
*
*
* @return offset in secords which needs to be added GMT to get the local time.
*/
extern int bh_get_timezone_offset(void);
size_t bh_time_strftime(char *s, size_t max, const char *format, int64 time);
#ifdef _INSTRUMENT_TEST_ENABLED
size_t bh_time_strftime_instr(char *s, size_t max, const char *format, int64 time, const char*func_name);
#define bh_time_strftime(s, max, format, time) bh_time_strftime_instr(s, max, format, time, __FUNCTION__)
#else
#define bh_time_strftime _bh_time_strftime
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BH_TYPES_H
#define _BH_TYPES_H
#include "bh_config.h"
typedef unsigned char uint8;
typedef char int8;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned int uint32;
typedef int int32;
#define BYTES_OF_UINT8 1
#define BYTES_OF_UINT16 2
#define BYTES_OF_UINT32 4
#define BYTES_OF_UINT64 8
#define BYTES_OF_BOOLEAN 1
#define BYTES_OF_BYTE 1
#define BYTES_OF_CHAR 2
#define BYTES_OF_SHORT 2
#define BYTES_OF_INT 4
#define BYTES_OF_FLOAT 4
#define BYTES_OF_LONG 8
#define BYTES_OF_DOUBLE 8
#include "bh_platform.h"
#ifndef __cplusplus
#define true 1
#define false 0
#endif
#endif