From 19d573cf7c6dd729289ef5151f15db51bcc79d91 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Thu, 3 Jan 2013 22:11:37 +0100 Subject: Compiler can now push ints and strings --- notes | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'notes') diff --git a/notes b/notes index 368d2a0..a8be229 100644 --- a/notes +++ b/notes @@ -1,4 +1,7 @@ -Expressions: +RegEx stuff: http://sebfisch.github.com/haskell-regexp/ + += Expressions = + 0 1 2... -> just push themselves on the stack "string" -> pushes "string" on the stack -> "bareword" @@ -9,6 +12,7 @@ Expressions: bareword -> lookup "bareword" in current scopes -> passive -> push value on the stack -> active -> call value on current stack + -> quote -> call value on current stack, even in quoted mode / -> nop "string" | -> resolve "string" in current scope, push value @@ -71,7 +75,8 @@ _ -> copy stack contents according to digits A->int B->int add -> B->A->int A->int A->int add -> A->int -Characters: += Characters = + !: ": string quote #: line comment @@ -107,3 +112,44 @@ a-z: bareword characters |: passify }: quote end ~: + + += Memory Management = + +Inspiration: http://wiki.luajit.org/new-garbage-collector + +0x6???????????: Heap memory ("16 TB should be enough for everyone.") +0x5???????????: GC black bitmap +0x4???????????: GC allocation maps + +Large set of reachable, old objects +Large set of unreachable, new objects +Small set in between + + +== Object Memory Layout == + +=== Int === +* Length in bytes (including header, always 16) + bit 63-60: 0 0 0 0 + bit 59: reserved for GC +* value + +=== String === +* Length in bytes (including header) + bit 63-60: 0 0 0 1 + bit 59: reserved for GC +* hash (0 if not yet calculated) +* Exact length +* data (UTF-8) + +=== Struct === +* Length in bytes (including header) + bit 63-60: 0 0 1 0 + bit 59: reserved for GC + bit 58: parent pointer exists (for scopes) + bit 57: extension area pointer exists +* hashtable name -> offset including headers +* parent scope (0 if no parent) +* extension area pointer (0 if no extra members (yet)) +* data -- cgit v1.2.3