aboutsummaryrefslogtreecommitdiff
path: root/notes
diff options
context:
space:
mode:
Diffstat (limited to 'notes')
-rw-r--r--notes50
1 files changed, 48 insertions, 2 deletions
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
<non-bareword><bareword> -> "bareword" <non-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 @@ _<digits> -> copy stack contents according to digits
A->int B->int add -> B->A->int
A->int A->int add -> A->int
-Characters:
+= Characters =
+
!: <open>
": string quote
#: line comment
@@ -107,3 +112,44 @@ a-z: bareword characters
|: passify
}: quote end
~: <open>
+
+
+= 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