summaryrefslogtreecommitdiff
path: root/6
AgeCommit message (Collapse)Author
42 hoursFix tests on BSDs and 9front, improve names.HEADmasterabiOri Bernstein
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-03-15Align spilled arguments correctly for amd64 abi.Ori Bernstein
2019-04-28Fix float conversions in casts.Ori Bernstein
We were dropping the intness, and didn't registerize the args to comisd.
2019-04-12Rename traits correctly.Ori Bernstein
2019-02-27Remove unused lines from the regmap.Ori Bernstein
These were placeholders for %rpb, %rsp -- but we never use %rsp and %rbp in the colormap, so they were just dead lines that caused confusion.
2019-02-26Accept that `file` isn't a node.Ori Bernstein
Shrink node sizes, simplify code a bit.
2019-02-26Add support for `__fini__` functions.Ori Bernstein
2019-01-28Missed type alignment for slices.Ori Bernstein
Holy crap, how did this work until now.
2019-01-12Fix indexed array initializers.Ori Bernstein
2019-01-07Don't leave asm in /tmp on any system.Ori Bernstein
2018-12-16fix missized copy.Ori Bernstein
2018-11-06Clean up.Ori Bernstein
2018-11-06Create the output directory when assembling.Ori Bernstein
Easier to bootstrap.
2018-10-15Disallow negative array sizes. And do some cleanup.Ori Bernstein
2018-07-22Add zeroed env pointer when a const fn is passed as an argument.iriri
This makes it safe to fndup a global function which makes it safe to spawn a global function.
2018-07-20Fix codegen bug in env capture.Ori Bernstein
We could capture too little in the env, because we didn't account for padding in the captures.
2018-07-19Support direct tuple access operators "tuple.N"Quentin Carbonneaux
This patch adds tuple access expressions. If t is a tuple, its N-th component can be retrieved with the syntax t.N. Of course, the components are zero indexed. I believe the code also works if 't' is a pointer to a tuple (but I have not checked this).
2018-07-03Fix escaping of closing '}' in fmt.Ori Bernstein
2018-06-09Consistently and corretly add Oundef.Ori Bernstein
2018-05-26Initialize the closure before a recursive capture.Ori Bernstein
2018-05-26Fix indentation.Ori Bernstein
2018-05-11Check return value of getcwd.Ori Bernstein
Some systems warn.
2018-05-09Merge remote-tracking branch 'npnth/libmath'Ori Bernstein
2018-05-08Don't specify .comm alignment.Ori Bernstein
It seems to confuse lld.
2018-05-06Start of AES GCM work.Ori Bernstein
2018-04-27Extract slices recursively.Ori Bernstein
This fixes deeply nestedl slices of arrays of slices of arrays.
2018-04-24We don't do PIE yet, let's deal with it later.Ori Bernstein
2018-04-22Add a special exit stack to our thread library.Ori Bernstein
Because OpenBSD wants a valid stack pointer in any code that enters the kernel, unmapping our stack as part of exiting the process is rather unreliable. This change allocates a stack page that we can switch to when a thread is deallocating itself, which keeps the kernel happy.
2018-04-18Merge remote-tracking branch 'ori/master' into HEADS. Gilles
2018-04-08Add support for `-T` option to compile in test mode.Ori Bernstein
Tests can now access hidden declarations.
2018-04-05Ensure that we initialize the environment fully.Ori Bernstein
Initially, the thought was that since the function doesn't access any of the environment data, initializing it was a waste of time. This is true -- if the environment is not heapified. But we do often want to heapify the environment, which means that if we have junk in the environment pointer we will think, incorrectly, that there is an environment to duplicate. This leads to crashes. Crashes are a bad thing. This change zeroes out the environment pointer, so that we don't have crashes. This makes mpu happy(er).
2018-03-20Fix corrupted merge of 'autoexpr'S. Gilles
2018-03-13Merge branch 'autoexpr' into libmathS. Gilles
2018-03-06Add ternary operator.Ori Bernstein
2018-01-29Allow generating function vars.Ori Bernstein
2018-01-27Put data into sections too.Ori Bernstein
2018-01-27Put data into sections too.autoexprOri Bernstein
2018-01-26New auto operator.Quentin Carbonneaux
Summary: -------- During the Myrcon in September Ori suggested an 'auto' operator that would evaluate what it applies to, store the result in a temporary t, and call __dispose__(t) when the current block exits. This patch implements this idea under the form of a unary operator. This, for instance, allows to have: impl disposable regex# = __dispose__ = {r; regex.free(r)} ;; regex.exec(auto std.try(regex.compile("f..bar")), "foobar") Like before, it is guaranteed that __dispose__ is called in reverse order of auto appearance. Backward compatibility: ----------------------- Nope. Auto variables are now gone. This should not be a problem, simply rewrite: var auto x = foo() into: var x = auto foo() Implementation: --------------- It largely reuses the code I had written for 'auto' variables but needs a little finer grain tracking because we don't always want to call __dispose__ for *all* auto expression results when leaving a block (some might not be evaluated yet). For example: auto 1 if b -> void ;; auto 2 Only __dispose__(1) must be called when '-> void' is executed. If the block falls through, __dispose__(2) and __dispose__(1) will be called in sequence. TODO: ----- - Err when goto jumps in/out of a block that has auto expressions. - Support auto in patterns. match ... | `std.Some (auto x): ... is essentially rewritten to: match ... | `std.Some (auto x): auto x ... - Test edge cases (e.g., auto in loop condition) Actually, test. Cheers,
2018-01-22Bring back old addresses, with a better explanation.Ori Bernstein
2018-01-21Cheap enums.Quentin Carbonneaux
2018-01-17Infer after generating init functions.Ori Bernstein
Pull out the usefile loading, so we can call it separately from inference. Then shuffle the infer() call to after we generate init().
2018-01-11Error out if getcwd fails.Ori Bernstein
2017-12-28Minor cleanup.Ori Bernstein