- end
-
- # Add a monomoprhic send.
- # The send site is not added to the pool.
- # The method just determine the associated method definition then
- # performs a static_call
- fun add_monomorphic_send(mtype: MClassType, mmethod: MMethod)
- do
- assert self.live_types.has(mtype)
- if not mtype.has_mproperty(self.mainmodule, mmethod) then return
- var def = mmethod.lookup_first_definition(self.mainmodule, mtype)
- self.add_static_call(mtype, def)
- end
-
- # Add a customized_methoddefs to the pool
- # Is the customized_methoddefs is already live, then do nothing
- fun add_static_call(mtype: MClassType, mmethoddef: MMethodDef)
- do
- assert self.live_types.has(mtype)
- var rm = new CustomizedMethodDef(mmethoddef, mtype)
- if self.live_customized_methoddefs.has(rm) then return
- self.live_customized_methoddefs.add(rm)
- self.todo.add(rm)
- self.live_methoddefs.add(mmethoddef)
- end
-
- # Add mtype to the cast pool.
- fun add_cast_type(mtype: MClassType)
- do
- if self.live_cast_types.has(mtype) then return
-
- assert not mtype.need_anchor
- self.live_cast_types.add(mtype)
- self.check_depth(mtype)
- end
-
- fun check_depth(mtype: MClassType)
- do
- var d = mtype.depth
- if d > 255 then
- self.modelbuilder.toolcontext.fatal_error(null, "Fatal error: limitation in the rapidtype analysis engine: a type depth of {d} is too important, the problematic type is {mtype}.")