AgeCommit message (Collapse)Author
2020-07-11Fix tests on BSDs and 9front, improve names.abiOri Bernstein
2020-06-24Add tests for abi conformity.S. Gilles
Tests 001 through 003 are specific errors, and 004 through 006 are batches of blanket fuzzing that uncovered at least one error each. The blanket fuzzers test function calls between all combinations of {myrddin, c} and {myrddin, c}, except for c functions calling c functions.
2020-06-24Allow runtest.{rc,sh} to handle subdirectories.S. Gilles
This allows tests consisting of multiple files, including .glue.c files, so we can check calling convention compliance.
2020-06-24Bump abi version.S. Gilles
2020-06-24Return small-aggregate values by the AMD64 abi.S. Gilles
Handling the returned value from a function call is now handled in four ways. - Functions that return void do nothing. - Functions that return in a single register are provided an extra argument by simpcall: the Node to which the return value should be stored. gencall handles moving %rax or %rxmm0d to that node as appropriate. - Functions that return large aggregates are provided an extra argument by simpcall: the address of the Node to which the return value should be stored. This is used as the hidden argument, as previously. - Functions that return small aggregates are also provided the address of the Node for the return value, but this is not used as a hidden argument. Instead, gencall uses this to know where to store the values in the return registers. Since gencall now handles the assignment of the returned value, gencall does not return a Loc *.
2020-06-20Pass small-aggregate arguments by the AMD64 abi.S. Gilles
Generally “aggregate types smaller than two eightbytes, such that each eightbyte is unambiguously integer or floating-point, are passed in registers”. Since things like structs are assumed to be on the stack (for addressing), this leads to inefficiencies in function calls: the code var foo : bar = [ .a = 123, .b = 4.567 ] baz(foo) will store foo on the stack, then load it into registers to call baz, and the prologue of baz will immediately push foo back onto the stack. Ah, well.
2020-06-11Add classification algorithm for small-struct passing.S. Gilles
This is meant to implement section 3.2.3 of the AMD64 abi draft. Types which are meant to inter-operate with C should be passed in ways that C will expect. - uint16, flt32, bool, &c. should map to the obvious things - myrddin structs should map to C structs - myrddin tuples could map to C structs, so are treated as structs with unnamed fields. - myrddin unions that are classified as enums are treated as ints. Slices and (non-enum) unions are always passed on the stack, regardless of size, and therefore do not inter-operate with C. - myrddin slices could map to struct { type *data; size_t len; } transparently. However, this would require a lot of work on the myrddin rt code, and would incur a minor performance penalty in the common case of simply passing a slice as an argument in myrddin-only code. Let's hold off on completely overhauling the rt code until a compelling use case for magical slice arguments appears. - myrddin (non-enum) unions are not mapped to anything right now. They could map to struct { union {...} data; int tag; }, though there are special cases to handle with std.option(@a#).
2020-06-11Factor out the code for placing/retrieving arguments.S. Gilles
2020-06-11Add isaggregate for later use with abi conformity.S. Gilles
2020-06-11Unify alignment for heterogeneous tuples.S. Gilles
This only appears to come into play when trying to match memory layout of tuples with structs, or when accessing deeply nested tuples.
2020-06-10Fix check for dumb moves (thanks sgilles)Ori Bernstein
We need to check if we have reg->reg moves.
2020-05-11add OSX recvfrom, fix UDP announce (thanks Int21h)Ori Bernstein
system call to libsys for OS X and also made a minor edit to announcesock so it would work with UDP.
2020-05-05Merge branch 'master' of git+ssh:// Bernstein
2020-05-05Remove useless codeMura Li
2020-05-05Remove unneeded checkMura Li
2020-05-05Use /**/ instead of //Mura Li
2020-05-05Remove unneeded changeMura Li
2020-05-05Simplify equality computationMura Li
2020-05-05Support or-patterns with wildcard variablesMura Li
2020-05-05Fix missing link of linked listMura Li
2020-05-05Fix wrong order of recursive callsMura Li
Also, improve slightly the error messages.
2020-05-05Support or-patternmural
2020-04-30Allow optional eol after the commas of function parametersMura Li
So we can break long parameters into lines without '\'. For example, ``` const foo = {a : byte[:], \ b : int } ``` becomes ``` const foo = {a : byte[:], b : int } ```
2020-04-28Remove useless codeMura Li
2020-04-23Remove unneeded checkMura Li
2020-04-22Use /**/ instead of //Mura Li
2020-04-22Remove unneeded changeMura Li
2020-04-22Simplify equality computationMura Li
2020-04-22Support or-patterns with wildcard variablesMura Li
2020-04-22Fix missing link of linked listMura Li
2020-04-22Fix wrong order of recursive callsMura Li
Also, improve slightly the error messages.
2020-04-20Support or-patternmural
2020-04-14Support the pseudo-member 'tag' for union typesMura Li
Similar to `x.len` which reads the element count of a sequence, `x.tag` reads the tag id of a union value.
2020-03-28Fix typo: s/intializer/initializer/ghenesy
2020-03-15remove debug statements.Ori Bernstein
2020-03-15Align spilled arguments correctly for amd64 abi.Ori Bernstein
2020-03-15Add support for LDFLAGS lines.Ori Bernstein
2020-03-06Merge branch 'master' of /git/ori/mcOri Bernstein
2020-01-25update bootstrap for osx.Ori Bernstein
2020-01-20Update bootstrap on FreeBSDOri Bernstein
2020-01-20Fix bootstrap on openbsd:Ori Bernstein
2020-01-20fix bootstrap on 9frontOri Bernstein
2020-01-12spelling mistake in commentbitmapper
2020-01-12fixed macos build, "improved" vim syntax highlighting (improved mode off by ↵bitmapper
2019-12-05[PATCH v2] Force correct sign for intermediate steps of
Since y1 is usually smaller than y0, the sign of (x0 - x1) * (y1 - y0) is usually the same as that of (x0 - x1). This isn't always the case, though, especially if y is 2^Large * small. Also, the result of umul should be trimmed, so that we can trust that z0, z1 are trimmed in kmul. Otherwise, if their signs are different, bigadd(z1, z0) may become confused about which has greater magnitude and perform an incorrect subtraction. Since the result of kmul comes from bigadd(), which trims already, we need only trim the result of smallmul to ensure that umul's result is trimmed.
2019-12-01[PATCH v2 4/3] Somewhat better error for std.put("{w=?}", "foo")"S. Gilles"
2019-12-04Allow specifying padding width from variableS. Gilles
So I can write std.put("{w=?}{w=?}\n", field_a, max_width, field_b, max_width)
2019-12-04Make vanext decrement tc.nelt unconditionallyS. Gilles
This allows formatting functions to pass off the valist to type-specific formatters, which may themselves consume elements from the valist, and still check for correct argument counts without passing around counter variables.
2019-12-04Convert lib/test/fmt.myr to use testrS. Gilles
2019-10-30Fix build on 9front.Ori Bernstein