aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/wasm.zig
AgeCommit message (Collapse)Author
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08update usage of std.testing in stage2Veikka Tuominen
2021-04-28stage2: semaDecl properly analyzes the decl blockAndrew Kelley
Also flattened out Decl TypedValue fields into ty, val, has_tv and add relevant fields to Decl for alignment and link section.
2021-04-08Refactor link/wasm.zig to use offset tableLuuk de Gram
This refactor inserts an offset table into wasm's data section where each offset points to the actual data region. This means we can keep offset indexes consistant and do not have to perform any computer to determine where in the data section something like a static string exists. Instead during runtime it will load the data offset onto the stack.
2021-04-08CleanupLuuk de Gram
2021-04-08Calculate data length to ensure correct pointer offsetsLuuk de Gram
2021-04-08Basic "Hello world" workingLuuk de Gram
2021-04-08stage2 wasm: Add bitwise/boolean ops &, |, ^, and, orgracefu
2021-04-05stage2 wasm codegen: refactor to use wasm.buildOpcodegracefu
2021-04-05std/wasm: add buildOpcode to help construction of `Opcode`sgracefu
2021-04-05stage2 wasm: codegen `mul` opgracefu
2021-04-05stage2 wasm: codegen `sub` opgracefu
2021-03-28Merge remote-tracking branch 'origin/master' into zir-memory-layoutAndrew Kelley
Wanted to make sure those new test cases still pass. Also grab that CI fix so we can get those green check marks.
2021-03-22Fix getNot and add test casesLuuk de Gram
2021-03-22Implement more instructions for more control flow supportLuuk de Gram
2021-03-18stage2: get Module and Sema compiling againAndrew Kelley
There are some `@panic("TODO")` in there but I'm trying to get the branch to the point where collaborators can jump in. Next is to repair the seam between LazySrcLoc and codegen's expected absolute file offsets.
2021-02-05Ensure function indices are correct and fix a memory leakLuuk de Gram
2021-02-05Create type declarations for extern functions and write the 'import' sectionLuuk de Gram
2021-01-26Add tests, fix locals that are created in blocks like loops, and handle all ↵Luuk de Gram
breaks correctly
2021-01-24Nested conditions and loops supportLuuk de Gram
2021-01-18update wasm backend to match new Module APIAndrew Kelley
Fixes a logical merge conflict that I didn't notice before.
2021-01-16Generate correct opcode for 'addGen' depending on typeLuuk de Gram
2021-01-16Add tests and move tests to wasm's own fileLuuk de Gram
2021-01-15Cleanup and 'add' instruction for bigger test areaLuuk de Gram
2021-01-15stage2: refactor wasm backend - similar to the other backendsLuuk de Gram
2021-01-02stage2: re-use ZIR for comptime and inline callsAndrew Kelley
Instead of freeing ZIR after semantic analysis, we keep it around so that it can be used for comptime calls, inline calls, and generic function calls. ZIR memory is now managed by the Decl arena. Debug dump() functions are conditionally compiled; only available in Debug builds of the compiler. Add a test for an inline function call.
2021-01-02stage2: implement function call inlining in the frontendAndrew Kelley
* remove the -Ddump-zir thing. that's handled through --verbose-ir * rework Fn to have an is_inline flag without requiring any more memory on the heap per function. * implement a rough first version of dumping typed zir (tzir) which is a lot more helpful for debugging than what we had before. We don't have a way to parse it though. * keep track of whether the inline-ness of a function changes because if it does we have to go update callsites. * add compile error for inline and export used together. inline function calls and comptime function calls are implemented the same way. A block instruction is set up to capture the result, and then a scope is set up that has a flag for is_comptime and some state if the scope is being inlined. when analyzing `ret` instructions, zig looks for inlining state in the scope, and if found, treats `ret` as a `break` instruction instead, with the target block being the one set up at the inline callsite. Follow-up items: * Complete out the debug TZIR dumping code. * Don't redundantly generate ZIR for each inline/comptime function call. Instead we should add a new state enum tag to Fn. * comptime and inlining branch quotas. * Add more test cases.
2020-12-30stage2: rework Value Payload layoutAndrew Kelley
This is the same as the previous commit but for Value instead of Type. Add `Value.castTag` and note that it is preferable to call than `Value.cast`. This matches other abstractions in the codebase. Added a convenience function `Value.Tag.create` which really cleans up the callsites of creating `Value` objects. `Value` tags can now share payload types. This is in preparation for another improvement that I want to do.
2020-11-16Move leb128 and remove trivial *mem functions as discussed in #5588 (#6876)tgschultz
* Move leb128 out of debug and remove trivial *mem functions as discussed in #5588 * Turns out one of the *Mem functions was used by MachO. Replaced with trivial use of FixedBufferStream.
2020-09-21rename src-self-hosted/ to src/Andrew Kelley