about summary refs log tree commit diff stats
path: root/020run.cc
Commit message (Collapse)AuthorAgeFilesLines
* 3201Kartik K. Agaram2016-08-161-1/+1
|
* 3200Kartik K. Agaram2016-08-161-1/+1
|
* 3199Kartik K. Agaram2016-08-161-2/+5
| | | | | | | | | Never mind, just close your nose and replace that function parameter with a global variable. This may not always be the solution for the problem of layers being unable to add parameters and arguments, but here it works well and it's unclear what problems the global might cause.
* 3197Kartik K. Agaram2016-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace an integer with a boolean across two layers of function calls. It has long been one of the ugliest consequences of my approach with layers that functions might need to be introduced with unnecessary arguments simply because we have no clean way to add parameters to a function definition after the fact -- or to add the default argument corresponding to that parameter in calls. This problem is exacerbated by the redundant argument having to be passed in through multiple layers of functions. In this instance: In layer 20 we define write_memory with an argument called 'saving_instruction_products' which isn't used yet. In layer 36 we reveal that we use this argument in a call to should_update_refcounts_in_write_memory() -- where it is again not used yet. Layer 43 finally clarifies what we're shooting for: a) In general when we need to update some memory, we always want to update refcounts. b) The only exception is when we're reclaiming locals in a function that set up its stack frame using 'local-scope' (signalling that it wants immediate reclamation). At that point we avoid decrementing refcounts of 'escaping' addresses that are being returned, and we also avoid incrementing refcounts of products in the caller instruction. The latter case is basically why we need this boolean and its dance across 3 layers. In summary, write_memory() needs to update refcounts except if: we're writing products for an instruction, the instruction is not a primitive, and the (callee) recipe for the instruction starts with 'local-scope'.
* 3196Kartik K. Agaram2016-08-161-1/+1
|
* 3171 - new commandline flag: --traceKartik K. Agaram2016-08-121-2/+11
| | | | | | | | The edit/ app without tracing turned on takes 22s to load up a reasonably complex file and run 12 scenarios. Turn on tracing, and it takes 68s. Turn on tracing just for app-level stashes, and it still takes 40s. That's too much overhead, so let's keep it turned off by default but give students an option to enable it at the commandline.
* 3137Kartik K. Agaram2016-07-221-2/+2
| | | | | | | | | | | | | | | | | | Complicated logic to not run core tests. I only want to disable core tests if: a) I'm changing CFLAGS on the commandline (usually to disable optimizations, causing tests to run slower in a debug cycle) b) I'm not printing a help message (either with just 'mu' or 'mu --help') c) I'm loading other files besides just the core. Under these circumstances I only want to run tests in the files explicitly loaded at the commandline. This is all pretty hairy, in spite of my attempts to document it in four different places. I might end up taking it all out the first time I need to run core tests under all these conditions.
* 3110 - better support static arrays in containersKartik K. Agaram2016-07-111-1/+1
|
* 3101 - purge .traces/ dir from repo historyKartik K. Agaram2016-07-051-4/+4
| | | | | | | | | | | | | | | | | | | | | I'd been toying with this idea for some time now given how large the repo had been growing. The final straw was noticing that people cloning the repo were having to wait *5 minutes*! That's not good, particularly for a project with 'tiny' in its description. After purging .traces/ clone time drops to 7 seconds in my tests. Major issue: some commits refer to .traces/ but don't really change anything there. That could get confusing :/ Minor issues: a) I've linked inside commits on GitHub like a half-dozen times online or over email. Those links are now liable to eventually break. (I seem to recall GitHub keeps them around as long as they get used at least once every 60 days, or something like that.) b) Numbering of commits is messed up because some commits only had changes to the .traces/ sub-directory.
* 3060Kartik K. Agaram2016-06-171-3/+3
|
* 3051Kartik K. Agaram2016-06-121-0/+2
|
* 3027Kartik K. Agaram2016-06-021-2/+2
|
* 2990Kartik K. Agaram2016-05-201-3/+3
| | | | | | | | | | Standardize quotes around reagents in error messages. I'm still sure there's issues. For example, the messages when type-checking 'copy'. I'm not putting quotes around them because in layer 60 I end up creating dilated reagents, and then it's a bit much to have quotes and (two kinds of) brackets. But I'm sure I'm doing that somewhere..
* 2973 - reclaim refcounts for local scopes againKartik K. Agaram2016-05-181-4/+3
| | | | | | More thorough redo of commit 2767 (Mar 12), which was undone in commit 2810 (Mar 24). It's been a long slog. Next step: write a bunch of mu code in the edit/ app in search of bugs.
* 2932Kartik K. Agaram2016-05-061-6/+6
| | | | | | | More consistent labeling of waypoints. Use types only when you need to distinguish between function overloadings. Otherwise just use variable names unless it's truly not apparent what they are (like that the result is a recipe in "End Rewrite Instruction").
* 2931 - be explicit about making copiesKartik K. Agaram2016-05-061-4/+6
|
* 2882 - warn if programmer overuses transform_all()Kartik K. Agaram2016-04-281-0/+1
| | | | | | | | | | | | | | | | | | | | This continues a line of thought sparked in commit 2831. I spent a while trying to avoid calling size_of() at transform-time, but there's no getting around the fact that translating names to addresses requires knowing how much space they need. This raised the question of what happens if the size of a container changes after a recipe using it is already transformed. I could go down the road of trying to detect such situations and redoing work, but that massively goes against the grain of my original design, which assumed that recipes don't get repeatedly transformed. Even though we call transform_all() in every test, in a non-testing run we should be loading all code and calling transform_all() just once to 'freeze-dry' everything. But even if we don't want to support multiple transforms it's worth checking that they don't occur. This commit does so in just one situation. There are likely others.
* 2864 - replace all address:shared with just addressKartik K. Agaram2016-04-241-1/+1
| | | | | | | Now that we no longer have non-shared addresses, we can just always track refcounts for all addresses. Phew!
* 2862Kartik K. Agaram2016-04-241-1/+1
| | | | | Layers 0-29 are now a complete rudimentary platform except for pointers and indirection.
* 2827 - start replacing 'get-address' with 'put'Kartik K. Agaram2016-04-101-0/+1
| | | | | | | Current plan: - get rid of get-address and index-address, and therefore any address that is not address:shared - rename address:shared to just 'shared'
* 2816Kartik K. Agaram2016-03-271-1/+0
| | | | Move all bounds checks for types and recipes to one place.
* 2803Kartik K. Agaram2016-03-211-11/+7
| | | | | Show more thorough information about instructions in the trace, but keep the original form in error messages.
* 2800 - remove a gotcha when writing testsKartik K. Agaram2016-03-201-1/+6
| | | | | | | | | Several times now I've wasted time tracking down a failing test only to eventually remember that order of definition matters in tests even though it doesn't elsewhere -- I've been having tests implicitly start running the first function defined in them. Now I stop doing that if a test defines a function called 'main', and just start the test at main instead.
* 2799 - new approach to undoing changes in testsKartik K. Agaram2016-03-201-11/+8
| | | | | | | | As outlined at the end of 2797. This worked out surprisingly well. Now the snapshotting code touches fewer layers, and it's much better behaved, with less need for special-case logic, particularly inside run_interactive(). 30% slower, but should hopefully not cause any more bugs.
* 2797 - bugfix: transform can create recipesKartik K. Agaram2016-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | When I started to make channels generic in 2784, I introduced an infinite loop when running until just layer 72. This happens because transform_all() can create new recipes while specializing, and these were getting added to Recently_added_recipes and then deleted. I didn't notice until now because layer 91 was clearing Recently_added_recipes soon after. Solution: make calls to transform_all after calls to load_permanently also clear Recently_added_recipes like load_permanently does. No transforms yet create new types. If they do we'll need to start handling the other Recently_added_* variables as well. I should rethink this whole approach of tracking changes to global state while running tests, and undoing such changes. Ideally I wouldn't need to manually track changes for each global. I should just encapsulate all global state in an object, copy it for each test and delete the copy when I'm done.
* 2792Kartik K. Agaram2016-03-191-0/+1
|
* 2773 - switch to 'int'Kartik K. Agaram2016-03-131-16/+16
| | | | This should eradicate the issue of 2771.
* 2772 - fix all layersKartik K. Agaram2016-03-131-0/+5
|
* 2765Kartik K. Agaram2016-03-121-9/+9
| | | | | Get rid of a local variable that was only serving to render unreadable the code for reclaiming allocated memory.
* 2762Kartik K. Agaram2016-03-121-1/+1
|
* 2735 - define recipes using 'def'Kartik K. Agaram2016-03-081-10/+10
| | | | | | | | | | | | I'm dropping all mention of 'recipe' terminology from the Readme. That way I hope to avoid further bike-shedding discussions while I very slowly decide on the right terminology with my students. I could be smarter in my error messages and use 'recipe' when code uses it and 'function' otherwise. But what about other words like ingredient? It would all add complexity that I'm not yet sure is worthwhile. But I do want separate experiences for veteran programmers reading about Mu on github and for people learning programming using Mu.
* 2712Kartik K. Agaram2016-02-261-5/+5
|
* 2707Kartik K. Agaram2016-02-251-1/+0
|
* 2691Kartik K. Agaram2016-02-231-2/+0
|
* 2690 - one more memory leakKartik K. Agaram2016-02-221-2/+2
| | | | | | | This is the easy one. The remaining ones are like phantoms popping up and dying at random. One thing I know is that they all have to do with tangling. Always implicated is the line in the tangle layer where instructions are loaded and inserted into After_fragments.
* 2685Kartik K. Agaram2016-02-191-4/+4
| | | | | | | | | | | | | | | | Stack of plans for cleaning up replace_type_ingredients() and a couple of other things, from main problem to subproblems: include type names in the type_tree rather than in the separate properties vector make type_tree and string_tree real cons cells, with separate leaf nodes redo the vocabulary for dumping various objects: do we really need to_string and debug_string? can we have a version with *all* information? can we have to_string not call debug_string? This commit nibbles at the edges of the final task, switching from member method syntax to global function like almost everything else. I'm mostly using methods just for STL in this project.
* 2663Kartik K. Agaram2016-02-161-6/+1
|
* 2649Kartik K. Agaram2016-02-111-0/+2
| | | | More tweaks to the trace after all my debugging.
* 2610 - warn when recipes don't use default-spaceKartik K. Agaram2016-01-271-0/+2
| | | | Somehow this never transferred over from the Arc version until now.
* 2609 - reuse test-recipe variables in sandbox/ testsKartik K. Agaram2016-01-271-0/+1
| | | | | | | | I'd feared that the refcount errors in the previous commit meant there was a bug in my ref-counting, so I temporarily used new variables rather than reusing existing ones. But it turns out the one remaining place memory corruption can happen is when recipes don't use default-scope and so end up sharing memory. Don't I have a warning for this?
* 2583 - start maintaining refcountsKartik K. Agaram2016-01-211-1/+3
| | | | | | | | | | | | Also start auto-abandoning addresses when their refcount returns to 0. I'm mixing this auto-abandon support with my earlier/hackier support for automatically abandoning default-space created by 'local-scope'. We need to flesh out the story for automatically reclaiming memory using C++-style destructors. But that's a value-add. Memory corruption is far more important to avoid than memory *leaks*.
* 2579Kartik K. Agaram2016-01-201-0/+1
| | | | Separate core mu tests from those loaded from the commandline.
* 2557 - type-check most ingredients ahead of timeKartik K. Agaram2016-01-121-0/+1
|
* 2622Kartik K. Agaram2015-12-131-1/+1
|
* 2478Kartik K. Agaram2015-11-271-3/+3
|
* 2461Kartik K. Agaram2015-11-191-4/+2
|
* 2416Kartik K. Agaram2015-11-101-1/+1
|
* 2406Kartik K. Agaram2015-11-081-0/+4
| | | | | One new issue: the traces for all tests are perturbed by the .mu files we choose to load.
* 2398Kartik K. Agaram2015-11-081-2/+2
|
* 2396 - edit working again!!Kartik K. Agaram2015-11-081-2/+2
| | | | | | | | | | | Still some spurious warnings. This was an insane experience building out generics. Time to reflect. Where did I go wrong? How did I end up writing no tests? Let's take some time and go over the last 50 commits with a fine-tooth comb. Generics seems to be the feature that has moved mu from a VM project to a compiler project.