tanishiking / scala-wasm

Experimental WasmGC backend for Scala.js | merging into the upstream Scala.js repo https://github.com/scala-js/scala-js/pull/4988
41 stars 3 forks source link

Fix static type tests for ancestors of hijacked classes. #93

Closed sjrd closed 7 months ago

sjrd commented 7 months ago

This commit fixes the result of x.isInstanceOf[C] where x is a primitive and C is an ancestor of the hijacked class for x.

For jl.Number, which is the only non-Object class that is an ancestor of a hijacked class, we add a special case in the codegen.

For interfaces, we add generic code in their genInstanceTest function, based on their specialInstanceTypes.

This means we have a second place where we need to compute specialInstanceTypes. We move it to the preprocessor, and also use it to generically compute isAncestorOfHijackedClass. This removes the hard-code set that we had before.

Fix #74. Fix #84. Fix #92.