9579 Commits

Author SHA1 Message Date
Andrew Kelley
1eed0cf0f3 zig fmt and delete unused type 2020-06-28 19:45:10 -04:00
Andrew Kelley
aa92446365 stage2: implement function parameters
In codegen.zig, the std.Target.Cpu.Arch is now generally available as a
comptime value where needed. This is a tradeoff that causes the compiler
binary to be more bloated, but gives us higher performance, since the
optimizer can optimize per architecture (which is usually how compilers
are designed anyway, with different code per-architecture), and it also
allows us to use per-architecture types, such as a Register enum that is
specific to the comptime-known architecture.

Adds abiSize method to Type.
2020-06-28 19:45:10 -04:00
Jonathan Marler
e120b07a52 arena_allocator: refactor and use full capacity 2020-06-28 18:40:15 -04:00
Jonathan Marler
c2eead9629 Fix issue 5741, use after free 2020-06-28 18:05:18 -04:00
Jonathan Marler
374e3e42e0 WasmPageAllocator: fix bug not aligning allocations 2020-06-28 14:25:39 -04:00
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
Andrew Kelley
ac6bf53069
stage2: clean up test harness, implement symbol collision detection (#5708)
* Clean up test harness
* Stage2/Testing: Add convenience wrappers
* Add a `compiles` wrapper case
* fix incremental compilation after error
* exported symbol collision detection
* function redefinition detection for Zig code
* handle missing function names
* Stage2/Testing: Simplify incremental compilation tests
* Stage2/Testing: Update documentation
* Stage2/TestHarness: Improve progress reporting
* Disable test
* Improve Tranform failure output
2020-06-27 21:54:11 -04:00
Noam Preil
80b70470c0
Stage2/Module: Add symbol -> export lookup table 2020-06-27 21:50:59 -04:00
Noam Preil
ffca1569d1
Return instead of branch 2020-06-27 21:39:39 -04:00
Noam Preil
38d2c5cdf1
Rename type -> extension 2020-06-27 21:39:04 -04:00
Noam Preil
1861c25142
Improve Tranform failure output 2020-06-27 21:15:23 -04:00
Noam Preil
97c41e7152
Disable test 2020-06-27 21:10:44 -04:00
Noam Preil
54148a8c88
Stage2/TestHarness: Improve progress reporting 2020-06-27 20:01:20 -04:00
Andrew Kelley
0cfe8e5d6f
Merge pull request #5064 from marler8997/newAllocator
new allocator interface
2020-06-27 18:21:00 -04:00
Jonathan Marler
a728436992 new allocator interface after Andrew Kelley review 2020-06-27 08:57:35 -06:00
Noam Preil
ab307a22f6
Stage2: remove clearErrors, fix ZIR export collision detection 2020-06-27 07:17:20 -04:00
Ryan Liptak
626b5eccab Move fs-specific tests from os/test.zig to fs/test.zig
The moved tests do not use `std.os` directly and instead use `std.fs` functions, so it makes more sense for them to be in `fs/test.zig`
2020-06-27 10:17:08 +00:00
Jonathan Marler
dc9648f868 new allocator interface 2020-06-26 13:34:48 -06:00
Andrew Kelley
bb55889ce0 README: add link to troubleshooting build issues wiki page
See #5673
2020-06-26 15:10:30 -04:00
Noam Preil
52787f2c9b
Fix a dumb 2020-06-26 06:52:29 -04:00
Noam Preil
6d536168b0
Stage2/Testing: Update documentation 2020-06-26 06:51:35 -04:00
Noam Preil
0e952a9f3a
Stage2/Testing: Simply incremental compilation tests 2020-06-26 05:00:53 -04:00
Noam Preil
c8f60b2e2f
Stage2: handle missing function names 2020-06-26 04:36:17 -04:00
Noam Preil
6510888039
Stage2: function redefinition detection for Zig code 2020-06-26 04:05:41 -04:00
Noam Preil
4a17e008da
Stage2: exported symbol collision detection 2020-06-26 03:17:13 -04:00
Noam Preil
e5a3cb8d71
Stage2: fix incremental compilation after error 2020-06-26 03:16:36 -04:00
Noam Preil
53fead580e
Add a compiles wrapper case 2020-06-26 03:09:56 -04:00
Noam Preil
649da2df52
Stage2/Testing: Add convenience wrappers 2020-06-26 02:42:02 -04:00
Andrew Kelley
130c7fd23b self-hosted: working towards conditional branching test case
New features:
 * Functions can have parameters in semantic analysis. Codegen
   is not implemented yet.
 * Support for i8, i16, i32, i64, u8, u16, u32, u64 primitive
   identifiers.
 * New ZIR instructions: arg, block, and breakvoid

Implementation details:

 * Move Module.Body to ir.Body
 * Scope.Block gains a parent field and an optional Label field
 * Fix bug in integer type equality comparison.

Here's the test case I'm working towards:

```
@void = primitive(void)
@i32 = primitive(i32)
@fnty = fntype([@i32, @i32], @void)

@0 = str("entry")
@1 = export(@0, "entry")

@entry = fn(@fnty, {
  %0 = arg(0)
  %1 = arg(1)
  %2 = add(%0, %1)
  %3 = int(7)
  %4 = block("if", {
    %neq = cmp(%2, neq, %3)
    %5 = condbr(%neq, {
      %6 = unreachable()
    }, {
      %7 = breakvoid("if")
    })
  })
  %11 = returnvoid()
})
```

$ ./zig-cache/bin/zig build-obj test.zir
test.zir:9:12: error: TODO implement function parameters for Arch.x86_64

That's where I left off.
2020-06-26 02:30:14 -04:00
Andrew Kelley
e820678ca1
Merge pull request #5588 from tgschultz/leb128-output
LEB128 overhaul and output
2020-06-25 19:10:31 -04:00
Andrew Kelley
061c8be049
Merge pull request #5684 from squeek502/fs-file-dir-ops
Add tests for using directory operations on files
2020-06-25 19:08:30 -04:00
data-man
77bb2dc094 Use writer in benchmarks 2020-06-25 19:07:25 -04:00
Ryan Liptak
dcdbb7006c Add tests for using directory operations on files 2020-06-25 03:49:58 -07:00
Ryan Liptak
f50ed94174 Windows: Fix fs.Dir.openDir not handling STATUS_NOT_A_DIRECTORY
Now correctly returns error.NotDir
2020-06-25 03:49:58 -07:00
Andrew Kelley
41c6cc9001
Merge pull request #5677 from kubkon/fstatat
[libstd]: implement fstatat in WASI plus fix on macOS
2020-06-25 00:01:38 -04:00
arbrk1
78d8931647
Fix issue #5618 (#5685)
* fix issue #5618

* A test for the issue #5618 added.
Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
2020-06-24 23:58:50 -04:00
Alexandros Naskos
2fde8249b7 Fixed crash when resolving peer types of *[N:s]const T and [*:s]const T 2020-06-24 23:58:02 -04:00
Noam Preil
c88edbc46f
OOM -> catch unreachable 2020-06-24 23:34:58 -04:00
Noam Preil
5d7e981f95
Clean up test harness 2020-06-24 22:43:18 -04:00
Andrew Kelley
d337469e44
Merge pull request #5583 from ziglang/zig-ast-to-zir
self-hosted: hook up Zig AST to ZIR
2020-06-24 22:37:58 -04:00
Code Hz
7875649c24 Pdb.openFile use []const u8 instead of []u8 2020-06-24 22:27:30 -04:00
Andrew Kelley
20b4a2cf2c self-hosted: add compare output test for new AST->ZIR code 2020-06-24 21:28:42 -04:00
Andrew Kelley
5aa3f56773 self-hosted: fix test regressions
I'm allowing incremental compilation of ZIR modules to be broken. This
is not a real use case of ZIR, and the feature requires a lot of code
duplication with incremental compilation of Zig AST (which works great).
2020-06-24 20:28:52 -04:00
Andrew Kelley
fd7a97b3b2 fix memory leak of anonymous decl name 2020-06-24 16:20:02 -04:00
Andrew Kelley
e42b7702eb Merge remote-tracking branch 'origin/master' into zig-ast-to-zir 2020-06-24 15:36:59 -04:00
Alexandros Naskos
129a4fb251 Copy union const values correctly 2020-06-24 15:21:58 -04:00
Jakub Konka
d40e367b73 Reformat using if-else where appropriate 2020-06-24 21:00:21 +02:00
Jakub Konka
c63b23d684 Use fstatat on macOS (otherwise uses 32bit) 2020-06-24 21:00:21 +02:00
Jakub Konka
be78b7b648 Implement fstatat targeting WASI
Also, add more informative `@compileError` in a few `std.os` functions
that would otherwise yield a cryptic compile error when targeting
WASI. Finally, enhance docs in a few places and add test case for
`fstatat`.
2020-06-24 21:00:21 +02:00
Andrew Kelley
2c7fc1c5c5 Merge branch 'marler8997-fixAzureMsys2'
closes #5688
closes #5679
2020-06-24 14:53:02 -04:00