Skip to content
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

[wasm] Emscripten 2.0.34 bump #62499

Merged
merged 28 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0a6c904
Initial changes for emscripten 2.0.34
radekdoulik Dec 7, 2021
1c2f989
Use emcc-link.rsp in build targets
radekdoulik Dec 8, 2021
f74d8b9
Use updated docker images
radekdoulik Dec 8, 2021
20f59e5
Fix compiler warnings
Dec 9, 2021
31197d9
Put `--profiling-funcs` to `_EmccLinkFlags`
radekdoulik Dec 9, 2021
2063241
Fix build
radekdoulik Dec 9, 2021
6aed1c5
Add shell to the environment
radekdoulik Dec 13, 2021
1f0048f
Merge remote-tracking branch 'origin/main' into pr-emscripten-34-bump
radekdoulik Dec 21, 2021
17c0117
Merge remote-tracking branch 'remotes/origin/main' into pr-emscripten…
radekdoulik Jan 3, 2022
11e2ce5
Add emcc-link.rsp to PlatformManifestFileEntry
radekdoulik Jan 4, 2022
3eb44cf
Feedback
radekdoulik Jan 7, 2022
e189182
Use new Emscripten workload
radekdoulik Jan 31, 2022
2f3227a
Merge remote-tracking branch 'remotes/origin/main' into pr-emscripten…
radekdoulik Jan 31, 2022
4ffd9a0
Remove unused variable
radekdoulik Jan 20, 2022
38a7107
Add the emcc-link.rsp
lewing Jan 31, 2022
afabf1c
Bump dotnet icu
radekdoulik Feb 1, 2022
5318de4
Merge remote-tracking branch 'remotes/origin/main' into pr-emscripten…
radekdoulik Feb 1, 2022
1e3a947
Merge branch 'main' into pr-emscripten-34-bump
lewing Feb 1, 2022
55cb081
Merge remote-tracking branch 'origin/main' into pr-emscripten-34-bump
radical Feb 2, 2022
16496b8
Feedback
radekdoulik Feb 2, 2022
2c81e67
Merge remote-tracking branch 'remotes/origin/main' into pr-emscripten…
radekdoulik Feb 2, 2022
814279b
Do not add linker flags to compilation
radekdoulik Feb 2, 2022
a54d310
Split `_EmccLDFlags`
radekdoulik Feb 2, 2022
4fb4543
Merge remote-tracking branch 'remotes/origin/main' into pr-emscripten…
radekdoulik Feb 2, 2022
56460a5
Bump emscripten workload
radekdoulik Feb 2, 2022
1c2f7a5
Update windows helix queues
Feb 2, 2022
6ab30fc
Merge branch 'main' into pr-emscripten-34-bump
lewing Feb 2, 2022
e411b47
[wasm] Fix WBT running with nodejs
radical Feb 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ jobs:
targetRid: browser-wasm
platform: Browser_wasm
container:
image: ubuntu-18.04-webassembly-20210707133424-12f133e
image: ubuntu-18.04-webassembly-20211208134944-544b18c
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,6 @@ jobs:

# WebAssembly windows
- ${{ if eq(parameters.platform, 'Browser_wasm_win') }}:
- (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-webassembly-amd64-20210702131541-6837048
- (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-webassembly-amd64-20211208140215-544b18c

${{ insert }}: ${{ parameters.jobParameters }}
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<PlatformManifestFileEntry Include="pinvoke.c" IsNative="true" />
<PlatformManifestFileEntry Include="pinvoke.h" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-default.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-link.rsp" IsNative="true" />
<PlatformManifestFileEntry Include="emcc-props.json" IsNative="true" />
<!-- ICU-specific files -->
<PlatformManifestFileEntry Include="libicudata.a" IsNative="true" />
Expand Down
11 changes: 9 additions & 2 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ MonoDefaults *mdbg_mono_defaults;
DebuggerTlsData *tls; \
tls = (DebuggerTlsData *)mono_native_tls_get_value (debugger_tls_id);
#else
#define GET_TLS_DATA_FROM_THREAD(thread) \
#define GET_TLS_DATA_FROM_THREAD(...) \
DebuggerTlsData *tls; \
tls = &debugger_wasm_thread;
#define GET_DEBUGGER_TLS() \
Expand Down Expand Up @@ -9135,7 +9135,9 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
int objid;
ErrorCode err;
MonoThread *thread_obj;
#ifndef TARGET_WASM
MonoInternalThread *thread;
#endif
int pos, i, len, frame_idx;
StackFrame *frame;
MonoDebugMethodJitInfo *jit;
Expand All @@ -9149,11 +9151,16 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
if (err != ERR_NONE)
return err;

#ifndef TARGET_WASM
thread = THREAD_TO_INTERNAL (thread_obj);

#endif
id = decode_id (p, &p, end);

#ifndef TARGET_WASM
GET_TLS_DATA_FROM_THREAD (thread);
#else
GET_TLS_DATA_FROM_THREAD ();
#endif
g_assert (tls);

for (i = 0; i < tls->frame_count; ++i) {
Expand Down
5 changes: 4 additions & 1 deletion src/mono/mono/metadata/seq-points-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ mono_seq_point_data_read (SeqPointData *data, char *path)
fseek(f, 0, SEEK_SET);

buffer_orig = buffer = (guint8 *)g_malloc (fsize + 1);
fread(buffer_orig, fsize, 1, f);
size_t items = fread(buffer_orig, fsize, 1, f);
if (items != 1)
return FALSE;

fclose(f);

entry_count = decode_var_int (buffer, &buffer);
Expand Down
9 changes: 3 additions & 6 deletions src/mono/mono/metadata/sre-encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *
HANDLE_FUNCTION_ENTER ();

MonoDynamicTable *table;
guint32 token, enclosing;
guint32 token;
MonoClass *klass;

/* if the type requires a typespec, we must try that first*/
Expand All @@ -446,11 +446,8 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *
goto leave;
}

if (m_class_get_nested_in (klass)) {
enclosing = mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE);
/* get the typeref idx of the enclosing type */
enclosing >>= MONO_TYPEDEFORREF_BITS;
}
if (m_class_get_nested_in (klass))
mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE);
table = &assembly->tables [MONO_TABLE_TYPEREF];
token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
Expand Down
8 changes: 6 additions & 2 deletions src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@ compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **c

