diff --git a/src/bindings/js.ts b/src/bindings/js.ts index 59f9685c43..a75272bae2 100644 --- a/src/bindings/js.ts +++ b/src/bindings/js.ts @@ -950,13 +950,13 @@ export class JSBuilder extends ExportsWalker { if (type.isInternalReference) { // Lift reference types const clazz = assert(type.getClassOrWrapper(this.program)); - if (clazz.extends(this.program.arrayBufferInstance.prototype)) { + if (clazz.extendsPrototype(this.program.arrayBufferInstance.prototype)) { sb.push("__liftBuffer("); this.needsLiftBuffer = true; - } else if (clazz.extends(this.program.stringInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.stringInstance.prototype)) { sb.push("__liftString("); this.needsLiftString = true; - } else if (clazz.extends(this.program.arrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.arrayPrototype)) { let valueType = clazz.getArrayValueType(); sb.push("__liftArray("); this.makeLiftFromMemory(valueType, sb); @@ -964,7 +964,7 @@ export class JSBuilder extends ExportsWalker { sb.push(valueType.alignLog2.toString()); sb.push(", "); this.needsLiftArray = true; - } else if (clazz.extends(this.program.staticArrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.staticArrayPrototype)) { let valueType = clazz.getArrayValueType(); sb.push("__liftStaticArray("); this.makeLiftFromMemory(valueType, sb); @@ -972,7 +972,7 @@ export class JSBuilder extends ExportsWalker { sb.push(valueType.alignLog2.toString()); sb.push(", "); this.needsLiftStaticArray = true; - } else if (clazz.extends(this.program.arrayBufferViewInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.arrayBufferViewInstance.prototype)) { sb.push("__liftTypedArray("); if (clazz.name == "Uint64Array") { sb.push("BigUint64Array"); @@ -1021,13 +1021,13 @@ export class JSBuilder extends ExportsWalker { if (type.isInternalReference) { // Lower reference types const clazz = assert(type.getClassOrWrapper(this.program)); - if (clazz.extends(this.program.arrayBufferInstance.prototype)) { + if (clazz.extendsPrototype(this.program.arrayBufferInstance.prototype)) { sb.push("__lowerBuffer("); this.needsLowerBuffer = true; - } else if (clazz.extends(this.program.stringInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.stringInstance.prototype)) { sb.push("__lowerString("); this.needsLowerString = true; - } else if (clazz.extends(this.program.arrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.arrayPrototype)) { let valueType = clazz.getArrayValueType(); sb.push("__lowerArray("); this.makeLowerToMemory(valueType, sb); @@ -1037,7 +1037,7 @@ export class JSBuilder extends ExportsWalker { sb.push(clazz.getArrayValueType().alignLog2.toString()); sb.push(", "); this.needsLowerArray = true; - } else if (clazz.extends(this.program.staticArrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.staticArrayPrototype)) { let valueType = clazz.getArrayValueType(); sb.push("__lowerStaticArray("); this.makeLowerToMemory(valueType, sb); @@ -1047,7 +1047,7 @@ export class JSBuilder extends ExportsWalker { sb.push(valueType.alignLog2.toString()); sb.push(", "); this.needsLowerStaticArray = true; - } else if (clazz.extends(this.program.arrayBufferViewInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.arrayBufferViewInstance.prototype)) { let valueType = clazz.getArrayValueType(); sb.push("__lowerTypedArray("); if (valueType == Type.u64) { @@ -1079,7 +1079,7 @@ export class JSBuilder extends ExportsWalker { this.needsLowerInternref = true; } sb.push(name); - if (clazz.extends(this.program.staticArrayPrototype)) { + if (clazz.extendsPrototype(this.program.staticArrayPrototype)) { // optional last argument for __lowerStaticArray let valueType = clazz.getArrayValueType(); if (valueType.isNumericValue) { @@ -1397,16 +1397,16 @@ export function liftRequiresExportRuntime(type: Type): bool { let program = clazz.program; // flat collections lift via memory copy if ( - clazz.extends(program.arrayBufferInstance.prototype) || - clazz.extends(program.stringInstance.prototype) || - clazz.extends(program.arrayBufferViewInstance.prototype) + clazz.extendsPrototype(program.arrayBufferInstance.prototype) || + clazz.extendsPrototype(program.stringInstance.prototype) || + clazz.extendsPrototype(program.arrayBufferViewInstance.prototype) ) { return false; } // nested collections lift depending on element type if ( - clazz.extends(program.arrayPrototype) || - clazz.extends(program.staticArrayPrototype) + clazz.extendsPrototype(program.arrayPrototype) || + clazz.extendsPrototype(program.staticArrayPrototype) ) { return liftRequiresExportRuntime(clazz.getArrayValueType()); } @@ -1428,11 +1428,11 @@ export function lowerRequiresExportRuntime(type: Type): bool { // lowers using __new let program = clazz.program; if ( - clazz.extends(program.arrayBufferInstance.prototype) || - clazz.extends(program.stringInstance.prototype) || - clazz.extends(program.arrayBufferViewInstance.prototype) || - clazz.extends(program.arrayPrototype) || - clazz.extends(program.staticArrayPrototype) + clazz.extendsPrototype(program.arrayBufferInstance.prototype) || + clazz.extendsPrototype(program.stringInstance.prototype) || + clazz.extendsPrototype(program.arrayBufferViewInstance.prototype) || + clazz.extendsPrototype(program.arrayPrototype) || + clazz.extendsPrototype(program.staticArrayPrototype) ) { return true; } diff --git a/src/bindings/tsd.ts b/src/bindings/tsd.ts index 75a9af7f91..a7f65bfd9d 100644 --- a/src/bindings/tsd.ts +++ b/src/bindings/tsd.ts @@ -249,26 +249,26 @@ export class TSDBuilder extends ExportsWalker { if (type.isInternalReference) { const sb = new Array(); const clazz = assert(type.getClassOrWrapper(this.program)); - if (clazz.extends(this.program.arrayBufferInstance.prototype)) { + if (clazz.extendsPrototype(this.program.arrayBufferInstance.prototype)) { sb.push("ArrayBuffer"); - } else if (clazz.extends(this.program.stringInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.stringInstance.prototype)) { sb.push("string"); - } else if (clazz.extends(this.program.arrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.arrayPrototype)) { const valueType = clazz.getArrayValueType(); sb.push("Array<"); sb.push(this.toTypeScriptType(valueType, mode)); sb.push(">"); - } else if (clazz.extends(this.program.staticArrayPrototype)) { + } else if (clazz.extendsPrototype(this.program.staticArrayPrototype)) { const valueType = clazz.getArrayValueType(); sb.push("ArrayLike<"); sb.push(this.toTypeScriptType(valueType, mode)); sb.push(">"); - } else if (clazz.extends(this.program.arrayBufferViewInstance.prototype)) { + } else if (clazz.extendsPrototype(this.program.arrayBufferViewInstance.prototype)) { const valueType = clazz.getArrayValueType(); if (valueType == Type.i8) { sb.push("Int8Array"); } else if (valueType == Type.u8) { - if (clazz.extends(this.program.uint8ClampedArrayPrototype)) { + if (clazz.extendsPrototype(this.program.uint8ClampedArrayPrototype)) { sb.push("Uint8ClampedArray"); } else { sb.push("Uint8Array"); diff --git a/src/builtins.ts b/src/builtins.ts index 711f10c152..559dd6d8b4 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -861,7 +861,7 @@ function builtin_isArray(ctx: BuiltinContext): ExpressionRef { let classReference = type.getClass(); return reifyConstantType(ctx, module.i32( - classReference && classReference.extends(compiler.program.arrayPrototype) + classReference && classReference.extendsPrototype(compiler.program.arrayPrototype) ? 1 : 0 ) @@ -10420,26 +10420,26 @@ export function compileRTTI(compiler: Compiler): void { assert(instanceId == lastId++); let flags: TypeinfoFlags = 0; if (instance.isPointerfree) flags |= TypeinfoFlags.POINTERFREE; - if (instance != abvInstance && instance.extends(abvPrototype)) { + if (instance != abvInstance && instance.extendsPrototype(abvPrototype)) { let valueType = instance.getArrayValueType(); flags |= TypeinfoFlags.ARRAYBUFFERVIEW; flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(valueType); - } else if (instance.extends(arrayPrototype)) { + } else if (instance.extendsPrototype(arrayPrototype)) { let valueType = instance.getArrayValueType(); flags |= TypeinfoFlags.ARRAY; flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(valueType); - } else if (instance.extends(setPrototype)) { + } else if (instance.extendsPrototype(setPrototype)) { let typeArguments = assert(instance.getTypeArgumentsTo(setPrototype)); assert(typeArguments.length == 1); flags |= TypeinfoFlags.SET; flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(typeArguments[0]); - } else if (instance.extends(mapPrototype)) { + } else if (instance.extendsPrototype(mapPrototype)) { let typeArguments = assert(instance.getTypeArgumentsTo(mapPrototype)); assert(typeArguments.length == 2); flags |= TypeinfoFlags.MAP; flags |= TypeinfoFlags.KEY_ALIGN_0 * typeToRuntimeFlags(typeArguments[0]); flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(typeArguments[1]); - } else if (instance.extends(staticArrayPrototype)) { + } else if (instance.extendsPrototype(staticArrayPrototype)) { let valueType = instance.getArrayValueType(); flags |= TypeinfoFlags.STATICARRAY; flags |= TypeinfoFlags.VALUE_ALIGN_0 * typeToRuntimeFlags(valueType); diff --git a/src/compiler.ts b/src/compiler.ts index e4d86c7dc2..2d55c91e12 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -556,12 +556,18 @@ export class Compiler extends DiagnosticEmitter { for (let _keys = Map_keys(this.pendingInstanceOf), i = 0, k = _keys.length; i < k; ++i) { let elem = _keys[i]; let name = assert(this.pendingInstanceOf.get(elem)); - if (elem.kind == ElementKind.Class) { - this.finalizeInstanceOf(elem, name); - } else if (elem.kind == ElementKind.ClassPrototype) { - this.finalizeAnyInstanceOf(elem, name); - } else { - assert(false); + switch (elem.kind) { + case ElementKind.Class: + case ElementKind.Interface: { + this.finalizeInstanceOf(elem, name); + break; + } + case ElementKind.ClassPrototype: + case ElementKind.InterfacePrototype: { + this.finalizeAnyInstanceOf(elem, name); + break; + } + default: assert(false); } } @@ -6569,11 +6575,17 @@ export class Compiler extends DiagnosticEmitter { } let classInstance = assert(overrideInstance.getBoundClassOrInterface()); builder.addCase(classInstance.id, stmts); - // Also alias each extendee inheriting this exact overload - let extendees = classInstance.getAllExtendees(instance.declaration.name.text); // without get:/set: - for (let _values = Set_values(extendees), a = 0, b = _values.length; a < b; ++a) { - let extendee = _values[a]; - builder.addCase(extendee.id, stmts); + // Also alias each extender inheriting this exact overload + let extenders = classInstance.extenders; + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + let instanceMembers = extender.prototype.instanceMembers; + if (instanceMembers && instanceMembers.has(instance.declaration.name.text)) { + continue; // skip those not inheriting + } + builder.addCase(extender.id, stmts); + } } } } @@ -6581,7 +6593,7 @@ export class Compiler extends DiagnosticEmitter { // Call the original function if no other id matches and the method is not // abstract or part of an interface. Note that doing so will not catch an // invalid id, but can reduce code size significantly since we also don't - // have to add branches for extendees inheriting the original function. + // have to add branches for extenders inheriting the original function. let body: ExpressionRef; let instanceClass = instance.getBoundClassOrInterface(); if (!instance.is(CommonFlags.Abstract) && !(instanceClass && instanceClass.kind == ElementKind.Interface)) { @@ -7432,7 +7444,7 @@ export class Compiler extends DiagnosticEmitter { // instanceof - LHS must be != 0 if (actualType.isNullableReference && !expectedType.isNullableReference) { - // upcast - check statically + // same or upcast - check statically if (actualType.nonNullableType.isAssignableTo(expectedType)) { return module.binary( sizeTypeRef == TypeRef.I64 @@ -7443,8 +7455,8 @@ export class Compiler extends DiagnosticEmitter { ); } - // downcast - check dynamically - if (expectedType.isAssignableTo(actualType)) { + // potential downcast - check dynamically + if (actualType.nonNullableType.hasSubtypeAssignableTo(expectedType)) { if (!(actualType.isUnmanaged || expectedType.isUnmanaged)) { if (this.options.pedantic) { this.pedantic( @@ -7477,12 +7489,13 @@ export class Compiler extends DiagnosticEmitter { // either none or both nullable } else { - // upcast - check statically + // same or upcast - check statically if (actualType.isAssignableTo(expectedType)) { return module.maybeDropCondition(expr, module.i32(1)); + } - // downcast - check dynamically - } else if (expectedType.isAssignableTo(actualType)) { + // potential downcast - check dynamically + if (actualType.hasSubtypeAssignableTo(expectedType)) { if (!(actualType.isUnmanaged || expectedType.isUnmanaged)) { let temp = flow.getTempLocal(actualType); let tempIndex = temp.index; @@ -7558,19 +7571,32 @@ export class Compiler extends DiagnosticEmitter { ), false // managedness is irrelevant here, isn't interrupted ) ); - let allInstances = new Set(); - allInstances.add(instance); - instance.getAllExtendeesAndImplementers(allInstances); - for (let _values = Set_values(allInstances), i = 0, k = _values.length; i < k; ++i) { - let instance = _values[i]; - stmts.push( - module.br("is_instance", - module.binary(BinaryOp.EqI32, - module.local_get(1, TypeRef.I32), - module.i32(instance.id) + let allInstances: Set | null; + if (instance.isInterface) { + allInstances = instance.implementers; + } else { + allInstances = new Set(); + allInstances.add(instance); + let extenders = instance.extenders; + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + allInstances.add(extender); + } + } + } + if (allInstances) { + for (let _values = Set_values(allInstances), i = 0, k = _values.length; i < k; ++i) { + let instance = _values[i]; + stmts.push( + module.br("is_instance", + module.binary(BinaryOp.EqI32, + module.local_get(1, TypeRef.I32), + module.i32(instance.id) + ) ) - ) - ); + ); + } } stmts.push( module.return( @@ -7599,7 +7625,7 @@ export class Compiler extends DiagnosticEmitter { if (classReference) { // static check - if (classReference.extends(prototype)) { + if (classReference.extendsPrototype(prototype)) { // instanceof - LHS must be != 0 if (actualType.isNullableReference) { @@ -7688,8 +7714,24 @@ export class Compiler extends DiagnosticEmitter { let allInstances = new Set(); for (let _values = Map_values(instances), i = 0, k = _values.length; i < k; ++i) { let instance = _values[i]; - allInstances.add(instance); - instance.getAllExtendeesAndImplementers(allInstances); + if (instance.isInterface) { + let implementers = instance.implementers; + if (implementers) { + for (let _values = Set_values(implementers), i = 0, k = _values.length; i < k; ++i) { + let implementer = _values[i]; + allInstances.add(implementer); + } + } + } else { + allInstances.add(instance); + let extenders = instance.extenders; + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + allInstances.add(extender); + } + } + } } for (let _values = Set_values(allInstances), i = 0, k = _values.length; i < k; ++i) { let instance = _values[i]; @@ -7946,7 +7988,7 @@ export class Compiler extends DiagnosticEmitter { let parameterTypes = instance.signature.parameterTypes; if (parameterTypes.length) { let first = parameterTypes[0].getClass(); - if (first && !first.extends(tsaArrayInstance.prototype)) { + if (first && !first.extendsPrototype(tsaArrayInstance.prototype)) { arrayInstance = assert(this.resolver.resolveClass(this.program.arrayPrototype, [ stringType ])); } } @@ -8014,7 +8056,7 @@ export class Compiler extends DiagnosticEmitter { // handle static arrays let contextualClass = contextualType.getClass(); - if (contextualClass && contextualClass.extends(program.staticArrayPrototype)) { + if (contextualClass && contextualClass.extendsPrototype(program.staticArrayPrototype)) { return this.compileStaticArrayLiteral(expression, contextualType, constraints); } @@ -8147,7 +8189,7 @@ export class Compiler extends DiagnosticEmitter { ): ExpressionRef { let program = this.program; let module = this.module; - assert(!arrayInstance.extends(program.staticArrayPrototype)); + assert(!arrayInstance.extendsPrototype(program.staticArrayPrototype)); let elementType = arrayInstance.getArrayValueType(); // asserts // __newArray(length, alignLog2, classId, staticBuffer) diff --git a/src/program.ts b/src/program.ts index 2116651eb8..7ca4cab9f4 100644 --- a/src/program.ts +++ b/src/program.ts @@ -4182,7 +4182,7 @@ export class ClassPrototype extends DeclaredElement { /** Already resolved instances. */ instances: Map | null = null; /** Classes extending this class. */ - extendees: Set = new Set(); + extenders: Set = new Set(); /** Whether this class implicitly extends `Object`. */ implicitlyExtendsObject: bool = false; @@ -4298,9 +4298,9 @@ export class Class extends TypedElement { prototype: ClassPrototype; /** Resolved type arguments. */ typeArguments: Type[] | null; - /** Base class, if applicable. */ + /** Base class, if any. */ base: Class | null = null; - /** Implemented interfaces, if applicable. */ + /** Directly implemented interfaces, if any. */ interfaces: Set | null = null; /** Contextual type arguments for fields and methods. */ contextualTypeArguments: Map | null = null; @@ -4318,9 +4318,9 @@ export class Class extends TypedElement { rttiFlags: u32 = 0; /** Wrapped type, if a wrapper for a basic type. */ wrappedType: Type | null = null; - /** Classes directly extending this class. */ - extendees: Set | null = null; - /** Classes implementing this interface. */ + /** Classes directly or indirectly extending this class, if any. */ + extenders: Set | null = null; + /** Classes directly or indirectly implementing this interface, if any. */ implementers: Set | null = null; /** Whether the field initialization check has already been performed. */ didCheckFieldInitialization: bool = false; @@ -4419,9 +4419,6 @@ export class Class extends TypedElement { setBase(base: Class): void { assert(!this.base); this.base = base; - let extendees = base.extendees; - if (!extendees) base.extendees = extendees = new Set(); - extendees.add(this); // Inherit contextual type arguments from base class let inheritedTypeArguments = base.contextualTypeArguments; @@ -4439,6 +4436,63 @@ export class Class extends TypedElement { } } } + + // This class and its extenders now extend each direct or indirect base class + base.propagateExtenderUp(this); + let extenders = this.extenders; + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + base.propagateExtenderUp(extender); + } + } + + // Direct or indirect base interfaces are now implemented by this class and its extenders + let nextBase: Class | null = base; + do { + let baseInterfaces = nextBase.interfaces; + if (baseInterfaces) { + for (let _values = Set_values(baseInterfaces), i = 0, k = _values.length; i < k; ++i) { + let baseInterface = _values[i]; + this.propagateInterfaceDown(baseInterface); + } + } + nextBase = nextBase.base; + } while (nextBase); + } + + /** Propagates an extender to this class and its base classes. */ + private propagateExtenderUp(extender: Class): void { + // Start with this class, adding the extender to it. Repeat for the class's + // bases that are indirectly extended by the extender. + let nextBase: Class | null = this; + do { + let extenders = nextBase.extenders; + if (!extenders) nextBase.extenders = extenders = new Set(); + extenders.add(extender); + nextBase = nextBase.base; + } while (nextBase); + } + + /** Propagates an interface and its base interfaces to this class and its extenders. */ + private propagateInterfaceDown(iface: Interface): void { + // Start with the interface itself, adding this class and its extenders to + // its implementers. Repeat for the interface's bases that are indirectly + // implemented by means of being extended by the interface. + let nextIface: Interface | null = iface; + let extenders = this.extenders; + do { + let implementers = nextIface.implementers; + if (!implementers) nextIface.implementers = implementers = new Set(); + implementers.add(this); + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + implementers.add(extender); + } + } + nextIface = nextIface.base; + } while (nextIface); } /** Adds an interface. */ @@ -4446,28 +4500,53 @@ export class Class extends TypedElement { let interfaces = this.interfaces; if (!interfaces) this.interfaces = interfaces = new Set(); interfaces.add(iface); - let implementers = iface.implementers; - if (!implementers) iface.implementers = implementers = new Set(); - implementers.add(this); + + // This class and its extenders now implement the interface and its bases + this.propagateInterfaceDown(iface); } /** Tests if a value of this class type is assignable to a target of the specified class type. */ isAssignableTo(target: Class): bool { - let current: Class | null = this; - do { - if (current == target) return true; - if (target.kind == ElementKind.Interface) { - let interfaces = current.interfaces; - if (interfaces) { - for (let _values = Set_values(interfaces), i = 0, k = _values.length; i < k; ++i) { - let iface = _values[i]; - if (iface.isAssignableTo(target)) return true; - } - } + // Q: When does the assignment in the comment below succeed? + if (target.isInterface) { + if (this.isInterface) { + // targetInterface = thisInterface + return this == target || this.extends(target); + } else { + // targetInterface = thisClass + return this.implements(target); } - current = current.base; - } while (current); - return false; + } else { + if (this.isInterface) { + // targetClass = thisInterface + return target == this.program.objectInstance; + } else { + // targetClass = thisClass + return this == target || this.extends(target); + } + } + } + + /** Tests if any subclass of this class is assignable to a target of the specified class type. */ + hasSubclassAssignableTo(target: Class): bool { + // Q: When can the cast in the comment below succeed? (while an assignment would not) + if (target.isInterface) { + if (this.isInterface) { + // thisInterface + return this.hasImplementerImplementing(target); + } else { + // thisClass + return this.hasExtenderImplementing(target); + } + } else { + if (this.isInterface) { + // thisInterface + return this.hasImplementer(target); + } else { + // thisClass + return this.hasExtender(target); + } + } } /** Looks up the operator overload of the specified kind. */ @@ -4608,7 +4687,7 @@ export class Class extends TypedElement { } /** Tests if this class extends the specified prototype. */ - extends(prototype: ClassPrototype): bool { + extendsPrototype(prototype: ClassPrototype): bool { return this.prototype.extends(prototype); } @@ -4627,11 +4706,11 @@ export class Class extends TypedElement { let current: Class = this; let program = this.program; let arrayPrototype = program.arrayPrototype; - if (this.extends(arrayPrototype)) { + if (this.extendsPrototype(arrayPrototype)) { return this.getTypeArgumentsTo(arrayPrototype)![0]; } let staticArrayPrototype = program.staticArrayPrototype; - if (this.extends(staticArrayPrototype)) { + if (this.extendsPrototype(staticArrayPrototype)) { return this.getTypeArgumentsTo(staticArrayPrototype)![0]; } let abvInstance = program.arrayBufferViewInstance; @@ -4706,42 +4785,50 @@ export class Class extends TypedElement { return true; } - /** Gets all extendees of this class (that do not have the specified instance member). */ - getAllExtendees(exceptIfMember: string | null = null, out: Set = new Set()): Set { - let extendees = this.extendees; - if (extendees) { - for (let _values = Set_values(extendees), i = 0, k = _values.length; i < k; ++i) { - let extendee = _values[i]; - if (exceptIfMember) { - let instanceMembers = extendee.prototype.instanceMembers; - if (instanceMembers && instanceMembers.has(exceptIfMember)) continue; - } - out.add(extendee); - extendee.getAllExtendees(exceptIfMember, out); - } - } - return out; + /** Tests if this class or interface extends the given class or interface. */ + extends(other: Class): bool { + return other.hasExtender(this); + } + + /** Tests if this class has a direct or indirect extender matching the given class. */ + hasExtender(other: Class): bool { + let extenders = this.extenders; + return extenders != null && extenders.has(other); } - /** Gets all extendees and implementers of this class. */ - getAllExtendeesAndImplementers(out: Set = new Set()): Set { - let extendees = this.extendees; - if (extendees) { - for (let _values = Set_values(extendees), i = 0, k = _values.length; i < k; ++i) { - let extendee = _values[i]; - out.add(extendee); - extendee.getAllExtendeesAndImplementers(out); + /** Tests if this class has a direct or indirect extender that implements the given interface. */ + hasExtenderImplementing(other: Interface): bool { + let extenders = this.extenders; + if (extenders) { + for (let _values = Set_values(extenders), i = 0, k = _values.length; i < k; ++i) { + let extender = _values[i]; + if (extender.implements(other)) return true; } } + return false; + } + + /** Tests if this class directly or indirectly implements the given interface. */ + implements(other: Interface): bool { + return other.hasImplementer(this); + } + + /** Tests if this interface has a direct or indirect implementer matching the given class. */ + hasImplementer(other: Class): bool { + let implementers = this.implementers; + return implementers != null && implementers.has(other); + } + + /** Tests if this interface has an implementer implementing the given interface. */ + hasImplementerImplementing(other: Interface): bool { let implementers = this.implementers; if (implementers) { for (let _values = Set_values(implementers), i = 0, k = _values.length; i < k; ++i) { let implementer = _values[i]; - out.add(implementer); - implementer.getAllExtendeesAndImplementers(out); + if (implementer.implements(other)) return true; } } - return out; + return false; } } diff --git a/src/types.ts b/src/types.ts index baad2a89f5..5e22db7ce3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -506,6 +506,14 @@ export class Type { return this.kind == target.kind; } + /** Tests if this type has a subtype assignable to the target type. */ + hasSubtypeAssignableTo(target: Type): bool { + let thisClass = this.getClass(); + let targetClass = target.getClass(); + if (!thisClass || !targetClass) return false; // TODO: what about basic types? + return thisClass.hasSubclassAssignableTo(targetClass); + } + /** Tests if a value of this type can be changed to the target type using `changetype`. */ isChangeableTo(target: Type): bool { // special in that it allows integer references as well diff --git a/tests/compiler/instanceof.debug.wat b/tests/compiler/instanceof.debug.wat index 10167dda24..fc52a65e08 100644 --- a/tests/compiler/instanceof.debug.wat +++ b/tests/compiler/instanceof.debug.wat @@ -1,7 +1,7 @@ (module + (type $i32_=>_none (func_subtype (param i32) func)) (type $i32_=>_i32 (func_subtype (param i32) (result i32) func)) (type $i32_i32_=>_none (func_subtype (param i32 i32) func)) - (type $i32_=>_none (func_subtype (param i32) func)) (type $none_=>_none (func_subtype func)) (type $i32_i32_=>_i32 (func_subtype (param i32 i32) (result i32) func)) (type $i32_i32_i32_=>_none (func_subtype (param i32 i32 i32) func)) @@ -42,10 +42,14 @@ (global $instanceof/nullAnimal (mut i32) (i32.const 0)) (global $instanceof/nullCat (mut i32) (i32.const 0)) (global $instanceof/nullBlackcat (mut i32) (i32.const 0)) + (global $instanceof/w (mut i32) (i32.const 0)) + (global $instanceof/x (mut i32) (i32.const 0)) + (global $instanceof/y (mut i32) (i32.const 0)) + (global $instanceof/z (mut i32) (i32.const 0)) (global $~lib/rt/__rtti_base i32 (i32.const 464)) - (global $~lib/memory/__data_end i32 (i32.const 524)) - (global $~lib/memory/__stack_pointer (mut i32) (i32.const 33292)) - (global $~lib/memory/__heap_base i32 (i32.const 33292)) + (global $~lib/memory/__data_end i32 (i32.const 560)) + (global $~lib/memory/__stack_pointer (mut i32) (i32.const 33328)) + (global $~lib/memory/__heap_base i32 (i32.const 33328)) (memory $0 1) (data (i32.const 12) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00(\00\00\00A\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00\00\00\00\00") (data (i32.const 76) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00 \00\00\00~\00l\00i\00b\00/\00r\00t\00/\00i\00t\00c\00m\00s\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00") @@ -56,7 +60,7 @@ (data (i32.const 320) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (data (i32.const 348) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") (data (i32.const 412) ",\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1a\00\00\00i\00n\00s\00t\00a\00n\00c\00e\00o\00f\00.\00t\00s\00\00\00") - (data (i32.const 464) "\0e\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00") + (data (i32.const 464) "\17\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00") (table $0 1 1 funcref) (elem $0 (i32.const 1)) (export "memory" (memory $0)) @@ -2278,835 +2282,1291 @@ i32.const 0 return ) - (func $start:instanceof (type $none_=>_none) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - (local $14 i32) - (local $15 i32) - (local $16 i32) - (local $17 i32) - (local $18 i32) - (local $19 i32) - (local $20 i32) - global.get $~lib/memory/__stack_pointer - i32.const 84 - i32.sub - global.set $~lib/memory/__stack_pointer - call $~stack_check - global.get $~lib/memory/__stack_pointer - i32.const 0 - i32.const 84 - memory.fill $0 - memory.size $0 - i32.const 16 - i32.shl - global.get $~lib/memory/__heap_base - i32.sub + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 - i32.shr_u - global.set $~lib/rt/itcms/threshold - i32.const 144 - call $~lib/rt/itcms/initLazy - global.set $~lib/rt/itcms/pinSpace - i32.const 176 - call $~lib/rt/itcms/initLazy - global.set $~lib/rt/itcms/toSpace - i32.const 320 - call $~lib/rt/itcms/initLazy - global.set $~lib/rt/itcms/fromSpace - i32.const 0 - call $instanceof/A#constructor - global.set $instanceof/a - i32.const 0 - call $instanceof/B#constructor - global.set $instanceof/b + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop - i32.const 0 - i32.eqz + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 drop - i32.const 0 - i32.eqz + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 drop - i32.const 0 - i32.eqz + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 drop - i32.const 0 - i32.eqz + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/a - local.tee $0 - i32.store $0 - local.get $0 + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/W> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $0 - call $~instanceof|instanceof/B + local.get $1 + call $~instanceof|instanceof/W end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 18 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end i32.const 1 drop - i32.const 0 - i32.eqz - drop - i32.const 0 - i32.eqz - drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/X + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Y + end i32.eqz - drop + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Z + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IA> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/IA + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IB> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/IB + end i32.eqz - drop + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IC> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/IC + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/ID> (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 - i32.eqz - drop - i32.const 0 - i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/ID + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 i32.eqz drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop - i32.const 0 - call $instanceof/isI32 + return + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - if + if (result i32) i32.const 0 - i32.const 432 - i32.const 62 - i32.const 1 - call $~lib/builtins/abort - unreachable + else + local.get $1 + call $~instanceof|instanceof/Y end - f64.const 0 - call $instanceof/isI32 - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 63 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - i32.const 0 - call $instanceof/isI32 - i32.eqz + i32.const 1 + drop + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - if + if (result i32) i32.const 0 - i32.const 432 - i32.const 64 - i32.const 1 - call $~lib/builtins/abort - unreachable + else + local.get $1 + call $~instanceof|instanceof/Z end - i32.const 0 - call $instanceof/isI32 - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 65 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $instanceof/an - i32.const 0 - i32.ne + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Y + end i32.eqz if i32.const 0 - i32.const 432 - i32.const 68 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end i32.const 1 drop - i32.const 1 - global.set $instanceof/an - global.get $instanceof/an - i32.const 0 - i32.ne + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Z + end i32.eqz if i32.const 0 - i32.const 432 - i32.const 71 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end i32.const 1 drop - i32.const 0 - call $instanceof/Child#constructor - global.set $instanceof/child + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop - i32.const 0 + return + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 1 - drop + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Z + end + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end i32.const 1 drop - i32.const 0 - i32.eqz - drop - i32.const 0 + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz - drop - i32.const 0 + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Z + end i32.eqz + if + i32.const 0 + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 drop - i32.const 0 - call $instanceof/Child#constructor - global.set $instanceof/childAsParent + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) i32.const 1 drop - i32.const 0 - i32.eqz + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/childAsParent + return + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value local.tee $1 - i32.store $0 offset=4 - local.get $1 i32.eqz if (result i32) i32.const 0 else local.get $1 - call $~instanceof|instanceof/Child + call $~instanceof|instanceof/IC end - i32.eqz if i32.const 0 - i32.const 432 - i32.const 94 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - i32.const 0 - i32.eqz + i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/childAsParent - local.tee $2 - i32.store $0 offset=8 - local.get $2 + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $2 - call $~anyinstanceof|instanceof/Child + local.get $1 + call $~instanceof|instanceof/IC end - i32.eqz if i32.const 0 - i32.const 432 - i32.const 96 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - i32.const 0 - i32.eqz - drop - i32.const 0 - i32.eqz - drop - i32.const 0 - call $instanceof/Animal#constructor - global.set $instanceof/animal - i32.const 0 - call $instanceof/Cat#constructor - global.set $instanceof/cat - i32.const 0 - call $instanceof/BlackCat#constructor - global.set $instanceof/blackcat i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/animal - local.tee $3 - i32.store $0 offset=12 - local.get $3 + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $3 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/ID end - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 111 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/animal - local.tee $4 - i32.store $0 offset=16 - local.get $4 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $4 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/ID end - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 112 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/cat - local.tee $5 - i32.store $0 offset=20 - local.get $5 + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $5 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/IC end i32.eqz if i32.const 0 - i32.const 432 - i32.const 115 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/cat - local.tee $6 - i32.store $0 offset=24 - local.get $6 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $6 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/IC end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 116 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end i32.const 1 drop - global.get $~lib/memory/__stack_pointer - global.get $instanceof/blackcat - local.tee $7 - i32.store $0 offset=28 - local.get $7 + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $7 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/ID end i32.eqz if i32.const 0 - i32.const 432 - i32.const 119 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/blackcat - local.tee $8 - i32.store $0 offset=32 - local.get $8 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $8 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/ID end i32.eqz if i32.const 0 - i32.const 432 - i32.const 120 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - i32.const 0 - call $instanceof/Animal#constructor - global.set $instanceof/nullableAnimal - i32.const 0 - call $instanceof/Cat#constructor - global.set $instanceof/nullableCat - i32.const 0 - call $instanceof/BlackCat#constructor - global.set $instanceof/nullableBlackcat - global.get $instanceof/nullableAnimal - i32.const 0 - i32.ne - i32.eqz - if + local.set $check i32.const 0 - i32.const 432 - i32.const 126 - i32.const 1 - call $~lib/builtins/abort - unreachable + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableAnimal - local.tee $9 - i32.store $0 offset=36 - local.get $9 + i32.const 1 + drop + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $9 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/ID end - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 127 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableAnimal - local.tee $10 - i32.store $0 offset=40 - local.get $10 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $10 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/IC end - i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 128 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $instanceof/nullableCat + i32.const 1 + drop + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 - i32.ne i32.eqz - if - i32.const 0 - i32.const 432 - i32.const 130 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableCat - local.tee $11 - i32.store $0 offset=44 - local.get $11 + drop + return + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $11 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/ID end i32.eqz if i32.const 0 - i32.const 432 - i32.const 131 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableCat - local.tee $12 - i32.store $0 offset=48 - local.get $12 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $12 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/IC end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 132 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $instanceof/nullableBlackcat + i32.const 1 + drop + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) i32.const 0 - i32.ne i32.eqz - if - i32.const 0 - i32.const 432 - i32.const 134 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableBlackcat - local.tee $13 - i32.store $0 offset=52 - local.get $13 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticTrue (type $i32_=>_none) (param $value i32) + i32.const 1 + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertStaticFalse (type $i32_=>_none) (param $value i32) + i32.const 0 + i32.eqz + drop + return + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $13 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/X end i32.eqz if i32.const 0 - i32.const 432 - i32.const 135 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullableBlackcat - local.tee $14 - i32.store $0 offset=56 - local.get $14 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $14 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/X end i32.eqz if i32.const 0 - i32.const 432 - i32.const 136 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - global.get $instanceof/nullAnimal - i32.const 0 - i32.ne - i32.eqz - i32.eqz - if + local.set $check i32.const 0 - i32.const 432 - i32.const 142 - i32.const 1 - call $~lib/builtins/abort - unreachable + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullAnimal - local.tee $15 - i32.store $0 offset=60 - local.get $15 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $15 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/Y end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 143 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullAnimal - local.tee $16 - i32.store $0 offset=64 - local.get $16 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $16 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/Y end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 144 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - global.get $instanceof/nullCat - i32.const 0 - i32.ne + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Y + end i32.eqz if i32.const 0 - i32.const 432 - i32.const 146 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullCat - local.tee $17 - i32.store $0 offset=68 - local.get $17 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $17 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/Y end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 147 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullCat - local.tee $18 - i32.store $0 offset=72 - local.get $18 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $18 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/Z end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 148 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $instanceof/nullBlackcat - i32.const 0 - i32.ne + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Z + end i32.eqz if i32.const 0 - i32.const 432 - i32.const 150 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullBlackcat - local.tee $19 - i32.store $0 offset=76 - local.get $19 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $19 - call $~instanceof|instanceof/Cat + local.get $1 + call $~instanceof|instanceof/Z end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 151 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - global.get $instanceof/nullBlackcat - local.tee $20 - i32.store $0 offset=80 - local.get $20 + i32.const 1 + drop + ) + (func $instanceof/assertDynamicTrue (type $i32_=>_none) (param $value i32) + (local $1 i32) + (local $check i32) + local.get $value + local.tee $1 i32.eqz if (result i32) i32.const 0 else - local.get $20 - call $~instanceof|instanceof/BlackCat + local.get $1 + call $~instanceof|instanceof/Z end i32.eqz - i32.eqz if i32.const 0 - i32.const 432 - i32.const 152 - i32.const 1 - call $~lib/builtins/abort - unreachable + local.set $check + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end end - global.get $~lib/memory/__stack_pointer - i32.const 84 - i32.add - global.set $~lib/memory/__stack_pointer + i32.const 1 + drop ) (func $~instanceof|instanceof/B (type $i32_=>_i32) (param $0 i32) (result i32) (local $1 i32) @@ -3201,67 +3661,239 @@ end i32.const 1 ) - (func $~lib/rt/__visit_globals (type $i32_=>_none) (param $0 i32) + (func $~instanceof|instanceof/W (type $i32_=>_i32) (param $0 i32) (result i32) (local $1 i32) - global.get $instanceof/a - local.tee $1 - if - local.get $1 + block $is_instance local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/b - local.tee $1 - if + i32.const 8 + i32.sub + i32.load $0 + local.set $1 local.get $1 - local.get $0 - call $~lib/rt/itcms/__visit + i32.const 14 + i32.eq + br_if $is_instance + i32.const 0 + return end - global.get $instanceof/an - local.tee $1 - if - local.get $1 + i32.const 1 + ) + (func $~instanceof|instanceof/X (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/child - local.tee $1 - if + i32.const 8 + i32.sub + i32.load $0 + local.set $1 local.get $1 - local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/childAsParent - local.tee $1 - if + i32.const 15 + i32.eq + br_if $is_instance local.get $1 - local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/animal - local.tee $1 - if + i32.const 18 + i32.eq + br_if $is_instance local.get $1 - local.get $0 - call $~lib/rt/itcms/__visit + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return end - global.get $instanceof/cat - local.tee $1 - if - local.get $1 + i32.const 1 + ) + (func $~instanceof|instanceof/Y (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/blackcat - local.tee $1 - if + i32.const 8 + i32.sub + i32.load $0 + local.set $1 local.get $1 - local.get $0 - call $~lib/rt/itcms/__visit - end - global.get $instanceof/nullableAnimal - local.tee $1 - if + i32.const 18 + i32.eq + br_if $is_instance + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~instanceof|instanceof/Z (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.set $1 + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~instanceof|instanceof/IA (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.set $1 + local.get $1 + i32.const 15 + i32.eq + br_if $is_instance + local.get $1 + i32.const 18 + i32.eq + br_if $is_instance + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~instanceof|instanceof/IB (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.set $1 + local.get $1 + i32.const 15 + i32.eq + br_if $is_instance + local.get $1 + i32.const 18 + i32.eq + br_if $is_instance + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~instanceof|instanceof/IC (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.set $1 + local.get $1 + i32.const 18 + i32.eq + br_if $is_instance + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~instanceof|instanceof/ID (type $i32_=>_i32) (param $0 i32) (result i32) + (local $1 i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.set $1 + local.get $1 + i32.const 18 + i32.eq + br_if $is_instance + local.get $1 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + return + end + i32.const 1 + ) + (func $~lib/rt/__visit_globals (type $i32_=>_none) (param $0 i32) + (local $1 i32) + global.get $instanceof/a + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/b + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/an + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/child + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/childAsParent + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/animal + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/cat + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/blackcat + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/nullableAnimal + local.tee $1 + if local.get $1 local.get $0 call $~lib/rt/itcms/__visit @@ -3301,6 +3933,34 @@ local.get $0 call $~lib/rt/itcms/__visit end + global.get $instanceof/w + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/x + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/y + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end + global.get $instanceof/z + local.tee $1 + if + local.get $1 + local.get $0 + call $~lib/rt/itcms/__visit + end i32.const 224 local.get $0 call $~lib/rt/itcms/__visit @@ -3327,25 +3987,55 @@ ) (func $~lib/rt/__visit_members (type $i32_i32_=>_none) (param $0 i32) (param $1 i32) block $invalid - block $instanceof/BlackCat - block $instanceof/Cat - block $instanceof/Animal - block $instanceof/SomethingElse - block $instanceof/Parent - block $instanceof/Child - block $instanceof/Parent - block $instanceof/Child - block $instanceof/B - block $instanceof/A - block $~lib/arraybuffer/ArrayBufferView - block $~lib/string/String - block $~lib/arraybuffer/ArrayBuffer - block $~lib/object/Object - local.get $0 - i32.const 8 - i32.sub - i32.load $0 - br_table $~lib/object/Object $~lib/arraybuffer/ArrayBuffer $~lib/string/String $~lib/arraybuffer/ArrayBufferView $instanceof/A $instanceof/B $instanceof/Child $instanceof/Parent $instanceof/Child $instanceof/Parent $instanceof/SomethingElse $instanceof/Animal $instanceof/Cat $instanceof/BlackCat $invalid + block $instanceof/IE + block $instanceof/Z + block $instanceof/IC + block $instanceof/ID + block $instanceof/Y + block $instanceof/IA + block $instanceof/IB + block $instanceof/X + block $instanceof/W + block $instanceof/BlackCat + block $instanceof/Cat + block $instanceof/Animal + block $instanceof/SomethingElse + block $instanceof/Parent + block $instanceof/Child + block $instanceof/Parent + block $instanceof/Child + block $instanceof/B + block $instanceof/A + block $~lib/arraybuffer/ArrayBufferView + block $~lib/string/String + block $~lib/arraybuffer/ArrayBuffer + block $~lib/object/Object + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + br_table $~lib/object/Object $~lib/arraybuffer/ArrayBuffer $~lib/string/String $~lib/arraybuffer/ArrayBufferView $instanceof/A $instanceof/B $instanceof/Child $instanceof/Parent $instanceof/Child $instanceof/Parent $instanceof/SomethingElse $instanceof/Animal $instanceof/Cat $instanceof/BlackCat $instanceof/W $instanceof/X $instanceof/IB $instanceof/IA $instanceof/Y $instanceof/ID $instanceof/IC $instanceof/Z $instanceof/IE $invalid + end + return + end + return + end + return + end + local.get $0 + local.get $1 + call $~lib/arraybuffer/ArrayBufferView~visit + return + end + return + end + return + end + return + end + return + end + return end return end @@ -3353,9 +4043,6 @@ end return end - local.get $0 - local.get $1 - call $~lib/arraybuffer/ArrayBufferView~visit return end return @@ -3385,16 +4072,1783 @@ ) (func $~stack_check (type $none_=>_none) global.get $~lib/memory/__stack_pointer - global.get $~lib/memory/__data_end - i32.lt_s - if - i32.const 33312 - i32.const 33360 - i32.const 1 - i32.const 1 - call $~lib/builtins/abort - unreachable - end + global.get $~lib/memory/__data_end + i32.lt_s + if + i32.const 33360 + i32.const 33408 + i32.const 1 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ) + (func $start:instanceof (type $none_=>_none) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + global.get $~lib/memory/__stack_pointer + i32.const 88 + i32.sub + global.set $~lib/memory/__stack_pointer + call $~stack_check + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.const 88 + memory.fill $0 + memory.size $0 + i32.const 16 + i32.shl + global.get $~lib/memory/__heap_base + i32.sub + i32.const 1 + i32.shr_u + global.set $~lib/rt/itcms/threshold + i32.const 144 + call $~lib/rt/itcms/initLazy + global.set $~lib/rt/itcms/pinSpace + i32.const 176 + call $~lib/rt/itcms/initLazy + global.set $~lib/rt/itcms/toSpace + i32.const 320 + call $~lib/rt/itcms/initLazy + global.set $~lib/rt/itcms/fromSpace + i32.const 0 + call $instanceof/A#constructor + global.set $instanceof/a + i32.const 0 + call $instanceof/B#constructor + global.set $instanceof/b + i32.const 1 + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/a + local.tee $0 + i32.store $0 + local.get $0 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $0 + call $~instanceof|instanceof/B + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 41 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 1 + drop + i32.const 0 + call $instanceof/isI32 + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 85 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + f64.const 0 + call $instanceof/isI32 + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 86 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $instanceof/isI32 + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 87 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $instanceof/isI32 + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 88 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/an + i32.const 0 + i32.ne + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 91 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + i32.const 1 + global.set $instanceof/an + global.get $instanceof/an + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 94 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + i32.const 0 + call $instanceof/Child#constructor + global.set $instanceof/child + i32.const 1 + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 1 + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + call $instanceof/Child#constructor + global.set $instanceof/childAsParent + i32.const 1 + drop + i32.const 1 + drop + i32.const 0 + i32.eqz + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/childAsParent + local.tee $1 + i32.store $0 offset=4 + local.get $1 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $1 + call $~instanceof|instanceof/Child + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 117 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + i32.eqz + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/childAsParent + local.tee $2 + i32.store $0 offset=8 + local.get $2 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $2 + call $~anyinstanceof|instanceof/Child + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 119 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + i32.eqz + drop + i32.const 0 + i32.eqz + drop + i32.const 0 + call $instanceof/Animal#constructor + global.set $instanceof/animal + i32.const 0 + call $instanceof/Cat#constructor + global.set $instanceof/cat + i32.const 0 + call $instanceof/BlackCat#constructor + global.set $instanceof/blackcat + i32.const 1 + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/animal + local.tee $3 + i32.store $0 offset=12 + local.get $3 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $3 + call $~instanceof|instanceof/Cat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 134 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/animal + local.tee $4 + i32.store $0 offset=16 + local.get $4 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $4 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 135 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/cat + local.tee $5 + i32.store $0 offset=20 + local.get $5 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $5 + call $~instanceof|instanceof/Cat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 138 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/cat + local.tee $6 + i32.store $0 offset=24 + local.get $6 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $6 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 139 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + global.get $~lib/memory/__stack_pointer + global.get $instanceof/blackcat + local.tee $7 + i32.store $0 offset=28 + local.get $7 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $7 + call $~instanceof|instanceof/Cat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 142 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/blackcat + local.tee $8 + i32.store $0 offset=32 + local.get $8 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $8 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 143 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $instanceof/Animal#constructor + global.set $instanceof/nullableAnimal + i32.const 0 + call $instanceof/Cat#constructor + global.set $instanceof/nullableCat + i32.const 0 + call $instanceof/BlackCat#constructor + global.set $instanceof/nullableBlackcat + global.get $instanceof/nullableAnimal + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 149 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableAnimal + local.tee $9 + i32.store $0 offset=36 + local.get $9 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $9 + call $~instanceof|instanceof/Cat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 150 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableAnimal + local.tee $10 + i32.store $0 offset=40 + local.get $10 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $10 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 151 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/nullableCat + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 153 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableCat + local.tee $11 + i32.store $0 offset=44 + local.get $11 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $11 + call $~instanceof|instanceof/Cat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 154 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableCat + local.tee $12 + i32.store $0 offset=48 + local.get $12 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $12 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 155 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/nullableBlackcat + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 157 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableBlackcat + local.tee $13 + i32.store $0 offset=52 + local.get $13 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $13 + call $~instanceof|instanceof/Cat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 158 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullableBlackcat + local.tee $14 + i32.store $0 offset=56 + local.get $14 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $14 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 159 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/nullAnimal + i32.const 0 + i32.ne + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 165 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullAnimal + local.tee $15 + i32.store $0 offset=60 + local.get $15 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $15 + call $~instanceof|instanceof/Cat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 166 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullAnimal + local.tee $16 + i32.store $0 offset=64 + local.get $16 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $16 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 167 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/nullCat + i32.const 0 + i32.ne + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 169 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullCat + local.tee $17 + i32.store $0 offset=68 + local.get $17 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $17 + call $~instanceof|instanceof/Cat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 170 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullCat + local.tee $18 + i32.store $0 offset=72 + local.get $18 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $18 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 171 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $instanceof/nullBlackcat + i32.const 0 + i32.ne + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 173 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullBlackcat + local.tee $19 + i32.store $0 offset=76 + local.get $19 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $19 + call $~instanceof|instanceof/Cat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 174 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/nullBlackcat + local.tee $20 + i32.store $0 offset=80 + local.get $20 + i32.eqz + if (result i32) + i32.const 0 + else + local.get $20 + call $~instanceof|instanceof/BlackCat + end + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 432 + i32.const 175 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + call $instanceof/W#constructor + global.set $instanceof/w + i32.const 0 + call $instanceof/X#constructor + global.set $instanceof/x + i32.const 0 + call $instanceof/Y#constructor + global.set $instanceof/y + i32.const 0 + call $instanceof/Z#constructor + global.set $instanceof/z + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/W> + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IA> + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IB> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IA> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IB> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IC> + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/ID> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IA> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IB> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/IC> + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/ID> + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/w + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertStaticFalse + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/x + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/y + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $instanceof/z + local.set $21 + global.get $~lib/memory/__stack_pointer + local.get $21 + i32.store $0 offset=84 + local.get $21 + call $instanceof/assertDynamicTrue + global.get $~lib/memory/__stack_pointer + i32.const 88 + i32.add + global.set $~lib/memory/__stack_pointer ) (func $~lib/object/Object#constructor (type $i32_=>_i32) (param $this i32) (result i32) (local $1 i32) @@ -3721,4 +6175,136 @@ global.set $~lib/memory/__stack_pointer local.get $1 ) + (func $instanceof/W#constructor (type $i32_=>_i32) (param $this i32) (result i32) + (local $1 i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + call $~stack_check + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $this + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.const 14 + call $~lib/rt/itcms/__new + local.tee $this + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $this + call $~lib/object/Object#constructor + local.tee $this + i32.store $0 + local.get $this + local.set $1 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $1 + ) + (func $instanceof/X#constructor (type $i32_=>_i32) (param $this i32) (result i32) + (local $1 i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + call $~stack_check + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $this + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.const 15 + call $~lib/rt/itcms/__new + local.tee $this + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $this + call $~lib/object/Object#constructor + local.tee $this + i32.store $0 + local.get $this + local.set $1 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $1 + ) + (func $instanceof/Y#constructor (type $i32_=>_i32) (param $this i32) (result i32) + (local $1 i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + call $~stack_check + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $this + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.const 18 + call $~lib/rt/itcms/__new + local.tee $this + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $this + call $instanceof/X#constructor + local.tee $this + i32.store $0 + local.get $this + local.set $1 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $1 + ) + (func $instanceof/Z#constructor (type $i32_=>_i32) (param $this i32) (result i32) + (local $1 i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + call $~stack_check + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $this + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.const 21 + call $~lib/rt/itcms/__new + local.tee $this + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $this + call $instanceof/Y#constructor + local.tee $this + i32.store $0 + local.get $this + local.set $1 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $1 + ) ) diff --git a/tests/compiler/instanceof.release.wat b/tests/compiler/instanceof.release.wat index 285a61dcad..25eebb2edc 100644 --- a/tests/compiler/instanceof.release.wat +++ b/tests/compiler/instanceof.release.wat @@ -1,7 +1,7 @@ (module + (type $i32_=>_none (func_subtype (param i32) func)) (type $i32_=>_i32 (func_subtype (param i32) (result i32) func)) (type $none_=>_none (func_subtype func)) - (type $i32_=>_none (func_subtype (param i32) func)) (type $i32_i32_=>_none (func_subtype (param i32 i32) func)) (type $none_=>_i32 (func_subtype (result i32) func)) (type $i32_i32_i32_i32_=>_none (func_subtype (param i32 i32 i32 i32) func)) @@ -28,7 +28,11 @@ (global $instanceof/nullableAnimal (mut i32) (i32.const 0)) (global $instanceof/nullableCat (mut i32) (i32.const 0)) (global $instanceof/nullableBlackcat (mut i32) (i32.const 0)) - (global $~lib/memory/__stack_pointer (mut i32) (i32.const 34316)) + (global $instanceof/w (mut i32) (i32.const 0)) + (global $instanceof/x (mut i32) (i32.const 0)) + (global $instanceof/y (mut i32) (i32.const 0)) + (global $instanceof/z (mut i32) (i32.const 0)) + (global $~lib/memory/__stack_pointer (mut i32) (i32.const 34352)) (memory $0 1) (data (i32.const 1036) "<") (data (i32.const 1048) "\02\00\00\00(\00\00\00A\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -42,7 +46,7 @@ (data (i32.const 1384) "\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (data (i32.const 1436) ",") (data (i32.const 1448) "\02\00\00\00\1a\00\00\00i\00n\00s\00t\00a\00n\00c\00e\00o\00f\00.\00t\00s") - (data (i32.const 1488) "\0e\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 ") + (data (i32.const 1488) "\17\00\00\00 \00\00\00 \00\00\00 \00\00\00\00\00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 \00\00\00 ") (export "memory" (memory $0)) (start $~start) (func $~lib/rt/itcms/visitRoots (type $none_=>_none) @@ -114,6 +118,30 @@ local.get $0 call $byn-split-outlined-A$~lib/rt/itcms/__visit end + global.get $instanceof/w + local.tee $0 + if + local.get $0 + call $byn-split-outlined-A$~lib/rt/itcms/__visit + end + global.get $instanceof/x + local.tee $0 + if + local.get $0 + call $byn-split-outlined-A$~lib/rt/itcms/__visit + end + global.get $instanceof/y + local.tee $0 + if + local.get $0 + call $byn-split-outlined-A$~lib/rt/itcms/__visit + end + global.get $instanceof/z + local.tee $0 + if + local.get $0 + call $byn-split-outlined-A$~lib/rt/itcms/__visit + end i32.const 1248 call $byn-split-outlined-A$~lib/rt/itcms/__visit i32.const 1056 @@ -191,7 +219,7 @@ i32.load $0 offset=8 i32.eqz local.get $0 - i32.const 34316 + i32.const 34352 i32.lt_u i32.and i32.eqz @@ -819,10 +847,10 @@ if unreachable end - i32.const 34320 + i32.const 34352 i32.const 0 i32.store $0 - i32.const 35888 + i32.const 35920 i32.const 0 i32.store $0 loop $for-loop|0 @@ -833,7 +861,7 @@ local.get $0 i32.const 2 i32.shl - i32.const 34320 + i32.const 34352 i32.add i32.const 0 i32.store $0 offset=4 @@ -851,7 +879,7 @@ i32.add i32.const 2 i32.shl - i32.const 34320 + i32.const 34352 i32.add i32.const 0 i32.store $0 offset=96 @@ -869,13 +897,13 @@ br $for-loop|0 end end - i32.const 34320 - i32.const 35892 + i32.const 34352 + i32.const 35924 memory.size $0 i32.const 16 i32.shl call $~lib/rt/tlsf/addMemory - i32.const 34320 + i32.const 34352 global.set $~lib/rt/tlsf/ROOT ) (func $~lib/rt/itcms/step (type $none_=>_i32) (result i32) @@ -960,7 +988,7 @@ local.set $0 loop $while-continue|0 local.get $0 - i32.const 34316 + i32.const 34352 i32.lt_u if local.get $0 @@ -1060,7 +1088,7 @@ unreachable end local.get $0 - i32.const 34316 + i32.const 34352 i32.lt_u if local.get $0 @@ -1083,7 +1111,7 @@ i32.const 4 i32.add local.tee $0 - i32.const 34316 + i32.const 34352 i32.ge_u if global.get $~lib/rt/tlsf/ROOT @@ -1435,26 +1463,261 @@ memory.fill $0 local.get $0 ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> (type $i32_=>_none) (param $0 i32) + local.get $0 + if (result i32) + block $__inlined_func$~instanceof|instanceof/X (result i32) + block $is_instance + block $tablify|0 + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + i32.const 15 + i32.sub + br_table $is_instance $tablify|0 $tablify|0 $is_instance $tablify|0 $tablify|0 $is_instance $tablify|0 + end + i32.const 0 + br $__inlined_func$~instanceof|instanceof/X + end + i32.const 1 + end + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1456 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> (type $i32_=>_none) (param $0 i32) + local.get $0 + if (result i32) + block $__inlined_func$~instanceof|instanceof/Y (result i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.tee $0 + i32.const 18 + i32.eq + br_if $is_instance + local.get $0 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + br $__inlined_func$~instanceof|instanceof/Y + end + i32.const 1 + end + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1456 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + ) + (func $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> (type $i32_=>_none) (param $0 i32) + local.get $0 + if (result i32) + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + i32.const 21 + i32.eq + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1456 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $0 i32) + local.get $0 + if (result i32) + block $__inlined_func$~instanceof|instanceof/Y (result i32) + block $is_instance + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + local.tee $0 + i32.const 18 + i32.eq + br_if $is_instance + local.get $0 + i32.const 21 + i32.eq + br_if $is_instance + i32.const 0 + br $__inlined_func$~instanceof|instanceof/Y + end + i32.const 1 + end + else + i32.const 0 + end + if + i32.const 0 + i32.const 1456 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + ) + (func $instanceof/assertDynamicFalse (type $i32_=>_none) (param $0 i32) + local.get $0 + if (result i32) + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + i32.const 21 + i32.eq + else + i32.const 0 + end + if + i32.const 0 + i32.const 1456 + i32.const 19 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/__visit_members (type $i32_=>_none) (param $0 i32) + block $invalid + block $instanceof/IE + block $instanceof/Z + block $instanceof/IC + block $instanceof/ID + block $instanceof/Y + block $instanceof/IA + block $instanceof/IB + block $instanceof/X + block $instanceof/W + block $instanceof/BlackCat + block $instanceof/Cat + block $instanceof/Animal + block $instanceof/SomethingElse + block $instanceof/Parent + block $instanceof/Child + block $instanceof/Parent + block $instanceof/Child + block $instanceof/B + block $instanceof/A + block $~lib/arraybuffer/ArrayBufferView + block $~lib/string/String + block $~lib/arraybuffer/ArrayBuffer + block $~lib/object/Object + local.get $0 + i32.const 8 + i32.sub + i32.load $0 + br_table $~lib/object/Object $~lib/arraybuffer/ArrayBuffer $~lib/string/String $~lib/arraybuffer/ArrayBufferView $instanceof/A $instanceof/B $instanceof/Child $instanceof/Parent $instanceof/Child $instanceof/Parent $instanceof/SomethingElse $instanceof/Animal $instanceof/Cat $instanceof/BlackCat $instanceof/W $instanceof/X $instanceof/IB $instanceof/IA $instanceof/Y $instanceof/ID $instanceof/IC $instanceof/Z $instanceof/IE $invalid + end + return + end + return + end + return + end + local.get $0 + i32.load $0 + local.tee $0 + if + local.get $0 + call $byn-split-outlined-A$~lib/rt/itcms/__visit + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + return + end + unreachable + ) + (func $~start (type $none_=>_none) + call $start:instanceof + ) (func $start:instanceof (type $none_=>_none) (local $0 i32) (local $1 i32) + (local $2 i32) + (local $3 i32) global.get $~lib/memory/__stack_pointer - i32.const 84 + i32.const 88 i32.sub global.set $~lib/memory/__stack_pointer block $folding-inner0 global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer i32.const 0 - i32.const 84 + i32.const 88 memory.fill $0 memory.size $0 i32.const 16 i32.shl - i32.const 34316 + i32.const 34352 i32.sub i32.const 1 i32.shr_u @@ -1491,7 +1754,7 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer @@ -1532,7 +1795,7 @@ if i32.const 0 i32.const 1456 - i32.const 18 + i32.const 41 i32.const 1 call $~lib/builtins/abort unreachable @@ -1541,7 +1804,7 @@ if i32.const 0 i32.const 1456 - i32.const 68 + i32.const 91 i32.const 1 call $~lib/builtins/abort unreachable @@ -1553,7 +1816,7 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer @@ -1571,7 +1834,7 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer @@ -1609,7 +1872,7 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer @@ -1627,7 +1890,7 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s br_if $folding-inner0 global.get $~lib/memory/__stack_pointer @@ -1679,7 +1942,7 @@ if i32.const 0 i32.const 1456 - i32.const 94 + i32.const 117 i32.const 1 call $~lib/builtins/abort unreachable @@ -1716,7 +1979,7 @@ if i32.const 0 i32.const 1456 - i32.const 96 + i32.const 119 i32.const 1 call $~lib/builtins/abort unreachable @@ -1760,7 +2023,7 @@ if i32.const 0 i32.const 1456 - i32.const 111 + i32.const 134 i32.const 1 call $~lib/builtins/abort unreachable @@ -1783,7 +2046,7 @@ if i32.const 0 i32.const 1456 - i32.const 112 + i32.const 135 i32.const 1 call $~lib/builtins/abort unreachable @@ -1820,7 +2083,7 @@ if i32.const 0 i32.const 1456 - i32.const 115 + i32.const 138 i32.const 1 call $~lib/builtins/abort unreachable @@ -1843,7 +2106,7 @@ if i32.const 0 i32.const 1456 - i32.const 116 + i32.const 139 i32.const 1 call $~lib/builtins/abort unreachable @@ -1880,7 +2143,7 @@ if i32.const 0 i32.const 1456 - i32.const 119 + i32.const 142 i32.const 1 call $~lib/builtins/abort unreachable @@ -1904,7 +2167,7 @@ if i32.const 0 i32.const 1456 - i32.const 120 + i32.const 143 i32.const 1 call $~lib/builtins/abort unreachable @@ -1922,7 +2185,7 @@ if i32.const 0 i32.const 1456 - i32.const 126 + i32.const 149 i32.const 1 call $~lib/builtins/abort unreachable @@ -1958,7 +2221,7 @@ if i32.const 0 i32.const 1456 - i32.const 127 + i32.const 150 i32.const 1 call $~lib/builtins/abort unreachable @@ -1981,7 +2244,7 @@ if i32.const 0 i32.const 1456 - i32.const 128 + i32.const 151 i32.const 1 call $~lib/builtins/abort unreachable @@ -1991,7 +2254,7 @@ if i32.const 0 i32.const 1456 - i32.const 130 + i32.const 153 i32.const 1 call $~lib/builtins/abort unreachable @@ -2028,7 +2291,7 @@ if i32.const 0 i32.const 1456 - i32.const 131 + i32.const 154 i32.const 1 call $~lib/builtins/abort unreachable @@ -2051,7 +2314,7 @@ if i32.const 0 i32.const 1456 - i32.const 132 + i32.const 155 i32.const 1 call $~lib/builtins/abort unreachable @@ -2061,7 +2324,7 @@ if i32.const 0 i32.const 1456 - i32.const 134 + i32.const 157 i32.const 1 call $~lib/builtins/abort unreachable @@ -2098,7 +2361,7 @@ if i32.const 0 i32.const 1456 - i32.const 135 + i32.const 158 i32.const 1 call $~lib/builtins/abort unreachable @@ -2122,7 +2385,7 @@ if i32.const 0 i32.const 1456 - i32.const 136 + i32.const 159 i32.const 1 call $~lib/builtins/abort unreachable @@ -2147,125 +2410,726 @@ i32.const 0 i32.store $0 offset=80 local.get $0 - i32.const 84 - i32.add + i32.const 4 + i32.sub global.set $~lib/memory/__stack_pointer - return - end - i32.const 34336 - i32.const 34384 - i32.const 1 - i32.const 1 - call $~lib/builtins/abort - unreachable - ) - (func $~lib/rt/__visit_members (type $i32_=>_none) (param $0 i32) - block $invalid - block $instanceof/BlackCat - block $instanceof/Cat - block $instanceof/Animal - block $instanceof/SomethingElse - block $instanceof/Parent - block $instanceof/Child - block $instanceof/Parent - block $instanceof/Child - block $instanceof/B - block $instanceof/A - block $~lib/arraybuffer/ArrayBufferView - block $~lib/string/String - block $~lib/arraybuffer/ArrayBuffer - block $~lib/object/Object - local.get $0 - i32.const 8 - i32.sub - i32.load $0 - br_table $~lib/object/Object $~lib/arraybuffer/ArrayBuffer $~lib/string/String $~lib/arraybuffer/ArrayBufferView $instanceof/A $instanceof/B $instanceof/Child $instanceof/Parent $instanceof/Child $instanceof/Parent $instanceof/SomethingElse $instanceof/Animal $instanceof/Cat $instanceof/BlackCat $invalid - end - return - end - return - end - return - end - local.get $0 - i32.load $0 - local.tee $0 - if - local.get $0 - call $byn-split-outlined-A$~lib/rt/itcms/__visit - end - return - end - return - end - return - end - return - end - return - end - return - end - return - end - return - end - return - end - return - end - return - end - unreachable - ) - (func $~start (type $none_=>_none) - call $start:instanceof - ) - (func $~lib/object/Object#constructor (type $i32_=>_i32) (param $0 i32) (result i32) - global.get $~lib/memory/__stack_pointer - i32.const 4 - i32.sub - global.set $~lib/memory/__stack_pointer - global.get $~lib/memory/__stack_pointer - i32.const 1548 - i32.lt_s - if - i32.const 34336 - i32.const 34384 - i32.const 1 - i32.const 1 - call $~lib/builtins/abort - unreachable - end - global.get $~lib/memory/__stack_pointer - i32.const 0 - i32.store $0 - local.get $0 - i32.eqz - if global.get $~lib/memory/__stack_pointer + i32.const 1584 + i32.lt_s + br_if $folding-inner0 + global.get $~lib/memory/__stack_pointer + local.tee $0 i32.const 0 + i32.store $0 + local.get $0 + i32.const 14 call $~lib/rt/itcms/__new local.tee $0 i32.store $0 - end - global.get $~lib/memory/__stack_pointer - i32.const 4 - i32.add - global.set $~lib/memory/__stack_pointer - local.get $0 - ) + global.get $~lib/memory/__stack_pointer + local.get $0 + call $~lib/object/Object#constructor + local.tee $0 + i32.store $0 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $0 + global.set $instanceof/w + i32.const 0 + call $instanceof/X#constructor + global.set $instanceof/x + i32.const 0 + call $instanceof/Y#constructor + global.set $instanceof/y + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + global.get $~lib/memory/__stack_pointer + i32.const 1584 + i32.lt_s + br_if $folding-inner0 + global.get $~lib/memory/__stack_pointer + local.tee $0 + i32.const 0 + i32.store $0 + local.get $0 + i32.const 21 + call $~lib/rt/itcms/__new + local.tee $0 + i32.store $0 + global.get $~lib/memory/__stack_pointer + local.get $0 + call $instanceof/Y#constructor + local.tee $0 + i32.store $0 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $0 + global.set $instanceof/z + global.get $~lib/memory/__stack_pointer + global.get $instanceof/w + local.tee $2 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $3 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $1 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $3 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $3 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $1 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $1 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $1 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $1 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $2 + i32.store $0 offset=84 + local.get $2 + if (result i32) + local.get $2 + i32.const 8 + i32.sub + i32.load $0 + i32.const 14 + i32.eq + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1456 + i32.const 12 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/w + local.tee $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + local.get $0 + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicFalse + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + i32.store $0 offset=84 + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/x + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/X> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/y + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Y> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + global.get $instanceof/z + local.tee $0 + i32.store $0 offset=84 + local.get $0 + call $instanceof/assertDynamicTrue<~lib/object/Object,instanceof/Z> + global.get $~lib/memory/__stack_pointer + i32.const 88 + i32.add + global.set $~lib/memory/__stack_pointer + return + end + i32.const 34384 + i32.const 34432 + i32.const 1 + i32.const 1 + call $~lib/builtins/abort + unreachable + ) + (func $~lib/object/Object#constructor (type $i32_=>_i32) (param $0 i32) (result i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + global.get $~lib/memory/__stack_pointer + i32.const 1584 + i32.lt_s + if + i32.const 34384 + i32.const 34432 + i32.const 1 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $0 + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 0 + call $~lib/rt/itcms/__new + local.tee $0 + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $0 + ) (func $instanceof/A#constructor (type $i32_=>_i32) (param $0 i32) (result i32) global.get $~lib/memory/__stack_pointer i32.const 4 i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s if - i32.const 34336 i32.const 34384 + i32.const 34432 i32.const 1 i32.const 1 call $~lib/builtins/abort @@ -2300,11 +3164,11 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s if - i32.const 34336 i32.const 34384 + i32.const 34432 i32.const 1 i32.const 1 call $~lib/builtins/abort @@ -2339,11 +3203,11 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s if - i32.const 34336 i32.const 34384 + i32.const 34432 i32.const 1 i32.const 1 call $~lib/builtins/abort @@ -2379,11 +3243,11 @@ i32.sub global.set $~lib/memory/__stack_pointer global.get $~lib/memory/__stack_pointer - i32.const 1548 + i32.const 1584 i32.lt_s if - i32.const 34336 i32.const 34384 + i32.const 34432 i32.const 1 i32.const 1 call $~lib/builtins/abort @@ -2409,6 +3273,84 @@ global.set $~lib/memory/__stack_pointer local.get $0 ) + (func $instanceof/X#constructor (type $i32_=>_i32) (param $0 i32) (result i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + global.get $~lib/memory/__stack_pointer + i32.const 1584 + i32.lt_s + if + i32.const 34384 + i32.const 34432 + i32.const 1 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $0 + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 15 + call $~lib/rt/itcms/__new + local.tee $0 + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $0 + call $~lib/object/Object#constructor + local.tee $0 + i32.store $0 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $0 + ) + (func $instanceof/Y#constructor (type $i32_=>_i32) (param $0 i32) (result i32) + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.sub + global.set $~lib/memory/__stack_pointer + global.get $~lib/memory/__stack_pointer + i32.const 1584 + i32.lt_s + if + i32.const 34384 + i32.const 34432 + i32.const 1 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/memory/__stack_pointer + i32.const 0 + i32.store $0 + local.get $0 + i32.eqz + if + global.get $~lib/memory/__stack_pointer + i32.const 18 + call $~lib/rt/itcms/__new + local.tee $0 + i32.store $0 + end + global.get $~lib/memory/__stack_pointer + local.get $0 + call $instanceof/X#constructor + local.tee $0 + i32.store $0 + global.get $~lib/memory/__stack_pointer + i32.const 4 + i32.add + global.set $~lib/memory/__stack_pointer + local.get $0 + ) (func $byn-split-outlined-A$~lib/rt/itcms/__visit (type $i32_=>_none) (param $0 i32) global.get $~lib/rt/itcms/white local.get $0 diff --git a/tests/compiler/instanceof.ts b/tests/compiler/instanceof.ts index c394d51808..6c1c8db6aa 100644 --- a/tests/compiler/instanceof.ts +++ b/tests/compiler/instanceof.ts @@ -1,3 +1,26 @@ +function assertStaticTrue(value: T): void { + if (value instanceof U) return; + ERROR("should be statically true"); +} +function assertStaticFalse(value: T): void { + if (!(value instanceof U)) return; + ERROR("should be statically false"); +} +function assertDynamicTrue(value: T): void { + if (!(value instanceof U)) { + var check: i32 = 0; + assert(false); + } + assert(isDefined(check)); +} +function assertDynamicFalse(value: T): void { + if (value instanceof U) { + var check: i32 = 0; + assert(false); + } + assert(isDefined(check)); +} + class A {} class B extends A {} @@ -150,3 +173,191 @@ assert(!(nullCat instanceof BlackCat)); // dynamic false assert(!(nullBlackcat instanceof Animal)); // static false assert(!(nullBlackcat instanceof Cat)); // dynamic false assert(!(nullBlackcat instanceof BlackCat)); // dynamic false + +// Interfaces + +// IA W +// | +// IB IC IE +// | / +// X ID +// | / +// Y +// | +// Z +class W {} +interface IA {} +interface IB extends IA {} +class X implements IB {} +interface IC {} +interface ID extends IC {} +class Y extends X implements ID {} +class Z extends Y {} +interface IE {} + +let w = new W(); +let x = new X(); +let y = new Y(); +let z = new Z(); + +// instanceof Object + +assertStaticTrue(w); +assertStaticTrue(x); +assertStaticTrue(y); +assertStaticTrue(z); + +assertStaticTrue(x); +assertStaticTrue(x); +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); + +// Object instanceof + +assertDynamicTrue(w); +assertDynamicTrue(x); +assertDynamicTrue(y); +assertDynamicTrue(z); +assertDynamicTrue(y); +assertDynamicTrue(z); +assertDynamicTrue(z); + +assertDynamicTrue(x); +assertDynamicTrue(x); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); + +// instanceof + +assertStaticTrue(w); +assertStaticFalse(w); +assertStaticFalse(w); +assertStaticFalse(w); +assertStaticFalse(x); +assertStaticFalse(y); +assertStaticFalse(z); + +assertStaticTrue(x); +assertDynamicFalse(x); +assertDynamicFalse(x); +assertStaticTrue(y); +assertDynamicTrue(y); +assertDynamicFalse(y); +assertStaticTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); + +assertStaticTrue(y); +assertStaticTrue(y); +assertDynamicFalse(y); +assertStaticTrue(z); +assertStaticTrue(z); +assertDynamicTrue(z); + +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); + +// instanceof + +assertDynamicFalse(x); +assertDynamicFalse(x); +assertDynamicFalse(x); +assertDynamicFalse(x); +assertStaticFalse(x); +assertStaticFalse(x); + +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertStaticFalse(y); +assertStaticFalse(y); + +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertStaticFalse(z); +assertStaticFalse(z); + +// instanceof + +assertStaticTrue(x); +assertStaticTrue(x); +assertDynamicFalse(x); +assertDynamicFalse(x); +assertStaticFalse(x); +assertStaticTrue(y); +assertStaticTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertStaticFalse(y); +assertStaticTrue(z); +assertStaticTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertStaticFalse(z); + +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticTrue(y); +assertStaticFalse(y); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticFalse(z); + +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticTrue(z); +assertStaticFalse(z); + +// instanceof + +assertStaticFalse(x); +assertStaticFalse(x); +assertStaticFalse(y); +assertStaticFalse(y); +assertStaticFalse(y); +assertStaticFalse(y); +assertStaticFalse(z); +assertStaticFalse(z); +assertStaticFalse(z); +assertStaticFalse(z); + +assertDynamicTrue(x); +assertDynamicTrue(x); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(z); +assertDynamicTrue(z); + +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(y); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); + +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z); +assertDynamicTrue(z);