Commit Graph

1429 Commits (d8227c79a2ff7882a52bf53f9ded2db4e7081fc8)

Author SHA1 Message Date
Andrew Kelley 97f6b6093c zig build can build and install static C libraries
See #332
2017-04-30 20:29:33 -04:00
Andrew Kelley 2c6827064c fix regression from previous commit 2017-04-30 20:11:35 -04:00
Andrew Kelley 1ec89b0286 zig build: refactor CLibrary and CExecutable into same struct 2017-04-30 19:48:45 -04:00
Andrew Kelley 363d9038c9 zig build: organize build artifacts
closes #328
2017-04-30 18:56:24 -04:00
Andrew Kelley 38a04a267c zig build: when compiling C files put .o files in cache dir
See #328
2017-04-30 13:01:35 -04:00
Andrew Kelley 43e7ac8418 add peer type resolution `[]T` and `[0]T`
closes #349

also fix slicing const array to be []const T instead of []T
2017-04-30 12:21:24 -04:00
Andrew Kelley 29defd705d back to AT&T syntax for assembly
this reverts 5c04730534.

sadly the quality of the intel dialect in llvm's assembly
parser has many frustrating bugs, and generally has unfortunate
syntax.

the plan is to use AT&T for now since it at least works,
and eventually zig will have its own assembly parser for
x86 and it will be as close to NASM as possible.
2017-04-30 11:28:11 -04:00
Andrew Kelley cbfe4b4bae add implicit cast from [0]T to %[]T
closes #347

also add std.os.path.relative
2017-04-29 19:23:33 -04:00
Andrew Kelley d04d3ec775 build system: remove setLinkerScriptContents 2017-04-28 10:46:01 -04:00
Andrew Kelley a147f06585 zig puts temporary object files in zig-cache folder
See #298
2017-04-28 02:22:12 -04:00
Andrew Kelley 458afb0ef9 phi instruction retains stack ptr hint 2017-04-27 23:40:43 -04:00
Andrew Kelley 2e512a0e6e add compile error for returning local variable address
closes #344
2017-04-27 19:40:35 -04:00
Andrew Kelley 1691074b4b add no-elim-base-pointer to __zig_fail function
fixes missing frame for unwrapping an error

