Commit Graph

4673 Commits

Author SHA1 Message Date
Marc Tiehuis
b3ecdfd7bf Fix big.Int toString maybe-null allocator 2019-04-11 19:36:35 +12:00
Marc Tiehuis
5f4fcd5030 Add initial big.Rational type 2019-04-11 19:36:35 +12:00
Marc Tiehuis
ea1d2a2409 Add read-only, non-allocating Int for internal constants
A constant Int is one which has a value of null for its allocator field.
It cannot be resized or have its limbs written. Any attempt made to
write to it will be caught with a runtime panic.
2019-04-11 19:36:35 +12:00
Andrew Kelley
e309ad884a
fix outdated/incorrect docs for @truncate
closes #2234
2019-04-10 23:00:53 -04:00
Andrew Kelley
a4c7e4c4eb __muloti4 does not need the ABI workaround on Windows
Fixes 128-bit integer multiplication on Windows.

closes #2250
2019-04-10 22:33:33 -04:00
Shritesh Bhattarai
13798d26c7 pass exec_path to zig run 2019-04-10 20:07:35 -04:00
Shritesh Bhattarai
666e879925 Build compiler_rt for WASM exe 2019-04-10 19:14:19 -04:00
Andrew Kelley
a71bfc249d compiler-rt: better way to do the ABI required on Windows
This removes the compiler_rt.setXmm0 hack. Instead, for
the functions that use i128 or u128 in their parameter and
return types, we use `@Vector(2, u64)` which generates
the LLVM IR `<2 x i64>` type that matches what Clang
generates for `typedef int ti_int __attribute__ ((mode (TI)))`
when targeting Windows x86_64.
2019-04-10 18:47:14 -04:00
Andrew Kelley
52934851f2
compiler_rt: @divTrunc rather than @divFloor in muloti4 2019-04-10 16:29:10 -04:00
vegecode
aff2e47821 compiler-rt: correct use_thumb_1 flag
The flag is for generating correct arm-thumb interwork veneers in the
assembly code __aeabi_{memcpy,memset,etc} functions.

Armv6m only does thumb code generation regardless of whether arm or
thumb is selected and armv6t2 uses the newer thumb 2 set. All other
versions that zig supports pre-armv7 need the veneers and hence the
flag. Armv5 is actually armv5t.

Relevant code from clang/lib/Basic/Targets/Arm.cpp

```c
bool ARMTargetInfo::isThumb() const {
  return ArchISA == llvm::ARM::ISAKind::THUMB;
  }

bool ARMTargetInfo::supportsThumb() const {
  return CPUAttr.count('T') || ArchVersion >= 6;
}

bool ARMTargetInfo::supportsThumb2() const {
  return CPUAttr.equals("6T2") ||
    (ArchVersion >= 7 && !CPUAttr.equals("8M_BASE"));
}
```

Also see

http://www.llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td
2019-04-10 12:35:16 -04:00
Andrew Kelley
dea1027f97
doc comments for parameters in std.mem.Allocator 2019-04-09 17:43:49 -04:00
Jay Weisskopf
cca02a4cf8 Update README headline to match website 2019-04-09 00:31:39 -04:00
Jay Weisskopf
98fa065de7 docs: Underline link when hovering over it
In addition to the pointer, this gives some visual feedback to the user
that the element is interactive. This is a very common style pattern
across the web.
2019-04-09 00:31:25 -04:00
Andrew Kelley
bddbbef32b
Release 0.4.0 2019-04-08 15:41:41 -04:00
Jimmi Holst Christensen
43e219b0d9 Merge branch 'master' of github.com:ziglang/zig 2019-04-08 05:30:32 +02:00
Jimmi Holst Christensen
f86ea797ba Import 1607.zig to behavior.zig 2019-04-08 05:30:27 +02:00
Ryan Liptak
6a78b315b2 Fix std.HashMap.remove returning incorrect KV
Now returns a copy of the removed kv instead of a pointer to the removed kv. The removed kv gets overwritten when shifting the hash map after the removal, so returning a pointer to it will have another kv's values in it after the return.

This bug had some nasty downstream effects in things like BufSet and BufMap where delete would free a still in-use KV and leave the actually removed KV un-free'd.
2019-04-07 15:47:09 -04:00
Andrew Kelley
6715c54cc6
Merge pull request #2205 from kristate/zig-backport-issue532
stage1: create ir.cpp specific `analyze_type_expr`
2019-04-07 15:32:02 -04:00
kristopher tate
fae0c35195
test/compile_errors.zig: add regression test for ziglang/zig#532 ; 2019-04-07 10:37:43 +09:00
kristopher tate
627b52fe65
src/ir.cpp: don't call-out to analyze_type_expr;
replaces `analyze_type_expr` with `ir_analyze_type_expr`
2019-04-07 10:37:43 +09:00
Jimmi Holst Christensen
7c38651a65 Merge branch 'master' of github.com:ziglang/zig 2019-04-07 03:19:08 +02:00
Jimmi Holst Christensen
6960cd156a Added regression test for #1607. fixes #1607 2019-04-07 03:18:51 +02:00
Andrew Kelley
77c2036159
Merge pull request #2200 from ziglang/fix-1726
fixed #1726
2019-04-06 12:49:00 -04:00
Jimmi Holst Christensen
65cf5a8e44 removed todo comment and added test 2019-04-06 11:04:55 +02:00
Jimmi Holst Christensen
3109c89850 fixed 1726 2019-04-06 10:56:07 +02:00
Andrew Kelley
f00adb47f5
ir: avoid dependency on isnan
there's a simple way to check for nan that does not need this header.
hryx on IRC reported that Linux Mint based on ubuntu 16.04, kernel
4.15.0, x86_64 did not have the isnan function.
2019-04-06 01:03:30 -04:00
Andrew Kelley
974977f12f
docgen: add a space between the header and the section symbol 2019-04-05 23:12:25 -04:00
Andrew Kelley
83390bdfdd
fix dereferencing a zero bit type
Before only u0 was special cased in handling a dereference;
now all zero bit types are handled the same way. Dereferencing
a pointer to a zero bit type always gives a comptime-known
result.

