.Net VM built on a top of .Net.
for certain purposes such as smart-contract and custom script engine.
Hello World
on the turtle VM
using Turtle;
var vm = new VM();
vm.Run(new Instruction[]
{
Instruction.Create(OpCodes.Ldstr, "HelloWorld"),
Instruction.Create(OpCodes.Call, module.GetType("System.Console")
.Methods
.Where(x => x.Name == "WriteLine")
.Where(x => x.Parameters.Count == 1 && x.Parameters[0]
.ParameterType.Name == typeof(string).Name)
.FirstOrDefault())
});
var vm = new VM();
// Needs preparation before run
vm.Build(program);
vm.Run(program.Assembly.EntryPoint, new object[] { args });
All static variables will be stored in Storage Engine
.
You can implement your own Storage Engine for certain needs. (Blockchain would be a good example)
public interface IStorage
{
void Set(long key, object value);
object Get(long key);
long GetNextKey();
}
blahblah
Otherwise, MemStorage will be used by default.
turtle.net has its own test framework. Please refer to unittest.runner
project.
CIL is not aimed to achieve fast execution itself since they already have good JIT compiler to make it fast. However, the main purpose of this repository is getting rid of the JIT and machine-specific assemblies.
So, we need to invent another instruction system which is performance-aware and having well-aligned structure.
blahblah