-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm coreclr] Prepare for running tests #119807
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
base: main
Are you sure you want to change the base?
[wasm coreclr] Prepare for running tests #119807
Conversation
With these changes we now fail with
in the interpreter compiler. It happens during compilation of |
std::fprintf(stderr, "Failed to load the ICU data\n"); | ||
return -1; | ||
} | ||
#endif |
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.
#endif | |
#endif // TARGET_WASM |
#define __CORERUN_WASM_HPP__ | ||
|
||
void wasm_add_pinvoke_override(); | ||
int32_t wasm_load_icu_data(const char* assemblyPath); |
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.
Please update this to be bool
instead of int32_t
.
return icuPath; | ||
} | ||
|
||
int32_t wasm_load_icu_data(const char* assemblyPath) |
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 realize this is probably copied from somewhere, but it is using very low leve APIs. For example, open
vs fopen
. Can we instead clean this up to be as C++ as possible?
|
||
extern "C" int32_t mono_wasm_load_icu_data(const void* pData); | ||
|
||
static char* _wasm_get_icu_dat_file_path(const char* assemblyPath) |
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.
static char* _wasm_get_icu_dat_file_path(const char* assemblyPath) | |
static char* wasm_get_icu_dat_file_path(const char* assemblyPath) |
|
||
int32_t wasm_load_icu_data(const char* assemblyPath) | ||
{ | ||
char* icuFile = _wasm_get_icu_dat_file_path(assemblyPath); |
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.
char* icuFile = _wasm_get_icu_dat_file_path(assemblyPath); | |
char* icuFile = wasm_get_icu_dat_file_path(assemblyPath); |
return strdup(icuFileName); | ||
|
||
size_t dirLen = (size_t)(lastSeparator - assemblyPath) + 1; // include separator | ||
size_t fileNameLen = sizeof(icuFileName) - 1; |
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.
size_t fileNameLen = sizeof(icuFileName) - 1; | |
size_t fileNameLen = ARRAY_SIZE(icuFileName) - 1; |
Using sizeof
is too easy to do wrong. All someone needs to do is change that to const char icuFileName*
and it will compile and be wrong.
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.
Remove the -1
and then you can remove the +1
and icuPath[dirLen + fileNameLen] = '\0';
. Doing that and making a comment is all that is needed.
|
||
static char* _wasm_get_icu_dat_file_path(const char* assemblyPath) | ||
{ | ||
if (!assemblyPath || !*assemblyPath) |
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.
When will this be NULL
?
} | ||
close(fd); | ||
|
||
return mono_wasm_load_icu_data(buffer); |
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.
If this returns failure, we should clean things up.
return 0; | ||
} | ||
|
||
struct stat st; |
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.
struct stat st; | |
stat st; |
…lver To work with protable entrypoints
// WASM-TODO: check where we reach that, return nullptr for now to not break runtime initialization | ||
//PORTABILITY_ASSERT("The function is not implemented on wasm, it lacks registers"); |
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.
How are we getting here? Can you share a callstack? I would prefer us to nicely ifdef out the caller in an intelligent way.
Get further with running interpreter tests.
Fix ICU loading from development hosts
Update wasm calli stubs to handle instance methods