Commit Graph

38 Commits

Author SHA1 Message Date
Noam Preil
a99e61ebaa
Stage2/Testing: Code cleanup 2020-06-15 21:47:42 -04:00
Noam Preil
afec3e72f4
Stage2/Testing: Enable another test 2020-06-15 20:42:22 -04:00
Noam Preil
7d1c9a69cc
Stage2/Testing: Remove dead code 2020-06-15 20:33:43 -04:00
Noam Preil
7ee0462f5f
Stage2/Testing: Fix transformation tests 2020-06-15 20:33:39 -04:00
Noam Preil
b6bd51ed69
Stage2/Testing: Move Transformation case to ZIRCase 2020-06-15 20:33:25 -04:00
Noam Preil
e77fc7fe7e
Stage2/Testing: Fix error specification 2020-06-15 20:33:17 -04:00
Noam Preil
6dce317fe3
Stage2/Testing: Fix error tests 2020-06-15 20:33:07 -04:00
Noam Preil
2ed07a36f8
[Stage2/Testing] Attempt to call nakedcc function 2020-06-15 17:52:21 -04:00
Noam Preil
68cc068a3a
[Stage2/Testing] Make API more friendly 2020-06-15 17:51:43 -04:00
Noam Preil
bebc1f49cf
[Stage2/Testing] Add (failing) test 2020-06-15 17:51:43 -04:00
Noam Preil
2d1d012f11
[Stage2/Testing] Reduce test 2020-06-15 17:51:43 -04:00
Noam Preil
c92816fbef
[Stage2/Testing] ZIR tests for expected errors 2020-06-15 17:51:29 -04:00
Andrew Kelley
47090d234e stage2: add passing test for compile error in unreferenced cycle 2020-06-08 15:16:40 -04:00
Andrew Kelley
cf654b52d6 stage2: -femit-zir respects decl names and supports cycles 2020-06-08 15:16:40 -04:00
Andrew Kelley
6524a64bda stage2: fix referencing decls which appear later in the file 2020-06-02 17:43:51 -04:00
Andrew Kelley
3eed7a4dea stage2: first pass at recursive dependency resolution 2020-05-28 12:19:00 -04:00
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
Andrew Kelley
8d3cca7fc2 stage2: function calls using the global offset table
so far they don't support parameters or return values
2020-05-19 13:51:46 -04:00
Andrew Kelley
b0968abccb update ZIR compare output test to test incremental updates 2020-05-17 13:49:22 -04:00
Andrew Kelley
cd5f69794d cross compile the stage2 tests for the target that they work for 2020-05-16 12:19:31 -04:00
Andrew Kelley
64f4ef7556 update ZIR test cases 2020-05-15 21:29:52 -04:00
Andrew Kelley
1d202008d8 add ZIR transform test case 2020-05-01 06:47:20 -04:00
Andrew Kelley
56a024bbfc disable stage2 zir tests on not-yet-supported archs 2020-05-01 06:47:20 -04:00
Andrew Kelley
6e6d0eb690 disable stage2 zir tests on not-yet-supported OS's 2020-05-01 06:47:20 -04:00
Andrew Kelley
2bae942800 add ZIR compare output test case to test suite 2020-05-01 06:47:20 -04:00
Andrew Kelley
cc1c2bd568 simplify ZIR spec; separate parsing/rendering from analysis 2020-04-20 19:21:03 -04:00
Andrew Kelley
f92ccf365b generic ir parsing framework 2020-04-19 19:31:50 -04:00
Andrew Kelley
bd4280decf beginnings of zig ir parser 2020-04-19 19:31:50 -04:00
Vexu
621c08e692
exported main must be pub 2019-12-03 12:50:42 -05:00
Andrew Kelley
34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers 2019-11-24 20:28:46 -05:00
Vexu
b9ef36094c
re-enable stage2 tests 2019-11-23 22:57:34 +02:00
Andrew Kelley
47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
hryx
3a3a738478
Recursive rewrite of stage2 parser, part 3 2019-05-12 02:01:45 -07:00
Andrew Kelley
02713e8d8a fix race conditions in self-hosted compiler; add test
* fix race condition in std.event.Channel deinit
 * add support to zig build for --no-rosegment
 * add passing self-hosted compare-output test for calling a function
 * put a global lock on LLD linking because it's not thread safe
2018-07-24 21:28:54 -04:00
Andrew Kelley
d767fae47e self-hosted: add first compare-output test 2018-07-23 00:35:53 -04:00
Andrew Kelley
f5a67dba08 self-hosted: implicit cast comptime ints to other ints
we now have successful exit codes from main linking
against libc
2018-07-20 01:46:49 -04:00
Andrew Kelley
bd1c55d2c2 self-hosted: compile errors for return in wrong place
* outside fn definition
 * inside defer expression
2018-07-18 17:43:36 -04:00
Andrew Kelley
9bdcd2a495 add std.event.Future
This is like a promise, but it's for multiple getters, and
uses an event loop.
2018-07-11 16:00:06 -04:00