nitc :: compilation
nitc :: compilation $ VirtualMachine
A virtual machine based on the naive_interpreternitc :: compilation $ VirtualMachine
A virtual machine based on the naive_interpreternitc :: astbuilder
Instantiation and transformation of semantic nodes in the AST of expressions and statementsSerializable::inspect
to show more useful information
nitc :: modelbuilder
more_collections :: more_collections
Highly specific, but useful, collections-related classes.serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsserialize_to_json
and JsonSerializer
nitc :: toolcontext
Common command-line tool infrastructure than handle options and error messagescore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# The compilation module of the VirtualMachine
module compilation
import variables_numbering
import ssa
redef class VirtualMachine
# The currently analyzed APropdef
var current_propdef: APropdef
redef fun new_frame(node, mpropdef, args)
do
# Save the current propdef
if node isa APropdef then self.current_propdef = node
return super
end
end
redef class APropdef
redef fun compile(vm)
do
super
# A new instance of SSA to analyze the self propdef
var ssa = new SSA(self)
# Generate basic_blocks and compute SSA-algorithm for this propdef
compute_ssa(ssa)
end
# Redef to add the same position to a new version of a Variable than the original variable
redef fun generate_name(v, counter, expr, ssa)
do
var new_version = super
# All versions of a variable have the same position in the environment
new_version.position = v.original_variable.position
return new_version
end
end
src/vm/compilation.nit:17,1--60,3