+ if compiler.modelbuilder.toolcontext.opt_typing_test_metrics.value then
+ self.compiler.count_type_test_resolved[tag] += 1
+ self.add("count_type_test_resolved_{tag}++;")
+ end
+ else if mtype isa MVirtualType then
+ var recv = self.frame.arguments.first
+ var recv_ptr
+ if recv.mtype.ctype == "val*" then
+ recv_ptr = "{recv}->class->"
+ else
+ var mclass = recv.mtype.as(MClassType).mclass
+ self.require_declaration("class_{mclass.c_name}")
+ recv_ptr = "class_{mclass.c_name}."
+ end
+ var entry = self.get_name("entry")
+ self.add("struct vts_entry {entry};")
+ self.require_declaration(mtype.mproperty.const_color)
+ if self.compiler.as(SeparateErasureCompiler).vt_layout isa PHLayout[MClass, MVirtualTypeProp] then
+ self.add("{entry} = {recv_ptr}vts_table->vts[HASH({recv_ptr}vts_table->mask, {mtype.mproperty.const_color})];")
+ else
+ self.add("{entry} = {recv_ptr}vts_table->vts[{mtype.mproperty.const_color}];")
+ end
+ self.add("{cltype} = {entry}.class->color;")
+ self.add("{idtype} = {entry}.class->id;")
+ if maybe_null and accept_null == "0" then
+ var is_nullable = self.get_name("is_nullable")
+ self.add_decl("short int {is_nullable};")
+ self.add("{is_nullable} = {entry}.is_nullable;")
+ accept_null = is_nullable.to_s
+ end
+ if compiler.modelbuilder.toolcontext.opt_typing_test_metrics.value then
+ self.compiler.count_type_test_unresolved[tag] += 1
+ self.add("count_type_test_unresolved_{tag}++;")
+ end