Commit Graph

38 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 a89c1bed26 4104
Stop hardcoding Max_depth everywhere; we had a default value for a
reason but then we forgot all about it.
2017-11-03 01:50:46 -07:00
Kartik K. Agaram 284e557649 3894 - comment/uncomment lines in edit app 2017-05-29 02:13:43 -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 d803b68769 3565
Cleaning up the console interfaces before we start changing the socket
interfaces to look like them. Reading from sockets need to be
non-blocking just like reading from the console.
2016-10-23 15:50:57 -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 30c90fc4c7 3502
Better implementation of commit 3445: not requiring types for special
variables in scenarios. It turned out that it wasn't working anytime we
needed to call 'get' on a special variable inside a scenario. After
moving that work to an earlier transform we can now use 'filesystem'
without a type inside scenarios.
2016-10-15 21:12:30 -07:00
Kartik K. Agaram f510af3bae 3500 2016-10-15 20:57:43 -07:00
Kartik K. Agaram 55479bc29d 3445
Ugly that we didn't need 'screen' to provide a type in scenarios
(because assume-screen expands to a definition of 'screen') but we did
need a type for 'console'. Just never require types for special names in
scenarios.
2016-10-06 10:52:37 -07:00
Kartik K. Agaram 760f683f27 3389 2016-09-17 12:55:10 -07:00
Kartik K. Agaram d52406ccd9 3381 2016-09-17 00:46:03 -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 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 2efceef6c1 3260
array length = number of elements
array size = in locations
2016-08-26 13:47:39 -07:00
Kartik K. Agaram 7fd010710c 3259
Prefer preincrement operators wherever possible. Old versions of
compilers used to be better at optimizing them. Even if we don't care
about performance it's useful to make unary operators look like unary
operators wherever possible, and to distinguish the 'statement form'
which doesn't care about the value of the expression from the
postincrement which usually increments as a side-effect in some larger
computation (and so is worth avoiding except for some common idioms, or
perhaps even there).
2016-08-26 13:40:19 -07:00
Kartik K. Agaram e33b0815d4 3241
Use allocate() in 'assume-console'.
2016-08-21 08:43:01 -07:00
Kartik K. Agaram 1ca9f3260b 3240 2016-08-21 08:40:01 -07:00
Kartik K. Agaram f40137f132 3239 2016-08-21 08:38:20 -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 639922e869 3178 2016-08-13 21:18:53 -07:00
Kartik K. Agaram 3259784417 3083 2016-07-01 22:34:50 -07:00
Kartik K. Agaram 9dcbec398c 2990
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..
2016-05-20 22:11:34 -07:00
Kartik K. Agaram 56c0e796ef 2973 - reclaim refcounts for local scopes again
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.
2016-05-18 16:45:32 -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 d8f2d0b130 2767 - reclaim refcounts for local variables
This uncovered a second bug (besides 2766) -- I was manually doing the
work of 'new-fake-console' inside 'assume-console' but forgetting to
increment a refcount.
2016-03-12 20:41:35 -08:00
Kartik K. Agaram 1b76245c63 2712 2016-02-26 13:04:55 -08:00
Kartik K. Agaram 343bc5359b 2677
Include type names in the type tree. Though we aren't using them yet.
2016-02-20 08:54: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 c603cd6cef 2430 - make room for more transforms 2015-11-13 10:08:57 -08:00