SlideShare ist ein Scribd-Unternehmen logo
1 von 20
GoLightly
A Go library for building Virtual Machines


            Eleanor McHugh
Go
a new language
statically-typed and compiled
object-oriented but no classes
garbage collected
concurrency via communication (CSP)
type polymorphism via interfaces
a new way of working

 the safety of a static type system
 the feel of a dynamic runtime
 the performance of a compiled language
Virtual Machines
from inspiration...

computation
serialisation
communication
...to perspiration
simulation v. emulation
instruction set design
bytecodes
memory abstraction
operation dispatch
GoLightly
principles
interface driven delegation
architecture agnostic
inspired by hardware techniques
decoupled components
scaling through specialisation
caveat

references current dev branch
fundamental changes from github
still evolving
next release due for Strange Loop
interfaces
type Executable interface {    type Comparable interface {
   Execute(p Processor)           Identical(v Value) bool
}                                 Compare(v Value) int
                               }
type Processor interface {
   Reset()                     type Value interface {
   Step()                         fmt.Stringer
   Jump(a Address)                Comparable
   Call(a Address)                Nil() Value
   Return()                       IsNil() bool
   Load(program Program)       }
   Run()
   Execute()                   type Program []Executable
   Sleep(n int64)
   Halt(n int)
   IsActive() bool
}
instructions

obey the Executable interface
expressed as separate types
no assumptions about semantics
not tied to a bytecode representation
ïŹ‚ow control
type NoOp struct {}                      type Call Address
func (n *NoOp) String() string {         func (c Call) String() string {
   return "NOOP"                            return Sprint("CALL", Address(c))
}                                        }
func (n *NoOp) Execute(p Processor) {}   func (c Call) Execute(p Processor) {
                                            p.Call(Address(c))
type Halt struct {}                      }
func (h *Halt) String() string {
   return "HALT"                         type Return struct {}
}                                        func (r Return) String() string {
func (h *Halt) Execute(p Processor) {       return "RET"
   p.Halt(PROGRAM_TERMINATED)            }
}                                        func (r Return) Execute(p Processor) {
                                            p.Return()
type Jump Address                        }
func (j Jump) String() string {
   return Sprint("JMP", Address(j))
}
func (j Jump) Execute(p Processor) {
   p.Jump(Address(j))
}
bytecode
type ByteCode []int                          case 5:          / JMPZ n
                                                               /                  case 10:      / POP r
                                                                                                 /
func (b *ByteCode) String() string {             PC++                                 PC++
    return "BYTECODE"                            if C == 0 {                          R[b[PC]] = DS.Pop()
}                                                      PC++                       case 11:      / LOAD r, v
                                                                                                 /
func (b *ByteCode) Execute(p Processor) {              PC += b[PC] - 1                PC++
    var PC, C, W int                             } else {                             W = b[PC]
    var R [2]int                                       PC++                           PC++
    CS := new(vector.IntVector)                  }                                    R[W] = b[PC]
    DS := new(vector.IntVector)              case 6:          / JMPNZ n
                                                               /                  case 12:      / ADD r1, r2
                                                                                                 /
    for p.Active() {                             PC++                                 PC++
         switch b[PC] {                          if C != 0 {                          W = b[PC]
         case 0:        / NOOP
                         /                             PC++                           PC++
         case 1:        / NSLEEP n
                         /                             PC += b[PC] - 1                R[b[PC]] += R[W]
              PC++                               } else {                         default:
              p.Sleep(int64(b[PC]))                    PC++                           p.Halt(ILLEGAL_INSTRUCTION)
         case 2:        / SLEEP n
                         /                       }                                }
              PC++                           case 7:          / CALL n
                                                               /              }
              p.Sleep(int64(b[PC]) << 32)        PC++                     }
         case 3:        / HALT
                         /                       CS.Push(PC)
              p.Halt(USER_HALT)                  PC = b[PC]
              return                         case 8: / RET
                                                      /
         case 4:        / JMP n
                         /                       PC = CS.Pop
              PC++                           case 9: / PUSH r
                                                      /
              PC += b[PC] - 1                    PC++
                                                 DS.Push(R[b[PC]])
processors
typical Turing machines
support ïŹ‚exible dispatch
not tied to a given instruction set
memory model agnostic
ripe for specialisation
a scalar processor
type SProc struct {                 func (s *SProc) Sleep(i int64) {   func (s *SProc) Call(a Address){
    Running bool                        syscall.Sleep(i)                   PC := s.PC
    PC        int                   }                                      s.PC = int(a)
    R         IntBuffer                                                    for s.IsActive() {
    F         FloatBuffer           func (s *SProc) Halt(n int) {               s.Execute()
    DS        vector.IntVector          s.Running = false                       s.Step()
    Program []Executable            }                                      }
}                                                                          s.PC = PC
                                    func (s *SProc) IsActive() bool{   }
func (s *SProc) Run() {                 return s.Running && s.PC <
    s.Running = true                    len(s.Program)                 func (s *SProc) Return() {
    s.Call(0)                       }                                      s.PC = len(s.Program)
}                                                                      }
                                    func (s *SProc) Reset() {
func (s *SProc) Step() {                s.R.ClearAll()
    s.PC++                              s.PC = 0
}                                   }