#ifdef HOST_WASM
gsize min = 1 << 30, max = 0;
gsize prev = 0;
//gsize prev = 0;

// FIXME: This depends on emscripten allocating ftnptr ids sequentially
for (int i = 0; i < amodule->info.nmethods; ++i) {
Expand All @@ -2672,7 +2672,7 @@ compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **c
min = val;
else if (val > max)
max = val;
prev = val;
//prev = val;
}
}
if (max) {
Expand Down Expand Up @@ -5679,12 +5679,16 @@ get_new_unbox_arbitrary_trampoline_frome_page (gpointer addr)
static gpointer
get_numerous_trampoline (MonoAotTrampoline tramp_type, int n_got_slots, MonoAotModule **out_amodule, guint32 *got_offset, guint32 *out_tramp_size)
{
#ifndef DISABLE_ASSERT_MESSAGES
MonoImage *image;
#endif
MonoAotModule *amodule = get_mscorlib_aot_module ();
int index, tramp_size;

#ifndef DISABLE_ASSERT_MESSAGES
/* Currently, we keep all trampolines in the mscorlib AOT image */
image = mono_defaults.corlib;
#endif

*out_amodule = amodule;

Expand Down
11 changes: 9 additions & 2 deletions src/mono/mono/mini/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,12 @@ mono_main (int argc, char* argv[])
MonoDomain *domain;
MonoImageOpenStatus open_status;
const char* aname, *mname = NULL;
int i, count = 1;
guint32 opt, action = DO_EXEC, recompilation_times = 1;
int i;
#ifndef DISABLE_JIT
int count = 1;
MonoGraphOptions mono_graph_options = (MonoGraphOptions)0;
#endif
guint32 opt, action = DO_EXEC, recompilation_times = 1;
int mini_verbose_level = 0;
char *trace_options = NULL;
char *aot_options = NULL;
Expand Down Expand Up @@ -2222,13 +2225,15 @@ mono_main (int argc, char* argv[])
} else if (strcmp (argv [i], "--mixed-mode") == 0) {
mixed_mode = TRUE;
#endif
#ifndef DISABLE_JIT
} else if (strcmp (argv [i], "--ncompile") == 0) {
if (i + 1 >= argc){
fprintf (stderr, "error: --ncompile requires an argument\n");
return 1;
}
count = atoi (argv [++i]);
action = DO_BENCH;
#endif
} else if (strcmp (argv [i], "--trace") == 0) {
trace_options = (char*)"";
} else if (strncmp (argv [i], "--trace=", 8) == 0) {
Expand Down Expand Up @@ -2346,6 +2351,7 @@ mono_main (int argc, char* argv[])

mname = argv [++i];
action = DO_BENCH;
#ifndef DISABLE_JIT
} else if (strncmp (argv [i], "--graph=", 8) == 0) {
if (i + 1 >= argc){
fprintf (stderr, "error: --graph option requires a method name argument\n");
Expand All @@ -2364,6 +2370,7 @@ mono_main (int argc, char* argv[])
mname = argv [++i];
mono_graph_options = MONO_GRAPH_CFG;
action = DO_DRAW;
#endif
} else if (strcmp (argv [i], "--debug") == 0) {
enable_debugging = TRUE;
} else if (strncmp (argv [i], "--debug=", 8) == 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/mono/mono/mini/mini-generic-sharing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,9 @@ mini_get_interp_in_wrapper (MonoMethodSignature *sig)
static GHashTable *cache;
const char *name;
gboolean generic = FALSE;
#ifndef DISABLE_JIT
gboolean return_native_struct;
#endif

sig = mini_get_underlying_reg_signature (sig);

Expand All @@ -1763,7 +1765,10 @@ mini_get_interp_in_wrapper (MonoMethodSignature *sig)
* stack, pass this address to the interp_entry and when we return it we use
* CEE_MONO_LDNATIVEOBJ
*/
return_native_struct = sig->ret->type == MONO_TYPE_VALUETYPE && sig->pinvoke;
#ifndef DISABLE_JIT
return_native_struct =
#endif
radekdoulik marked this conversation as resolved.
Show resolved Hide resolved
sig->ret->type == MONO_TYPE_VALUETYPE && sig->pinvoke;

/* Create the signature for the wrapper */
csig = g_malloc0 (MONO_SIZEOF_METHOD_SIGNATURE + (sig->param_count * sizeof (MonoType*)));
Expand Down
8 changes: 4 additions & 4 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3285,7 +3285,7 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void
static MonoObject*
mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error)
{
MonoMethod *invoke, *callee;
MonoMethod *callee;
MonoObject *(*runtime_invoke) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method);
RuntimeInvokeInfo *info, *info2;
MonoJitInfo *ji = NULL;
Expand Down Expand Up @@ -3328,7 +3328,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
MonoMethod *wrapper;

wrapper = mono_marshal_get_array_accessor_wrapper (method);
invoke = mono_marshal_get_runtime_invoke (wrapper, FALSE);
mono_marshal_get_runtime_invoke (wrapper, FALSE);
callee = wrapper;
} else {
callee = NULL;
Expand Down Expand Up @@ -3404,8 +3404,8 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
static RuntimeInvokeDynamicFunction dyn_runtime_invoke = NULL;
if (info->dyn_call_info) {
if (!dyn_runtime_invoke) {
invoke = mono_marshal_get_runtime_invoke_dynamic ();
RuntimeInvokeDynamicFunction invoke_func = (RuntimeInvokeDynamicFunction)mono_jit_compile_method_jit_only (invoke, error);
MonoMethod *dynamic_invoke = mono_marshal_get_runtime_invoke_dynamic ();
RuntimeInvokeDynamicFunction invoke_func = (RuntimeInvokeDynamicFunction)mono_jit_compile_method_jit_only (dynamic_invoke, error);
mono_memory_barrier ();
dyn_runtime_invoke = invoke_func;
if (!dyn_runtime_invoke && mono_use_interpreter) {
Expand Down
40 changes: 1 addition & 39 deletions src/mono/mono/mini/mini-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ mono_arch_create_vars (MonoCompile *cfg)
{
MonoMethodSignature *sig;
CallInfo *cinfo;
MonoType *sig_ret;

sig = mono_method_signature_internal (cfg->method);

Expand All @@ -258,7 +257,7 @@ mono_arch_create_vars (MonoCompile *cfg)
// if (cinfo->ret.storage == ArgValuetypeInReg)
// cfg->ret_var_is_local = TRUE;

sig_ret = mini_get_underlying_type (sig->ret);
mini_get_underlying_type (sig->ret);
if (cinfo->ret.storage == ArgValuetypeAddrInIReg || cinfo->ret.storage == ArgGsharedVTOnStack) {
cfg->vret_addr = mono_compile_create_var (cfg, mono_get_int_type (), OP_ARG);
if (G_UNLIKELY (cfg->verbose_level > 1)) {
Expand Down Expand Up @@ -681,8 +680,6 @@ mono_arch_patch_code_new (MonoCompile *cfg, guint8 *code, MonoJumpInfo *ji, gpoi

G_BEGIN_DECLS

void * getgrnam (const char *name);
void * getgrgid (gid_t gid);
int inotify_init (void);
int inotify_rm_watch (int fd, int wd);
int inotify_add_watch (int fd, const char *pathname, uint32_t mask);
Expand Down Expand Up @@ -712,13 +709,6 @@ pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *pa
return 0;
}

int
pthread_sigmask (int how, const sigset_t *set, sigset_t *oset)
{
return 0;
}


int
sigsuspend(const sigset_t *sigmask)
{
Expand All @@ -732,18 +722,6 @@ getdtablesize (void)
return 256; //random constant that is the fd limit
}

void *
getgrnam (const char *name)
{
return NULL;
}

void *
getgrgid (gid_t gid)
{
return NULL;
}

int
inotify_init (void)
{
Expand Down Expand Up @@ -781,22 +759,6 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
return -1;
}

int
getpwnam_r (const char *name, struct passwd *pwd, char *buffer, size_t bufsize,
struct passwd **result)
{
*result = NULL;
return ENOTSUP;
}

int
getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize,
struct passwd **result)
{
*result = NULL;
return ENOTSUP;
}

G_END_DECLS

/* Helper for runtime debugging */
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/sgen/sgen-gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ sgen_dummy_use (gpointer v)
{
#if defined(_MSC_VER) || defined(HOST_WASM)
static volatile gpointer ptr;
(void)ptr; // avoid compiler warning: variable 'ptr' set but not used
ptr = v;
#elif defined(__GNUC__)
__asm__ volatile ("" : "=r"(v) : "r"(v));
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/sgen/sgen-workers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void sgen_workers_set_num_active_workers (int generation, int num_workers);
#ifndef DISABLE_SGEN_MAJOR_MARKSWEEP_CONC
void sgen_workers_start_all_workers (int generation, SgenObjectOperations *object_ops_nopar, SgenObjectOperations *object_ops_par, SgenWorkersFinishCallback finish_job);
#else
#define sgen_workers_start_all_workers(...)
#define sgen_workers_start_all_workers(generation, object_ops_nopar, object_ops_par, finish_job) (void)object_ops_par; // avoid compiler warning: variable 'object_ops_par' set but not used
#endif

void sgen_workers_enqueue_job (int generation, SgenThreadPoolJob *job, gboolean enqueue);
Expand Down
5 changes: 2 additions & 3 deletions src/mono/mono/utils/mono-mmap-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,20 @@ int
mono_vfree (void *addr, size_t length, MonoMemAccountType type)
{
VallocInfo *info = (VallocInfo*)(valloc_hash ? g_hash_table_lookup (valloc_hash, addr) : NULL);
int res;

if (info) {
/*
* We are passed the aligned address in the middle of the mapping allocated by
* mono_valloc_align (), free the original mapping.
*/
BEGIN_CRITICAL_SECTION;
res = munmap (info->addr, info->size);
munmap (info->addr, info->size);
END_CRITICAL_SECTION;
g_free (info);
g_hash_table_remove (valloc_hash, addr);
} else {
BEGIN_CRITICAL_SECTION;
res = munmap (addr, length);
munmap (addr, length);
END_CRITICAL_SECTION;
}

Expand Down
6 changes: 4 additions & 2 deletions src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<PropertyGroup>
<_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm'))</_MonoAotCrossCompilerPath>
<_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp'))</_EmccDefaultFlagsRsp>
<_EmccDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp'))</_EmccDefaultLinkFlagsRsp>
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">false</WasmNativeStrip>
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
<WasmNativeDebugSymbols Condition="'$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
Expand Down Expand Up @@ -216,6 +217,7 @@
<!-- Adding optimization flag at the top, so it gets precedence -->
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
<_EmccLDFlags Include="@(_EmccCommonFlags)" />
<_EmccLDFlags Include="-Wl,--allow-undefined" />
<_EmccLDFlags Include="-s TOTAL_MEMORY=$(EmccTotalMemory)" />

<!-- ILLinker should have removed unused imports, so error for Publish -->
Expand Down Expand Up @@ -391,14 +393,14 @@
</Target>

<Target Name="_WasmLinkDotNet"
Inputs="@(_WasmLinkDependencies);$(_EmccDefaultFlagsRsp);$(_EmccLinkRsp)"
Inputs="@(_WasmLinkDependencies);$(_EmccDefaultFlagsRsp);$(_EmccDefaultLinkFlagsRsp);$(_EmccLinkRsp)"
Outputs="$(_WasmIntermediateOutputPath)dotnet.js;$(_WasmIntermediateOutputPath)dotnet.wasm"
DependsOnTargets="_CheckEmccIsExpectedVersion;_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking"
Returns="@(FileWrites)" >

<Message Text="Linking with emcc with $(EmccLinkOptimizationFlag). This may take a while ..." Importance="High" />
<Message Text="Running emcc with @(_EmccLinkStepArgs->'%(Identity)', ' ')" Importance="Low" />
<Exec Command='emcc "@$(_EmccDefaultFlagsRsp)" "@$(_EmccLinkRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
<Exec Command='emcc "@$(_EmccDefaultFlagsRsp)" "@$(_EmccDefaultLinkFlagsRsp)" "@$(_EmccLinkRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
<ItemGroup>
<FileWrites Include="$(_WasmIntermediateOutputPath)dotnet.wasm" />
<FileWrites Include="$(_WasmIntermediateOutputPath)dotnet.js" />
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/emscripten-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.23
2.0.34
Loading