17997 Commits

Author SHA1 Message Date
Veikka Tuominen
ef7282bab4 stage2 macho: workaround stage2 bugs 2022-04-15 16:05:27 +03:00
Veikka Tuominen
845a30624f std: add workaround for stage2 bug 2022-04-15 11:17:19 +03:00
Veikka Tuominen
6ad510d832 update self hosted sources to language changes 2022-04-15 11:17:19 +03:00
Veikka Tuominen
4911d39769 AstGen: handle rl_ty_inst for mutable variables 2022-04-15 11:17:06 +03:00
Veikka Tuominen
4ef1c1c705 Sema: allow fieldType on optionals and error unions 2022-04-15 10:24:18 +03:00
Luuk de Gram
d66c61a2cf wasm-linker: Prevent overalignment for segments
Previously, the data segments were being aligned twice.
This caused us to overalign the segment and therefore allocate a much larger
size for each segment than was required. This fix ensures we align and set the size
just once, ensuring semantically correct binaries as well as smaller binaries.
2022-04-14 22:53:13 +02:00
Luuk de Gram
cf37101108 wasm-linker: Add function table indexes
When linking with an object file, verify if a relocation is a table index relocation.
If that's the case, add the relocation target to the function table.
2022-04-14 22:53:13 +02:00
Luuk de Gram
321a164269 wasm-linker: Fix memory leak
This fixes a memory leak when an object file contains one or more element sections which
then contains one or more function indexes. This commit ensures the slice of index functions
for each element section will be freed upon resource deallocation also.
2022-04-14 22:53:13 +02:00
Jakub Konka
2635e4ca6e
Merge pull request #11434 from koachan/sparc64-codegen 2022-04-14 21:38:35 +02:00
Jakub Konka
35171dd3db
Merge pull request #11433 from ziglang/elf-fixes
elf: support `--strip` option and set symtab size when writing globals
2022-04-14 20:04:29 +02:00
Andrew Kelley
2587474717 stage2: progress towards stage3
* The `@bitCast` workaround is removed in favor of `@ptrCast` properly
   doing element casting for slice element types. This required an
   enhancement both to stage1 and stage2.
 * stage1 incorrectly accepts `.{}` instead of `{}`. stage2 code that
   abused this is fixed.
 * Make some parameters comptime to support functions in switch
   expressions (as opposed to making them function pointers).
 * Avoid relying on local temporaries being mutable.
 * Workarounds for when stage1 and stage2 disagree on function pointer
   types.
 * Workaround recursive formatting bug with a `@panic("TODO")`.
 * Remove unreachable `else` prongs for some inferred error sets.

