Commit Graph

2117 Commits

Author SHA1 Message Date
Andrew Kelley
4bdfc8a10a fix error return traces pointing to off-by-one source line
See #651
2018-01-17 00:22:53 -05:00
Josh Wolfe
24c2ff5cae Revert "Buffer.toSliceCopy"
This reverts commit c58f5a4742.
2018-01-16 13:45:34 -07:00
Josh Wolfe
c58f5a4742 Buffer.toSliceCopy 2018-01-16 13:28:53 -07:00
Andrew Kelley
ee9ab15679
Merge pull request #695 from Hejsil/tranlate-c-fixes
Tranlate c fixes - undefined variable initialization and non-bool if statements
2018-01-16 10:32:37 -05:00
Jimmi Holst Christensen
3974b7d31d translate_c can now translate if statements on integers and floats 2018-01-16 15:48:28 +01:00
Jimmi Holst Christensen
f59dcc5546 Fixed tests for undefined variables 2018-01-16 15:21:48 +01:00
Andrew Kelley
8b280d5b31
Merge pull request #689 from zig-lang/blake2
Add Blake2X hash functions
2018-01-16 09:13:09 -05:00
Jimmi Holst Christensen
821cbd7a1b Output "undefined" on uninitialized variables 2018-01-16 15:01:02 +01:00
Marc Tiehuis
73b4f09845 Add crypto internal test functions 2018-01-17 00:20:20 +13:00
Marc Tiehuis
66a24c9c00 Merge branch 'master' into blake2 2018-01-17 00:20:06 +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
Andrew Kelley
6a95b88d1b fix bigint remainder division
See #405
2018-01-16 03:09:44 -05:00
Andrew Kelley
84d8584c5b implement bigint div and rem
See #405
2018-01-16 02:22:19 -05:00
Andrew Kelley
92fc5947fc fix compiler crash related to @alignOf 2018-01-15 20:44:21 -05:00
Andrew Kelley
5a4968484b Merge branch 'wip-err-ret-trace' 2018-01-15 16:28:30 -05:00
Andrew Kelley
6ec9933fd8 fix getting debug info twice in default panic handler 2018-01-15 16:26:13 -05: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
Andrew Kelley
c9ac607bd3 add builtin.have_error_return_tracing 2018-01-15 00:14:14 -05:00
Andrew Kelley
7b57454cc1 clean up error return tracing
* error return tracing is disabled in release-fast mode
 * add @errorReturnTrace
 * zig build API changes build return type from `void` to `%void`
 * allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley
d973b40884 stack traces are a variable number of frames 2018-01-14 19:40:02 -05:00
Andrew Kelley
f0df2cdde9 error return traces use a zig-provided function to save binary size 2018-01-14 16:26:06 -05:00
Andrew Kelley
793f031c4c remove 32-bit windows from supported targets list
we still want to support it, but there are too many bugs
to claim that we support it right now.

See #537
2018-01-14 15:17:07 -05:00
Andrew Kelley
fa024f8092 error return trace pointer prefixes other params
instead of being last. This increases the chances that it can
remain in the same register between calls.
2018-01-14 14:35:43 -05:00
Andrew Kelley
971a6fc531 fix duplicate stack trace code 2018-01-14 10:19:21 -05:00
Andrew Kelley
e7e7625633
Merge pull request #687 from zig-lang/sha2
Add Sha2 functions
2018-01-13 21:38:29 -05:00
Marc Tiehuis
9be9f1ad20 Disable win32 tests for Sha2 + correct lengths 2018-01-14 09:58:30 +13:00
Marc Tiehuis
1f3ed5cf27 Change indexing variable types for crypto functions 2018-01-13 22:44:58 +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
Andrew Kelley
4551489b92 typecheck the panic function 2018-01-13 01:00:50 -05:00
Andrew Kelley
a2315cfbfc
Merge pull request #686 from zig-lang/md5-sha1
Add Md5 and Sha1 functions
2018-01-13 00:00:33 -05: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
304f6f1d01 Add integer rotation functions 2018-01-13 13:23:12 +13:00
Andrew Kelley
32ea6f54e5 *WIP* proof of concept error return traces 2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a functions which can return errors have secret stack trace param
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
3268276b58 the same string literal codegens to the same constant
this makes it so that you can send the same string literal
as a comptime slice and get the same type
2018-01-11 21:02:30 -05:00
Andrew Kelley
465e75bc5a
Merge pull request #682 from zig-lang/fix-endian
Fix endian swap parameters
2018-01-11 02:51:17 -05:00
Marc Tiehuis
899e36489d Fix endian swap parameters 2018-01-11 19:50:08 +13:00
Andrew Kelley
891c93c118
Merge pull request #681 from zig-lang/hw-math
Add hw sqrt for x86_64
2018-01-10 10:22:40 -05:00
Andrew Kelley
d4f791cf6c
Merge pull request #680 from zig-lang/intrusiveLinkedList
Intrusive linked lists
2018-01-10 10:13:15 -05:00
Marc Tiehuis
24cd99160c Add hw sqrt for x86_64 2018-01-10 19:53:36 +13:00
Andrea Orru
19343db593 Intrusive linked lists 2018-01-10 00:33:07 -05:00
Andrew Kelley
3c094116aa remove %% prefix operator
See #632
closes #545
closes #510

this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrea Orru
98a95cc698 exit, createThread for zen 2018-01-08 12:16:23 -05:00
Andrew Kelley
598170756c a catch unreachable generates unwrap-error code
See #545
See #510
See #632
2018-01-07 18:13:54 -05:00
Andrew Kelley
632d143bff replace a %% b with a catch b
See #632

better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley
66717db735 replace %return with try
See #632

better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrea Orru
de1f57926f Merge branch 'master' of github.com:zig-lang/zig 2018-01-07 04:43:15 -05:00
Andrea Orru
3182857224 Adding zen support 2018-01-07 04:43:08 -05:00
Andrew Kelley
32ba0dcea9 update hello world docs 2018-01-07 01:59:23 -05:00
Andrew Kelley
e7c04b6df2 add a test for returning a type that closes over a local const
closes #552
2018-01-07 00:50:43 -05:00