func (s *SProc) Jump(a Address) {   func (s *SProc) Load(program
    s.PC += int(a)                  Program) {
}                                       s.Reset()
                                        s.Program = program
func (s *SProc) Execute() {         }
    s.Program[s.PC].Execute(s)
}
memory
based on allocated Values
aggregate as ValueStores
require boxing/unboxing
buffers for speciïŹc types
buffers are also ValueStores
beneïŹts
encourages simple designs
many different VMs per executable
can run in separate goroutines
easily duplicated and serialised
split across processes or hosts
the future
single dispatch for vector operations
per vasive threading
runtime code rewriting
speculative loading
JIT compilation
ïŹnd out more

http://github.com/feyeleanor/GoLightly
http://golightly.wikidot.com
t witter://#golightly

Weitere Àhnliche Inhalte

Was ist angesagt?

Function
FunctionFunction
Functionvenkatme83
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...Muhammad Ulhaque
 
To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2Bahul Neel Upadhyaya
 
Python ćŠ‚äœ•ćŸ·èĄŒ
Python ćŠ‚äœ•ćŸ·èĄŒPython ćŠ‚äœ•ćŸ·èĄŒ
Python ćŠ‚äœ•ćŸ·èĄŒkao kuo-tung
 
C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 
Introduction to go
Introduction to goIntroduction to go
Introduction to goJaehue Jang
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of GoFrank MĂŒller
 
Golang iran - tutorial go programming language - Preliminary
Golang iran - tutorial  go programming language - PreliminaryGolang iran - tutorial  go programming language - Preliminary
Golang iran - tutorial go programming language - Preliminarygo-lang
 
Bristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveBristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveObsidian Software
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEMVictor Stinner
 
C++ aptitude
C++ aptitudeC++ aptitude
C++ aptitudechetan_p211
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnMoriyoshi Koizumi
 
MeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone DetectorMeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone Detector영ëȔ 정
 
Turbo basic commands
Turbo basic commandsTurbo basic commands
Turbo basic commandsjulviapretty
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
 

Was ist angesagt? (20)

Function
FunctionFunction
Function
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2
 
Rcpp11
Rcpp11Rcpp11
Rcpp11
 
Python ćŠ‚äœ•ćŸ·èĄŒ
Python ćŠ‚äœ•ćŸ·èĄŒPython ćŠ‚äœ•ćŸ·èĄŒ
Python ćŠ‚äœ•ćŸ·èĄŒ
 
C++totural file
C++totural fileC++totural file
C++totural file
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 
OpenMP
OpenMPOpenMP
OpenMP
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 
Golang iran - tutorial go programming language - Preliminary
Golang iran - tutorial  go programming language - PreliminaryGolang iran - tutorial  go programming language - Preliminary
Golang iran - tutorial go programming language - Preliminary
 
Bristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steveBristol 2009 q1_wright_steve
Bristol 2009 q1_wright_steve
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEM
 
C++ aptitude
C++ aptitudeC++ aptitude
C++ aptitude
 
tokyotalk
tokyotalktokyotalk
tokyotalk
 
Maintainable go
Maintainable goMaintainable go
Maintainable go
 
Hacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 AutumnHacking Go Compiler Internals / GoCon 2014 Autumn
Hacking Go Compiler Internals / GoCon 2014 Autumn
 
MeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone DetectorMeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone Detector
 
Turbo basic commands
Turbo basic commandsTurbo basic commands
Turbo basic commands
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
 

Andere mochten auch

Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013
Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013
Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013Filippo Bernardi
 
Lighting analysis LIBRARY ashutosh aniruddh
Lighting analysis LIBRARY ashutosh aniruddhLighting analysis LIBRARY ashutosh aniruddh
Lighting analysis LIBRARY ashutosh aniruddhAniruddh Jain
 
Planning a school library
Planning a school library Planning a school library
Planning a school library Guenter K. Schlamp
 
Career As A Librarian Pp
Career As A Librarian PpCareer As A Librarian Pp
Career As A Librarian Ppflowersb3896
 
Zur Dissertation von Nathalie Mertes
Zur Dissertation von Nathalie MertesZur Dissertation von Nathalie Mertes
Zur Dissertation von Nathalie MertesGuenter K. Schlamp
 
