Commit Graph

41 Commits

Author SHA1 Message Date
Kartik K. Agaram 848ebc1e63 3760 - force functions to use dependency-injection
This is the kind of check I want Mu to be anal about, not whitespace or
unused variables.
2017-03-07 00:36:58 -08:00
Kartik K. Agaram 9a81d7460f 3561 2016-10-22 16:56:07 -07:00
Kartik K. Agaram d8509b4175 3555 2016-10-22 16:10:23 -07:00
Kartik K. Agaram 6c96a437ce 3522 2016-10-19 22:10:35 -07:00
Kartik K. Agaram 5813bcfc7d 3520
Drop a few debug prints. Hopefully now we need never duplicate trace
statements and can instead just dump them to screen.

I'll soon need the ability to selectively dump traces for a specific
label.
2016-10-18 10:44:40 -07:00
Kartik K. Agaram 38e96056e4 3437
Drop an ancient case of premature optimization: skipping transform for
recipes without bodies. These days recipes also have headers that need
transforming.

Thanks Caleb Couch for running into this issue.
2016-10-04 09:13:25 -07:00
Kartik K. Agaram 1ec3eb4cd8 3436 2016-10-04 08:34:49 -07:00
Kartik K. Agaram 8a92ada807 3435 2016-10-04 08:18:43 -07:00
Kartik K. Agaram 7858a06a54 2882 - warn if programmer overuses transform_all()
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.
2016-04-28 17:36:30 -07:00
Kartik K. Agaram 7cca03bd11 2815 2016-03-27 22:03:13 -07:00
Kartik K. Agaram 2429c65cce 2799 - new approach to undoing changes in tests
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.
2016-03-20 00:55:33 -07:00
Kartik K. Agaram 1f69d061c1 2797 - bugfix: transform can create recipes
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.
2016-03-19 11:57:47 -07:00
Kartik K. Agaram d97bafd318 2796 2016-03-19 11:49:55 -07:00
Kartik K. Agaram f1e09b1472 2775 - test rewrite-stash transform 2016-03-13 23:09:40 -07:00
Kartik K. Agaram b24eb4766a 2773 - switch to 'int'
This should eradicate the issue of 2771.
2016-03-13 20:26:47 -07:00
Kartik K. Agaram a70ce31113 2728 - don't ignore /space: while checking types 2016-03-04 19:22:09 -08:00
Kartik K. Agaram 215365d427 2494
Some more structure to transforms, and flattening of dependencies
between them.
2015-11-28 22:17:47 -08:00
Kartik K. Agaram 322ce34d77 2458 - edit/: recipe side free of sandbox errors
This is happening because of our recent generic changes, which trigger
some post-processing transforms on all recipes even if we processed them
before. We could clear 'interactive' inside 'reload' to avoid this, but
random 'run' blocks in scenarios can still pick up errors from sandboxes
earlier in a scenario. The right place to clear the 'interactive' recipe
is right after we use it, in run_code_end().
2015-11-18 11:35:24 -08:00
Kartik K. Agaram 91abd257e2 2393 - redo 2391
Got that idea to work with a special-case for 'new'. Requires parsing
new's first ingredient, performing the replacement, and then turning it
back into a string. I didn't want to replace NEW with ALLOCATE right
here, because then it messes with my invariant that transform should
never see a naked ALLOCATE.

Layer 11 still not working, but everything else is. Let's clean up
before we diagnose the new breakage.
2015-11-07 22:56:06 -08:00
Kartik K. Agaram 82c886d71c 2392 - undo 2391
Yup, type ingredients were taking size 1 by default.
2015-11-07 22:31:35 -08:00
Kartik K. Agaram 562ceed016 2391
No, my idea was abortive. My new plan was to run no transforms for
generic recipes, and instead only run them on concrete specializations
as they're created.

The trouble with this approach is that new contains a type specification
in its ingredient which apparently needed to be transformed into an
allocate before specialization.

But no, how was that working? How was new computing size based on type
ingredients? It might have been wrong all along.
2015-11-07 22:26:00 -08:00
Kartik K. Agaram 57d01f212c 2382
Starting to leave commented out prints again out of desperation.
2015-11-06 17:03:02 -08:00
Kartik K. Agaram b0403c1888 2374 - now edit works until layer 8 2015-11-05 14:17:31 -08:00
Kartik K. Agaram 8389d168e4 2373 - bad bug: instruction was losing /lookup 2015-11-05 14:13:26 -08:00
Kartik K. Agaram c8cbda012f 2364 2015-11-05 00:12:29 -08:00
Kartik K. Agaram 5a4810855d 2358 - starting to tackle the phase ordering problem
A new externality is starting to make its presence felt.

