- var mmethoddef = self.mmethoddef
-
- var recv = self.mmethoddef.mclassdef.bound_mtype
- var v = new SeparateErasureCompilerVisitor(compiler)
- var selfvar = new RuntimeVariable("self", v.object_type, recv)
- var arguments = new Array[RuntimeVariable]
- var frame = new Frame(v, mmethoddef, recv, arguments)
- v.frame = frame
-
- var sig = new Buffer
- var comment = new Buffer
-
- # Because the function is virtual, the signature must match the one of the original class
- var intromclassdef = self.mmethoddef.mproperty.intro.mclassdef
- var msignature = mmethoddef.mproperty.intro.msignature.resolve_for(intromclassdef.bound_mtype, intromclassdef.bound_mtype, intromclassdef.mmodule, true)
- var ret = msignature.return_mtype
- if ret != null then
- sig.append("{ret.ctype} ")
- else if mmethoddef.mproperty.is_new then
- ret = recv
- sig.append("{ret.ctype} ")
- else
- sig.append("void ")
- end
- sig.append(self.c_name)
- sig.append("({selfvar.mtype.ctype} {selfvar}")
- comment.append("(self: {selfvar}")
- arguments.add(selfvar)
- for i in [0..msignature.arity[ do
- var mtype = msignature.mparameters[i].mtype
- if i == msignature.vararg_rank then
- mtype = v.get_class("Array").get_mtype([mtype])
- end
- comment.append(", {mtype}")
- sig.append(", {mtype.ctype} p{i}")
- var argvar = new RuntimeVariable("p{i}", mtype, mtype)
- arguments.add(argvar)
- end
- sig.append(")")
- comment.append(")")
- if ret != null then
- comment.append(": {ret}")
- end
- compiler.header.add_decl("{sig};")
-
- v.add_decl("/* method {self} for {comment} */")
- v.add_decl("{sig} \{")
- if ret != null then
- frame.returnvar = v.new_var(ret)
- end
- frame.returnlabel = v.get_name("RET_LABEL")
-
- if recv != arguments.first.mtype then
- #print "{self} {recv} {arguments.first}"
- end
- mmethoddef.compile_inside_to_c(v, arguments)
-
- v.add("{frame.returnlabel.as(not null)}:;")
- if ret != null then
- v.add("return {frame.returnvar.as(not null)};")
- end
- v.add("\}")
+ print "# size of subtyping tables"
+ print "\ttotal \tholes"
+ var total = 0
+ var holes = 0
+ for t, table in class_tables do
+ total += table.length
+ for e in table do if e == null then holes += 1
+ end
+ print "\t{total}\t{holes}"
+
+ print "# size of resolution tables"
+ print "\ttotal \tholes"
+ total = 0
+ holes = 0
+ for t, table in vt_tables do
+ total += table.length
+ for e in table do if e == null then holes += 1
+ end
+ print "\t{total}\t{holes}"
+
+ print "# size of methods tables"
+ print "\ttotal \tholes"
+ total = 0
+ holes = 0
+ for t, table in method_tables do
+ total += table.length
+ for e in table do if e == null then holes += 1
+ end
+ print "\t{total}\t{holes}"
+
+ print "# size of attributes tables"
+ print "\ttotal \tholes"
+ total = 0
+ holes = 0
+ for t, table in attr_tables do
+ total += table.length
+ for e in table do if e == null then holes += 1
+ end
+ print "\t{total}\t{holes}"