A customisable virtual machine written in Go

Overview
== About GoLightly ==

GoLightly is a lightweight virtual machine library implemented in Go, designed for flexibility and
reuse. Traditionally popular VMs have adopted a stack-based design as this is perceived to be easier
to implement than the register-based design that real-world hardware generally uses. There are
arguments both ways on which of the two approaches is 'better' and it's not our intention to mandate
either: a good VM toolkit should leave that decision to those who know which suits their purpose best.

However just because GoLightly adopts a careful neutrality on this issue doesn't mean that it has
nothing fresh to offer.

Firstly GoLightly provides support for vector instructions allowing each virtual processor to handle
large data sets more efficiently than in traditional VM designs. Not only is this a boon for fast
maths, it also allows complex data structures to be transferred between virtual processors with only
a couple of instructions.

And speaking of multiple virtual processors, once a processor has been initialised it can be cloned
with a single instruction and both processors are hooked together with a communications channel.

Each processor has its own dynamic instruction definition and dispatch mechanism providing a flexible
model during development. However function-based dynamic dispatch is more expensive than the
switch-based dispatch used in traditional VM designs so the latter is also supported via type
embedding of the ProcessorCore and method hiding of InlinedInstructions().

One interesting consequence of making each virtual processor configurable in this manner is that it
allows complex problems to be modelled in terms of several different processors running relatively
simple programs and arranged in a pipeline.

Likewise the ability to clone virtual processors can be used as a building block for transactional
and speculative execution.


== Tests and Benchmarks ==

Golightly includes a large collection of tests and benchmarks. A simple set of micro-benchmarks
is available to judge the relative cost of various standard Go instructions and idioms which can
be invoked from the command-line:

	cd go
	gotest -benchmarks="Benchmark"


Likewise the test suite for the VM primitives can be executed with:

	cd vm
	gotest

and the optional benchmarks invoked with:

	gotest -benchmarks="Benchmark"

These include extensive micro-benchmarks focusing on individual primitive operation performance which
will hopefully act as a useful guide to relative performance for those writing compilers or assemblers
targeting GoLightly virtual machines.
You might also like...
OperatingSys-GO - A Virtual Operating System made by using GOLANG and FYNE

Operating-System This is a Virtual Operating System made by using GOLANG and FYN

Scriptable interpreter written in golang
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).

Gentee script programming language Gentee is a free open source script programming language. The Gentee programming language is designed to create scr

A POSIX-compliant AWK interpreter written in Go

GoAWK: an AWK interpreter written in Go AWK is a fascinating text-processing language, and somehow after reading the delightfully-terse The AWK Progra

A BASIC interpreter written in golang.
A BASIC interpreter written in golang.

05 PRINT "Index" 10 PRINT "GOBASIC!" 20 PRINT "Limitations" Arrays Line Numbers IF Statement DATA / READ Statements Builtin Functions Types 30 PRINT "

A basic Forth parser written in Go.

GoForth ======= I got really interested in Forth and thus I began making a parser, of sorts, in Go. Though I don't intend for it to catch on, it's st

A dialect of Lisp extended to support concurrent programming, written in Go.

LispEx A dialect of Lisp extended to support concurrent programming. Overview LispEx is another Lisp Interpreter implemented with Go. The syntax, sema

Genetic Algorithms library written in Go / golang

Description Genetic Algorithms for Go/Golang Install $ go install git://github.com/thoj/go-galib.git Compiling examples: $ git clone git://github.com

Chip-8 emulator written in Go
Chip-8 emulator written in Go

Welcome to Chippy 👋 Chippy is a CHIP-8 emulator that runs Chip-8 public domain roms. The Chip 8 actually never was a real system, but more like a vir

