Commit Graph

165 Commits (3919afcad26d2359efe52f98cd4f2f0573527369)

Author SHA1 Message Date
Andrew Kelley 44d8d654a0 fix test failure, organize code, add new compile error 2018-02-05 09:26:39 -05:00
Ben Noordhuis 73ee434c8c Use /dev/urandom and sysctl(RANDOM_UUID) on Linux.
Add fallback paths for when the getrandom(2) system call is not
available.  Try /dev/urandom first and sysctl(RANDOM_UUID) second.

The sysctl issues a warning in the system logs with some kernels but
that seems like an acceptable tradeoff for the fallback of a fallback.
2018-02-04 18:58:36 +01:00
David McFarland 4ec856b0f0 make lld include paths private
This fixes a build failure on cygwin caused by <string.h> -> <strings.h> taking
the latter from one of the lld paths.
2018-02-02 10:49:31 -04:00
Marc Tiehuis 7a3fd89d25 Add Sha3 hashing functions
These are on the slower side and could be improved. No performance optimizations
yet have been done.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```

-- Sha3-256

```
Zig --release-fast
    93 Mb/s
Zig --release-safe
    99 Mb/s
Zig
    4 Mb/s
```

-- Sha3-512

```
Zig --release-fast
    49 Mb/s
Zig --release-safe
    54 Mb/s
Zig
    2 Mb/s
```

Interestingly, release-safe is producing slightly better code than
release-fast.
2018-01-17 21:19:45 +13:00
Marc Tiehuis fa7b33549e Change crypto functions to fill a buffer
- Rename blake2x -> blake2
 - Fix blake2s truncated tests
2018-01-17 00:17:48 +13:00
Marc Tiehuis 4cf86b4a94 Add Blake2X hash functions
The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
2018-01-15 23:14:13 +13:00
Marc Tiehuis 2659ac01be Add Sha2 functions
We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly.

```
Gcc -O2
    219 Mb/s
Clang -O2
    213 Mb/s
Zig --release-fast
    284 Mb/s
Zig --release-safe
    211 Mb/s
Zig
    6 Mb/s
```

```
Gcc -O2
    350 Mb/s
Clang -O2
    354 Mb/s
Zig --release-fast
    426 Mb/s
Zig --release-safe
    300 Mb/s
Zig
    11 Mb/s
```
2018-01-13 22:37:47 +13:00
Marc Tiehuis 51fdbf7f8c Add Md5 and Sha1 hash functions
Some performance comparisons to C.

We take the fastest time measurement taken across multiple runs.

The block hashing functions use the same md5/sha1 methods.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly:

```
gcc -O2
    661 Mb/s
clang -O2
    490 Mb/s
zig --release-fast and zig --release-safe
    570 Mb/s
zig
    50 Mb/s
```

See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly:

```
gcc -O2
    588 Mb/s
clang -O2
    563 Mb/s
zig --release-fast and zig --release-safe
    610 Mb/s
zig
    21 Mb/s
