Commit Graph

35 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
377b00b045 4265
Standardize use of type ingredients some more.
2018-06-17 19:53:52 -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
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
1441e507b6 3917
Redo commit 3905 to always shutdown cleanly on any error raised.
2017-06-16 16:56:29 -07:00
Kartik K. Agaram
b56c564c05 3909
In tests where a text has the wrong length, properly show the text
observed to help debug failures.

We now also consistently say 'text' in Mu errors, never 'string'.

Thanks Ella Couch for reporting this long-standing issue.
2017-06-15 11:11:42 -07:00
Kartik K. Agaram
909adb27f9 3905
Standardize exit paths. Most layers now don't need to know about termbox.

We can't really use `assert` in console-mode apps; it can't just exit because
we want to be able to check assertion failures in tests.
2017-06-10 15:41:42 -07:00
Kartik K. Agaram
2b25071710 3877 2017-05-26 17:36:16 -07:00
Kartik K. Agaram
2c91ac0c6a 3847
Fix a crash on an invalid program. Thanks Lakshman Swaminathan for reporting
this issue.
2017-05-06 21:35:46 -07:00
Kartik K. Agaram
2b37bbeae2 3809 2017-04-04 00:10:47 -07:00
Kartik K. Agaram
797edfd041 3799 2017-03-18 20:44:48 -07:00
Kartik K. Agaram
6515192306 3694
Fix CI, broken by commit 3691.
2016-11-26 20:44:52 -08:00
Kartik K. Agaram
4b424bb245 3678 - complain about string labels
Thanks Jack Couch for running into this.
2016-11-15 23:29:19 -08:00
Kartik K. Agaram
17401c3854 3671 - support text in '$print' 2016-11-12 01:05:38 -08:00
Kartik K. Agaram
e41e8e09e6 3669 2016-11-11 23:30:37 -08:00
Kartik K. Agaram
aa3d29a566 3668 - $read a word, stopping at whitespace
Useful for programming contests like https://halite.io

Doesn't suffer from C++'s usual buffered gotchas: it'll skip leading
whitespace. Slow, though. Can be speeded up, though.

- 20 minutes later
But what's the point? Typewriter mode is actually harder to test than
'raw' console mode. Writing Mu programs in typewriter mode is just going
to encourage us all to slack off on writing tests.
2016-11-11 23:04:01 -08:00
Kartik K. Agaram
9a81d7460f 3561 2016-10-22 16:56:07 -07:00
Kartik K. Agaram
6c96a437ce 3522 2016-10-19 22:10:35 -07:00
Kartik K. Agaram
0f2781f8a2 3393 2016-09-17 14:43:13 -07:00
Kartik K. Agaram
192d59d3bb 3380
One more place we were missing expanding type abbreviations: inside
container definitions.
2016-09-17 00:43:20 -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
7c9def3c5a 3376 - start maximally using all type abbreviations
It might be too much, particularly if students start peeking inside .mu
files early. But worth a shot for not just to iron out the kinks in the
abbreviation system.
2016-09-17 00:06:04 -07:00
Kartik K. Agaram
14b0932a54 3375 2016-09-17 00:01:45 -07:00
Kartik K. Agaram
78c5020531 3374 2016-09-16 23:57:55 -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
ad2604e893 3257 2016-08-26 11:47:10 -07:00
Kartik K. Agaram
0230a6cc0b 3256
Bugfix in filesystem creation. I'm sure there are other fake-filesystem
bugs.
2016-08-26 11:27:13 -07:00
Kartik K. Agaram
a41f84c5c9 3079 2016-06-29 16:08:13 -07:00
Kartik K. Agaram
d9630e06d8 3074
Thanks Ella Couch for finding this bug.
2016-06-29 09:49:35 -07:00
Kartik K. Agaram
5f0280a90d 2998 2016-05-24 18:32:18 -07:00
Kartik K. Agaram
43b866d199 2932
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").
2016-05-06 08:33:15 -07:00
Kartik K. Agaram
b96c0763f8 2895 2016-05-03 10:18:05 -07:00