closes #345
2017-04-27 18:40:17 -04:00
Andrew Kelley 7e11ef79d6 zig test no longer requires a separate test_runner.o file
See #298
2017-04-27 16:19:20 -04:00
Andrew Kelley 7b0542d08b build system: consolidate duplicate code and more
* add ability to add assembly files when building an exe, obj, or lib
 * add implicit cast from `[N]T` to `?[]const T` (closes #343)
 * remove link_exe and link_lib in favor of allowing build_exe and
   build_lib support no root zig source file
2017-04-26 19:17:05 -04:00
Andrew Kelley 09bc4d6ba3 build system: addAssembly and addObject functions
for building executables
2017-04-26 12:56:10 -04:00
Andrew Kelley afa80da857 revert the last 3 compile time improvements
they introduced complexity into the compiler and didn't
really help.

This reverts commit efa771af75.
This reverts commit 8614397110.
This reverts commit 13c6a58a61.
2017-04-25 17:14:22 -04:00
Andrew Kelley 13c6a58a61 compile time improvement - move bounds checking to function calls
once again this barely had an effect:

Before:

./build size: 1.3 MB
hello.zig size: 301 KB
full test: 1m31.253s
debug test: 19.607s
hello.zig timing:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0002
   Semantic Analysis      0.0000      0.0431      0.0431      0.2262
     Code Generation      0.0431      0.0660      0.0229      0.1201
    LLVM Emit Object      0.0660      0.1765      0.1105      0.5795
  Build Dependencies      0.1765      0.1890      0.0125      0.0655
           LLVM Link      0.1890      0.1906      0.0016      0.0086
         Generate .h      0.1906      0.1906      0.0000      0.0000
               Total      0.0000      0.1906      0.1906      1.0000

After:

./build size: 1.3 MB
hello.zig size: 300 KB
full test: 1m31.882s
debug test: 19.569s
hello.zig timing:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0002
   Semantic Analysis      0.0000      0.0425      0.0424      0.2228
     Code Generation      0.0425      0.0661      0.0236      0.1239
    LLVM Emit Object      0.0661      0.1762      0.1101      0.5782
  Build Dependencies      0.1762      0.1888      0.0126      0.0664
           LLVM Link      0.1888      0.1905      0.0016      0.0085
         Generate .h      0.1905      0.1905      0.0000      0.0000
               Total      0.0000      0.1905      0.1905      1.0000
2017-04-25 16:53:22 -04:00
Andrew Kelley 8614397110 compile time improvement - move overflow math safety to fns
move some boilerplate code having to do with overflow math safety
to functions.

Again the timing difference is not much:

Before:

./build size: 1.3 MB
hello.zig size: 308 KB
full test:  1m33.588s
debug test: 20.303s
hello.zig timing:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0002
   Semantic Analysis      0.0000      0.0425      0.0425      0.2202
     Code Generation      0.0425      0.0675      0.0250      0.1293
    LLVM Emit Object      0.0675      0.1789      0.1114      0.5773
  Build Dependencies      0.1789      0.1913      0.0124      0.0640
           LLVM Link      0.1913      0.1931      0.0018      0.0091
         Generate .h      0.1931      0.1931      0.0000      0.0000
               Total      0.0000      0.1931      0.1931      1.0000

After:

./build size: 1.3 MB
hello.zig size: 301 KB
full test: 1m31.253s
debug test: 19.607s
hello.zig timing:
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0002
   Semantic Analysis      0.0000      0.0431      0.0431      0.2262
     Code Generation      0.0431      0.0660      0.0229      0.1201
    LLVM Emit Object      0.0660      0.1765      0.1105      0.5795
  Build Dependencies      0.1765      0.1890      0.0125      0.0655
           LLVM Link      0.1890      0.1906      0.0016      0.0086
         Generate .h      0.1906      0.1906      0.0000      0.0000
               Total      0.0000      0.1906      0.1906      1.0000
2017-04-25 15:37:56 -04:00
Andrew Kelley efa771af75 compile time improvement - add __zig_panic_slice fn
move some boilerplate code having to do with panicking
to a function.

Here's the timing difference. It's not much:

Before:

full test:  1m36.511s
debug test: 20.862s
hello.zig
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0001
   Semantic Analysis      0.0000      0.0421      0.0420      0.2109
     Code Generation      0.0421      0.0620      0.0200      0.1003
    LLVM Emit Object      0.0620      0.1852      0.1231      0.6180
  Build Dependencies      0.1852      0.1974      0.0122      0.0615
           LLVM Link      0.1974      0.1993      0.0018      0.0093
         Generate .h      0.1993      0.1993      0.0000      0.0000
               Total      0.0000      0.1993      0.1993      1.0000

After:

full test:  1m33.588s
debug test: 20.303s
hello.zig
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0002
   Semantic Analysis      0.0000      0.0425      0.0425      0.2202
     Code Generation      0.0425      0.0675      0.0250      0.1293
    LLVM Emit Object      0.0675      0.1789      0.1114      0.5773
  Build Dependencies      0.1789      0.1913      0.0124      0.0640
           LLVM Link      0.1913      0.1931      0.0018      0.0091
         Generate .h      0.1931      0.1931      0.0000      0.0000
               Total      0.0000      0.1931      0.1931      1.0000
2017-04-25 14:20:15 -04:00
Andrew Kelley e0050af293 add some timing diagnostics
pass --enable-timing-info to print a nice table like this:

```
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0001
   Semantic Analysis      0.0000      0.0421      0.0420      0.2109
     Code Generation      0.0421      0.0620      0.0200      0.1003
    LLVM Emit Object      0.0620      0.1852      0.1231      0.6180
  Build Dependencies      0.1852      0.1974      0.0122      0.0615
           LLVM Link      0.1974      0.1993      0.0018      0.0093
         Generate .h      0.1993      0.1993      0.0000      0.0000
               Total      0.0000      0.1993      0.1993      1.0000
```
2017-04-25 12:29:25 -04:00
Andrew Kelley 4cc2ea1421 update travis badge to new url 2017-04-25 01:26:37 -04:00
Andrew Kelley a5c509c94f readme update 2017-04-24 17:53:00 -04:00
Andrew Kelley 05198e0321 readme update 2017-04-24 17:04:52 -04:00
Andrew Kelley d72fb2abad update README 2017-04-24 16:17:28 -04:00
Andrew Kelley 6cd725c24b stack traces support compile units with no pc range 2017-04-24 13:03:32 -04:00
Andrew Kelley 245eed8afe better stack traces for ELF x86_64 2017-04-24 12:14:45 -04:00
Josh Wolfe 08a871f625 defer requires expr to be void. closes #341 2017-04-23 22:33:06 -07:00
Josh Wolfe ac7971122d fix check-statement-is-void. add tests
see #291
2017-04-23 21:50:34 -07:00
Josh Wolfe c6605cba83 blocks check that their statements are void
closes #291

This changes the error message "return value ignored" to "expression value is ignored".
This is because this error also applies to {1;}, which has no function calls.

Also fix ignored expression values in std and test.
This caught a bug in debug.readAllocBytes where an early Eof error would have been missed.
See #219.
2017-04-23 21:15:15 -07:00
Andrew Kelley 6de33ded81 make undefined as a constant value lazy
closes #268
2017-04-23 14:34:40 -04:00
Josh Wolfe 2ed47070ef refactor ir_gen_block to make different return paths more clear 2017-04-23 09:04:15 -07:00
Josh Wolfe 14dfbd6ad3 remove redundant unreachable code error 2017-04-23 08:36:21 -07:00
Josh Wolfe 8299fe19c0 add test_artifacts to .gitignore, so you can commit while tests are running 2017-04-23 08:36:21 -07:00
Andrew Kelley f9fa768dca zig build system: installFile and installClibrary
See #332
2017-04-23 11:09:26 -04:00
Andrew Kelley 0f633167c5 fix crash when unwrapping error with no error decls
closes #339
2017-04-23 03:14:22 -04:00
Andrew Kelley ad9040443c new compile errors for setGlobalAlign and setGlobalSection builtins
if you try to use them on an external variable or function
then you get a compile error, since the alignment/section
is set externally in this case.

closes #244
2017-04-22 12:54:00 -04:00
Andrew Kelley aafb0b9082 slicing now returns correct const-ness
also remove the ability to override constness when slicing

closes #334
2017-04-22 12:19:20 -04:00
Andrew Kelley 1a0081b763 add peer type resolution for T and ?T
See #334
2017-04-22 11:45:04 -04:00
Andrew Kelley e0b635e825 std.os.ChildProcess: fix closing wrong file descriptors 2017-04-22 11:36:42 -04:00
Andrew Kelley 0cce115476 update syntax for try and nullable unwrapping
closes #285
2017-04-21 16:46:33 -04:00
Andrew Kelley d5346d7a80 remove `?return` and `?defer`
closes #309
2017-04-21 15:08:03 -04:00
Andrew Kelley bee1ae68ef std: fix PATH resolution when spawning child 2017-04-21 13:27:11 -04:00
Andrew Kelley 3a137c6ff0 add Travis CI integration 2017-04-21 13:27:11 -04:00
Andrew Kelley e3c524c1d4 rename `@ptrcast` to `@ptrCast` to follow convention 2017-04-21 10:39:13 -04:00
Andrew Kelley ecb71d1dd3 add example which exercises addObject in the zig build system
closes #329
2017-04-21 02:26:48 -04:00
Andrew Kelley fb492d19eb zig build system supports building a library
See #329

Supporting work:
 * move std.cstr.Buffer0 to std.buffer.Buffer
 * add build.zig to example/shared_library/ and add an automated test
   for it
 * add std.list.List.resizeDown
 * improve std.os.makePath
   - no longer recursive
   - takes into account . and ..
 * add std.os.path.isAbsolute
 * add std.os.path.resolve
 * reimplement std.os.path.dirname
   - no longer requires an allocator
   - handles edge cases correctly
2017-04-21 01:56:12 -04:00
Andrew Kelley 599215cee4 add compile error tests for offsetOf builtin 2017-04-20 10:57:41 -04:00
Andrew Kelley 68f75a3130 Merge pull request #338 from raulgrell/master
Add `@offsetOf` builtin function
2017-04-20 10:45:23 -04:00
Raul Leal 5234016561 Add @offsetOf builtin function 2017-04-20 11:53:00 +00:00