All in effort towards #89.
2022-04-14 10:12:45 -07:00
Koakuma
c07213269f stage2: zig fmt 2022-04-14 23:26:03 +07:00
Koakuma
e791f062ba stage2: sparcv9: Load tests to the list of testcases 2022-04-14 23:24:46 +07:00
Koakuma
2ee83e76f7 stage2: Adjust line numbers in tests 2022-04-14 23:15:56 +07:00
Koakuma
9201fbe85b stage2: sparcv9: Add cmp_lt_errors_len AIR inst & fix asm parsing 2022-04-14 22:34:51 +07:00
Koakuma
f6b95166eb stage2: sparcv9: Add simple test case 2022-04-14 22:18:06 +07:00
Koakuma
47b136e3b3 stage2: Add SPARC function alignment
This is based on @kubkon's suggestion.
2022-04-14 22:18:06 +07:00
Koakuma
a6ce2fc3dc linker: ELF: Add page sizes for ppc64le and sparcv9 2022-04-14 22:18:06 +07:00
Koakuma
43e69be196 stage2: sparcv9: Add exit2 implementation 2022-04-14 22:18:06 +07:00
Koakuma
b916ba18b6 stage2: sparcv9: Fix Tcc encoding 2022-04-14 22:18:06 +07:00
Koakuma
dcb12a7941 stage2: sparcv9: Use regular structs to encode instructions
Currently packed structs still has endian-dependent behavior, so it results
in code that is not portable across platforms (see also issue 10113).
2022-04-14 22:18:06 +07:00
Koakuma
1467590e40 stage2: sparcv9: Implement enough instruction to compile simple exes 2022-04-14 22:18:06 +07:00
Koakuma
1f63afa7c9 stage2: sparcv9: Register the backend in stdlib & driver 2022-04-14 22:18:06 +07:00
Koakuma
cfd389f927 stage2: sparcv9: zig fmt 2022-04-14 22:18:06 +07:00
Flandre Scarlet
ab2ea9fb09 stage2: sparcv9: Test failure error logging 2022-04-14 22:18:06 +07:00
Koakuma
7051970ad7 stage2: sparcv9: implement basic instruction lowering 2022-04-14 22:18:06 +07:00
Koakuma
5e2045cbe5 stage2: sparcv9: Implement basic asm codegen 2022-04-14 22:18:06 +07:00
Koakuma
42f4bd3421 stage2: sparcv9: Add breakpoint, ret, and calling mechanism 2022-04-14 22:18:06 +07:00
Koakuma
1972a2b080 stage2: sparcv9: Add placeholders to generate a minimal program 2022-04-14 22:18:06 +07:00
Koakuma
cec48f2cf1 stage2: sparcv9: Different formatting for genBody 2022-04-14 22:18:06 +07:00
Koakuma
5ab6b5a777 stage2: sparcv9: implement dbgAdvancePCAndLine 2022-04-14 22:18:06 +07:00
Koakuma
71cd3466ec stage2: sparcv9: Adjust RegisterManager settings 2022-04-14 22:18:06 +07:00
Koakuma
18c98eb429 stage2: sparcv9: Placeholder for Air instructions in genBody 2022-04-14 22:18:06 +07:00
Koakuma
94d70bdb69 stage2: sparcv9: Change ordering in Mir Tag 2022-04-14 22:18:05 +07:00
Koakuma
94a84e783e stage2: sparcv9: Implement basic prologue/epilogue Mir emission 2022-04-14 22:18:05 +07:00
Koakuma
927706e6d0 stage2: sparcv9: Emit debug inst placeholder 2022-04-14 22:18:05 +07:00
Koakuma
cf13356dab stage2: sparcv9: Mir extraData implementation 2022-04-14 22:18:05 +07:00
Koakuma
1ba5227216 stage2: sparcv9: Initial resolveCallingConventionValues implementation 2022-04-14 22:18:05 +07:00
Koakuma
a5a89fde13 stage2: sparcv9: Add skeleton codegen impl and necessary fields 2022-04-14 22:18:05 +07:00
Koakuma
a30688ef2a stage2: sparcv9: Add some initial checks in codegen 2022-04-14 22:18:05 +07:00
Andrew Kelley
0739770739 Sema: workaround for generic instantiation recurison bug 2022-04-14 06:37:11 -07:00
Jakub Konka
4d77ef25f9 elf: check symtab section headers size when writing globals
Without this, it may happen we write the globals without extending
the symtab section header's size. This can potentially lead to
clobbering some data in the file, or simply omitting the globals
from the symtab when displaying with support tooling such as `readelf`.
2022-04-14 15:16:55 +02:00
Jakub Konka
7a00227253 elf: support --strip option
When the user passes `--strip` option on the command line, we do
not emit any debug info by skipping initializing the internal `Dwarf`
module.
2022-04-14 15:15:13 +02:00
Andrew Kelley
2a00df9c09 Sema: fix generic instantiation false negatives
The problem was that types of non-anytype parameters were being included
as part of the check to see if generic function instantiations were
equal. Now, Module.Fn additionally stores the information for whether each
parameter is anytype or not. `generic_poison` cannot be used to signal
this because the type is still needed for comptime arguments; in such
case the type will not be present in the newly generated function
prototype.

This presented one additional challenge: we need to compare equality of
two values where one of them is post-coercion and the other is not. So
we make some minor adjustments to `Type.eql` to support this. I think
this small complexity tradeoff is worth it because it means the compiler
does much less work on the hot path that a generic function is called
and there is already an existing matching instantiation.

closes #11146
2022-04-14 06:08:28 -07:00
Andrew Lee
9b82e7f558 std/bounded_array.zig: Add Writer interface 2022-04-14 02:56:40 -04:00
vi
6ad9ac59e7 std.math.float: fix f80-backed c_longdouble consts 2022-04-14 02:55:46 -04:00
Eric Shrewsberry
497f8a6098 Fix bug in PriorityQueue::removeIndex()
Fix to call siftDown on the removed index instead of always on index 0.
Updated test to a test that fails before and passes now.

PriorityDequeue does not have this issue.
2022-04-14 02:54:41 -04:00
Andrew Kelley
59fa548be8
Merge pull request #11429 from ziglang/stage2-alive-decls
stage2: fix (recursively) marking decls as alive, and improve DWARF for local vars
2022-04-14 02:01:16 -04:00
Ryan Liptak
9c509f1526 Enable passing 'Dir.rename directories' fs test on Windows
Looks like d3f87f8ac01039722197a13a12342fc747a90567 fixed the standard cases of dir renaming, but the edge cases (renaming onto an existing empty/non-empty directory) are still behaving differently than on non-Windows.
2022-04-13 19:55:16 +02:00
Jakub Konka
edb428fae4 macho,x64: resolve debug info relocs for RIP-based addressing
Sometimes we will want to generate debug info for a constant that
has been lowered to memory and not copied anywhere else. For this
we will need to defer resolution on PIE platforms until all locals
(including GOT entries) have been allocated.
2022-04-13 19:50:23 +02:00