Commit Graph

9453 Commits (c9a0ec25e0baae7f128a8f7efe4d308af7fad753)

Author SHA1 Message Date
Andrew Kelley c9a0ec25e0 self-hosted: add Tracy integration
This tool helps give an intuitive picture of performance. This will help
us understand where to improve the code.
2020-06-18 21:55:37 -04:00
Andrew Kelley 355319fb67 zig cc: add missing cxxabi include path 2020-06-18 18:17:26 -04:00
Andrew Kelley 7e44302260 stage2: explicit hash and equality function for the DeclTable 2020-06-18 17:12:56 -04:00
Andrew Kelley 81f766eecd self-hosted parser: make a function pointer comptime 2020-06-18 17:12:56 -04:00
Andrew Kelley 46b57748a5 stage1: stop emitting memset to undefined when safety is off 2020-06-18 17:12:56 -04:00
Andrew Kelley 02f688d710 remove std.debug.warn debugging logs 2020-06-18 17:12:56 -04:00
Andrew Kelley 7e58c56ca7 self-hosted: implement Decl lookup
* Take advantage of coercing anonymous struct literals to struct types.
 * Reworks Module to favor Zig source as the primary use case.
   Breaks ZIR compilation, which will have to be restored in a future commit.
 * Decl uses src_index rather then src, pointing to an AST Decl node
   index, or ZIR Module Decl index, rather than a byte offset.
 * ZIR instructions have an `analyzed_inst` field instead of Module
   having a hash table.
 * Module.Fn loses the `fn_type` field since it is redundant with
   its `owner_decl` `TypedValue` type.
 * Implement Type and Value copying. A ZIR Const instruction's TypedValue
   is copied to the Decl arena during analysis, which allows freeing the
   ZIR text instructions post-analysis.
 * Don't flush the ELF file if there are compilation errors.
 * Function return types allow arbitrarily complex expressions.
 * AST->ZIR for function calls and return statements.
2020-06-18 17:12:56 -04:00
Andrew Kelley b4eac0414a stage2: hook up Zig AST to ZIR
* Introduce the concept of anonymous Decls
 * Primitive Hello, World with inline asm works
 * There is still an unsolved problem of how to manage ZIR instructions
   memory when generating from AST. Currently it leaks.
2020-06-18 17:12:56 -04:00
Andrew Kelley 4a38799631 make file and fn_name fields of SourceLocation also null-terminated
One of the main motivating use cases for this language feature is
tracing/profiling tools, which expect null-terminated strings for these
values. Since the data is statically allocated, making them
additionally null-terminated comes at no cost.

This prevents the requirement of compile-time code to convert to
null-termination, which could increase the compilation time of
code with tracing enabled.

See #2029
2020-06-18 17:09:10 -04:00
Andrew Kelley e54ed9f638
Merge pull request #5628 from Vexu/src
Implement @src
2020-06-18 16:23:56 -04:00
Vexu 14acc65675
add tests for `@src` 2020-06-18 21:11:34 +03:00
Vexu a5379aa3ee
implement `@src` 2020-06-18 21:11:09 +03:00
Andrew Kelley 9781342042
Merge pull request #5607 from daurnimator/cleanup-debug-stderr
std: clean up debug stderr variables
2020-06-16 18:27:44 -04:00
Jonathan Marler f0b8791da7 ArrayList(u8) support writer interface 2020-06-16 18:26:54 -04:00
Andrew Kelley 593db7e8d0
Merge pull request #5608 from alexnask/windows_utf16_dir
Use PathSpace and wide FS calls on windows in stage1
2020-06-16 18:26:02 -04:00
Jakub Konka 04c3fae720 Remove obsolete branch in ir_analyze_cast
Branch handling `*[N]T` to `E![]T` is already handled in a more complete
branch handling `*[N]T` to `[]T` *and* `*[N]T` to `E![]T` so it seems
safe to remove this one.
2020-06-16 18:24:45 -04:00
Andrew Kelley f595545c10
Merge pull request #5422 from pixelherodev/error_tests
[Stage2/Testing] ZIR tests for expected errors
2020-06-16 03:50:56 -04:00
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 adb21f1caf
Stage2/Testing: Add error tests to ZIRCase 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 1e5945d0a9
Stage2/Testing: remove ZIRTransformCase 2020-06-15 20:33:39 -04:00
Noam Preil 71dca252a5
Stage2/Testing: Rename stage -> update 2020-06-15 20:33:32 -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 d4fd7c6a01
Stage2/Testing: Staged test harness draft design 2020-06-15 20:32:54 -04:00
Noam Preil 2ed07a36f8
[Stage2/Testing] Attempt to call nakedcc function 2020-06-15 17:52:21 -04:00
Noam Preil bf8b3a4394
[Stage2/Testing] Handle decl and export errors 2020-06-15 17:51:43 -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 e030414c16
[Stage2/Testing] Always finish case, note all errs 2020-06-15 17:51:43 -04:00
Noam Preil f2399db3ef
[Stage2/Testing] Don't rely on update erroring 2020-06-15 17:51:42 -04:00
Noam Preil 67414be86b
[Stage2/Testing] Print name of failed test 2020-06-15 17:51:42 -04:00
Noam Preil c92816fbef
[Stage2/Testing] ZIR tests for expected errors 2020-06-15 17:51:29 -04:00
Andrew Kelley 2bb3e1aff4 stage1: implement type coercion of anon struct literal to struct
closes #3672
2020-06-15 16:52:18 -04:00
Alexandros Naskos 2c8a3aaf85 Use _wfopen instead of fopen on windows 2020-06-15 22:21:01 +03:00
Alexandros Naskos 242246f793 UTF16 create process, utf8->utf16 fix 2020-06-15 21:51:53 +03:00
Alexandros Naskos c34bdff4bb Use more wide functions on windows 2020-06-15 18:38:41 +03:00
daurnimator af592f0ddd
std: remove std.debug.getStderrStream
Rather than migrate to new 'writer' interface, just remove it
2020-06-15 23:51:25 +10:00
daurnimator ce30357532
std: clean up debug stderr variables
- stderr_file_writer was unused
  - stderr_stream was a pointer to a stream, rather than a stream
  - other functions assumed that getStderrStream has already been called
2020-06-15 23:48:33 +10:00
Alexandros Naskos 3b0b56b81a Switched more Windows FS calls to their wide versions 2020-06-15 16:15:10 +03:00
Alexandros Naskos 037c72fe67 Convert paths to UTF-16 before calling CreateDirectory on windows 2020-06-15 15:52:59 +03:00
Vexu e7207bc267
add workaround for #5599 2020-06-14 20:13:02 +03:00
Carter Sande 09cded209d Add strict_align to pre-v6 ARM targets
This matches GCC's and Clang's default behavior for these targets.
2020-06-12 13:43:12 -04:00
Andrew Kelley 866651a5a3
Merge pull request #5589 from kubkon/preopens-example
Add doc example for extracting WASI preopens
2020-06-12 13:40:30 -04:00
Alexandros Naskos 1bc92b1fde Fix formatting of floating point values with the B and Bi specifiers 2020-06-12 13:38:12 -04:00
Cassidy Dingenskirchen 57f1ed5325 Fix a few std.sort.sort invocations 2020-06-12 13:33:31 -04:00