2025 Libraries
2025 Libraries2025 Libraries
2025 Librariesdherman101
 

Andere mochten auch (6)

Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013
Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013
Ordinanza di ingiunzione nei confronti di Google inc. 18 dicembre 2013
 
Lighting analysis LIBRARY ashutosh aniruddh
Lighting analysis LIBRARY ashutosh aniruddhLighting analysis LIBRARY ashutosh aniruddh
Lighting analysis LIBRARY ashutosh aniruddh
 
Planning a school library
Planning a school library Planning a school library
Planning a school library
 
Career As A Librarian Pp
Career As A Librarian PpCareer As A Librarian Pp
Career As A Librarian Pp
 
Zur Dissertation von Nathalie Mertes
Zur Dissertation von Nathalie MertesZur Dissertation von Nathalie Mertes
Zur Dissertation von Nathalie Mertes
 
2025 Libraries
2025 Libraries2025 Libraries
2025 Libraries
 

Ähnlich wie GoLightly: A Go library for building Virtual Machines

àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6 1
àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6  1àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6  1
àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6 1Little Tukta Lita
 
4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...PROIDEA
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)changehee lee
 
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdfANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdfanukoolelectronics
 
CorePy High-Productivity CellB.E. Programming
CorePy High-Productivity CellB.E. ProgrammingCorePy High-Productivity CellB.E. Programming
CorePy High-Productivity CellB.E. ProgrammingSlide_N
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my dayTor Ivry
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programsAbhishek Jena
 
MeCC: Memory Comparison based Clone Detector
MeCC: Memory Comparison based Clone DetectorMeCC: Memory Comparison based Clone Detector
MeCC: Memory Comparison based Clone DetectorSung Kim
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CEleanor McHugh
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_papervandna123
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorJussi Pohjolainen
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with StatixEelco Visser
 
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17LogeekNightUkraine
 

Ähnlich wie GoLightly: A Go library for building Virtual Machines (20)

àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6 1
àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6  1àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6  1
àžŸàž±àž‡àžàčŒàžŠàž±àčˆàž™àžąàčˆàž­àžąàčàž„àž°àč‚àž›àžŁàčàžàžŁàžĄàžĄàžČàž•àžŁàžàžČàž™ àžĄ. 6 1
 
4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...4Developers 2018: The turbulent road to byte-addressable storage support at t...
4Developers 2018: The turbulent road to byte-addressable storage support at t...
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Stack
StackStack
Stack
 
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)
개발 êłŒì • 씜적화 하Ʞ ë‚Žë¶€íˆŽëĄœ 더욱 ê°•ë „í•œ 개발하Ʞ Stephen kennedy _(11시40분_103혞)
 
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdfANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
 
CorePy High-Productivity CellB.E. Programming
CorePy High-Productivity CellB.E. ProgrammingCorePy High-Productivity CellB.E. Programming
CorePy High-Productivity CellB.E. Programming
 
Go ahead, make my day
Go ahead, make my dayGo ahead, make my day
Go ahead, make my day
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
 
MeCC: Memory Comparison based Clone Detector
MeCC: Memory Comparison based Clone DetectorMeCC: Memory Comparison based Clone Detector
MeCC: Memory Comparison based Clone Detector
 
Struct examples
Struct examplesStruct examples
Struct examples
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & C
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
 
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
 

Mehr von Eleanor McHugh

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsEleanor McHugh
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityEleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveEleanor McHugh
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionEleanor McHugh
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]Eleanor McHugh
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with goEleanor McHugh
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxEleanor McHugh
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored SpacesEleanor McHugh
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignEleanor McHugh
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by designEleanor McHugh
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trustEleanor McHugh
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoEleanor McHugh
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleEleanor McHugh
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionEleanor McHugh
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoEleanor McHugh
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goEleanor McHugh
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountabilityEleanor McHugh
 

Mehr von Eleanor McHugh (20)

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient Collections
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data Integrity
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with go
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored Spaces
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By Design
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by design
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trust
 
Going Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google GoGoing Loopy - Adventures in Iteration with Google Go
Going Loopy - Adventures in Iteration with Google Go
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at Scale
 
Hello Go
Hello GoHello Go
Hello Go
 
Go for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd editionGo for the paranoid network programmer, 2nd edition
Go for the paranoid network programmer, 2nd edition
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in go
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountability
 

KĂŒrzlich hochgeladen

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

