Added an essay on the design of paged space objects; started experimenting in Zig.
This commit is contained in:
parent
99d4794f3b
commit
09051a3e63
5 changed files with 167 additions and 0 deletions
9
src/zig/memory/page.zig
Normal file
9
src/zig/memory/page.zig
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/// A Page is an area of memory in which objects are stored. Every page has
|
||||
/// a header, and every page header has common structure. The objects stored
|
||||
/// on any page are all PagedObjects, q.v. and, on any given page, all the
|
||||
/// objects stored on that page are of the same size.
|
||||
const Page = struct {
|
||||
const content = union {
|
||||
const bytes = [1048576]u8;
|
||||
};
|
||||
};
|
||||
17
src/zig/memory/paged-space-objects.zig
Normal file
17
src/zig/memory/paged-space-objects.zig
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/// Header for objects which are allocated in pages.
|
||||
const PagedSpaceObjectHeader = struct {
|
||||
const tag = union {
|
||||
const bytes = [4]u8;
|
||||
const value = u32;
|
||||
};
|
||||
var count = u32;
|
||||
const acl = u64; // later when we have a pointer object defined this will be substituted
|
||||
};
|
||||
|
||||
const PSO4: type = struct {
|
||||
const PagedSpaceObjectHeader: header;
|
||||
const payload = union {
|
||||
var bytes: [8]u8;
|
||||
var words: [2]u64;
|
||||
};
|
||||
};
|
||||
1
src/zig/memory/version.zig
Normal file
1
src/zig/memory/version.zig
Normal file
|
|
@ -0,0 +1 @@
|
|||
const version: []const u8 = "0.1.0-SNAPSHOT";
|
||||
Loading…
Add table
Add a link
Reference in a new issue