From fbacd0afe371d1e728024b1541c8c6213d026a17 Mon Sep 17 00:00:00 2001 From: titzer Date: Mon, 17 Aug 2015 18:57:34 +0200 Subject: [PATCH 1/3] Add data segments to binary format Add a description of data segments, which are a way that the binary module can load initialized data into memory, similar to a .data section. --- BinaryEncoding.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BinaryEncoding.md b/BinaryEncoding.md index f360d62d..5b993215 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -98,8 +98,12 @@ Yes: * Type ID * Count of locals + The serialized AST + * A `data` section contains + - A sequence of byte ranges within the binary and corresponding addresses in the linear memory + All strings are encoded as null-terminated UTF8. +Data segments represent initialized data that is loaded directly from the binary into the linear memory when the program starts. ## Serialized AST From e9bee501b78442225667276c49d6fe370af18205 Mon Sep 17 00:00:00 2001 From: titzer Date: Tue, 18 Aug 2015 18:31:19 +0200 Subject: [PATCH 2/3] Update BinaryEncoding.md --- BinaryEncoding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 5b993215..70ec4787 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -103,7 +103,7 @@ Yes: All strings are encoded as null-terminated UTF8. -Data segments represent initialized data that is loaded directly from the binary into the linear memory when the program starts. +Data segments represent initialized data that is loaded directly from the binary into the linear memory when the program starts (see [modules](Modules.md#initial-state-of-linear-memory)). ## Serialized AST From 5d3dbeb2cb57eb5e086d4da3f95e22c5fa83d27c Mon Sep 17 00:00:00 2001 From: titzer Date: Tue, 18 Aug 2015 18:33:15 +0200 Subject: [PATCH 3/3] Update Modules.md --- Modules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules.md b/Modules.md index b91aba23..e1460fa6 100644 --- a/Modules.md +++ b/Modules.md @@ -109,8 +109,8 @@ to allow *explicitly* sharing linear memory between multiple modules. A module will contain a section declaring the linear memory size (initial and maximum size allowed by [`resize_memory`](AstSemantics.md#resizing) and the -initial contents of memory (analogous to `.data`, `.rodata`, `.bss` sections in -native executables). +initial contents of memory,analogous to `.data`, `.rodata`, `.bss` sections in +native executables (see [binary encoding](BinaryEncoding.md#global-structure) ## Code section