Commit a4780dd
committed
fix: callWithRefs dispatch splitting, SELECT/DROP isObjectRef, default alloc
Three fixes discovered by testing the metacircular-java-wasm examples
(WebImage javac, Scala.js WasmGC, hello-world, count-vowels) against
this branch:
- Compiler: split callWithRefs dispatch into separate DispatchRefs_N
classes for modules with >128 functions. Without this, modules with
13K+ functions fail with Method too large (same pattern as call).
- InterpreterMachine: SELECT, SELECT_T, and DROP used
Builder.isObjectRef() without TypeSection, causing concrete GC ref
types (ref $MyStruct) to be misclassified as longs. This corrupted
the MStack dual-array invariant and caused javac to NPE. Fixed via
ValType.isObjectRef(long id, TypeSection ts) static helper.
- InterpreterMachine: STRUCT_NEW_DEFAULT and ARRAY_NEW_DEFAULT did not
allocate fieldRefs/elementRefs Object arrays for GC ref types. In the
dual-array design these must exist so STRUCT_GET/ARRAY_GET can read
ref values.
- GlobalInstance: added constructor accepting Object refValue for
externref globals (needed by Scala.js WasmGC module imports).1 parent 07d27fc commit a4780dd
5 files changed
Lines changed: 72 additions & 23 deletions
File tree
- compiler/src/main/java/run/endive/compiler/internal
- runtime/src/main/java/run/endive/runtime
- wasm/src/main/java/run/endive/wasm/types
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
1105 | 1107 | | |
1106 | 1108 | | |
1107 | 1109 | | |
1108 | | - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1109 | 1130 | | |
1110 | 1131 | | |
1111 | 1132 | | |
| |||
1255 | 1276 | | |
1256 | 1277 | | |
1257 | 1278 | | |
1258 | | - | |
1259 | | - | |
1260 | 1279 | | |
1261 | 1280 | | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
1266 | 1287 | | |
1267 | 1288 | | |
1268 | 1289 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
326 | 334 | | |
327 | 335 | | |
328 | 336 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
Lines changed: 26 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| |||
2346 | 2346 | | |
2347 | 2347 | | |
2348 | 2348 | | |
2349 | | - | |
| 2349 | + | |
2350 | 2350 | | |
2351 | 2351 | | |
2352 | 2352 | | |
2353 | 2353 | | |
2354 | | - | |
| 2354 | + | |
2355 | 2355 | | |
2356 | 2356 | | |
2357 | 2357 | | |
2358 | 2358 | | |
2359 | 2359 | | |
2360 | 2360 | | |
2361 | | - | |
| 2361 | + | |
2362 | 2362 | | |
2363 | 2363 | | |
2364 | 2364 | | |
| |||
2372 | 2372 | | |
2373 | 2373 | | |
2374 | 2374 | | |
2375 | | - | |
| 2375 | + | |
2376 | 2376 | | |
2377 | 2377 | | |
2378 | 2378 | | |
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
2407 | 2407 | | |
2408 | 2408 | | |
2409 | 2409 | | |
2410 | | - | |
| 2410 | + | |
2411 | 2411 | | |
2412 | 2412 | | |
2413 | 2413 | | |
| |||
3493 | 3493 | | |
3494 | 3494 | | |
3495 | 3495 | | |
3496 | | - | |
3497 | | - | |
| 3496 | + | |
3498 | 3497 | | |
3499 | 3498 | | |
3500 | | - | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
3501 | 3502 | | |
3502 | 3503 | | |
3503 | 3504 | | |
3504 | 3505 | | |
3505 | 3506 | | |
3506 | | - | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
3507 | 3511 | | |
3508 | 3512 | | |
3509 | 3513 | | |
| |||
3590 | 3594 | | |
3591 | 3595 | | |
3592 | 3596 | | |
3593 | | - | |
| 3597 | + | |
| 3598 | + | |
| 3599 | + | |
| 3600 | + | |
3594 | 3601 | | |
3595 | 3602 | | |
3596 | 3603 | | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
3597 | 3609 | | |
3598 | | - | |
3599 | | - | |
3600 | 3610 | | |
3601 | 3611 | | |
3602 | 3612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
| |||
0 commit comments