about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* 3370Kartik K. Agaram2016-09-161-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix CI. Figuring out this memory leak was an epic story. I was able to quickly track down that it was caused by commit 3365, in particular the overloading of to-text to support characters. But beyond that I was stumped. Why were layer 3's trace_stream::curr_stream objects being leaked in layer 81 by a change in layer 59?! Triaging through the layers, I found the following: layer 81 - leaks 2 blocks (in clear-line-erases-printed-characters) layer 83 - leaks 4 additional blocks (in clear-line-erases-printed-characters-2) I also figured out that the leaks were happening because of the call to 'trace' on a character inside print:character (that's the 'print' function called with a character argument) trace 90, [print-character], c So I tried to create a simple scenario: scenario trace-on-character-leaks [ 1:character <- copy 111/o trace 90, [print-character], 1:character ] But that triggered no leaks. Which made sense because there were plenty of calls to that 'trace' instruction in print:character. The leak only happened when print:character was called from clear-line. Oh, it happens only when tracing 0/nul characters. Tracing a Mu string with a nul character creates an empty C++ string, which is weird. But why should it leak memory?! Anyway, I tried a new scenario at layer 62 (when 'trace' starts auto-converting characters to text) scenario stashing-nul-character-leaks [ 1:character <- copy 0/nul trace 90, [dbg], 1:character ] But still, no leak! I played around with running layers until 70, 80. But then it didn't leak even at layer 82 where I'd seen it leak before. What had I done? Turns out it was only leaking if I used names for variables and not numeric addresses. Eventually I was able to get layer 59 to leak: scenario stashing-nul-character-leaks [ c:character <- copy 0/nul x:text <- to-text c trace 90, [dbg], x ] At that point I finally went to look at layer 3 (I'd been thinking about it before, but hadn't bothered to *actually go look*!) And the leak was obvious. In the end, all the information I needed was right there in the leak report. The reason this was hard to find was that I wasn't ready to believe there could be a bug in layer 3 after all these months. I had to go through the five stages of grief before I was ready for that realization. Final mystery: why was the memory leak not triggered by numeric variables? Because the transform to auto-convert ingredients to text only operated on named variables. Manually performing the transform did leak: scenario stashing-text-containing-nul-character-leaks [ 1:text <- new character:type, 1/capacity put-index *1:text, 0, 0/nul trace 90, [dbg], 1:text ]
* 3369Kartik K. Agaram2016-09-152-24/+0
| | | | Fix some tests and make them less fragile.
* 3368Kartik K. Agaram2016-09-152-15/+4
| | | | Decouple layer 61 test from layer 62 dependency.
* 3367Kartik K. Agaram2016-09-151-8/+24
| | | | | | | | | | | | | | | | | | | | | | Solution to a minor puzzle that came up during today's lesson with Ella: some sandboxes were showing the address of text results, while others were showing their contents. It took a while to realize that the distinction lay in whether the sandbox was saving the results in a text variable: new [abc] => <some address> x:text <- new [abc] => abc It took *much* longer to realize why I couldn't make the first case work like the second. Eventually I realized why: recipes were reclaiming their results if they weren't 'escaping' -- that is, being saved in a variable in the caller so they could be used later. Any solution to this would be a hack, so I'm going to just leave it alone. Type abbreviations should help minimize the extra typing needed to get sandboxes to show text contents.
* 3366Kartik K. Agaram2016-09-151-1/+1
| | | | | | Small bugfix in error messages for scenarios: we're trying to use read_mu_string() on an array of characters rather than an address to an array of characters. So we need to pretend we have a refcount.
* 3365 - create strings out of arbitrary typesKartik K. Agaram2016-09-153-3/+72
| | | | | The implementation is quite hacky. Let's see how future needs develop before we try to clean it up.
* 3364Kartik K. Agaram2016-09-154-9/+17
|
* 3363 - bugfix in tangleKartik K. Agaram2016-09-152-1/+12
|
* 3362Kartik K. Agaram2016-09-151-3/+3
|
* 3361Kartik K. Agaram2016-09-151-7/+7
|
* 3360Kartik K. Agaram2016-09-151-1/+1
|
* 3359Kartik K. Agaram2016-09-151-10/+9
|
* 3358Kartik K. Agaram2016-09-152-0/+9
|
* 3357 - multi-ary 'append'Kartik K. Agaram2016-09-151-33/+36
|
* 3356Kartik K. Agaram2016-09-151-10/+10
|
* 3355Kartik K. Agaram2016-09-1549-980/+1704
|
* 3354 - support multiple routines at a source/sinkKartik K. Agaram2016-09-152-13/+40
| | | | | This commit completes the final step: fixing the final failing tests (in chessboard.mu) by teaching `restart` about the block signal.
* 3353Kartik K. Agaram2016-09-152-7/+65
| | | | | | | | | | | | | Fix failing scenarios in channel layer. We do so by introducing a kludgy new instruction to explicitly signal when a routine is stuck ('blocked') and waiting on another. All this locking and blocking may well be a crap design. We'll see if we find ourselves using these primitives again. Ideally we don't need them for anything else now that we're done building channels. Still some failing scenarios left in chessboard.mu. Let's see how that goes.
* 3352Kartik K. Agaram2016-09-141-72/+72
| | | | | Reorder `wait-for-routine-to-block` to be close to related routines `switch` and `restart`.
* 3351 - new but incomplete synchronization setupKartik K. Agaram2016-09-142-48/+101
| | | | | | | | | | | | | Previously our channels were based on an unconventional `wait-for-location` primitive that waits for a specific address to change its contents. This only works as long as a channel has a single reader and a single writer routine. To support multiple readers and writers we switch to a more conventional compare-and-set primitive. There's still a couple of failing scenarios, though -- the ones using `wait-for-routine-to-block`, because the new approach never blocks on an empty or full channel, just yields CPU for a time before polling. Hmm, how to fix this?
* 3350Kartik K. Agaram2016-09-142-3/+7
| | | | Three separate CI fixes(!)
* 3349Kartik K. Agaram2016-09-141-2/+6
| | | | Fix a warning on some compilers.
* 3348Kartik K. Agaram2016-09-141-4/+20
| | | | | | | | Expand type abbreviations when checking for colliding/redefined variants. This may need a separate transform if we ever find the need to use type abbreviations before defining them.
* 3347Kartik K. Agaram2016-09-134-8/+8
| | | | | | | | | Done using 'text' type abbreviation everywhere. There's still a problem. If we define a function with a type abbreviation and then redefine it without, I think we end up creating separate variants. That seems wrong. Let's isolate a scenario for that next.
* 3346Kartik K. Agaram2016-09-133-9/+14
| | | | Process type abbreviations in *shape-shifting* function headers.
* 3345Kartik K. Agaram2016-09-121-1/+1
|
* 3344Kartik K. Agaram2016-09-123-6/+8
|
* 3343Kartik K. Agaram2016-09-124-35/+54
| | | | | Reorganize layers a bit so I can add a couple of scenarios testing static dispatch *before* I add `stash` into the mix.
* 3342Kartik K. Agaram2016-09-121-1/+8
|
* 3341Kartik K. Agaram2016-09-1215-35/+58
| | | | | | | Process type abbreviations in function headers. Still a couple of places where doing this causes strange errors. We'll track those down next.
* 3340Kartik K. Agaram2016-09-123-0/+0
| | | | | | | | Rename files to be consistent with my (forgotten) convention of always using underscores over hyphens. I'll leave server-socket.mu alone for now, since Stephen's hacking on it.
* 3339Kartik K. Agaram2016-09-122-1/+2
| | | | Fix a couple of failing example programs.
* 3338Kartik K. Agaram2016-09-1212-16/+41
| | | | Process type abbreviations in container definitions.
* 3337 - first use of type abbreviations: textKartik K. Agaram2016-09-1235-968/+971
| | | | | In the process I've uncover a couple of situations we don't support type abbreviations yet. They're next.
* 3336Kartik K. Agaram2016-09-111-4/+0
|
* 3335Kartik K. Agaram2016-09-113-16/+26
| | | | | | | | Clean up rest of long-standing bit of ugliness. I'm growing more confident now that I can use layers to cleanly add any functionality I want. All I need is hook functions. No need to ever put '{' on their own line, or add arguments to calls.
* 3334Kartik K. Agaram2016-09-112-8/+6
| | | | Clean up one long-standing bit of ugliness.
* 3333Kartik K. Agaram2016-09-111-3/+0
|
* 3332Kartik K. Agaram2016-09-111-2/+2
|
* 3331Kartik K. Agaram2016-09-111-23/+26
|
* 3330Kartik K. Agaram2016-09-111-0/+7
| | | | Fix CI #2: memory leaks.
* 3329Kartik K. Agaram2016-09-111-4/+4
| | | | Fix CI.
* 3328Kartik K. Agaram2016-09-111-1/+0
|
* 3327Kartik K. Agaram2016-09-117-10/+9
|
* 3326Kartik K. Agaram2016-09-111-0/+8
|
* 3325Kartik K. Agaram2016-09-111-2/+14
|
* 3324 - completely redo type abbreviationsKartik K. Agaram2016-09-115-81/+157
| | | | | | | | | | | | | | | | | | | | | | | | | The old approach with '&' and '@' modifiers turned out to be a bad idea because it introduces notions of precedence. Worse, it turns out you want different precedence rules at different times as the old test alluded: x:@number:3 # we want this to mean (address number 3) x:address:@number # we want this to mean (address array number) Instead we'll give up and focus on a single extensible mechanism that allows us to say this instead: x:@:number:3 x:address:@:number In addition it allows us to shorten other types as well: x:&:@:num type board = &:@:&:@:char # for tic-tac-toe Hmm, that last example reminds me that we don't handle abbreviations inside type abbreviation definitions so far..
* 3323 - Add simple network primitivesStephen Malina2016-09-112-0/+180
| | | | | | | | | | | | | | Includes four Mu functions: - $socket: Creates the C structure for a socket and tries to bind and listen on a user-provided port. - $accept: Returns a number pointer to a new socket session. Should be called with the result of $socket. - $read-from-socket: Read one character from the socket, passed in as a Mu number. Should only be called after calling $socket and $accept. - $close-socket: Takes two parameters, one for the result of $socket and one for the result of $accept, closing both sockets and releasing bound ports.
* 3322Kartik K. Agaram2016-09-111-2/+2
|
* 3321Kartik K. Agaram2016-09-103-18/+34
| | | | | | | | | | | Clean up another case (after commit 3309) of premature support for shape-shifting recipes, where early layers had code without corresponding tests. One addendum to commit 3309: the proximal cause for triggering the rewrite of type_trees was that I realized to_string() and variants were lying to me while debugging; they couldn't distinguish between `(a . b)` and `((a) . b)`