| type | slide |
|---|
- Bharath Chandra Sudheer
- Hoang Trong Tan
Concurrency Primitives:
goroutine,mutex,semaphore,waitgroup,channel- should not be naive busy-waiting
Granularity level of concurrency: interleaved execution of VM instructions
-
sequential logic:
for,if,func,funcliterals,var, primitive types:bool,str,intand related operations and*Tfor any type -
low-level memory management
- garbage collection: cheney
- visualisation of memory
- PeggyJs generates left-recursive parser in JS
- TSC: strong confidence in preventing malformed objects and ensuring safe logic in parsing, compiling and execution
- Jest: CI/CD regression testing & test-driven development
- recursive compiler
- well-typed parsed objects -> well-typed instruction data objects
- macro-like compiler directives for reusable Gosling snippets
addGlobalEnvto set builtins
updateBuiltinsFnDef(
`
func testAndSetInt(ptr *int, expected, desired int) bool {
return __noop(testAndSetInt_TEST_AND_SWAP)
}`,
{
testAndSetInt_TEST_AND_SWAP: [
{ op: OpCode.LD, symbol: "desired" },
{ op: OpCode.LD, symbol: "expected" },
{ op: OpCode.LD, symbol: "ptr" },
{ op: OpCode.TEST_AND_SET },
],
}
)
- Gosling interpreter written in Typescript
- operand-stack architecture, with RTS and OS both stored in VM-managed memory
- provides access to thread control and sys call (
print,breakpoint,yield, ...)
- our heap is an ArrayBuffer split into fixed-size nodes
- types:
Int,Bool,StrandBinary Pointer - composite types (e.g. list, queue, stack, function ptr) are built with
Binary Pointer - runtime stacks (incl. environment) and operands stacks are stored in the heap
- Stop and Copy (Cheney's) due to low memory residency
- space:
$O(1)$ , time:$O(\text{liveNodes})$
SysCall('done'): terminate execution (if main, terminate all)SysCall('yield'): relinquish CPU controlTestAndSet: key atomic instruction to implementmutexandsemaphore.
mutexsemaphore: with explicit upper-boundwaitgroup: bounded semaphorechannel: bounded semaphore & mutex
func main() {
bar := "main bar"
foo(1)
go foo(1)
}
func foo(y int) {
bar := "foo bar"
x = x + y // breakpoint
return
}
- functions as first class objects
- support expressions as args or as functions
- applicative-order evaluation
- Goose types: array, struct
- typechecking
- compile time env







