zig/src-self-hosted
Andrew Kelley c7ca1fe6f7 self-hosted: introduce a virtual address allocation scheme
The binary file abstraction changed its struct named "Decl" to
"TextBlock" and it now represents an allocated slice of memory in
the .text section. It has two new fields: prev and next, making it
a linked list node. This allows a TextBlock to find its neighbors.

The ElfFile struct now has free_list and last_text_block fields.
Doc comments for free_list are reproduced here:

A list of text blocks that have surplus capacity. This list can have false
positives, as functions grow and shrink over time, only sometimes being added
or removed from the freelist.

A text block has surplus capacity when its overcapacity value is greater than
minimum_text_block_size * alloc_num / alloc_den. That is, when it has so
much extra capacity, that we could fit a small new symbol in it, itself with
ideal_capacity or more.

Ideal capacity is defined by size * alloc_num / alloc_den.

Overcapacity is measured by actual_capacity - ideal_capacity. Note that
overcapacity can be negative. A simple way to have negative overcapacity is to
allocate a fresh text block, which will have ideal capacity, and then grow it
by 1 byte. It will then have -1 overcapacity.

The last_text_block keeps track of the end of the .text section.

Allocation, freeing, and resizing decls are all now more sophisticated,
and participate in the virtual address allocation scheme. There is no
longer the possibility for virtual address collisions.
2020-05-27 15:23:27 -04:00
..
codegen [Stage2/Codegen] Typo fix 2020-05-22 15:34:32 -04:00
clang.zig translate-c: fix decl statement regression 2020-05-23 17:50:35 -04:00
clang_options.zig zig cc: fix ambiguity with -MT 2020-04-02 21:15:36 -04:00
clang_options_data.zig zig cc looks for native include directories unless -nostdinc 2020-04-04 14:58:24 -04:00
codegen.zig [Stage2/Codegen] Properly handle arch in genCall 2020-05-24 20:49:29 -04:00
dep_tokenizer.zig (breaking) std.Buffer => std.ArrayListSentineled(u8, 0) 2020-04-01 13:30:07 -04:00
introspect.zig self-hosted: use fs.selfExePathAlloc 2020-03-25 18:40:28 -04:00
ir.zig move Module to its own file 2020-05-15 21:44:33 -04:00
libc_installation.zig rework self-hosted compiler for incremental builds 2020-05-10 02:05:54 -04:00
link.zig self-hosted: introduce a virtual address allocation scheme 2020-05-27 15:23:27 -04:00
llvm.zig fix stage2 build 2019-12-29 11:04:58 +02:00
main.zig translate-c is building again, but I have 1 @panic in there 2020-05-23 16:24:03 -04:00
Module.zig self-hosted: introduce a virtual address allocation scheme 2020-05-27 15:23:27 -04:00
Package.zig self-hosted: link: global offset table support for decls 2020-05-12 20:11:47 -04:00
print_targets.zig windows: don't hard-code forward-slash paths 2020-03-27 21:28:52 -04:00
stage2.zig Merge remote-tracking branch 'origin/master' into self-hosted-incremental-compilation 2020-05-16 01:26:18 -04:00
test.zig update ZIR compare output test to test incremental updates 2020-05-17 13:49:22 -04:00
translate_c.zig translate-c: use correct scope in for loop condition 2020-05-27 14:14:17 +03:00
type.zig fix codegen of sentinel-terminated arrays and .got alignment 2020-05-14 16:34:04 -04:00
TypedValue.zig self-hosted: fix compile errors, except for codegen.zig 2020-05-13 20:06:01 -04:00
value.zig move Module to its own file 2020-05-15 21:44:33 -04:00
windows_sdk.zig self-hosted libc detection 2020-02-16 13:25:30 -05:00
zir.zig Merge remote-tracking branch 'origin/master' into self-hosted-incremental-compilation 2020-05-16 01:26:18 -04:00