Skip to content
/ cspvm Public

Experimental, polyglot, work-in-progress stack VM implementations around native cooperative multitasking and CSP channels to communicate and syncrhonize between tasks.

License

Notifications You must be signed in to change notification settings

thi-ng/cspvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e9c33a2 · Nov 7, 2024

History

5 Commits
Nov 7, 2024
Nov 7, 2024
Apr 24, 2024
Apr 24, 2024
Nov 7, 2024
Apr 24, 2024
Apr 24, 2024
Apr 24, 2024
Apr 24, 2024
Nov 7, 2024
Apr 24, 2024
Apr 24, 2024
Apr 24, 2024
Nov 7, 2024
Apr 24, 2024
Apr 24, 2024
Nov 7, 2024

Repository files navigation

@thi.ng/cspvm

Experimental, polyglot, work-in-progeess stack VM implementations around native cooperative multitasking and CSP channels to communicate and syncrhonize between tasks.

Op code table

Multiple (very incomplete) versions/experiments are in:

Zig

Source - most recent developments...

# currently requires Zig v0.12.x

# run tests/example
zig build test

# [default] (info): task size 240
# [default] (info): tasklist: dual-list.FixedBufferDualList(14,u8){ .active = 0, .available = 1, .slots = { 255, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 255 } }
# [default] (debug): task: 0
# [default] (debug): ip: 1000 op: vm.Op.push16 ds: {  } rs: {  }
# [default] (debug): ip: 1003 op: vm.Op.call ds: { 16, 32 } rs: {  }
# [default] (debug): ip: 1009 op: vm.Op.push ds: { 16, 32 } rs: { 6, 16 }
# [default] (debug): ip: 100b op: vm.Op.jump ds: { 16, 32, 48 } rs: { 6, 16 }
# [default] (debug): ip: 1010 op: vm.Op.push ds: { 16, 32, 48 } rs: { 6, 16 }
# [default] (debug): ip: 1012 op: vm.Op.trap ds: { 16, 32, 48, 64 } rs: { 6, 16 }
# [default] (info): trap task 16 #85
# 
# [default] (debug): ip: 1014 op: vm.Op.add16 ds: { 16, 32, 48, 64 } rs: { 6, 16 }
# [default] (debug): ip: 1015 op: vm.Op.ret ds: { 64, 96 } rs: { 6, 16 }
# [default] (debug): ip: 1006 op: vm.Op.push ds: { 64, 96 } rs: {  }
# [default] (debug): ip: 1008 op: vm.Op.halt ds: { 64, 96, 80 } rs: {  }
# [default] (debug): task 0 halted
# [default] (info): ds: { 64, 96, 80 } rs: {  }

# build optimized WASM binary & WAT disassembly
scripts/build-zig.sh

WebAssembly

Source - VM implementation in handwritten WASM

scripts/build-wasm.sh

TypeScript

Source - Initial implementation & tests

yarn install

yarn test

License

© 2022 - 2024 Karsten Schmidt // Apache Software License 2.0

About

Experimental, polyglot, work-in-progress stack VM implementations around native cooperative multitasking and CSP channels to communicate and syncrhonize between tasks.

Topics

Resources

License

Stars

Watchers

Forks