KĂŒrzlich hochgeladen (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

GoLightly: A Go library for building Virtual Machines

  • 1. GoLightly A Go library for building Virtual Machines Eleanor McHugh
  • 2. Go
  • 3. a new language statically-typed and compiled object-oriented but no classes garbage collected concurrency via communication (CSP) type polymorphism via interfaces
  • 4. a new way of working the safety of a static type system the feel of a dynamic runtime the performance of a compiled language
  • 7. ...to perspiration simulation v. emulation instruction set design bytecodes memory abstraction operation dispatch
  • 9. principles interface driven delegation architecture agnostic inspired by hardware techniques decoupled components scaling through specialisation
  • 10. caveat references current dev branch fundamental changes from github still evolving next release due for Strange Loop
  • 11. interfaces type Executable interface { type Comparable interface { Execute(p Processor) Identical(v Value) bool } Compare(v Value) int } type Processor interface { Reset() type Value interface { Step() fmt.Stringer Jump(a Address) Comparable Call(a Address) Nil() Value Return() IsNil() bool Load(program Program) } Run() Execute() type Program []Executable Sleep(n int64) Halt(n int) IsActive() bool }
  • 12. instructions obey the Executable interface expressed as separate types no assumptions about semantics not tied to a bytecode representation
  • 13. ïŹ‚ow control type NoOp struct {} type Call Address func (n *NoOp) String() string { func (c Call) String() string { return "NOOP" return Sprint("CALL", Address(c)) } } func (n *NoOp) Execute(p Processor) {} func (c Call) Execute(p Processor) { p.Call(Address(c)) type Halt struct {} } func (h *Halt) String() string { return "HALT" type Return struct {} } func (r Return) String() string { func (h *Halt) Execute(p Processor) { return "RET" p.Halt(PROGRAM_TERMINATED) } } func (r Return) Execute(p Processor) { p.Return() type Jump Address } func (j Jump) String() string { return Sprint("JMP", Address(j)) } func (j Jump) Execute(p Processor) { p.Jump(Address(j)) }
  • 14. bytecode type ByteCode []int case 5: / JMPZ n / case 10: / POP r / func (b *ByteCode) String() string { PC++ PC++ return "BYTECODE" if C == 0 { R[b[PC]] = DS.Pop() } PC++ case 11: / LOAD r, v / func (b *ByteCode) Execute(p Processor) { PC += b[PC] - 1 PC++ var PC, C, W int } else { W = b[PC] var R [2]int PC++ PC++ CS := new(vector.IntVector) } R[W] = b[PC] DS := new(vector.IntVector) case 6: / JMPNZ n / case 12: / ADD r1, r2 / for p.Active() { PC++ PC++ switch b[PC] { if C != 0 { W = b[PC] case 0: / NOOP / PC++ PC++ case 1: / NSLEEP n / PC += b[PC] - 1 R[b[PC]] += R[W] PC++ } else { default: p.Sleep(int64(b[PC])) PC++ p.Halt(ILLEGAL_INSTRUCTION) case 2: / SLEEP n / } } PC++ case 7: / CALL n / } p.Sleep(int64(b[PC]) << 32) PC++ } case 3: / HALT / CS.Push(PC) p.Halt(USER_HALT) PC = b[PC] return case 8: / RET / case 4: / JMP n / PC = CS.Pop PC++ case 9: / PUSH r / PC += b[PC] - 1 PC++ DS.Push(R[b[PC]])
  • 15. processors typical Turing machines support ïŹ‚exible dispatch not tied to a given instruction set memory model agnostic ripe for specialisation
  • 16. a scalar processor type SProc struct { func (s *SProc) Sleep(i int64) { func (s *SProc) Call(a Address){ Running bool syscall.Sleep(i) PC := s.PC PC int } s.PC = int(a) R IntBuffer for s.IsActive() { F FloatBuffer func (s *SProc) Halt(n int) { s.Execute() DS vector.IntVector s.Running = false s.Step() Program []Executable } } } s.PC = PC func (s *SProc) IsActive() bool{ } func (s *SProc) Run() { return s.Running && s.PC < s.Running = true len(s.Program) func (s *SProc) Return() { s.Call(0) } s.PC = len(s.Program) } } func (s *SProc) Reset() { func (s *SProc) Step() { s.R.ClearAll() s.PC++ s.PC = 0 } } func (s *SProc) Jump(a Address) { func (s *SProc) Load(program s.PC += int(a) Program) { } s.Reset() s.Program = program func (s *SProc) Execute() { } s.Program[s.PC].Execute(s) }
  • 17. memory based on allocated Values aggregate as ValueStores require boxing/unboxing buffers for speciïŹc types buffers are also ValueStores
  • 18. beneïŹts encourages simple designs many different VMs per executable can run in separate goroutines easily duplicated and serialised split across processes or hosts
  • 19. the future single dispatch for vector operations per vasive threading runtime code rewriting speculative loading JIT compilation

Hinweis der Redaktion