Comments
  • Shift left/right are the wrong way around

    Shift left/right are the wrong way around

    http://github.com/feyeleanor/GoLightly/blob/master/vm/buffer.go#L103 http://github.com/feyeleanor/GoLightly/blob/master/vm/buffer.go#L104

    << in ShiftRight() and >> in ShiftLeft() should be the other way around.

    opened by ghost 1
  • Golang Version Compatibility

    Golang Version Compatibility

    What versions of Golang does this work with? I'm trying to use it with 1.1.2 and it's failing with the following error:

    golightly.go:8:2: cannot find package "container/vector"
    

    After some checking it seems that package was replaced by native slices. I guess I just want to confirm that I'm not missing something.

    opened by CtrlC-Root 0
  • Hi! We cleaned up your code for you!

    Hi! We cleaned up your code for you!

    Hi there!

    This is WhitespaceBot from Gun.io. I'm an open-source robot that removes trailing white space in your code, and gives you a gitignore file if you didn't have one! I've only cleaned your most popular project, and I've added you to a list of users not to contact again, so you won't get any more pull requests from me unless you ask. If I'm misbehaving, please email my owner and tell him to turn me off!

    == About Gun.io == Gun.io is a place for hackers to hire each other for small tasks. We offer no-hassle, winner-take-all freelance gigs, by hackers, for hackers. Got a bug you can't fix or a feature you want for your project? Post a gig and have somebody else sort it out for you. Oh, and it's free for open source! Sign up and get notified about new gigs you can work on!

    == About WhitespaceBot== WhitespaceBot is a simple open source robot which uses GitHub's API as a way of cleaning up open source projects! We've put up a paid bounty for whoever can add security fixing features to it.

    opened by GunioRobot 0
  • Compilation fail

    Compilation fail

    Hi, I can't compile your application

    $ ./make.bash 
    make: Nothing to be done for `all'.
    mkdir: cannot create directory `/home/jlarky/go/pkg/linux_386/golightly': Permission denied
    make: *** [/home/jlarky/go/pkg/linux_386/golightly/test.a] Error 1
    8g -o _go_.8 utility.go reslicing.go buffer.go int_buffer.go int_vector.go float_buffer.go
    utility.go:5: undefined: float
    utility.go:6: undefined: float
    int_vector.go:368: undefined: float
    int_vector.go:390: undefined: float
    float_buffer.go:7: undefined: float
    float_buffer.go:9: invalid receiver type FloatBuffer
    float_buffer.go:10: invalid receiver type FloatBuffer
    float_buffer.go:12: invalid receiver type FloatBuffer
    float_buffer.go:18: invalid receiver type *FloatBuffer
    float_buffer.go:28: invalid receiver type *FloatBuffer
    float_buffer.go:28: too many errors
    make: *** [_go_.8] Error 1
    8g -o _go_.8 utility.go reslicing.go buffer.go int_buffer.go int_vector.go float_buffer.go
    utility.go:5: undefined: float
    utility.go:6: undefined: float
    int_vector.go:368: undefined: float
    int_vector.go:390: undefined: float
    float_buffer.go:7: undefined: float
    float_buffer.go:9: invalid receiver type FloatBuffer
    float_buffer.go:10: invalid receiver type FloatBuffer
    float_buffer.go:12: invalid receiver type FloatBuffer
    float_buffer.go:18: invalid receiver type *FloatBuffer
    float_buffer.go:28: invalid receiver type *FloatBuffer
    float_buffer.go:28: too many errors
    make: *** [_go_.8] Error 1
    rm -f _test/feyeleanor/golightly.a
    8g -o _gotest_.8 baseline.go baseline_benchmark_test.go baseline_test.go
    baseline_benchmark_test.go:282: undefined: float
    make: *** [_gotest_.8] Error 1
    rm -f _test/golightly/vm.a
    8g -o _gotest_.8 instruction_set.go iocontroller.go processor_core.go program.go instruction_set_benchmark_test.go
    

    instruction_set_test.go iocontroller_test.go processor_core_benchmark_test.go processor_core_test.go iocontroller.go:7: can't find import: golightly/storage make: *** [gotest.8] Error 1

    opened by JLarky 0
Owner
Eleanor McHugh
Presenter of Ruby and Go oddities, author of http://leanpub.com/GoNotebook, digital identity researcher and co-founder at @inidsol_uk.
Eleanor McHugh
Virtual-Operating-System - Virtual Operating System Using Golang And Fyne Implemented Gallery app

Virtual Operating System Virtual Operating System Using Golang And Fyne Implemen

Arjit Kumar 0 Jan 1, 2022
A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

Steve Kemp 260 Nov 16, 2022
Expr – a tiny stack-based virtual machine written in Go

Expr – a tiny stack-based virtual machine written in Go The executor is designed to interpret a simple expression language and it's useful in delegati

Anthony Regeda 26 Nov 11, 2022
A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Steve Kemp 90 Nov 15, 2022
Forth virtual machine in Go

forego - A Forth implementation in Go ===================================== Why? ---- For ego. This is me learning the language. Both of them. So

Vadim Vygonets 26 Sep 9, 2022
Weave Ignite is an open source Virtual Machine (VM) manager with a container UX and built-in GitOps management.

Weave Ignite is an open source Virtual Machine (VM) manager with a container UX and built-in GitOps management.

Temur Yunusov 0 Nov 16, 2021
Create virtual machines and run Linux-based operating systems in Go using Apple Virtualization.framework.

vz - Go binding with Apple Virtualization.framework vz provides the power of the Apple Virtualization.framework in Go.

Kei Kamikawa 318 Dec 3, 2022
This is a Virtual Operating System made by using GOLANG and FYNE.

Virtual-Operating-System This is a Virtual Operating System made by using GOLANG and FYNE. Hello! All In this project I have made a virtual Operating

SURBHI SINHA 1 Nov 1, 2021
Lima: Linux virtual machines (on macOS, in most cases)

Linux virtual machines, on macOS (aka "Linux-on-Mac", "macOS subsystem for Linux", "containerd for Mac", unofficially)

Linux Machines 10k Dec 1, 2022
Virtual Operating System Using Golang

Virtual Operating System Virtual Operating System Using Golang And Fyne Installation 1.Install Go 2.Install Gcc 3.Install Fyne Using This Command:- g

Ranjit Kumar Sahoo 2 Jun 5, 2022