Skip to content

pjc0247/turtle.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

turtle.net

.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())
});

Getting Started

var vm = new VM();

// Needs preparation before run
vm.Build(program);
vm.Run(program.Assembly.EntryPoint, new object[] { args });

Storage Engine

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.

Running Tests

turtle.net has its own test framework. Please refer to unittest.runner project.

FIR Compliation (Concept)

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

About

It makes you slow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages