Andrew Kelley
85534a26c6
stage1: function to classify x86_64 abi types
2018-09-07 18:51:34 -04:00
raulgrell
09a1162af5
builtin functions: @byteOffsetOf and @bitOffsetOf
2018-09-07 22:49:19 +01:00
Andrew Kelley
b18af37c57
fix crash when var init has compile error
...
and then the var is referenced
closes #1483
2018-09-07 15:17:24 -04:00
Andrew Kelley
743b2e4afc
add C ABI test for big unions
2018-09-07 13:51:11 -04:00
Andrew Kelley
421ca1523f
stage1: refactor variable inits to use c abi fn walk
2018-09-07 13:24:41 -04:00
Andrew Kelley
c528c00900
stage1: refactor param vars for C ABI
2018-09-07 12:59:59 -04:00
Andrew Kelley
04d7b565f7
stage1: refactor fn type analysis to use C ABI walk fn
2018-09-07 12:23:50 -04:00
Andrew Kelley
be6cccb3a5
stage1: c abi for big struct works
2018-09-07 11:52:57 -04:00
Andrew Kelley
a9a925e500
add C ABI tests
2018-09-06 16:29:35 -04:00
Andrew Kelley
a375bd0d9f
stage1: compile error instead of incorrect code
...
for unimplemented C ABI
See #1411
See #1481
2018-09-06 11:58:58 -04:00
Andrew Kelley
b4d5d4d174
assume evenly divided base64
2018-09-05 23:39:14 -04:00
Andrew Kelley
97c9f61db4
start creating a hash of input parameters
...
See #1416
2018-09-05 23:24:40 -04:00
Andrew Kelley
2d4b95900e
stage1: import blake2b implementation
...
from master branch of blake2 reference implementation
320c325437539ae91091ce62efec1913cd8093c2
2018-09-05 23:23:11 -04:00
Andrew Kelley
6632d85e5f
stage1: improve handling of generic fn proto type expr
...
closes #902
2018-09-05 21:21:59 -04:00
Andrew Kelley
1d8b8ad687
add compile error for using outer scoped runtime variables
...
from a fn defined inside it. closes #876
2018-09-05 20:32:06 -04:00
Andrew Kelley
8400163e02
stage1: rename more TypeTableEntry types to ZigType
2018-09-05 18:42:56 -04:00
Andrew Kelley
1f5c7ff4d7
stage1: rename VariableTableEntry to ZigVar
2018-09-05 18:35:57 -04:00
Andrew Kelley
3500d32db5
stage1: rename FnTableEntry to ZigFn
2018-09-05 18:34:33 -04:00
Andrew Kelley
db882e5d63
stage1: rename TypeTableEntry to ZigType
2018-09-05 18:33:07 -04:00
Andrew Kelley
b517bea734
allow comptime_int to @floatToInt
2018-09-05 18:01:48 -04:00
hfcc
768d1fc539
Added compilation error when a non-float is given to @floatToInt()
2018-09-05 23:31:25 +02:00
Andrew Kelley
ffb3b1576b
stage1: fix tagged union with no payloads
...
closes #1478
2018-09-05 16:19:58 -04:00
Andrew Kelley
c87a576cb5
stage1 compile error instead of crashing for unsupported comptime ptr cast
...
See #955
2018-09-05 15:53:36 -04:00
Andrew Kelley
a76a72469b
stage1: fix crash when invalid type used in array type
...
closes #1186
2018-09-05 10:43:35 -04:00
Andrew Kelley
3e94650ef7
stage1: fix emit asm with explicit output file
...
closes #1473
2018-09-05 10:28:08 -04:00
Andrew Kelley
b35c74ea4c
stage1: use os_path_resolve instead of os_path_real
...
to canonicalize imports.
This means that softlinks can represent different files,
but referencing the same absolute path different ways
still references the same import.
2018-09-04 23:17:38 -04:00
Andrew Kelley
2bf1b6840d
port std.os.path.resolve to stage1
2018-09-04 22:45:20 -04:00
Andrew Kelley
869167fc6d
compile error for @noInlineCall on an inline fn
...
closes #1133
2018-09-04 17:38:48 -04:00
Andrew Kelley
cbb3f1d76c
ir: consistent error checking for br and cond_br instructions
2018-09-04 16:58:19 -04:00
Andrew Kelley
68db9d5074
add compile error for comptime control flow inside runtime block
...
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley
f27d82fe90
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-04 12:51:50 -04:00
Andrew Kelley
36828a2e6a
fix incorrect variable ref count
...
regression introduced by e82cd53df4
2018-09-04 12:50:02 -04:00
Andrew Kelley
ff4591f0e6
fix llvm assertion when adding callsite sret attr
2018-09-04 12:15:15 -04:00
Andrew Kelley
dbde8254d0
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-04 11:58:31 -04:00
Andrew Kelley
bc88ef2dc3
compile errors for unimplemented minValue/maxValue builtins
2018-09-03 22:47:23 -04:00
Andrew Kelley
e82cd53df4
fix incorrect value for inline loop
...
09cc1dc660
failed to handle mem_slot_index correctly
closes #1436
2018-09-03 21:24:20 -04:00
Andrew Kelley
a11e73bee2
compile error instead of segfault for unimplemented feature
...
closes #1103
2018-09-03 12:38:24 -04:00
Andrew Kelley
2a9329c998
better anonymous struct naming
...
this makes anonymous structs inherit the name of the function they are in
only when they are the return expression.
also document the behavior and provide examples.
closes #1243
2018-09-03 11:32:39 -04:00
Andrew Kelley
95636c7e5f
ability to @ptrCast to *void
...
fixes #960
2018-09-03 00:04:12 -04:00
Andrew Kelley
d5968086fe
use the sret attribute at the callsite when appropriate
...
Thanks to Shawn Landden for the original pull request.
closes #1450
2018-09-02 21:08:59 -04:00
kristopher tate
9e6f53dd58
i#1438: src/windows_sdk.cpp: fix version guard in find_81_version
;
2018-09-01 12:02:21 +09:00
kristopher tate
d4474e195e
i#1438: src/windows_sdk.cpp: fix version guard in find_10_version
;
2018-09-01 12:02:04 +09:00
Jimmi Holst Christensen
e036f65ac0
Translate-c: Check for error before working on while loop body ( #1445 )
2018-08-31 23:17:17 +02:00
Andrew Kelley
901b5c1566
add compile error for function prototype with no body
...
closes #1231
2018-08-28 15:39:32 -04:00
Andrew Kelley
09cc1dc660
fix crash when var in inline loop has different types
...
closes #917
closes #845
closes #741
closes #740
2018-08-28 15:24:28 -04:00
Andrew Kelley
45d9d9f953
minor fixups
2018-08-27 18:31:28 -04:00
raulgrell
e2a9f2ef98
Allow implicit cast from *T and [*]T to ?*c_void
2018-08-27 23:13:57 +01:00
Andrew Kelley
009e90f446
fix @typeInfo unable to distinguish compile error vs no-payload
...
closes #1421
closes #1426
2018-08-27 17:13:34 -04:00
Andrew Kelley
2f2215c9f4
this was intended to be included in the previous commit
2018-08-27 16:26:36 -04:00
Andrew Kelley
526d8425ab
fix false negative determining if function is generic
...
This solves the smaller test case of #1421 but the
other test case is still an assertion failure.
2018-08-27 16:14:48 -04:00
Andrew Kelley
68e2794e15
ir: const_ptr_pointee asserts that its return value is non-null
2018-08-26 13:13:26 -04:00
Andrew Kelley
6a3fad1d59
Revert "src/ir.cpp: check return value of const_ptr_pointee
to protect against dereferencing null pointers;"
...
This reverts commit 0839ed1f94
.
I realized too late there is a better fix. See PR #1419
2018-08-26 13:04:58 -04:00
kristopher tate
0839ed1f94
src/ir.cpp: check return value of const_ptr_pointee
to protect against dereferencing null pointers;
2018-08-26 13:02:09 -04:00
Andrew Kelley
f7f11e237c
Merge remote-tracking branch 'origin/master' into llvm7
2018-08-26 02:39:26 -04:00
Andrew Kelley
8047f0eae2
fix llvm assertion failure when building std lib tests for macos
...
closes #1417
2018-08-26 02:36:18 -04:00
Andrew Kelley
7109035b78
Merge remote-tracking branch 'origin/master' into llvm7
2018-08-25 21:57:28 -04:00
Andrew Kelley
815950996d
Merge remote-tracking branch 'origin/master' into macos-stack-traces
2018-08-25 04:48:58 -04:00
Andrew Kelley
02f5a9fa62
fix handling multiple extern vars with the same name
2018-08-25 03:55:59 -04:00
Andrew Kelley
b95ff12f2f
fix regressions
2018-08-25 03:40:47 -04:00
Andrew Kelley
ac36f98e72
fix stack traces on linux
2018-08-25 03:07:37 -04:00
Marc Tiehuis
05f9b14fc2
Fix builtin alignment type
...
Closes #1235 .
2018-08-24 17:57:17 +12:00
Andrew Kelley
3a02ba9b82
fix error message for incorrect panic handler fn signature
...
closes #1353
2018-08-23 23:22:48 -04:00
Marc Tiehuis
353419f82d
Default to strict IEEE floating point
...
Closes #1227 .
2018-08-23 22:54:46 +12:00
Andrew Kelley
4b68ef45af
fix incorrectly generating an unused const fn global
...
closes #1277
2018-08-22 14:31:30 -04:00
Andrew Kelley
5aeb3217ee
fixup for previous commit
2018-08-22 14:24:48 -04:00
Raul Leal
87b10400c2
allow implicit cast from *[N]T to ?[*]T ( #1398 )
...
* allow implicit cast from *[N]T to ?[*]T
2018-08-22 13:12:08 -04:00
Andrew Kelley
b2917e6be0
Revert "Merge branch 'mtn-translate-c-enum-vals'"
...
This reverts commit 937b822fa9
, reversing
changes made to dd4b13ac03
.
Tests failing on Windows.
Re-opens #1360
2018-08-21 20:50:03 -04:00
kristopher tate
b023db2e82
src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;
...
ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.
test/translate_c.zig: enum: add wider range of values (u64) to try;
2018-08-20 22:46:11 -04:00
Michael Noronha
7e7e59d881
translate-c: Correctly translate enum init values, addressing #1360
2018-08-20 22:45:19 -04:00
Andrew Kelley
dd4b13ac03
Revert "translate-c: Correctly translate enum init values, addressing #1360 ( #1377 )"
...
This reverts commit b8ce8f219c
.
Squashing the commits from the pull request resulted in kristopher tate
from being omitted from the authors. A future commit will merge
the code correctly.
2018-08-20 22:39:39 -04:00
Michael Noronha
b8ce8f219c
translate-c: Correctly translate enum init values, addressing #1360 ( #1377 )
...
* translate-c: Correctly translate enum init values
* translate-c: Test enum initialization
* translate-c: Flip to positive using APSInt builtins
* src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;
ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.
* test/translate_c.zig: enum: add wider range of values (u64) to try;
closes #1360
2018-08-20 14:29:26 -04:00
Wink Saville
d927f347de
Fix ir_analyze_instruction_atomic_rmw ( #1351 )
...
There were two tests of type_is_valid(casted_ptr->value.type) change the
second one to type_is_valie(casted_operand->value.type).
2018-08-07 23:18:26 -04:00
Andrew Kelley
63a23e848a
translate-c: fix for loops with var init and empty body
2018-08-05 18:40:14 -04:00
Andrew Kelley
387fab60a6
translate-c: fix do while with empty body
2018-08-05 18:32:38 -04:00
Andrew Kelley
c420b234cc
translate-c: handle for loop with empty body
2018-08-05 18:18:24 -04:00
Andrew Kelley
aa232089f2
translate-c: fix while loop with no body
2018-08-05 18:06:39 -04:00
Andrew Kelley
b48948d6e8
Merge branch 'master' into llvm7
2018-08-04 15:19:03 -04:00
Andrew Kelley
9bd8b01650
fix tagged union initialization with a runtime void
...
closes #1328
2018-08-03 15:21:08 -04:00
kristopher tate
298abbcff8
better support for _
identifier
...
* disallow variable declaration of `_`
* prevent `_` from shadowing itself
* prevent read access of `_`
closes #1204
closes #1320
2018-08-03 02:57:17 -04:00
Andrew Kelley
895f262a55
pull request fixups
...
* clean up parser code
* fix stage2 parse and render code
* remove redundant test
* make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
kristopher tate
5de92425d5
src/parser.cpp: fix typo from rebase;
2018-08-02 17:11:37 +09:00
kristopher tate
d3f628907a
src/parser.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate
b3cd65d56e
src/ir.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
5e5685c117
src/ast_render.cpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
ca1b356337
src/all_types.hpp: remove promise_symbol from suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
92cb330e16
src/codegen.cpp: @handle(): replace hacky ref chain with llvm intrinsic;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
104bdb03d6
src/codegen.cpp: return promise instead of null promise;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
a8ea236095
src/ir.cpp: don't allow @handle()
outside of a function;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
fcf53b31fc
src/ir.cpp: return promise->T instead of promise;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
c1a3b0cb0a
src/ir.cpp: add/throw error for @handle() in a non async context;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
db362bec18
src/codegen.cpp: reassert that there are no generated errors in codegen;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
0ee6502562
src/codegen.cpp: remove add_node_error
from ir_render_handle
;
...
Tracking Issue #1296 ;
Thanks @andrewrk ;
2018-08-02 16:50:08 +09:00
kristopher tate
81f463626a
src/codegen.cpp: add/throw error for @handle() in a non async context;
...
Tracking Issue #1296 ;
I removed/commented-out the assert checking for no errors since we now have some errors rendered.
2018-08-02 16:50:08 +09:00
kristopher tate
a2e5691228
src/codegen.cpp: return null if calling convention is not async;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
da5f3d5c4c
src/ir_print.cpp: support @handle()
;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
cd18186715
src/codegen.cpp: base handle builtin on @frameAddress()
;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
a9ea22d4f9
src/ir.cpp: wire-up IR for handle builtin;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
kristopher tate
e79c913cbc
src/all_types.hpp: add enums for Handle Builtin;
...
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00
Andrew Kelley
f804310d9f
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-31 14:36:27 -04:00
Andrew Kelley
6fd6bc94f5
await sets suspend bit; return clears suspend bit
2018-07-30 12:22:54 -04:00
Andrew Kelley
09304aab77
fix cancel and await semantics
2018-07-29 23:25:40 -04:00
Andrew Kelley
0d79e03816
canceling an await also cancels things awaiting it
2018-07-28 13:52:48 -04:00
Andrew Kelley
dd272d1316
await cancels the await target when it is canceled
2018-07-28 12:36:02 -04:00
Andrew Kelley
0ba2bc38d7
await checks the cancel bit
2018-07-28 12:23:47 -04:00
Andrew Kelley
60cda3713f
suspend cancels awaiter when it gets canceled
2018-07-28 12:11:39 -04:00
Andrew Kelley
c6f9a4c044
cancel detects suspend bit
2018-07-28 01:26:11 -04:00
Andrew Kelley
6fed777637
cancel detects if the target handle has already returned
2018-07-28 01:22:51 -04:00
Andrew Kelley
f0c049d02b
detect double await
2018-07-27 18:37:30 -04:00
Andrew Kelley
e5beca886d
suspend checks the cancel bit
2018-07-27 18:07:30 -04:00
Andrew Kelley
e491c38189
resume detects resuming when not suspended
2018-07-27 18:01:39 -04:00
Andrew Kelley
341bd0dfa4
await sets the await bit
2018-07-27 17:47:27 -04:00
Andrew Kelley
0b7a9c0722
cancel sets the cancel bit
2018-07-27 17:42:09 -04:00
Andrew Kelley
02c5bda704
remove ability to break from suspend blocks
...
closes #803
2018-07-27 17:27:03 -04:00
Andrew Kelley
442e244b4d
suspend sets suspend bit
2018-07-27 17:16:00 -04:00
Andrew Kelley
10764ee0e6
resume clears suspend bit
2018-07-27 17:00:41 -04:00
Andrew Kelley
7113f109a4
update coroutine return codegen with new status bits
2018-07-27 15:50:26 -04:00
Andrew Kelley
b3f4182ca1
coroutines have 3 more bits of atomic state
2018-07-26 22:26:00 -04:00
Andrew Kelley
2cbad364c1
add compile error for ignoring return value of while loop bodies
...
closes #1049
2018-07-26 18:29:07 -04:00
Andrew Kelley
fd575fe1f3
add compile error for missing parameter name of generic function
2018-07-25 18:15:55 -04:00
Andrew Kelley
84195467ad
add compile error for non-inline for loop on comptime type
2018-07-25 17:08:55 -04:00
Andrew Kelley
2257660916
fix assertion failure when some compile errors happen
...
I don't actually know of a test case to trigger this
self-hosted won't have this problem because get_pointer_to_type
will return error.SemanticAnalysisFailed
2018-07-25 13:12:03 -04:00
Andrew Kelley
2ea08561cf
self-hosted: function types use table lookup
2018-07-24 14:20:49 -04:00
Andrew Kelley
29e19ace36
fix logic for determining whether param requires comptime
...
closes #778
closes #1213
2018-07-24 10:21:33 -04:00
Andrew Kelley
dd9728c5a0
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-24 00:43:12 -04:00
Andrew Kelley
72599d420b
self-hosted: find all libc paths; windows linker code
2018-07-24 00:06:34 -04:00
Andrew Kelley
2614ef056a
self-hosted: basic linker code for macos
2018-07-23 17:38:03 -04:00
Andrew Kelley
5a919dd82d
Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world
2018-07-23 14:32:13 -04:00
Andrew Kelley
d767fae47e
self-hosted: add first compare-output test
2018-07-23 00:35:53 -04:00
Andrew Kelley
58c5f94a99
self-hosted: share C++ code for finding libc on windows
2018-07-20 23:38:13 -04:00
Andrew Kelley
0a880d5e60
fix generation of error defers for fns inside fns
...
closes #878
2018-07-19 18:06:41 -04:00
Andrew Kelley
a9f0681f85
prevent non-export symbols from clobbering builtins
...
closes #1263
2018-07-19 10:47:17 -04:00
Jimmi Holst Christensen
fd3a41dadc
Allow pointers to anything in extern/exported declarations ( #1258 )
...
* type_allowed_in_extern accepts all ptr not size 0
* Generate correct headers for none extern structs/unions/enums
2018-07-18 11:00:42 -04:00
Andrew Kelley
c393a399fb
fix invalid character test on windows
2018-07-18 10:51:42 -04:00
Andrew Kelley
cbfe9a4077
fix @setEvalBranchQuota not respected in generic fn calls
...
closes #1257
2018-07-17 23:37:17 -04:00
Andrew Kelley
ecf8da00c5
self-hosted: linking
2018-07-17 13:18:13 -04:00
kristopher tate
69e3b4e7dc
revert commit 860d3da915
; please see #1249 for more information; ( #1255 )
2018-07-17 10:27:18 -04:00
Andrew Kelley
97bfeac13f
self-hosted: create tmp dir for .o files and emit .o file for fn
2018-07-16 20:52:50 -04:00
Andrew Kelley
0fa24b6b75
allow implicit cast of undefined to optional
2018-07-16 19:26:15 -04:00
Andrew Kelley
558b0b8791
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-16 13:37:16 -04:00
Andrew Kelley
d3ce9d0643
codegen: remove unused variable
2018-07-16 11:59:37 -04:00
Andrew Kelley
e9a03cccf3
all integer sizes are available as primitives
...
* fix wrong implicit cast for `@IntType` bit_count parameter.
* fix incorrect docs for `@IntType` bit_count parameter.
closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
2255f275a0
update for latest clang API
2018-07-15 00:03:33 -04:00
Andrew Kelley
4d920cee6e
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-14 18:27:51 -04:00
Eduardo Sánchez Muñoz
722b9b9e59
codegen: Store returned value if type is 'handle_is_ptr' and function is not 'first_arg_ret'.
...
Seems to fix #1230 , includes test.
2018-07-14 11:33:01 -04:00
Andrew Kelley
c87102c304
ir_get_ref: delete unnecessary and probably buggy code
2018-07-13 14:53:54 -04:00
Andrew Kelley
171f33b961
ir: remove unnecessary and probably buggy code
2018-07-13 14:18:37 -04:00
Andrew Kelley
860d3da915
ir: remove dead code
2018-07-13 13:37:01 -04:00
Andrew Kelley
5354d1f5fc
allow == for comparing optional pointers
...
closes #658
2018-07-13 12:34:42 -04:00
Andrew Kelley
ce11d6d16c
ir: refactor lvalues
2018-07-11 21:37:47 -04:00
Andrew Kelley
3f30897fdc
add compile error for disallowed types in extern structs
...
closes #1218
2018-07-11 14:08:56 -04:00
Andrew Kelley
da3acacc14
update vendor list for newest llvm version
2018-07-11 00:46:48 -04:00
Andrew Kelley
574e31f0a0
self-hosted: first passing test
...
* introduce std.atomic.Int
* add src-self-hosted/test.zig which is tested by the main test suite
- it fully utilizes the multithreaded async/await event loop so the
tests should Go Fast
* `stage2/bin/zig build-obj test.zig` is able to spit out an error if 2 exported
functions collide
* ability for `zig test` to accept `--object` and `--assembly`
arguments
* std.build: TestStep supports addLibPath and addObjectFile
2018-07-10 20:18:43 -04:00
Andrew Kelley
cfaebb20d8
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-10 14:03:03 -04:00
Andrew Kelley
0ce6934e26
allow var args calls to async functions
2018-07-10 11:44:47 -04:00
Andrew Kelley
28f9230b40
fix crash when calling comptime-known undefined function ptr
...
closes #880
closes #1212
2018-07-10 10:12:08 -04:00
Andrew Kelley
3f4d0ecd7e
Merge remote-tracking branch 'origin/master' into m-n-threading
2018-07-09 17:14:42 -04:00
Andrew Kelley
0ac1b83885
fix non-portable format specifier
2018-07-09 17:13:31 -04:00
Andrew Kelley
2ee67b7642
langref: docs for invalid error set cast and incorrect pointer alignment
...
also add detection of incorrect pointer alignment at compile-time
of pointers that were constructed with `@intToPtr`.
2018-07-09 11:13:29 -04:00
Andrew Kelley
9eb51e20ed
fix crash on @ptrToInt of a *void
...
closes #1192
2018-07-09 10:44:06 -04:00
Andrew Kelley
eb326e1553
M:N threading
...
* add std.atomic.QueueMpsc.isEmpty
* make std.debug.global_allocator thread-safe
* std.event.Loop: now you have to choose between
- initSingleThreaded
- initMultiThreaded
* std.event.Loop multiplexes coroutines onto kernel threads
* Remove std.event.Loop.stop. Instead the event loop run() function
returns once there are no pending coroutines.
* fix crash in ir.cpp for calling methods under some conditions
* small progress self-hosted compiler, analyzing top level declarations
* Introduce std.event.Lock for synchronizing coroutines
* introduce std.event.Locked(T) for data that only 1 coroutine should
modify at once.
* make the self hosted compiler use multi threaded event loop
* make std.heap.DirectAllocator thread-safe
See #174
TODO:
* call sched_getaffinity instead of hard coding thread pool size 4
* support for Windows and MacOS
* #1194
* #1197
2018-07-07 00:32:19 -04:00
Andrew Kelley
d8295c1889
add @popCount intrinsic
2018-07-07 00:25:32 -04:00
Andrew Kelley
4ad4cd2654
fix iterating over a void slice
...
closes #1203
2018-07-06 17:27:44 -04:00
Andrew Kelley
1cf7511dc9
add compile error notes for where struct definitions are
...
closes #1202
2018-07-06 16:20:46 -04:00
Andrew Kelley
1a5bd88881
alternate implementation of previous commit
...
This strategy adds another field to the SwitchBr instruction,
which is the result of the CheckSwitchProngs instruction. The
type of the result is void, and is unused, except that the SwitchBr
instruction will not perform analysis if the CheckSwitchProngs
instruction did not pass analysis. This allows the CheckSwitchProngs
instruction to do implicit casting for its type checking, while
preventing duplicate compile error messages.
2018-07-06 12:03:07 -04:00
Andrew Kelley
b5d07297de
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-04 20:43:49 -04:00
Isaac Hier
9cff23dbf9
Fix assertion crash on enum switch values
2018-07-04 13:27:10 -04:00
Isaac Hier
9395162a7c
Debug enum issue
2018-07-04 12:47:35 -04:00
Andrew Kelley
8c39cdc89f
fix await on early return when return type is struct
...
previously, await on an early return would try to access the
destroyed coroutine frame; now it copies the result into a
temporary variable before destroying the coroutine frame
2018-07-04 11:51:02 -04:00
Andrew Kelley
291afcf75a
fix runtime libc detection depending on locale
...
closes #1165
2018-07-03 14:20:26 -04:00
Andrew Kelley
9665cfe027
update for latest llvm
2018-07-03 03:48:47 -04:00
Andrew Kelley
6e1425e312
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-02 20:00:13 -04:00
Andrew Kelley
35463526cc
add runtime safety for @intToEnum
; add docs for runtime safety
...
See #367
2018-07-02 15:50:28 -04:00
Andrew Kelley
2759c7951d
always link against compiler_rt.o even when linking libc
...
sometimes libgcc is missing things we need, so we always link
compiler_rt and rely on weak linkage to allow libgcc to override.
2018-07-02 14:10:27 -04:00
Andrew Kelley
4c0e280d6d
Merge pull request #1185 from ziglang/undefined-at-comptime-improvements
...
Operators now throw a compiler error when operating on undefined values
2018-07-01 01:33:23 -04:00
Jimmi Holst Christensen
055e0fef4e
Avoid resolve_const in cmp when instr are not comptime
2018-06-30 21:22:26 +02:00
Jimmi Holst Christensen
ecd5e60be9
Expanded the list of operators that catch undefined values at comptime
2018-06-30 20:50:09 +02:00
Jimmi Holst Christensen
42033ea3ca
Merge pull request #1167 from ziglang/comptime-array-by-value
...
Implement const_values_equal for arrays
2018-06-30 18:58:31 +02:00
Jimmi Holst Christensen
01bd5c46e1
Revert "ir_resolve_const now checks recursivly for undef values"
...
This reverts commit 4c3f27ce1e
.
2018-06-30 17:35:06 +02:00
Jimmi Holst Christensen
616fe798c8
Revert "contains_comptime_undefined_value should not follow pointers"
...
This reverts commit 58b1692182
.
2018-06-30 17:35:05 +02:00
Ben Noordhuis
03f66825d6
support --emit in 'test' command
...
Support the `--emit` switch in `zig --emit asm test file.zig`.
The command fails because no tests run (no executable is created) but
it emits the requested file. That seems like a good tradeoff.
2018-06-29 23:32:10 +02:00
isaachier
f1c56f7f22
Clarify reason implicit cast does not work for large RHS ( #1168 )
...
* Clarify reason implicit cast does not work for large RHS
2018-06-29 14:52:25 -04:00
Jimmi HC
58b1692182
contains_comptime_undefined_value should not follow pointers
2018-06-29 11:34:38 +02:00
Jimmi HC
4c3f27ce1e
ir_resolve_const now checks recursivly for undef values
2018-06-29 10:21:43 +02:00
Jimmi HC
b1128b18d5
Assert that array is not ConstArraySpecialUndef in const_values_equal
2018-06-29 08:41:16 +02:00
Jimmi HC
3ec38b2494
Implement const_values_equal for array type
...
* This allows arrays to be passed by value at comptime
2018-06-28 10:34:37 +02:00
Marc Tiehuis
4a35d7eeeb
Correct hex-float parsing
...
Unblocks #495 .
2018-06-28 20:12:03 +12:00
Andrew Kelley
2fa588e81d
fix coroutine accessing freed memory
...
closes #1164
2018-06-27 18:45:21 -04:00
Andrew Kelley
19961c50e4
fix comptime @tagName crashing sometimes
...
closes #1118
2018-06-27 13:15:55 -04:00
Ben Noordhuis
440c1d52b4
simplify comptime floating-point @divTrunc
...
Replace a conditional ceil/floor call with an unconditional trunc call.
2018-06-27 16:20:04 +02:00
Ben Noordhuis
fd75e73ee9
add f16 type
...
Add support for half-precision floating point operations.
Introduce `__extendhfsf2` and `__truncsfhf2` in std/special/compiler_rt.
Add `__gnu_h2f_ieee` and `__gnu_f2h_ieee` as aliases that are used in
Windows builds.
The logic in std/special/compiler_rt/extendXfYf2.zig has been reworked
and can now operate on 16 bits floating point types.
`extendXfYf2()` and `truncXfYf2()` are marked `inline` to work around
a not entirely understood stack alignment issue on Windows when calling
the f16 versions of the builtins.
closes #1122
2018-06-27 16:20:04 +02:00
Ben Noordhuis
1f45075a0e
dry floating-point type definitions
2018-06-27 16:20:04 +02:00
Andrew Kelley
11ca38a4e9
fix crash for optional pointer to empty struct
...
closes #1153
2018-06-26 15:27:41 -04:00
Andrew Kelley
af95e15572
rename get_maybe_type to get_optional_type
2018-06-26 15:11:05 -04:00
Isaac Hier
8e714289ca
Fix os_path_join for case where dirname is empty
2018-06-26 13:31:32 -04:00
Andrew Kelley
459d72f873
fix compiler crash for invalid enum
...
closes #1079
closes #1147
2018-06-21 17:41:49 -04:00
Andrew Kelley
5f38d6e2e9
add casting docs, __extenddftf2, and __extendsftf2
2018-06-21 14:44:35 -04:00
Isaac Hier
eeda1a1396
Fix logic
2018-06-21 08:17:08 -04:00
Isaac Hier
0ab4afbf42
Fix increment operation for bigint -1
2018-06-21 08:14:26 -04:00
Ben Noordhuis
eb6a8e6a3b
fix f128 remainder division bug
...
The modulo operation computed rem(b+rem(a,b), b) which produces -1
for a=1 and b=2.
Switch to a - b * trunc(a/b) which produces the expected result, 1.
closes #1137
2018-06-20 17:37:38 -04:00
Andrew Kelley
55193cb13b
fix runtime fn ptr equality codegen
...
closes #1140
2018-06-20 06:46:53 -04:00