This previously had been failing on master branch but went unnoticed
because until 846f72b57c the CI server was mistakenly not actually
running the single-threaded tests with --single-threaded.

This fixes the standard library tests with --single-threaded
--release-fast.
2019-04-05 20:18:26 -04:00
Shritesh Bhattarai
3854bb9198 wasm: Pass --allow-undefined and --export-all to the linker 2019-04-05 18:46:11 -04:00
Shritesh Bhattarai
66fab05eba build: usageAndErr clean exit (#2194)
* build: usageAndErr clean exit
2019-04-05 18:38:11 -04:00
Shritesh Bhattarai
895e6eabc2 Fix getCurrentId test for pthreads (#2197)
* Fix getCurrentId test for pthreads
2019-04-05 18:12:46 -04:00
vegecode
d72239d339 Add divdf3 to compiler_rt
Also adds __aeabi_ddiv for arm32 targets
2019-04-05 18:10:19 -04:00
Andrew Kelley
1f9ebf49f8
ci: stop doing the branch redirect thing
Now that we have https://ziglang.org/download/index.json

See #1046
2019-04-05 17:33:58 -04:00
Andrew Kelley
f6be6ace1f
docgen: allow urls to have numbers 2019-04-05 17:33:58 -04:00
Andrew Kelley
fd65cdc55a
fix incorrect Thread.getCurrentId test
Documentation comments copied here:

On Linux, it is possible that the thread spawned with `spawnThread`
finishes executing entirely before the clone syscall completes. In this
case, `std.os.Thread.handle` will return 0 rather than the
no-longer-existing thread's pid.
2019-04-05 16:06:35 -04:00
Andrew Kelley
c47c2a2f2a stage1: fix debug builds on macOS 2019-04-05 15:39:00 -04:00
Andrew Kelley
846f72b57c
zig build: support single-threaded builds
and fix the zig test suite not setting the --single-threaded flag
2019-04-05 14:54:37 -04:00
Andrew Kelley
a5b47bc2c2
docs: update @typeInfo definition and clarify field order 2019-04-05 12:38:15 -04:00
Shritesh Bhattarai
2f236e6efb fmt: support trailing comma after var_args 2019-04-05 12:27:13 -04:00
Shritesh Bhattarai
6cc2d3938e support comptime_int in formatInt{,Value} 2019-04-05 11:11:04 -04:00
Jay Weisskopf
3cce56af99 docs: Use section symbol §, not paragraph symbol ¶
A header may cover more than one paragraph, so a section symbol is more appropriate. 

https://en.wikipedia.org/wiki/Section_sign
2019-04-05 11:09:38 -04:00
vegecode
c24a49a1a7 Fixes to divsf3 (#2186)
* Fixes to divsf3

Embarrassingly failed to notice a section that was unchanged from where
it was copied from mulXf3.zig. The test cases for this function series
div{s,d,t}f3 are very incomplete and don't exercise all code paths.

Remove unnecessary switch from divsf3 left during development from when
I tried to make it generic to support f32, f64, and f128 in one go.

Make runtime safety dependent on whether a test is being run.

* divsf3: switch plus to minus
2019-04-05 11:04:46 -04:00
Shawn Landden
aecbd1892a Simplify math.isnan
We can just rely on the builtin behavior.
2019-04-05 11:03:57 -04:00
Andrew Kelley
1dc6751721
fix NaN comparing equal to itself
This was broken both in comptime code and in runtime code.

closes #1174
2019-04-04 22:07:15 -04:00
Shritesh Bhattarai
8e6ff8d615 fmt: format multi line only on trailing comma (#2184)
* fmt: format multi line only on trailing comma
2019-04-04 19:33:32 -04:00
Andrew Kelley
5866dfe4d9
Merge pull request #2109 from emekoi/fix-mingw
fixed libc command on mingw
2019-04-04 15:55:40 -04:00
Andrew Kelley
be0f656c21
fix @divFloor returning incorrect value and add __modti3
Closes #2152
See #1290
2019-04-04 15:45:37 -04:00
vegecode
12c4ab3927 Add divsf3 to compiler rt 2019-04-04 15:38:09 -04:00
Andrew Kelley
7dd1e0fc2b
docs: add Variables section
closes #1927
2019-04-04 12:26:47 -04:00
Andrew Kelley
c195d645e4
add regression test for #1025
closes #1025
2019-04-04 01:45:18 -04:00