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,34 @@
/*
* 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 _WASM_ASSERT_H
#define _WASM_ASSERT_H
#include "bh_assert.h"
#ifdef __cplusplus
extern "C" {
#endif
#define wasm_assert bh_assert
#ifdef __cplusplus
}
#endif
#endif /* end of _WASM_ASSERT_H */

View File

@ -0,0 +1,23 @@
/*
* 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 _WASM_CONFIG_H
#define _WASM_CONFIG_H
#include "config.h"
#endif /* end of _WASM_CONFIG_H */

View File

@ -0,0 +1,34 @@
/*
* 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 _WASM_MEMORY_H
#define _WASM_MEMORY_H
#ifdef __cplusplus
extern "C" {
#endif
#include "bh_memory.h"
#define wasm_malloc bh_malloc
#define wasm_free bh_free
#ifdef __cplusplus
}
#endif
#endif /* end of _WASM_MEMORY_H */

View File

@ -0,0 +1,24 @@
/*
* 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 _WASM_PLATFORM_LOG
#define _WASM_PLATFORM_LOG
#define wasm_printf printf
#define wasm_vprintf vprintf
#endif /* _WASM_PLATFORM_LOG */

View File

@ -0,0 +1,63 @@
/*
* 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 wasm_thread.h
* @brief This file contains Beihai platform abstract layer interface for
* thread relative function.
*/
#ifndef _WASM_THREAD_H
#define _WASM_THREAD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "bh_thread.h"
#define ws_thread_sys_init vm_thread_sys_init
#define ws_thread_sys_destroy vm_thread_sys_destroy
#define ws_self_thread vm_self_thread
#define ws_tls_put(ptr) vm_tls_put(0, ptr)
#define ws_tls_get() vm_tls_get(0)
static inline int
ws_mutex_init(korp_mutex *mutex, bool is_recursive)
{
if (is_recursive)
return vm_recursive_mutex_init(mutex);
else
return vm_mutex_init(mutex);
}
#define ws_mutex_destroy vm_mutex_destroy
#define ws_mutex_lock vm_mutex_lock
#define ws_mutex_unlock vm_mutex_unlock
#ifdef __cplusplus
}
#endif
#endif /* end of _WASM_THREAD_H */

View File

@ -0,0 +1,38 @@
/*
* 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 _WASM_TYPES_H
#define _WASM_TYPES_H
#include "wasm_config.h"
typedef unsigned char uint8;
typedef char int8;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned int uint32;
typedef int int32;
#include "wasm_platform.h"
#ifndef __cplusplus
#define true 1
#define false 0
#define inline __inline
#endif
#endif /* end of _WASM_TYPES_H */