aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
AgeCommit message (Collapse)Author
2019-09-03fix compiler crash in struct field pointersAndrew Kelley
when the llvm type has not been fully analyzed. This is a regression from lazy values.
2019-09-03fix stack traces on macos when passing absolute path to root source fileAndrew Kelley
The comment added by this commit is copied here: For macOS stack traces, we want to avoid having to parse the compilation unit debug info. As long as each debug info file has a path independent of the compilation unit directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug info. If we provide an absolute path to LLVM here for the compilation unit debug info, LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "." for the compilation unit directory. This forces each debug file to have a directory rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will no longer reference DW_AT_comp_dir, for the purpose of being able to support the common practice of stripping all but the line number sections from an executable. closes #2700
2019-09-02omit prefix data for async functions sometimesAndrew Kelley
When `@frameSize` is never called, and `@asyncCall` on a runtime-known pointer is never used, no prefix data for async functions is needed. Related: #3160
2019-09-02fix const result loc, runtime if cond, else unreachableAndrew Kelley
Closes #2791. See that issue for more details; I documented the debugging process quite thoroughly on this one.
2019-09-02add ability to specify darwin framework search dirsAndrew Kelley
2019-08-31improvements to `@asyncCall`Andrew Kelley
* `await @asyncCall` generates better code. See #3065 * `@asyncCall` works with a real `@Frame(func)` in addition to a byte slice. Closes #3072 * `@asyncCall` allows passing `{}` (a void value) as the result pointer, which uses the result location inside the frame. Closes #3068 * support `await @asyncCall` on a non-async function. This is in preparation for safe recursion (#1006).
2019-08-31`@typeOf` now guarantees no runtime side effectsAndrew Kelley
related: #1627
2019-08-30support recursive async and non-async functionsAndrew Kelley
which heap allocate their own frames related: #1006
2019-08-29await does not force async if callee is blockingAndrew Kelley
closes #3067
2019-08-29make `@sizeOf` lazyAndrew Kelley
2019-08-29fix not fully resolving debug info for structs causing llvm errorAndrew Kelley
2019-08-28fix implicit cast from zero sized array ptr to sliceAndrew Kelley
closes #1850
2019-08-26fix regression with global variable assignment...Andrew Kelley
...with optional unwrapping with var initialized to undefined
2019-08-25hook up unions with lazy valuesAndrew Kelley
this case works now: ```zig const Expr = union(enum) { Literal: u8, Question: *Expr, }; ```
2019-08-23better handling of lazy structsAndrew Kelley
this case works now: ```zig const A = struct { b_list_pointer: *const []B, }; const B = struct { a_pointer: *const A, }; const b_list: []B = [_]B{}; const a = A{ .b_list_pointer = &b_list }; const obj = B{ .a_pointer = &a }; ```
2019-08-23allow top level declarations to be lazyAndrew Kelley
this case now works: ```zig const A = struct { b: B, }; const B = fn (A) void; ```
2019-08-23Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludgeAndrew Kelley
2019-08-23Encapsulate bigint representation, assert on cast data lossJonathan Marler
2019-08-22introduce lazy valuesAndrew Kelley
see #2174
2019-08-16fix and test case for returning from suspend blockAndrew Kelley
See #3063
2019-08-16codegen: LLVMConstSub instead of LLVMBuildSub in one placeAndrew Kelley
2019-08-15fix crash with sometimes type not being resolvedAndrew Kelley
2019-08-15add assertion about control flow to fix gcc warningAndrew Kelley
2019-08-15fix error return traces for async calls of blocking functionsAndrew Kelley
2019-08-15remove `cancel`Andrew Kelley
2019-08-14codegen for async call of blocking functionAndrew Kelley
2019-08-13avoid the word "coroutine", they're "async functions"Andrew Kelley
2019-08-13alignment of structs no longer depends on LLVMAndrew Kelley
fixes async function tests in optimized builds
2019-08-13Merge remote-tracking branch 'origin/master' into rewrite-coroutinesAndrew Kelley
2019-08-13flip the order of fields in error unionsAndrew Kelley
to prepare for fixing u128 alignment issues
2019-08-11fix no-longer-correct `nonnull` attribute on merge err ret traces fnAndrew Kelley
2019-08-11fix cancel invoking branch on undefined memoryAndrew Kelley
2019-08-11all tests passingAndrew Kelley
2019-08-11fix canceling async functions which have error return tracingAndrew Kelley
2019-08-10fix returning a const error from async functionAndrew Kelley
2019-08-10fix try in an async function with error union and non-zero-bit payloadAndrew Kelley
2019-08-09fix combining try with errdefer cancelAndrew Kelley
2019-08-09fix cancel inside an errdeferAndrew Kelley
2019-08-08fix passing string literals to async functionsAndrew Kelley
2019-08-08async functions in single threaded mode do not use atomic opsAndrew Kelley
2019-08-08more debuggable safety for awaiting twiceAndrew Kelley
2019-08-08cancel, defer, errdefer all working as intended nowAndrew Kelley
2019-08-07modify header precedence for zig cc, resolves intrinsics issues (#3027)Ryan Saunderson
2019-08-07clean up the bitcasting of awaiter fn ptrAndrew Kelley
2019-08-07implement cancelAndrew Kelley
all behavior tests passing in this branch
2019-08-06fix awaiting when result type is a structAndrew Kelley
2019-08-06error return trace across suspend pointsAndrew Kelley
2019-08-06passing the error return trace async function testAndrew Kelley
2019-08-06improve async function semanticsAndrew Kelley
* add safety panic for resuming a function which is returning, pending an await * remove IrInstructionResultPtr * add IrInstructionReturnBegin. This does the early return in async functions; does nothing in normal functions. * `await` gets a result location * `analyze_fn_async` will call `analyze_fn_body` if necessary. * async function frames have a result pointer field for themselves to access and one for the awaiter to supply before the atomic rmw. when returning, async functions copy the result to the awaiter result pointer, if it is non-null. * async function frames have a stack trace pointer which is supplied by the awaiter before the atomicrmw. Later in the frame is a stack trace struct and addresses, which is used for its own calls and awaits. * when awaiting an async function, if an early return occurred, the awaiter tail resumes the frame. * when an async function returns, early return does a suspend (in IrInstructionReturnBegin) before copying the error return trace data, result, and running the defers. After the last defer runs, the frame will no longer be accessed. * proper acquire/release atomic ordering attributes in async functions.
2019-08-05async functions have error return traces where appropriateAndrew Kelley
however the traces are not merged on `await` or async function calls yet. When an async function has an error set or error union as its return type, it has a `StackTrace` before the args in the frame, so that it is accessible from `anyframe->T` awaiters. However when it does not have an errorable return type, but it does call or await an errorable, it has a stack trace just before the locals. This way when doing an `@asyncCall` on an async function pointer, it can populate the args (which are after the `StackTrace`) because it knows the offset of the args based only on the return type. This sort of matches normal functions, where a stack trace pointer could be supplied by a parameter, or it could be supplied by the stack of the function, depending on whether the function itself is errorable.