-
Notifications
You must be signed in to change notification settings - Fork 724
Add WASM32 Platform #4639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
basicer
wants to merge
2
commits into
bytecodealliance:main
Choose a base branch
from
basicer:wasm32
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add WASM32 Platform #4639
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,19 @@ | |
#define PLATFORM_API_EXTENSION_H | ||
|
||
#include "platform_common.h" | ||
|
||
#if !defined(__wasm32__) && !defined(__EMSCRIPTEN__) | ||
#include "platform_wasi_types.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you avoid using platform_wasi_types.h? |
||
#else | ||
#include <wasi/api.h> | ||
#define __WASI_ESUCCESS (0) | ||
#define __WASI_EINVAL (28) | ||
#define __WASI_CLOCK_REALTIME (0) | ||
#define __WASI_CLOCK_MONOTONIC (1) | ||
#define __WASI_CLOCK_PROCESS_CPUTIME_ID (2) | ||
#define __WASI_CLOCK_THREAD_CPUTIME_ID (3) | ||
#endif | ||
|
||
/** | ||
* The related data structures should be defined | ||
* in platform_internal.h | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2019 Intel Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
*/ | ||
|
||
#include "platform_api_vmcore.h" | ||
|
||
int | ||
bh_platform_init() | ||
{ | ||
return 0; | ||
} | ||
|
||
void | ||
bh_platform_destroy() | ||
{} | ||
|
||
int | ||
os_printf(const char *format, ...) | ||
{ | ||
int ret = 0; | ||
va_list ap; | ||
|
||
va_start(ap, format); | ||
#ifndef BH_VPRINTF | ||
ret += vprintf(format, ap); | ||
#else | ||
ret += BH_VPRINTF(format, ap); | ||
#endif | ||
va_end(ap); | ||
|
||
return ret; | ||
} | ||
|
||
int | ||
os_vprintf(const char *format, va_list ap) | ||
{ | ||
#ifndef BH_VPRINTF | ||
return vprintf(format, ap); | ||
#else | ||
return BH_VPRINTF(format, ap); | ||
#endif | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../linux/platform_internal.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
# Copyright (C) 2019 Intel Corporation. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
add_definitions(-DBH_PLATFORM_WASM32) | ||
|
||
include_directories(${PLATFORM_SHARED_DIR}) | ||
include_directories(${PLATFORM_SHARED_DIR}/../include) | ||
|
||
include (${CMAKE_CURRENT_LIST_DIR}/../common/posix/platform_api_posix.cmake) | ||
|
||
file (GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c) | ||
|
||
set (PLATFORM_SHARED_SOURCE ${source_all} ${PLATFORM_COMMON_POSIX_SOURCE}) | ||
|
||
file (GLOB header ${PLATFORM_SHARED_DIR}/../include/*.h) | ||
LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC
WASM_ENABLE_INVOKE_NATIVE
is designed to prevent the involvement of runtime built-in functions. In that case,-DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_WASI=0
can achieve the same effect, along with-DWAMR_BUILD_QUICK_AOT_ENTRY=0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess it's a good opportunity to replace the heavy ifdef conditions with something easier to maintain.