```

In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
2018-01-13 14:40:21 +13:00
Marc Tiehuis 24cd99160c Add hw sqrt for x86_64 2018-01-10 19:53:36 +13:00
Andrea Orru 3182857224 Adding zen support 2018-01-07 04:43:08 -05:00
Andrew Kelley 1b120d1e49 update windows build to llvm 5.0.1
llvm-config.exe does not handle diaguids.lib for us so we have to
duplicate the work.
2018-01-04 22:46:26 -05:00
Andrew Kelley 5a800db48c build: std files and c header files are only specified once
In the CMakeLists.txt file. And then we communicate the list
to the zig build.
2018-01-03 19:39:04 -05:00
Josh Wolfe 192a039173 move utf8 parsing to std
source files no longer need to end with a newline
2017-12-26 23:17:33 -07:00
Josh Wolfe 08dd1b553b set compile flags for zip_cpp 2017-12-26 18:05:43 -07:00
Andrew Kelley 6fece14cfb self-hosted: build against zig_llvm and embedded LLD
Now the self-hosted compiler re-uses the same C++ code for interfacing
with LLVM as the C++ code.
It also links against the same LLD library files.
2017-12-26 19:44:08 -05:00
Andrew Kelley 4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley cf96b6f87b update to LLVM 5.0.1rc2 2017-12-01 13:44:28 -05:00
Andrew Kelley 5a25505668 rename "parsec" to "translate-c" 2017-11-24 14:56:05 -05: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 78cb4ce030 Release 0.1.1 2017-10-17 08:50:00 -04:00
Andrew Kelley 79193ffed2 build: fix logic for version when there is a git tag 2017-10-17 08:47:27 -04:00
Andrew Kelley ad07c68504 Release 0.1.0 2017-10-17 08:42:52 -04:00
Andrew Kelley 1d88f9b9a6 appveyor: build with msvc and publish artifacts
See #540
2017-10-16 12:22:13 -04:00
Andrew Kelley d08c57741a ability to make a DLL
See #302
2017-10-16 01:14:28 -04:00
Andrew Kelley f87f98015c 16MB stack size when building with msvc
fixes crash when evaluating user code that hits the branch limit

See #302
2017-10-15 19:04:19 -04:00
Andrew Kelley 0307dc0b77 organize windows utility functions 2017-10-14 16:59:43 -04:00
Andrew Kelley 1563574740 add git rev name to version string when available 2017-10-01 18:34:22 -04:00
Andrew Kelley 1962c8588f implement standard library path search
closes #463
See #302
2017-10-01 18:30:31 -04:00
Andrew Kelley 9636603a3b fix build when no cmake path args specified
broken by 0227becb56
2017-10-01 16:10:35 -04:00
Andrew Kelley 0227becb56 build: escape backslashes in path arguments given to cmake 2017-10-01 14:01:18 -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 cd58b40011 update C headers to clang 5.0.0 2017-09-30 18:20:55 -04:00
Andrew Kelley 845f22101b zig test on 64-bit windows runs 32-bit tests 2017-09-30 14:40:16 -04:00
Andrew Kelley 5c4504e005 disable /W4 on MSVC 2017-09-30 14:00:27 -04:00
Andrew Kelley 9c6e12ac29 compiler-rt: add _aulldiv and _aullrem for i386 windows 2017-09-30 13:58:05 -04:00
Andrew Kelley cba4a9ad4a update std.os.ChildProcess API
* add std.os.ChildProcess.setUserName
 * add std.os.getUserId
2017-09-26 01:01:49 -04:00
Andrew Kelley 41b588547c improvements to windows support
See #302
2017-09-23 18:46:03 -04:00
Andrew Kelley 14cda27b64 depend on embedded SoftFloat-3d instead of __float128
See #302
See #467
2017-09-14 01:46:47 -04:00
Andrew Kelley 57ea6e8c9f fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
Jonathan Marler 67021e2bff Modified cmake to use LLVM imported packages. 2017-09-11 18:27:41 -06:00
Jonathan Marler 7c81cd30de Add support for MSVC 2017-09-11 09:26:26 -06:00
Andrew Kelley 2c9bdad346 rename parseh to parsec 2017-09-05 22:55:03 -04:00
Andrew Kelley d302ddab08 build: fix embedded LLD build 2017-08-28 03:34:50 -04:00
Andrew Kelley 6c7e975b75 remove remnants of depending on darwin system linker 2017-08-28 03:31:57 -04:00
Andrew Kelley e6b7b8a070 build: use embedded LLD by default 2017-08-28 03:12:23 -04:00
Andrew Kelley ff2c794612 all behavior tests passing for macos
See #273
2017-08-27 05:15:24 -04:00
Andrew Kelley 29a418c9d5 progress toward tests passing on MacOS 2017-08-27 00:11:09 -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 b73d4f74c2 depend on libquadmath
it seems to be shipped with gcc and clang
2017-08-18 13:13:03 -04:00