pkhex 25.12.21 → 26.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PKHeX.Core.dll +0 -0
- package/PKHeX.deps.json +70 -56
- package/PKHeX.dll +0 -0
- package/System.Collections.Concurrent.dll +0 -0
- package/System.Collections.dll +0 -0
- package/System.ComponentModel.Annotations.dll +0 -0
- package/System.ComponentModel.Primitives.dll +0 -0
- package/System.ComponentModel.TypeConverter.dll +0 -0
- package/System.Diagnostics.TraceSource.dll +0 -0
- package/System.IO.Compression.dll +0 -0
- package/System.IO.Pipelines.dll +0 -0
- package/System.Linq.dll +0 -0
- package/System.Memory.dll +0 -0
- package/System.ObjectModel.dll +0 -0
- package/System.Private.CoreLib.dll +0 -0
- package/System.Runtime.InteropServices.JavaScript.dll +0 -0
- package/System.Runtime.Numerics.dll +0 -0
- package/System.Runtime.dll +0 -0
- package/System.Security.Cryptography.dll +0 -0
- package/System.Text.Encodings.Web.dll +0 -0
- package/System.Text.Json.dll +0 -0
- package/System.Text.RegularExpressions.dll +0 -0
- package/System.Threading.Tasks.Parallel.dll +0 -0
- package/System.Threading.dll +0 -0
- package/blazor.boot.json +3 -1
- package/corebindings.c +3 -20
- package/dotnet.d.ts +144 -57
- package/dotnet.diagnostics.js +4 -0
- package/dotnet.diagnostics.js.map +1 -0
- package/dotnet.es6.lib.js +24 -30
- package/dotnet.js +2 -2
- package/dotnet.js.map +1 -1
- package/dotnet.native.js +1 -1
- package/dotnet.native.js.symbols +8669 -8656
- package/dotnet.native.wasm +0 -0
- package/dotnet.runtime.js +1 -1
- package/dotnet.runtime.js.map +1 -1
- package/driver.c +50 -36
- package/emcc-link.rsp +1 -1
- package/package.json +1 -1
- package/pinvoke.c +47 -15
- package/pinvoke.h +14 -2
- package/runtime.c +73 -26
- package/runtime.h +1 -3
- package/wasm-props.json +6 -2
- package/PKHeX.runtimeconfig.json +0 -41
- package/dotnet.globalization.js +0 -1015
- package/segmentation-rules.json +0 -83
package/driver.c
CHANGED
|
@@ -42,6 +42,7 @@ void bindings_initialize_internals ();
|
|
|
42
42
|
char *monoeg_g_getenv(const char *variable);
|
|
43
43
|
int monoeg_g_setenv(const char *variable, const char *value, int overwrite);
|
|
44
44
|
char *mono_method_get_full_name (MonoMethod *method);
|
|
45
|
+
char *mono_method_full_name (MonoMethod *method, int32_t signature);
|
|
45
46
|
|
|
46
47
|
#ifndef INVARIANT_TIMEZONE
|
|
47
48
|
extern void mono_register_timezones_bundle (void);
|
|
@@ -62,8 +63,6 @@ int mono_regression_test_step (int verbose_level, char *image, char *method_name
|
|
|
62
63
|
|
|
63
64
|
static MonoDomain *root_domain;
|
|
64
65
|
|
|
65
|
-
#define RUNTIMECONFIG_BIN_FILE "runtimeconfig.bin"
|
|
66
|
-
|
|
67
66
|
extern void mono_wasm_trace_logger (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data);
|
|
68
67
|
|
|
69
68
|
static void
|
|
@@ -180,17 +179,36 @@ cleanup_runtime_config (MonovmRuntimeConfigArguments *args, void *user_data)
|
|
|
180
179
|
free (user_data);
|
|
181
180
|
}
|
|
182
181
|
|
|
182
|
+
static int runtime_initialized = 0;
|
|
183
|
+
|
|
183
184
|
EMSCRIPTEN_KEEPALIVE void
|
|
184
|
-
mono_wasm_load_runtime (int debug_level)
|
|
185
|
+
mono_wasm_load_runtime (int debug_level, int propertyCount, const char **propertyKeys, const char **propertyValues)
|
|
185
186
|
{
|
|
187
|
+
runtime_initialized = 1;
|
|
186
188
|
const char *interp_opts = "";
|
|
187
189
|
|
|
188
190
|
#ifndef INVARIANT_GLOBALIZATION
|
|
189
191
|
mono_wasm_link_icu_shim ();
|
|
190
192
|
#endif
|
|
191
193
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
monovm_initialize (propertyCount, propertyKeys, propertyValues);
|
|
195
|
+
|
|
196
|
+
#ifndef INVARIANT_TIMEZONE
|
|
197
|
+
char* invariant_timezone = monoeg_g_getenv ("DOTNET_SYSTEM_TIMEZONE_INVARIANT");
|
|
198
|
+
if (strcmp(invariant_timezone, "true") != 0 && strcmp(invariant_timezone, "1") != 0)
|
|
199
|
+
mono_register_timezones_bundle ();
|
|
200
|
+
#endif /* INVARIANT_TIMEZONE */
|
|
201
|
+
|
|
202
|
+
root_domain = mono_wasm_load_runtime_common (debug_level, wasm_trace_logger, interp_opts);
|
|
203
|
+
|
|
204
|
+
bindings_initialize_internals();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
int initialize_runtime()
|
|
208
|
+
{
|
|
209
|
+
if (runtime_initialized == 1)
|
|
210
|
+
return 0;
|
|
211
|
+
|
|
194
212
|
const char *appctx_keys[2];
|
|
195
213
|
appctx_keys [0] = "APP_CONTEXT_BASE_DIRECTORY";
|
|
196
214
|
appctx_keys [1] = "RUNTIME_IDENTIFIER";
|
|
@@ -199,32 +217,10 @@ mono_wasm_load_runtime (int debug_level)
|
|
|
199
217
|
appctx_values [0] = "/";
|
|
200
218
|
appctx_values [1] = "browser-wasm";
|
|
201
219
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
char *file_path = (char *)malloc (sizeof (char) * (str_len +1)); // +1 is for the terminating null character
|
|
205
|
-
int num_char = snprintf (file_path, (str_len + 1), "/%s", file_name);
|
|
206
|
-
struct stat buffer;
|
|
207
|
-
|
|
208
|
-
assert (num_char > 0 && num_char == str_len);
|
|
209
|
-
|
|
210
|
-
if (stat (file_path, &buffer) == 0) {
|
|
211
|
-
MonovmRuntimeConfigArguments *arg = (MonovmRuntimeConfigArguments *)malloc (sizeof (MonovmRuntimeConfigArguments));
|
|
212
|
-
arg->kind = 0;
|
|
213
|
-
arg->runtimeconfig.name.path = file_path;
|
|
214
|
-
monovm_runtimeconfig_initialize (arg, cleanup_runtime_config, file_path);
|
|
215
|
-
} else {
|
|
216
|
-
free (file_path);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
monovm_initialize (2, appctx_keys, appctx_values);
|
|
220
|
-
|
|
221
|
-
#ifndef INVARIANT_TIMEZONE
|
|
222
|
-
mono_register_timezones_bundle ();
|
|
223
|
-
#endif /* INVARIANT_TIMEZONE */
|
|
224
|
-
|
|
225
|
-
root_domain = mono_wasm_load_runtime_common (debug_level, wasm_trace_logger, interp_opts);
|
|
220
|
+
// this does not support loading runtimeConfig.json part of boot.config.json
|
|
221
|
+
mono_wasm_load_runtime (0, 2, appctx_keys, appctx_values);
|
|
226
222
|
|
|
227
|
-
|
|
223
|
+
return 0;
|
|
228
224
|
}
|
|
229
225
|
|
|
230
226
|
EMSCRIPTEN_KEEPALIVE void
|
|
@@ -418,14 +414,14 @@ mono_wasm_profiler_init_aot (const char *desc)
|
|
|
418
414
|
|
|
419
415
|
#endif
|
|
420
416
|
|
|
421
|
-
#ifdef
|
|
417
|
+
#ifdef ENABLE_DEVTOOLS_PROFILER
|
|
422
418
|
|
|
423
|
-
void
|
|
419
|
+
void mono_profiler_init_browser_devtools (const char *desc);
|
|
424
420
|
|
|
425
421
|
EMSCRIPTEN_KEEPALIVE void
|
|
426
|
-
|
|
422
|
+
mono_wasm_profiler_init_browser_devtools (const char *desc)
|
|
427
423
|
{
|
|
428
|
-
|
|
424
|
+
mono_profiler_init_browser_devtools (desc);
|
|
429
425
|
}
|
|
430
426
|
|
|
431
427
|
#endif
|
|
@@ -504,8 +500,8 @@ EMSCRIPTEN_KEEPALIVE int mono_wasm_f64_to_i52 (int64_t *destination, double valu
|
|
|
504
500
|
}
|
|
505
501
|
|
|
506
502
|
// JS is responsible for freeing this
|
|
507
|
-
EMSCRIPTEN_KEEPALIVE
|
|
508
|
-
|
|
503
|
+
EMSCRIPTEN_KEEPALIVE char * mono_wasm_method_get_full_name (MonoMethod *method) {
|
|
504
|
+
char *res;
|
|
509
505
|
MONO_ENTER_GC_UNSAFE;
|
|
510
506
|
res = mono_method_get_full_name (method);
|
|
511
507
|
MONO_EXIT_GC_UNSAFE;
|
|
@@ -520,6 +516,24 @@ EMSCRIPTEN_KEEPALIVE const char * mono_wasm_method_get_name (MonoMethod *method)
|
|
|
520
516
|
return res;
|
|
521
517
|
}
|
|
522
518
|
|
|
519
|
+
EMSCRIPTEN_KEEPALIVE char * mono_wasm_method_get_name_ex (MonoMethod *method) {
|
|
520
|
+
char *res;
|
|
521
|
+
MONO_ENTER_GC_UNSAFE;
|
|
522
|
+
const char *method_name = mono_method_get_name (method);
|
|
523
|
+
// starts with .ctor or .cctor
|
|
524
|
+
if (!method_name) {
|
|
525
|
+
res = strdup ("<unknown>");
|
|
526
|
+
} else if (method_name && mono_method_get_flags (method, NULL) & 0x0800 /* METHOD_ATTRIBUTE_SPECIAL_NAME */ && strlen (method_name) < 7) {
|
|
527
|
+
res = (char *) malloc (128);
|
|
528
|
+
snprintf (res, 128,"%s.%s", mono_class_get_name (mono_method_get_class (method)), method_name);
|
|
529
|
+
res[127] = '\0';
|
|
530
|
+
} else {
|
|
531
|
+
res = strdup (method_name);
|
|
532
|
+
}
|
|
533
|
+
MONO_EXIT_GC_UNSAFE;
|
|
534
|
+
return res;
|
|
535
|
+
}
|
|
536
|
+
|
|
523
537
|
EMSCRIPTEN_KEEPALIVE float mono_wasm_get_f32_unaligned (const float *src) {
|
|
524
538
|
return *src;
|
|
525
539
|
}
|
package/emcc-link.rsp
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
-s FORCE_FILESYSTEM=1
|
|
8
8
|
-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE="[]"
|
|
9
9
|
-s EXPORTED_RUNTIME_METHODS="['FS','out','err','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','lengthBytesUTF8','stringToUTF8Array','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency','addFunction','safeSetTimeout','runtimeKeepalivePush','runtimeKeepalivePop','maybeExit','abort','wasmExports']"
|
|
10
|
-
-s EXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave,_emscripten_force_exit,_fmod,_atan2,_fma,_pow,_fmodf,_atan2f,_fmaf,_powf,_asin,_asinh,_acos,_acosh,_atan,_atanh,_cbrt,_cos,_cosh,_exp,_log,_log2,_log10,_sin,_sinh,_tan,_tanh,_asinf,_asinhf,_acosf,_acoshf,_atanf,_atanhf,_cbrtf,_cosf,_coshf,_expf,_logf,_log2f,_log10f,_sinf,_sinhf,_tanf,_tanhf
|
|
10
|
+
-s EXPORTED_FUNCTIONS=_free,_htons,_malloc,_sbrk,_memalign,_posix_memalign,_memset,_ntohs,stackAlloc,stackRestore,stackSave,_emscripten_force_exit,_fmod,_atan2,_fma,_pow,_fmodf,_atan2f,_fmaf,_powf,_asin,_asinh,_acos,_acosh,_atan,_atanh,_cbrt,_cos,_cosh,_exp,_log,_log2,_log10,_sin,_sinh,_tan,_tanh,_asinf,_asinhf,_acosf,_acoshf,_atanf,_atanhf,_cbrtf,_cosf,_coshf,_expf,_logf,_log2f,_log10f,_sinf,_sinhf,_tanf,_tanhf
|
|
11
11
|
--source-map-base http://example.com
|
|
12
12
|
-s WASM_BIGINT=1
|
|
13
13
|
-s EXPORT_NAME="'createDotnetRuntime'"
|
package/package.json
CHANGED
package/pinvoke.c
CHANGED
|
@@ -23,39 +23,71 @@ mono_wasm_pinvoke_vararg_stub (void)
|
|
|
23
23
|
/* This is just a stub used to mark vararg pinvokes */
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
int
|
|
27
|
+
table_compare_name (const void *t1, const void *t2)
|
|
28
|
+
{
|
|
29
|
+
return strcmp (((PinvokeTable*)t1)->name, ((PinvokeTable*)t2)->name);
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
void*
|
|
27
33
|
wasm_dl_lookup_pinvoke_table (const char *name)
|
|
28
34
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return pinvoke_tables [i];
|
|
32
|
-
}
|
|
33
|
-
return NULL;
|
|
35
|
+
PinvokeImport needle = { name, NULL };
|
|
36
|
+
return bsearch (&needle, pinvoke_tables, (sizeof (pinvoke_tables) / sizeof (PinvokeTable)), sizeof (PinvokeTable), table_compare_name);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
int
|
|
37
40
|
wasm_dl_is_pinvoke_table (void *handle)
|
|
38
41
|
{
|
|
39
|
-
for (int i = 0; i < sizeof (pinvoke_tables) / sizeof (
|
|
40
|
-
if (pinvoke_tables
|
|
42
|
+
for (int i = 0; i < sizeof (pinvoke_tables) / sizeof (PinvokeTable); ++i) {
|
|
43
|
+
if (&pinvoke_tables[i] == handle) {
|
|
41
44
|
return 1;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
return 0;
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
static int
|
|
51
|
+
export_compare_key (const void *k1, const void *k2)
|
|
52
|
+
{
|
|
53
|
+
return strcmp (((UnmanagedExport*)k1)->key, ((UnmanagedExport*)k2)->key);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static int
|
|
57
|
+
export_compare_key_and_token (const void *k1, const void *k2)
|
|
58
|
+
{
|
|
59
|
+
UnmanagedExport *e1 = (UnmanagedExport*)k1;
|
|
60
|
+
UnmanagedExport *e2 = (UnmanagedExport*)k2;
|
|
61
|
+
|
|
62
|
+
// first compare by key
|
|
63
|
+
int compare = strcmp (e1->key, e2->key);
|
|
64
|
+
if (compare)
|
|
65
|
+
return compare;
|
|
66
|
+
|
|
67
|
+
// then by token
|
|
68
|
+
return (int)(e1->token - e2->token);
|
|
69
|
+
}
|
|
70
|
+
|
|
47
71
|
void*
|
|
48
|
-
wasm_dl_get_native_to_interp (const char *key, void *extra_arg)
|
|
72
|
+
wasm_dl_get_native_to_interp (uint32_t token, const char *key, void *extra_arg)
|
|
49
73
|
{
|
|
50
74
|
#ifdef GEN_PINVOKE
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
75
|
+
UnmanagedExport needle = { key, token, NULL };
|
|
76
|
+
int count = (sizeof (wasm_native_to_interp_table) / sizeof (UnmanagedExport));
|
|
77
|
+
|
|
78
|
+
// comparison must match the one used in the PInvokeTableGenerator to ensure the same order
|
|
79
|
+
UnmanagedExport *result = bsearch (&needle, wasm_native_to_interp_table, count, sizeof (UnmanagedExport), export_compare_key_and_token);
|
|
80
|
+
if (!result) {
|
|
81
|
+
// assembly may have been trimmed / modified, try to find by key only
|
|
82
|
+
result = bsearch (&needle, wasm_native_to_interp_table, count, sizeof (UnmanagedExport), export_compare_key);
|
|
57
83
|
}
|
|
58
|
-
|
|
84
|
+
|
|
85
|
+
if (!result)
|
|
86
|
+
return NULL;
|
|
87
|
+
|
|
88
|
+
void *addr = result->func;
|
|
89
|
+
wasm_native_to_interp_ftndescs [result - wasm_native_to_interp_table] = *(InterpFtnDesc*)extra_arg;
|
|
90
|
+
return addr;
|
|
59
91
|
#else
|
|
60
92
|
return NULL;
|
|
61
93
|
#endif
|
package/pinvoke.h
CHANGED
|
@@ -8,6 +8,18 @@ typedef struct {
|
|
|
8
8
|
void *func;
|
|
9
9
|
} PinvokeImport;
|
|
10
10
|
|
|
11
|
+
typedef struct {
|
|
12
|
+
const char *name;
|
|
13
|
+
PinvokeImport *imports;
|
|
14
|
+
int count;
|
|
15
|
+
} PinvokeTable;
|
|
16
|
+
|
|
17
|
+
typedef struct {
|
|
18
|
+
const char *key;
|
|
19
|
+
uint32_t token;
|
|
20
|
+
void *func;
|
|
21
|
+
} UnmanagedExport;
|
|
22
|
+
|
|
11
23
|
typedef struct {
|
|
12
24
|
void *func;
|
|
13
25
|
void *arg;
|
|
@@ -20,7 +32,7 @@ int
|
|
|
20
32
|
wasm_dl_is_pinvoke_table (void *handle);
|
|
21
33
|
|
|
22
34
|
void*
|
|
23
|
-
wasm_dl_get_native_to_interp (const char *key, void *extra_arg);
|
|
35
|
+
wasm_dl_get_native_to_interp (uint32_t token, const char *key, void *extra_arg);
|
|
24
36
|
|
|
25
37
|
void
|
|
26
38
|
mono_wasm_pinvoke_vararg_stub (void);
|
|
@@ -45,6 +57,6 @@ double
|
|
|
45
57
|
mono_wasm_interp_method_args_get_darg (MonoInterpMethodArguments *margs, int i);
|
|
46
58
|
|
|
47
59
|
void*
|
|
48
|
-
mono_wasm_interp_method_args_get_retval
|
|
60
|
+
mono_wasm_interp_method_args_get_retval (MonoInterpMethodArguments *margs);
|
|
49
61
|
|
|
50
62
|
#endif
|
package/runtime.c
CHANGED
|
@@ -62,8 +62,6 @@
|
|
|
62
62
|
#define EMSCRIPTEN_KEEPALIVE
|
|
63
63
|
#endif
|
|
64
64
|
|
|
65
|
-
int mono_wasm_enable_gc = 1;
|
|
66
|
-
|
|
67
65
|
/* Missing from public headers */
|
|
68
66
|
char *mono_fixup_symbol_name (const char *prefix, const char *key, const char *suffix);
|
|
69
67
|
void mono_icall_table_init (void);
|
|
@@ -199,29 +197,43 @@ init_icall_table (void)
|
|
|
199
197
|
static void*
|
|
200
198
|
get_native_to_interp (MonoMethod *method, void *extra_arg)
|
|
201
199
|
{
|
|
202
|
-
void *addr;
|
|
203
|
-
|
|
200
|
+
void *addr = NULL;
|
|
204
201
|
MONO_ENTER_GC_UNSAFE;
|
|
205
202
|
MonoClass *klass = mono_method_get_class (method);
|
|
206
203
|
MonoImage *image = mono_class_get_image (klass);
|
|
207
204
|
MonoAssembly *assembly = mono_image_get_assembly (image);
|
|
208
205
|
MonoAssemblyName *aname = mono_assembly_get_name (assembly);
|
|
209
206
|
const char *name = mono_assembly_name_get_name (aname);
|
|
207
|
+
const char *namespace = mono_class_get_namespace (klass);
|
|
210
208
|
const char *class_name = mono_class_get_name (klass);
|
|
211
209
|
const char *method_name = mono_method_get_name (method);
|
|
212
|
-
|
|
210
|
+
MonoMethodSignature *sig = mono_method_signature (method);
|
|
211
|
+
uint32_t param_count = mono_signature_get_param_count (sig);
|
|
212
|
+
uint32_t token = mono_method_get_token (method);
|
|
213
|
+
|
|
214
|
+
char buf [128];
|
|
215
|
+
char *key = buf;
|
|
213
216
|
int len;
|
|
217
|
+
if (name != NULL) {
|
|
218
|
+
// the key must match the one used in PInvokeTableGenerator
|
|
219
|
+
len = snprintf (key, sizeof(buf), "%s#%d:%s:%s:%s", method_name, param_count, name, namespace, class_name);
|
|
214
220
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
221
|
+
if (len >= sizeof (buf)) {
|
|
222
|
+
// The key is too long, try again with a larger buffer
|
|
223
|
+
key = g_new (char, len + 1);
|
|
224
|
+
snprintf (key, len + 1, "%s#%d:%s:%s:%s", method_name, param_count, name, namespace, class_name);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
addr = wasm_dl_get_native_to_interp (token, key, extra_arg);
|
|
228
|
+
|
|
229
|
+
if (key != buf)
|
|
230
|
+
free (key);
|
|
231
|
+
}
|
|
220
232
|
MONO_EXIT_GC_UNSAFE;
|
|
221
233
|
return addr;
|
|
222
234
|
}
|
|
223
235
|
|
|
224
|
-
static void *sysglobal_native_handle;
|
|
236
|
+
static void *sysglobal_native_handle = (void *)0xDeadBeef;
|
|
225
237
|
|
|
226
238
|
static void*
|
|
227
239
|
wasm_dl_load (const char *name, int flags, char **err, void *user_data)
|
|
@@ -248,24 +260,33 @@ wasm_dl_load (const char *name, int flags, char **err, void *user_data)
|
|
|
248
260
|
return NULL;
|
|
249
261
|
}
|
|
250
262
|
|
|
263
|
+
int
|
|
264
|
+
import_compare_name (const void *k1, const void *k2)
|
|
265
|
+
{
|
|
266
|
+
const PinvokeImport *e1 = (const PinvokeImport*)k1;
|
|
267
|
+
const PinvokeImport *e2 = (const PinvokeImport*)k2;
|
|
268
|
+
|
|
269
|
+
return strcmp (e1->name, e2->name);
|
|
270
|
+
}
|
|
271
|
+
|
|
251
272
|
static void*
|
|
252
273
|
wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data)
|
|
253
274
|
{
|
|
254
|
-
|
|
255
|
-
assert (0);
|
|
275
|
+
assert (handle != sysglobal_native_handle);
|
|
256
276
|
|
|
257
277
|
#if WASM_SUPPORTS_DLOPEN
|
|
258
278
|
if (!wasm_dl_is_pinvoke_tables (handle)) {
|
|
259
279
|
return dlsym (handle, name);
|
|
260
280
|
}
|
|
261
281
|
#endif
|
|
262
|
-
|
|
263
|
-
PinvokeImport
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
282
|
+
PinvokeTable* index = (PinvokeTable*)handle;
|
|
283
|
+
PinvokeImport key = { name, NULL };
|
|
284
|
+
PinvokeImport* result = (PinvokeImport *)bsearch(&key, index->imports, index->count, sizeof(PinvokeImport), import_compare_name);
|
|
285
|
+
if (!result) {
|
|
286
|
+
// *err = g_strdup_printf ("Symbol not found: %s", name);
|
|
287
|
+
return NULL;
|
|
288
|
+
}
|
|
289
|
+
return result->func;
|
|
269
290
|
}
|
|
270
291
|
|
|
271
292
|
MonoDomain *
|
|
@@ -304,7 +325,7 @@ mono_wasm_load_runtime_common (int debug_level, MonoLogCallback log_callback, co
|
|
|
304
325
|
*/
|
|
305
326
|
if (debug_level) {
|
|
306
327
|
// Disable optimizations which interfere with debugging
|
|
307
|
-
interp_opts = "-all";
|
|
328
|
+
interp_opts = "-all,simd";
|
|
308
329
|
mono_wasm_enable_debugging (debug_level);
|
|
309
330
|
}
|
|
310
331
|
#endif
|
|
@@ -363,6 +384,28 @@ mono_wasm_assembly_find_method (MonoClass *klass, const char *name, int argument
|
|
|
363
384
|
return result;
|
|
364
385
|
}
|
|
365
386
|
|
|
387
|
+
MonoMethod*
|
|
388
|
+
mono_wasm_get_method_matching (MonoImage *image, uint32_t token, MonoClass *klass, const char* name, int param_count)
|
|
389
|
+
{
|
|
390
|
+
MonoMethod *result = NULL;
|
|
391
|
+
MONO_ENTER_GC_UNSAFE;
|
|
392
|
+
MonoMethod *method = mono_get_method (image, token, klass);
|
|
393
|
+
MonoMethodSignature *sig = mono_method_signature (method);
|
|
394
|
+
// Lookp by token but verify the name and param count in case assembly was trimmed
|
|
395
|
+
if (mono_signature_get_param_count (sig) == param_count) {
|
|
396
|
+
const char *method_name = mono_method_get_name (method);
|
|
397
|
+
if (!strcmp (method_name, name)) {
|
|
398
|
+
result = method;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
// If the token lookup failed, try to find the method by name and param count
|
|
402
|
+
if (!result) {
|
|
403
|
+
result = mono_class_get_method_from_name (klass, name, param_count);
|
|
404
|
+
}
|
|
405
|
+
MONO_EXIT_GC_UNSAFE;
|
|
406
|
+
return result;
|
|
407
|
+
}
|
|
408
|
+
|
|
366
409
|
/*
|
|
367
410
|
* mono_wasm_marshal_get_managed_wrapper:
|
|
368
411
|
* Creates a wrapper for a function pointer to a method marked with
|
|
@@ -370,17 +413,21 @@ mono_wasm_assembly_find_method (MonoClass *klass, const char *name, int argument
|
|
|
370
413
|
* This wrapper ensures that the interpreter initializes the pointers.
|
|
371
414
|
*/
|
|
372
415
|
void
|
|
373
|
-
mono_wasm_marshal_get_managed_wrapper (const char* assemblyName, const char* namespaceName, const char* typeName, const char* methodName, int
|
|
416
|
+
mono_wasm_marshal_get_managed_wrapper (const char* assemblyName, const char* namespaceName, const char* typeName, const char* methodName, uint32_t token, int param_count)
|
|
374
417
|
{
|
|
375
418
|
MonoError error;
|
|
376
419
|
mono_error_init (&error);
|
|
420
|
+
MONO_ENTER_GC_UNSAFE;
|
|
377
421
|
MonoAssembly* assembly = mono_wasm_assembly_load (assemblyName);
|
|
378
422
|
assert (assembly);
|
|
379
|
-
|
|
380
|
-
assert (
|
|
381
|
-
|
|
423
|
+
MonoImage *image = mono_assembly_get_image (assembly);
|
|
424
|
+
assert (image);
|
|
425
|
+
MonoClass* klass = mono_class_from_name (image, namespaceName, typeName);
|
|
426
|
+
assert (klass);
|
|
427
|
+
MonoMethod *method = mono_wasm_get_method_matching (image, token, klass, methodName, param_count);
|
|
382
428
|
assert (method);
|
|
383
429
|
MonoMethod *managedWrapper = mono_marshal_get_managed_wrapper (method, NULL, 0, &error);
|
|
384
430
|
assert (managedWrapper);
|
|
385
431
|
mono_compile_method (managedWrapper);
|
|
386
|
-
|
|
432
|
+
MONO_EXIT_GC_UNSAFE;
|
|
433
|
+
}
|
package/runtime.h
CHANGED
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
#include <mono/metadata/object.h>
|
|
14
14
|
#include <mono/metadata/debug-helpers.h>
|
|
15
15
|
|
|
16
|
-
extern int mono_wasm_enable_gc;
|
|
17
|
-
|
|
18
16
|
MonoDomain *mono_wasm_load_runtime_common (int debug_level, MonoLogCallback log_callback, const char *interp_opts);
|
|
19
17
|
MonoAssembly *mono_wasm_assembly_load (const char *name);
|
|
20
18
|
MonoClass *mono_wasm_assembly_find_class (MonoAssembly *assembly, const char *namespace, const char *name);
|
|
21
19
|
MonoMethod *mono_wasm_assembly_find_method (MonoClass *klass, const char *name, int arguments);
|
|
22
|
-
void mono_wasm_marshal_get_managed_wrapper (const char* assemblyName, const char* namespaceName, const char* typeName, const char* methodName, int
|
|
20
|
+
void mono_wasm_marshal_get_managed_wrapper (const char* assemblyName, const char* namespaceName, const char* typeName, const char* methodName, uint32_t token, int param_count);
|
|
23
21
|
int initialize_runtime ();
|
|
24
22
|
|
|
25
23
|
#endif
|
package/wasm-props.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{ "identity": "RuntimeEmccVersionHash", "value": "57b21b8fdcbe3ebb523178b79465254668eab408" }
|
|
7
7
|
],
|
|
8
8
|
"WasmOptConfigurationFlags": [],
|
|
9
|
-
"EmccDefaultExportedFunctions": ["_free","_htons","_malloc","_sbrk","_memalign","_memset","_ntohs","stackAlloc","stackRestore","stackSave","_emscripten_force_exit","_fmod","_atan2","_fma","_pow","_fmodf","_atan2f","_fmaf","_powf","_asin","_asinh","_acos","_acosh","_atan","_atanh","_cbrt","_cos","_cosh","_exp","_log","_log2","_log10","_sin","_sinh","_tan","_tanh","_asinf","_asinhf","_acosf","_acoshf","_atanf","_atanhf","_cbrtf","_cosf","_coshf","_expf","_logf","_log2f","_log10f","_sinf","_sinhf","_tanf","_tanhf"],
|
|
9
|
+
"EmccDefaultExportedFunctions": ["_free","_htons","_malloc","_sbrk","_memalign","_posix_memalign","_memset","_ntohs","stackAlloc","stackRestore","stackSave","_emscripten_force_exit","_fmod","_atan2","_fma","_pow","_fmodf","_atan2f","_fmaf","_powf","_asin","_asinh","_acos","_acosh","_atan","_atanh","_cbrt","_cos","_cosh","_exp","_log","_log2","_log10","_sin","_sinh","_tan","_tanh","_asinf","_asinhf","_acosf","_acoshf","_atanf","_atanhf","_cbrtf","_cosf","_coshf","_expf","_logf","_log2f","_log10f","_sinf","_sinhf","_tanf","_tanhf"],
|
|
10
10
|
"EmccDefaultExportedRuntimeMethods": ["FS","out","err","ccall","cwrap","setValue","getValue","UTF8ToString","UTF8ArrayToString","lengthBytesUTF8","stringToUTF8Array","FS_createPath","FS_createDataFile","removeRunDependency","addRunDependency","addFunction","safeSetTimeout","runtimeKeepalivePush","runtimeKeepalivePop","maybeExit","abort","wasmExports"],
|
|
11
11
|
"PropertiesThatTriggerRelinking": [
|
|
12
12
|
{ "identity": "InvariantTimezone", "defaultValueInRuntimePack": "false" },
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
{ "identity": "WasmSingleFileBundle", "defaultValueInRuntimePack": "false" },
|
|
16
16
|
{ "identity": "WasmEnableSIMD", "defaultValueInRuntimePack": "true" },
|
|
17
17
|
{ "identity": "WasmEnableExceptionHandling", "defaultValueInRuntimePack": "true" },
|
|
18
|
-
{ "identity": "
|
|
18
|
+
{ "identity": "EnableDiagnostics", "defaultValueInRuntimePack": "false" },
|
|
19
|
+
{ "identity": "WasmProfilers", "defaultValueInRuntimePack": "" },
|
|
20
|
+
{ "identity": "EmccMaximumHeapSize", "defaultValueInRuntimePack": "2147483648" },
|
|
21
|
+
{ "identity": "EmccInitialHeapSize", "defaultValueInRuntimePack": "33554432" },
|
|
22
|
+
{ "identity": "RunAOTCompilation", "defaultValueInRuntimePack": "" }
|
|
19
23
|
]
|
|
20
24
|
}
|
|
21
25
|
}
|
package/PKHeX.runtimeconfig.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeOptions": {
|
|
3
|
-
"tfm": "net9.0",
|
|
4
|
-
"includedFrameworks": [
|
|
5
|
-
{
|
|
6
|
-
"name": "Microsoft.NETCore.App",
|
|
7
|
-
"version": "9.0.13"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
"configProperties": {
|
|
11
|
-
"Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability": true,
|
|
12
|
-
"System.ComponentModel.DefaultValueAttribute.IsSupported": false,
|
|
13
|
-
"System.ComponentModel.Design.IDesignerHost.IsSupported": false,
|
|
14
|
-
"System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization": false,
|
|
15
|
-
"System.ComponentModel.TypeDescriptor.IsComObjectDescriptorSupported": false,
|
|
16
|
-
"System.Diagnostics.Debugger.IsSupported": false,
|
|
17
|
-
"System.Diagnostics.Metrics.Meter.IsSupported": false,
|
|
18
|
-
"System.Diagnostics.Tracing.EventSource.IsSupported": false,
|
|
19
|
-
"System.Globalization.Invariant": true,
|
|
20
|
-
"System.TimeZoneInfo.Invariant": false,
|
|
21
|
-
"System.Globalization.PredefinedCulturesOnly": true,
|
|
22
|
-
"System.Linq.Enumerable.IsSizeOptimized": true,
|
|
23
|
-
"System.Net.Http.EnableActivityPropagation": false,
|
|
24
|
-
"System.Net.Http.WasmEnableStreamingResponse": true,
|
|
25
|
-
"System.Net.SocketsHttpHandler.Http3Support": false,
|
|
26
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
27
|
-
"System.Resources.ResourceManager.AllowCustomResourceTypes": false,
|
|
28
|
-
"System.Resources.UseSystemResourceKeys": true,
|
|
29
|
-
"System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported": true,
|
|
30
|
-
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": false,
|
|
31
|
-
"System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting": false,
|
|
32
|
-
"System.Runtime.InteropServices.EnableCppCLIHostActivation": false,
|
|
33
|
-
"System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop": false,
|
|
34
|
-
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
|
35
|
-
"System.StartupHookProvider.IsSupported": false,
|
|
36
|
-
"System.Text.Encoding.EnableUnsafeUTF7Encoding": false,
|
|
37
|
-
"System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault": false,
|
|
38
|
-
"System.Threading.Thread.EnableAutoreleasePool": false
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|