| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Simplify the implementation of calling continuations. Since we don't
support next-ingredient on continuations, might as well not bother with
all that call housekeeping for ingredients.
|
|
|
|
|
|
|
|
|
| |
Bugfix: I hadn't been allowing continuations to be copied.
Deepens our initial sin of managing the Mu call stack implicitly in the
C interpreter. Since the call stack was implicit, continuations had to
be implicit as well. Since continuations aren't in Mu's memory, we have
to replicate refcounting logic for them.
|
| |
|
|
|
|
| |
map::operator[](k) is indeed equivalent to (*((this->insert(make_pair(k,mapped_type()))).first)).second
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Support explicit conversions from number to character.
|
|
|
|
| |
Running example programs after a long time.
|
| |
|
|
|
|
|
| |
At least this particular implementation of them. Let's play with them
now for a while, see if they're fully equivalent to shift/reduce.
|
|
|
|
|
|
| |
Surprisingly small change, considering how long it took me and how
mind-bending it was. 'return-continuation-until-mark' now behaves like
both call and return instructions, which made it hard to reason about.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Return other values along with the current continuation.
|
| |
|
| |
|
|
|
|
|
| |
Stop hardcoding Max_depth everywhere; we had a default value for a
reason but then we forgot all about it.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generalize commit 4089 to arbitrary closures, and not just the current
'space' or call frame. Now we should be treating spaces just like any
other data structure, and reclaiming all addresses inside them when we
need to.
The cost: all spaces must now specify what recipe generated them (so
they know how to interpret the array of locations) using the /names
property.
We can probably make this ergonomic with a little 'type inference'. But
at least things are safe now.
|
|
|
|
|
|
|
|
|
| |
Finally, make the seemingly-trivial change to buffer methods that I was
envisioning 2 days ago.
I still have zero confidence in our heuristic for picking the generic
method to specialize for a call-site. Waiting for issues to reveal
themselves.
|
|
|
|
|
|
|
| |
Don't silently ignore ties we failed to break when matching generic
functions to calls.
Now we can start working on the bug that triggered commits 4092-4097.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Some cleanup as I remind myself of how generic functions work in Mu.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up how we reclaim local scopes.
It used to work like this (commit 3216):
1. Update refcounts of products after every instruction, EXCEPT:
a) when instruction is a non-primitive and the callee starts with
'local-scope' (because it's already not decremented in 'return')
OR:
b) when instruction is primitive 'next-ingredient' or
'next-ingredient-without-typechecking', and its result is saved to a
variable in the default space (because it's already incremented at
the time of the call)
2. If a function starts with 'local-scope', force it to be reclaimed
before each return. However, since locals may be returned, *very
carefully* don't reclaim those. (See the logic in the old `escaping`
and `should_update_refcount` functions.)
However, this approach had issues. We needed two separate commands for
'local-scope' (reclaim locals on exit) and 'new-default-space'
(programmer takes charge of reclaiming locals). The hard-coded
reclamation duplicated refcounting logic. In addition to adding
complexity, this implementation failed to work if a function overwrites
default-space after setting up a local-scope (the old default-space is
leaked). It also fails in the presence of continuations. Calling a
continuation more than once was guaranteed to corrupt memory (commit
3986).
After this commit, reclaiming local scopes now works like this:
Update refcounts of products for every PRIMITIVE instruction.
For non-primitive instructions, all the work happens in the `return`
instruction:
increment refcount of ingredients to `return`
(unless -- one last bit of ugliness -- they aren't saved in the
caller)
decrement the refcount of the default-space
use existing infrastructure for reclaiming as necessary
if reclaiming default-space, first decrement refcount of each
local
again, use existing infrastructure for reclaiming as necessary
This commit (finally!) completes the bulk[1] of step 2 of the plan in
commit 3991. It was very hard until I gave up trying to tweak the
existing implementation and just test-drove layer 43 from scratch.
[1] There's still potential for memory corruption if we abuse
`default-space`. I should probably try to add warnings about that at
some point (todo in layer 45).
|
|
|
|
|
| |
I no longer remember why we were disabling memory reclamation inside
sandboxes. Everything seems to be working. Just take it out.
|
|
|
|
|
| |
Clean up the narrative of spaces as I struggle to reimplement
`local-scope` by the plan of commit 3992.
|
| |
|
|
|
|
| |
subx: 'call' and 'return' instructions
|
|
|
|
|
| |
subx: extract helpers for 'push' and 'pop'. We will be using them in
'call' and 'ret' as well.
|
|
|
|
| |
subx: 'pop'
|