From aefb3a644dd72d6a31fd720e9d3ea1c1a9355893 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 3 Aug 2015 21:50:11 -0400 Subject: [PATCH] Divided the data types section --- docs/Writing-the-Cyclone-Scheme-Compiler.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/Writing-the-Cyclone-Scheme-Compiler.md b/docs/Writing-the-Cyclone-Scheme-Compiler.md index 3b62e92d..854c8877 100644 --- a/docs/Writing-the-Cyclone-Scheme-Compiler.md +++ b/docs/Writing-the-Cyclone-Scheme-Compiler.md @@ -95,10 +95,14 @@ Here is a snippet demonstrating how C functions may be written using Baker's app ## Data Types +### Objects + Most Scheme data types are represented as allocated "objects" that contain a tag to identify the object type. For example: typedef struct {tag_type tag; double value;} double_type; +### Value Types + On the other hand, some data types can be represented using 30 bits or less and can be stored as value types using a technique from Lisp in Small Pieces. On many machines, addresses are multiples of four, leaving the two least significant bits free. [A brief explanation](http://stackoverflow.com/q/9272526/101258): > The reason why most pointers are aligned to at least 4 bytes is that most pointers are pointers to objects or basic types that themselves are aligned to at least 4 bytes. Things that have 4 byte alignment include (for most systems): int, float, bool (yes, really), any pointer type, and any basic type their size or larger.