Commit Graph

51 Commits

Author SHA1 Message Date
Kartik Agaram
23d3a02226 4266 - space for alloc-id in heap allocations
This has taken me almost 6 weeks :(
2018-06-24 09:18:20 -07:00
Kartik Agaram
ce9b2b0515 4258 - undo 4257 2018-06-15 22:16:09 -07:00
Kartik Agaram
0edd9b9fc6 4257 - abortive attempt at safe fat pointers
I've been working on this slowly over several weeks, but it's too hard
to support 0 as the null value for addresses. I constantly have to add
exceptions for scalar value corresponding to an address type (now
occupying 2 locations). The final straw is the test for 'reload':

  x:num <- reload text

'reload' returns an address. But there's no way to know that for
arbitrary instructions.

New plan: let's put this off for a bit and first create support for
literals. Then use 'null' instead of '0' for addresses everywhere. Then
it'll be easy to just change what 'null' means.
2018-06-15 22:12:03 -07:00
Kartik K. Agaram
acce384bcc 4179 - experiment: rip out memory reclamation
I have a plan for a way to avoid use-after-free errors without all the
overheads of maintaining refcounts. Has the nice side-effect of
requiring manual memory management. The Mu way is to leak memory by
default and build tools to help decide when and where to expend effort
plugging memory leaks. Arguably programs should be distributed with
summaries of their resource use characteristics.

Eliminating refcount maintenance reduces time to run tests by 30% for
`mu edit`:

              this commit                 parent
  mu test:         3.9s                        4.5s
  mu test edit:  2:38                        3:48

Open questions:
  - making reclamation easier; some sort of support for destructors
  - reclaiming local scopes (which are allocated on the heap)
    - should we support automatically reclaiming allocations inside them?
2018-01-03 00:44:09 -08:00
Kartik K. Agaram
504292f6f1 4106 2017-11-03 18:01:59 -07:00
Kartik K. Agaram
7d07cd1de8 3987 2017-09-01 01:50:10 -07:00
Kartik K. Agaram
ec99eb7a2a 3966 2017-07-09 14:34:17 -07:00
Kartik K. Agaram
e80fd05f4e 3937
Fix screen-checking functions to handle fake screen after scrolling.
I can't believe I forgot about this during commit 3882.
2017-06-22 10:29:38 -07:00
Kartik K. Agaram
3e31f29a5b 3907 - standardize test failure messages 2017-06-15 10:45:03 -07:00
Kartik K. Agaram
2b25071710 3877 2017-05-26 17:36:16 -07:00
Kartik K. Agaram
1211a3ab30 3643
Standardize on calling literate waypoints "Special-cases" rather than
"Cases". Invariably there's a default path already present.
2016-11-07 09:10:48 -08:00
Kartik K. Agaram
9a81d7460f 3561 2016-10-22 16:56:07 -07:00
Kartik K. Agaram
dddc384c51 3531
Be consistent in checking for Scenario_testing_scenario when signalling
that a Mu scenario failed.
2016-10-20 20:19:29 -07:00
Kartik K. Agaram
6c96a437ce 3522 2016-10-19 22:10:35 -07:00
Kartik K. Agaram
dd995c6174 3503
Undo commit 3500; turns out we need the duplicate scenario names for
good test failure messages.
2016-10-15 22:16:30 -07:00
Kartik K. Agaram
392249a76d 3501 2016-10-15 20:59:26 -07:00
Kartik K. Agaram
f510af3bae 3500 2016-10-15 20:57:43 -07:00
Kartik K. Agaram
6f65d5918f 3429 - standardize Mu scenarios
A long-standing problem has been that I couldn't spread code across
'run' blocks because they were separate scopes, so I've ended up making
them effectively comments. Running code inside a 'run' block is
identical in every way to simply running the code directly. The 'run'
block is merely a visual aid to separate setup from the component under
test.

In the process I've also standardized all Mu scenarios to always run in
a local scope, and only use (raw) numeric addresses for values they want
to check later.
2016-09-28 19:48:56 -07:00
Kartik K. Agaram
0f2781f8a2 3393 2016-09-17 14:43:13 -07:00
Kartik K. Agaram
a0331a9b0e 3390 2016-09-17 13:00:39 -07:00
Kartik K. Agaram
760f683f27 3389 2016-09-17 12:55:10 -07:00
Kartik K. Agaram
7a84094adb 3385 2016-09-17 10:28:25 -07:00
Kartik K. Agaram
08f4628e8b 3379
Can't use type abbreviations inside 'memory-should-contain'.
2016-09-17 00:31:55 -07:00
Kartik K. Agaram
78c5020531 3374 2016-09-16 23:57:55 -07:00
Kartik K. Agaram
5f05e954ee 3273
Undo 3272. The trouble with creating a new section for constants is that
there's no good place to order it since constants can be initialized
using globals as well as vice versa. And I don't want to add constraints
disallowing either side.

Instead, a new plan: always declare constants in the Globals section
using 'extern const' rather than just 'const', since otherwise constants
implicitly have internal linkage (http://stackoverflow.com/questions/14894698/why-does-extern-const-int-n-not-work-as-expected)
2016-08-28 18:37:57 -07:00
Kartik K. Agaram
c7fde8d4e4 3272
Move global constants into their own section since we seem to be having
trouble linking in 'extern const' variables when manually cleaving mu.cc
into separate compilation units.
2016-08-28 17:08:01 -07:00
Kartik K. Agaram
3f41cca67e 3251
Replace some asserts when checking scenario screens with better error
messages.
2016-08-25 11:24:25 -07:00
Kartik K. Agaram
4b0db8a764 3250 2016-08-25 11:02:50 -07:00
Kartik K. Agaram
bc98ddb2b6 3229 - fake file systems using 'assume-filesystem'
Built with Stephen Malina.
2016-08-20 17:51:58 -07:00
Kartik K. Agaram
7cc017e545 3226 2016-08-18 21:13:22 -07:00
Kartik K. Agaram
639922e869 3178 2016-08-13 21:18:53 -07:00
Kartik K. Agaram
4cb5b56763 3126 2016-07-22 14:13:25 -07:00
Kartik K. Agaram
8d72e56521 3120
Always show instruction before any transforms in error messages.

This is likely going to make some errors unclear because they *need* to
show the original instruction. But if we don't have tests for those
situations did they ever really work?
2016-07-21 19:22:03 -07:00
Kartik K. Agaram
a9a2f7db59 3108 2016-07-10 21:47:24 -07:00
Kartik K. Agaram
e8eea70ab1 3025 - fix a minor annoyance in edit/
When I floor the down-arrow too much, don't scroll unnecessarily off the
bottom of the screen. But *do* scroll if there's errors to show.
2016-05-29 13:37:02 -07:00
Kartik K. Agaram
607ddf3391 2983 - migrate buttons over to sandbox/ 2016-05-19 21:35:34 -07:00
Kartik K. Agaram
b0bf5321de 2864 - replace all address:shared with just address
Now that we no longer have non-shared addresses, we can just always
track refcounts for all addresses.

Phew!
2016-04-24 11:54:30 -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
d1b8d5eeb2 2771 - fix for clang on 32-bit machines
Turns out that LLVM/Clang still doesn't support multiplying 64-bit
numbers on a 32-bit platform.
  https://llvm.org/bugs/show_bug.cgi?id=14469

This is just a quick fix, because it turns out I don't have any integer
multiplication anywhere else. In the long run I think I'm going to just
drop 'long long int' in favor of 'int'. Overflow is less likely than
this configuration on somebody's machine.
2016-03-13 20:13:55 -07:00
Kartik K. Agaram
1ead356219 2735 - define recipes using 'def'
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.
2016-03-08 01:46:47 -08:00
Kartik K. Agaram
1b76245c63 2712 2016-02-26 13:04:55 -08:00
Kartik K. Agaram
a3a0574f17 2709
Only Hide_errors when strictly necessary. In other places let test
failures directly show the unexpected error.
2016-02-25 22:08:27 -08:00
Kartik K. Agaram
d0e29245f9 2707 2016-02-25 20:47:42 -08:00
Kartik K. Agaram
263e6b2a9f 2581 - make space for the refcount in address:shared
We don't yet actually maintain the refcount. That's next.

Hardest part of this was debugging the assume-console scenarios in layer
85. That took some detailed manual diffing of traces (because the output
of diff was no good).

New tracing added in this commit add 8% to .traces LoC. Commented out
trace() calls (used during debugging) make that 45%.
2016-01-20 20:47:54 -08:00
Kartik K. Agaram
455fbac64f 2576 - distinguish allocated addresses from others
This is the one major refinement on the C programming model I'm planning
to introduce in mu. Instead of Rust's menagerie of pointer types and
static checking, I want to introduce just one new type, and use it to
perform ref-counting at runtime.

So far all we're doing is updating new's interface. The actual
ref-counting implementation is next.

One implication: I might sometimes need duplicate implementations for a
recipe with allocated vs vanilla addresses of the same type. So far it
seems I can get away with just always passing in allocated addresses;
the situations when you want to pass an unallocated address to a recipe
should be few and far between.
2016-01-19 23:18:03 -08:00
Kartik K. Agaram
bbe0801ab1 2548 - teach 'print' to print integers
Still can't print non-integer numbers, so this is a bit hacky.

The big consequence is that you can't print literal characters anymore
because of our rules about how we pick which variant to statically
dispatch to. You have to save to a character variable first.

Maybe I can add an annotation to literals..
2015-12-28 08:44:36 -08:00
Kartik K. Agaram
f10584abe9 2627 2015-12-15 09:42:50 -08:00
Kartik K. Agaram
52f065c7cf 2626 2015-12-15 09:41:27 -08:00
Kartik K. Agaram
136412d263 2468 - overload print-character as just 'print' 2015-11-21 10:19:34 -08:00
Kartik K. Agaram
8a0f55cdff 2463 - make edit/ robust to errors in client code 2015-11-19 09:22:46 -08:00