about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* 4095Kartik K. Agaram2017-10-301-1/+1
|
* 4094Kartik K. Agaram2017-10-301-3/+7
|
* 4093Kartik K. Agaram2017-10-301-6/+2
|
* 4092Kartik K. Agaram2017-10-302-6/+8
| | | | Some cleanup as I remind myself of how generic functions work in Mu.
* 4091Kartik K. Agaram2017-10-291-1/+1
|
* 4090Kartik K. Agaram2017-10-261-4/+4
|
* 4089Kartik K. Agaram2017-10-2212-118/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* 4088Kartik K. Agaram2017-10-211-1/+1
| | | | | I no longer remember why we were disabling memory reclamation inside sandboxes. Everything seems to be working. Just take it out.
* 4087Kartik K. Agaram2017-10-212-24/+27
| | | | | Clean up the narrative of spaces as I struggle to reimplement `local-scope` by the plan of commit 3992.
* 4086 - back to cleaning up delimited continuationsKartik K. Agaram2017-10-186-6/+10
|
* 4085 - done with first cut of the SubX VMKartik K. Agaram2017-10-184-6/+226
| | | | subx: 'call' and 'return' instructions
* 4084Kartik K. Agaram2017-10-185-120/+118
| | | | | subx: extract helpers for 'push' and 'pop'. We will be using them in 'call' and 'ret' as well.
* 4083Kartik K. Agaram2017-10-184-2/+120
| | | | subx: 'pop'
* 4082Kartik K. Agaram2017-10-184-55/+67
| | | | | subx: correct a 'copy' ('mov') instruction as well to get its operand right from the opcode.
* 4081Kartik K. Agaram2017-10-182-238/+230
|
* 4080Kartik K. Agaram2017-10-182-17/+29
| | | | | | | | subx: correct 'push' register. It gets its operand right from the opcode, not a new modrm byte. Have I misinterpreted any other instructions in this manner (`+rd` in the Intel manual)?
* 4079Kartik K. Agaram2017-10-186-33/+183
| | | | subx: 'pop'
* 4078Kartik K. Agaram2017-10-177-450/+454
|
* 4077Kartik K. Agaram2017-10-176-33/+33
| | | | | Stop hyperlinking every `i` in subx html files to the integer register union.
* 4076Kartik K. Agaram2017-10-161-1/+1
|
* 4075Kartik K. Agaram2017-10-161-3/+4
|
* 4074Kartik K. Agaram2017-10-161-6/+10
|
* 4073Kartik K. Agaram2017-10-161-4/+7
|
* 4072Kartik K. Agaram2017-10-166-68/+667
|
* 4071Kartik K. Agaram2017-10-163-46/+510
| | | | | | | | | subx: conditional jump instructions Lots of boilerplate here. This commit really strains my 'copyista' ethic. But I think it's still clearer to see each instruction implemented independently than to try to create a macro or something like that.
* 4070Kartik K. Agaram2017-10-151-0/+11
|
* 4069Kartik K. Agaram2017-10-157-221/+383
| | | | subx: unconditional 'jump'
* 4068Kartik K. Agaram2017-10-152-6/+6
|
* 4067Kartik K. Agaram2017-10-156-6/+184
| | | | subx: 'mov'
* 4066Kartik K. Agaram2017-10-144-4/+4
| | | | | | I spent a while spelunking into the code generated by C compilers before realizing that ignoring the order of arguments for 'cmp' instructions clarifies everything.
* 4065Kartik K. Agaram2017-10-146-0/+456
| | | | | | subx: 'compare' Hopefully I've implemented the 'sense' of comparisons right..
* 4064Kartik K. Agaram2017-10-149-519/+477
|
* 4063Kartik K. Agaram2017-10-144-8/+8
|
* 4062Kartik K. Agaram2017-10-135-252/+260
|
* 4061Kartik K. Agaram2017-10-134-18/+18
|
* 4060 - subx: correct stale ReadmeKartik K. Agaram2017-10-131-7/+1
|
* 4059Kartik K. Agaram2017-10-133-242/+609
|
* 4058Kartik K. Agaram2017-10-132-0/+38
|
* 4057Kartik K. Agaram2017-10-133-0/+111
|
* 4056Kartik K. Agaram2017-10-133-0/+111
| | | | subx: 'or'
* 4055Kartik K. Agaram2017-10-133-0/+105
| | | | subx: Implement 'and' for the addressing modes we've built so far.
* 4054Kartik K. Agaram2017-10-1210-371/+375
|
* 4053Kartik K. Agaram2017-10-124-10/+10
|
* 4052Kartik K. Agaram2017-10-1210-140/+1949
|
* 4051Kartik K. Agaram2017-10-123-74/+74
| | | | subx: Move register direct mode before indirect in the exposition.
* 4050Kartik K. Agaram2017-10-121-0/+18
|
* 4049Kartik K. Agaram2017-10-123-99/+101
| | | | Instead of organizing layers by instruction, do so by addressing mode.
* 4048Kartik K. Agaram2017-10-121-0/+22
|
* 4047Kartik K. Agaram2017-10-121-0/+22
|
* 4046Kartik K. Agaram2017-10-121-0/+12
|