Fill the vtable with local methods for self class

  • vm Current instance of the VirtualMachine
  • table the table of self class, will be filled with its methods
  • cl The class which introduced the methods

Property definitions

nitc :: virtual_machine $ MClass :: fill_vtable
	# Fill the vtable with local methods for `self` class
	# * `vm` Current instance of the VirtualMachine
	# * `table` the table of self class, will be filled with its methods
	# * `cl` The class which introduced the methods
	private fun fill_vtable(vm: VirtualMachine, table: VTable, cl: MClass)
	do
		var methods = new Array[MMethodDef]
		for m in cl.intro_mmethods do
			# `propdef` is the most specific implementation for this MMethod
			var propdef = m.lookup_first_definition(vm.mainmodule, self.intro.bound_mtype)
			methods.push(propdef)
		end

		# Call a method in C to put propdefs of self methods in the vtables
		vm.memory_manager.put_methods(vtable.internal_vtable, vtable.mask, cl.vtable.id, methods)
	end
src/vm/virtual_machine.nit:626,2--641,4