Commit Graph

84 Commits (990db3c35a798a6e51dbbbc1696f3fe78c7a0faf)

Author SHA1 Message Date
Andrew Kelley 62c25af802 add higher level arg-parsing API + misc. changes
* add @noInlineCall - see #640
   This fixes a crash in --release-safe and --release-fast modes
   where the optimizer inlines everything into _start and
   clobbers the command line argument data.
   If we were able to verify that the user's code never reads
   command line args, we could leave off this "no inline"
   attribute.
 * add i29 and u29 primitive types. u29 is the type of alignment,
   so it makes sense to be a primitive.
   probably in the future we'll make any `i` or `u` followed by
   digits into a primitive.
 * add `aligned` functions to Allocator interface
 * add `os.argsAlloc` and `os.argsFree` so that you can get
   a `[]const []u8`, do whatever arg parsing you want, and then free
   it. For now this uses the other API under the hood, but it could
   be reimplemented to do a single allocation.
 * add tests to make sure command line argument parsing works.
2017-12-06 18:12:05 -05:00
Andrew Kelley a966275e50 rename builtin.is_big_endian to builtin.endian
See #307
2017-12-04 10:36:31 -05:00
Andrew Kelley 4543413491 std.io: introduce buffered I/O and change API
I started working on #465 and made some corresponding std.io
API changes.

New structs:
 * std.io.FileInStream
 * std.io.FileOutStream
 * std.io.BufferedOutStream
 * std.io.BufferedInStream

Removed:
 * std.io.File.in_stream
 * std.io.File.out_stream

Now instead of &file.out_stream or &file.in_stream to get access to
the stream API for a file, you get it like this:

var file_in_stream = io.FileInStream.init(&file);
const in_stream = &file_in_stream.stream;

var file_out_stream = io.FileOutStream.init(&file);
const out_stream = &file_out_stream.stream;

This is evidence that we might not need any OOP features -
See #130.
2017-11-07 03:22:27 -05:00
Andrew Kelley f7837f445e bump build_runner allocator to use 30 MB 2017-11-01 16:46:10 -04:00
Andrew Kelley 9e234d4208 breaking change to std.io API
* Merge io.InStream and io.OutStream into io.File
 * Introduce io.OutStream and io.InStream interfaces
   - io.File implements both of these
 * Move mem.IncrementingAllocator to heap.IncrementingAllocator

Instead of:

```
%return std.io.stderr.printf("hello\n");
```

now do:

```
std.debug.warn("hello\n");
```

To print to stdout, see `io.getStdOut()`.

 * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-31 04:47:55 -04:00
Andrew Kelley 5f28a9d238 cleaner verbose flags and zig build prints failed command 2017-10-25 23:10:41 -04:00
Andrew Kelley 1828f8eb8e fix missing compiler_rt in release modes
the optimizer was deleting compiler_rt symbols, so I changed
the linkage type from LinkOnce to Weak

also changed LinkOnce to mean linkonce_odr in llvm and
Weak to mean weak_odr in llvm.

See #563
2017-10-24 21:31:47 -04:00
Andrew Kelley d08c57741a ability to make a DLL
See #302
2017-10-16 01:14:28 -04:00
Andrew Kelley 8ab5313043 implement environment variables for windows 2017-10-15 01:23:10 -04:00
Andrew Kelley b61a6ec8a6 implement command line argument parsing for windows
See #302
2017-10-11 22:50:16 -04:00
Andrew Kelley f86684f410 fix duplicated symbols in compiler-rt tests 2017-10-03 01:26:07 -04:00
Andrew Kelley 6a0c428997 use __chkstk_ms compiler-rt functions for __chkstk
I had to revert the target native features thing because there
is still some incorrect behavior with f128.

Reopens #508
partially reverts b505462509

See #302
2017-10-03 00:57:02 -04:00
Andrew Kelley b505462509 replace __chkstk function with a stub that does not crash
Closes #508
See #302
2017-10-03 00:29:41 -04:00
Andrew Kelley f1bd02e6f4 add @setAlignStack builtin 2017-10-03 00:29:27 -04:00
Andrew Kelley b3f3db46be compiler-rt: strong linkage for __chkstk
otherwise we get undefined symbol errors
2017-10-02 00:22:24 -04:00
Andrew Kelley 25ea8f7dbb fix typo in compiler-rt 2017-10-02 00:13:56 -04:00
Andrew Kelley 5cbae7b671 better compiler-rt linkage logic
now the compiler-rt tests are passing on windows. See #302
2017-10-02 00:11:45 -04:00
Andrew Kelley e3ea0b652c still build compiler-rt when linking msvc CRT
because it's missing some things
2017-10-01 21:19:58 -04:00
Andrew Kelley 6ae631d1a7 add windows 32 bit to test matrix
See #302
2017-10-01 11:11:38 -04:00
Andrew Kelley c6295fe9ab remove zigrt
adds test case for #394

