-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm][coreclr] Get further in the runtime initialization #116383
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
Merged
radekdoulik
merged 75 commits into
dotnet:main
from
radekdoulik:wasm-coreclr-wip-3-squashed
Jul 24, 2025
Merged
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
b32ad25
[wasm][coreclr] Get further in the runtime initialization
radekdoulik 790712a
Fix condition
radekdoulik 0036748
Fix build
radekdoulik 788fecf
Update after merge
radekdoulik 0119876
Feedback
radekdoulik 9605e64
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik 43c83fd
Update after merge
radekdoulik 70b06c5
Fix release build offsets
radekdoulik 51f0214
Build Debug runtime configuration on CI, so that interpreter is enabled
radekdoulik c667e6c
Fix build
radekdoulik e45f726
Enable interpreter in all configuration on wasm
radekdoulik 3470ff4
Merge branch 'main' into wasm-coreclr-wip-3-squashed
radekdoulik 91f336c
Build in Release again as we are missing debug packages
radekdoulik f9a0339
Move inline keyword
radekdoulik 2df11b1
Feedback
radekdoulik 556e5fa
Feedback
radekdoulik 5032d37
Fix release build
radekdoulik c61d5a3
Feedback
radekdoulik 15e1d83
Feedback
radekdoulik 86efb1c
Feedback
radekdoulik 01563ca
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik c6da89e
Feedback
radekdoulik d1eb90a
Feedback
radekdoulik 063fc3b
Feedback, add FEATURE_PEIMAGE_FLAT_LAYOUT
radekdoulik 22acc25
Revert mapping changes for PE loaded layout
radekdoulik c93a61b
Feedback, change call order of execute interp method
radekdoulik 406594a
Feedback, change condition to avoid dynamic loads in corhost
radekdoulik 34a6179
Merge branch 'main' into wasm-coreclr-wip-3-squashed
radekdoulik 3c58f83
Increase stub size to fit interpreter stub data
radekdoulik caec182
Update precode sizes, feedback and size check
radekdoulik 9a761d7
Feedback, TODO, transition block
radekdoulik dda8b41
Feedback
radekdoulik ee63503
Use coreclr_static library for wasm
radekdoulik ebc8f45
Feedback
radekdoulik 18e25e4
Feedback
radekdoulik 6ca105c
Write barriers helper updated
radekdoulik 542d732
Write barriers helper updated
radekdoulik f907a4d
Feedback
radekdoulik f5c3500
Make InitJITWriteBarrierHelpers no-op on wasm
radekdoulik 2bdc376
Feedback
radekdoulik c3ca64a
Feedback
radekdoulik efd8722
Feedback
radekdoulik fb6f747
Feedback
radekdoulik 13b945a
Feedback
radekdoulik da2b405
Feedback
radekdoulik 7c912c5
Feedback
radekdoulik bd16e77
Feedback
radekdoulik 035332b
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik defe297
Fix build
radekdoulik ef5b327
Fix non-wasm build
radekdoulik a7ef899
Merge branch 'main' into wasm-coreclr-wip-3-squashed
radekdoulik 71643ec
Feedback
radekdoulik 2aa639f
Feedback
radekdoulik 0226bf8
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik bcc8051
Feedback
radekdoulik 19d1e78
Feedback
radekdoulik 897ac1c
Merge branch 'main' into wasm-coreclr-wip-3-squashed
radekdoulik a5d3c97
Feedback
radekdoulik 9f26f89
Feedback
radekdoulik e811fbe
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik 9f26ea7
Add comment
radekdoulik 3afb7ae
Merge branch 'main' into wasm-coreclr-wip-3-squashed
radekdoulik fdb56bc
Feedback
radekdoulik 7a556e6
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik 7c27915
Fix build
radekdoulik 4a2f57a
Feedback
radekdoulik 3eae3d7
Feedback
radekdoulik c2ecb47
Fix whitespace
radekdoulik a9df639
Prefer TARGET_WASM
radekdoulik ca1ce47
Update src/coreclr/pal/src/init/pal.cpp
radekdoulik 17d9952
Prefer TARGET_WASM
radekdoulik 1e2246f
Prefer TARGET_WASM
radekdoulik 2ba3bc8
Merge remote-tracking branch 'remotes/origin/main' into wasm-coreclr-…
radekdoulik 52dd3d2
Few more places to use more general TARGET_WASM
radekdoulik 4f6f578
Prefer TARGET_WASM
radekdoulik 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| include_directories(inc) | ||
|
|
||
| if(CLR_CMAKE_HOST_WIN32) | ||
| add_subdirectory(coreshim) | ||
| endif(CLR_CMAKE_HOST_WIN32) | ||
| if (CLR_CMAKE_TARGET_ARCH_WASM) | ||
| add_subdirectory(corewasmrun) | ||
| else() | ||
| if(CLR_CMAKE_HOST_WIN32) | ||
| add_subdirectory(coreshim) | ||
| endif(CLR_CMAKE_HOST_WIN32) | ||
|
|
||
| add_subdirectory(corerun) | ||
| add_subdirectory(corerun) | ||
| 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,28 @@ | ||
| project(corewasmrun) | ||
|
|
||
| set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
|
||
| if (DEFINED CLR_CMAKE_ICU_DIR) | ||
| link_directories(${CLR_CMAKE_ICU_DIR}/lib) | ||
| endif(DEFINED CLR_CMAKE_ICU_DIR) | ||
|
|
||
| add_executable_clr(corewasmrun | ||
| corewasmrun.cpp | ||
| ) | ||
|
|
||
| set(_WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") | ||
| if (EXISTS "${_WASM_PRELOAD_DIR}") | ||
| set(_WASM_PRELOAD_FILE --preload-file ${_WASM_PRELOAD_DIR}@/) | ||
| endif (EXISTS "${_WASM_PRELOAD_DIR}") | ||
|
|
||
| target_compile_options(corewasmrun PRIVATE -fwasm-exceptions) | ||
| target_link_options(corewasmrun PRIVATE -fwasm-exceptions -sEXIT_RUNTIME=1 -sINITIAL_MEMORY=134217728 -sFORCE_FILESYSTEM=1 ${_WASM_PRELOAD_FILE} -Wl,-error-limit=0) | ||
|
|
||
| target_link_libraries(corewasmrun PRIVATE coreclr_static) | ||
| target_link_libraries(corewasmrun PRIVATE clrinterpreter) | ||
|
|
||
| target_link_libraries(corewasmrun PRIVATE icuuc) | ||
| target_link_libraries(corewasmrun PRIVATE icui18n) | ||
| target_link_libraries(corewasmrun PRIVATE icudata) | ||
|
|
||
| install_clr(TARGETS corewasmrun DESTINATIONS . COMPONENT hosts) |
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,49 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // | ||
|
|
||
| #include <cstdio> | ||
| #include <coreclrhost.h> | ||
|
|
||
| static void log_error_info(const char* line) | ||
| { | ||
| std::fprintf(stderr, "log error: %s\n", line); | ||
| } | ||
|
|
||
| // The current CoreCLR instance details. | ||
| static void* CurrentClrInstance; | ||
| static unsigned int CurrentAppDomainId; | ||
|
|
||
| static int run() | ||
| { | ||
| const char* exe_path = "<coreclr-wasm>"; | ||
| const char* app_domain_name = "corewasmrun"; | ||
| const char* entry_assembly = "ManagedAssembly.dll"; | ||
|
|
||
| coreclr_set_error_writer(log_error_info); | ||
|
|
||
| printf("call coreclr_initialize\n"); | ||
| int retval = coreclr_initialize(exe_path, app_domain_name, 0, nullptr, nullptr, &CurrentClrInstance, &CurrentAppDomainId); | ||
|
|
||
| if (retval < 0) | ||
| { | ||
| std::fprintf(stderr, "coreclr_initialize failed - Error: 0x%08x\n", retval); | ||
| return -1; | ||
| } | ||
| else | ||
| { | ||
| printf("coreclr_initialize succeeded - retval: 0x%08x\n", retval); | ||
| } | ||
|
|
||
| // coreclr_execute_assembly(); | ||
| // coreclr_shutdown(); | ||
|
|
||
| return retval; | ||
| } | ||
|
|
||
| int main() | ||
| { | ||
| int retval = run(); | ||
|
|
||
| return retval; | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.