4 ms·
How would one write a 0 bit value into registers?
by shiandow 2y ago
How would one write a 0 bit value into registers?
- Joker_vD 2y agoYes, that's the problem you face when you're dealing strictly with functions of a single argument. Still, there are two options: first, it's arguably is already written into the register so you don't need to do anything. Alternatively, you may instead represent () as a full, 64-bit wide machine word and then map every 64-bit value to mean () so, again, you don't actually need to write anything: all registers contain a valid representation of () at all times. This is similar to how we usually represent booleans: 0 is mapped to mean False, and everything else is mapped to mean True, although in this case we sometimes do need to rematerialize some definite value into the register of choice. In any case, it's mostly just a matter of correctly writing the constant materializer; but if you adopt multi-argument/multi-valued functions you simply never encounter this problem: for arg, place in zip(arg_list, arg_places): load(arg, place) invoke(fun, kont) for val, place in zip(ret_values, ret_places): load(val, place) kontinue(kont) Notice how degenerate loops simply disappear with no additional handling.
- lmm 2y ago> if you adopt multi-argument/multi-valued functions you simply never encounter this problem Sure. If you have multiple return then unit values become a lot less important because you can just have a function that returns 0 values. But most languages, especially C-like languages, do not have multiple return.