partially reverts a32b5929cc
2017-09-30 20:21:57 -04:00
Andrew Kelley 9c6e12ac29 compiler-rt: add _aulldiv and _aullrem for i386 windows 2017-09-30 13:58:05 -04:00
Andrew Kelley b7a4f16cc4 fix previous commit 2017-09-30 13:40:55 -04:00
Andrew Kelley 53aa72b58a add ___chkstk_ms compiler-rt function 2017-09-30 13:39:37 -04:00
Andrew Kelley 766547dbfe bump incrementing allocator memory in build system to 20MB
See #467
2017-09-14 20:28:38 -04:00
Andrew Kelley 9f7e62b95b std: add ChildProcess.kill 2017-09-06 18:30:45 -04:00
Andrew Kelley 1f2548ec5f better build.zig template 2017-09-06 14:18:14 -04:00
Andrew Kelley 06b64d82bf only export __chkstk for windows
it's a windows only function anyway
2017-08-31 20:10:24 -04:00
Andrew Kelley eb0979189b add windows to test targets
cross-compiling hello world with no libc for windows is working
2017-08-31 11:41:58 -04:00
Andrew Kelley 156a84e80f compiler-rt: add __aeabi_uldivmod 2017-08-31 01:39:20 -04:00
Andrew Kelley 052b4ae941 align syntax: align(4) instead of align 4
closes #37
2017-08-30 04:54:33 -04:00
Andrew Kelley 3f5dd08ca8 codegen: all stores specify align value
See #37
2017-08-30 04:23:52 -04:00
Andrew Kelley 816689a3b1 ptrCast gives compile error for increasing alignment
See #37
2017-08-29 16:52:31 -04:00
Andrew Kelley 5fd579a51c macos passing all tests except for building a shared library
see #273
2017-08-27 05:44:03 -04:00
Andrew Kelley ff2c794612 all behavior tests passing for macos
See #273
2017-08-27 05:15:24 -04:00
Andrew Kelley 91536813ec macos updates
* try some macos travis stuff
 * put c in the link libs for macos since we always link with libSystem
 * for non-native targets on macos, allow runtime symbol resolution
   - it's causing an infinite loop in LLD.
 * for macos, always build compiler_rt and turn on LinkOnce because
   compiler_rt on darwin is missing some stuff.
2017-08-27 02:51:25 -04:00
Andrew Kelley 629aa10c56 unreachable still codegens to unreachable in ReleaseFast test mode
closes #430
2017-08-25 10:20:06 -04:00
Andrew Kelley 987768778a bit shifting safety
* add u3, u4, u5, u6, u7 and i3, i4, i5, i6, i7
 * shift operations shift amount parameter type is
   integer with log2 bit width of other param
   - This enforces not violating undefined behavior on
     shift amount >= bit width with the type system
 * clean up math.log, math.ln, math.log2, math.log10

closes #403
2017-08-19 01:43:43 -04:00
Andrew Kelley 33c592e981 make udivmod generic and add tests 2017-08-18 17:20:03 -04:00
Andrew Kelley 51bde26842 add compiler-rt fns: udivmodti4, udivti3, umodti3 2017-08-18 16:26:09 -04:00
Andrew Kelley ea9e1639ca include compiler-rt tests in main testing suite 2017-08-18 13:51:16 -04:00
Andrew Kelley 1b5d61bee9 fix bitCast for big integers
and make bigfloat use __float128
2017-08-17 22:52:12 -04:00
Andrew Kelley 2173e1f457 fix big integer shifting by large number 2017-08-17 22:01:19 -04:00
Andrew Kelley e63d864c1e add compiler_rt functions for f128
* __letf2
 * __cmptf2
 * __getf2
 * __unordtf2
 * __eqtf2
 * __lttf2
 * __netf2
 * __gttf2
2017-08-17 19:10:15 -04:00
Andrew Kelley 0d117bb0a9 fix wrong value for clz, ctz at compile time
closes #418

also make clz, ctz return smaller integer bit widths
and use smaller integer bit widths for enum tag types
2017-08-17 17:14:35 -04:00
Andrew Kelley 6a98bf3dba compiler_rt implementations for __fixuns* functions
* add u128 and i128 integer types
 * add f128 floating point type
 * implement big integer multiplication (See #405)
2017-08-16 19:07:35 -04:00
Andrew Kelley cf46cd5f2b organize file path of compiler_rt 2017-08-15 07:16:22 -04:00
Andrew Kelley 35d3444e27 more intuitive left shift and right shift operators
Before:
 * << is left shift, not allowed to shift 1 bits out
 * <<% is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out

After:
 * << is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out
 * @shlExact is left shift, not allowed to shift 1 bits out
 * @shrExact is right shift, not allowed to shift 1 bits out

Closes #413
2017-08-09 10:09:38 -04:00
Andrew Kelley 62323eeb75 std: refactor pow to be generic 2017-06-17 20:39:45 -04:00
Andrew Kelley 6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley 199bbb6292 progress toward hello world without libc in windows 2017-06-04 10:08:55 -04:00