Until I sort this out it's going to be hard to finish making duplex-list
generic.
2015-11-04 23:35:21 -08:00
Kartik K. Agaram df40cb6e4d 2316 - preparing for static dispatch 2015-10-29 13:01:04 -07:00
Kartik K. Agaram dd2e01e43e 2311 2015-10-29 11:56:10 -07:00
Kartik K. Agaram 0d9d275314 2154 - check types only after loading all layers
Follow-up to 2147, which switched transform_all to only run once, after
loading all layers.
2015-09-05 11:23:20 -07:00
Kartik K. Agaram 6c1376f830 2095
Finally terminate the experiment of keeping debug prints around. I'm
also going to give up on maintaining counts.

What we really need is two kinds of tracing:
  a) For tests, just the domain-specific facts, organized by labels.
  b) For debugging, just transient dumps to stdout.
b) only works if stdout is clean by default.

Hmm, I think this means 'stash' should be the transient kind of trace.
2015-08-28 23:25:21 -07:00
Kartik K. Agaram 363be37f3f 1702 - experiment: start using 'ordinal' in names
It comes up pretty early in the codebase, but hopefully won't come up
in the mu level until we get to higher-order recipes. Potentially
intimidating name, but such prime real estate with no confusing
overloadings in other projects!
2015-07-04 09:40:50 -07:00
Kartik K. Agaram 7f73795cf5 1699 - first-class recipe types
It should now be easy to do dynamic dispatch, create higher-order
functions, etc.
2015-07-03 19:38:21 -07:00
Kartik K. Agaram 6152ef13a8 1399 - better 'unknown type' warnings
Implement warnings for types without definitions without constraining
where type definitions must appear.

We also eliminate the anti-pattern where a change in layer 10 had its
test in layer 11 (commit 1383).
2015-05-18 18:40:58 -07:00
Kartik K. Agaram ac0e9db526 1391 - avoid unsigned integers 2015-05-17 02:22:41 -07:00
Kartik K. Agaram 0f125d5ff1 1387 2015-05-16 21:24:21 -07:00
Kartik K. Agaram 827898fc1b 1357 - temporarily revert floating-point support 2015-05-12 17:10:33 -07:00
Kartik K. Agaram 3663ca6c2d 1356 - snapshot #2: floating point support
I added one test to check that divide can return a float, then hacked at
the rippling failures across the entire entire codebase until all tests
pass. Now I need to look at the changes I made and see if there's a
system to them, identify other places that I missed, and figure out the
best way to cover all cases. I also need to show real rather than
encoded values in the traces, but I can't use value() inside reagent
methods because of the name clash with the member variable. So let's
take a snapshot before we attempt any refactoring. This was non-trivial
to get right.

Even if I convince myself that I've gotten it right, I might back this
all out if I can't easily *persuade others* that I've gotten it right.
2015-05-12 17:00:19 -07:00
Kartik K. Agaram 5798a11bf0 1343 2015-05-11 10:04:16 -07:00
Kartik K. Agaram dc1323e936 1323 - keyboard supports backspace and newline
Lots mixed into this commit:
  some off-by-one errors in display.cc
  a new transform to translate jump labels that I'd somehow never gotten around to supporting
2015-05-10 08:55:18 -07:00
Kartik K. Agaram 05d177737c 1299 - stop using [] in any vector
Useful check:

  $ grep "[^ '\"]\[[^\"]" *.cc \
    |perl -pwe 's/\Wargv\[|\WTests\[|\Wframe\[|\WMemory\[|\WName\[|\WSurrounding_space\[|\WRecipe\[|\WType\[|\WRecipe_number\[|\WType_number\[|\WBefore_fragments\[|\WAfter_fragments\[//g' \
    |perl -pwe 's/\Wargv\[|\WTests\[|\Wframe\[|\WMemory\[|\WName\[|\WSurrounding_space\[|\WRecipe\[|\WType\[|\WRecipe_number\[|\WType_number\[|\WBefore_fragments\[|\WAfter_fragments\[//g' \
    |grep '[^ ]\['
2015-05-07 15:49:40 -07:00
Kartik K. Agaram b96af395b9 1276 - make C++ version the default
I've tried to update the Readme, but there are at least a couple of issues.
2015-05-05 21:17:24 -07:00