Commit Graph

6973 Commits

Author SHA1 Message Date
Kartik Agaram
d906d5fd38 6973 2020-10-08 20:32:44 -07:00
Kartik Agaram
e9957c78da 6972 - tile: stop persisting cursor-word
Rather surprisingly, this transformation worked the first time!
2020-10-08 20:32:34 -07:00
Kartik Agaram
be11737062
Merge pull request #42 from jimmyhmiller/patch-1
Fix broken link
2020-10-08 19:15:14 -07:00
Jimmy Miller
97f4d3ed95
Fix broken link 2020-10-08 20:05:56 -04:00
Kartik Agaram
b8fd119b78 6969
Fix and cleanup.
2020-10-06 00:41:20 -07:00
Kartik Agaram
ce094a5d82 6968
Snapshot that requires a check in the Mu compiler.

Currently I don't spill a register if it could possibly be over-written
by a function output within. However, find-in-call-path is a good example
of where this constraint is too lenient and results in unsafe code. The
variable `curr` gets clobbered during loop update by the variable `match?`.

What's the answer? Perhaps we should ban all conditional updates to function
outputs? That'd be dashed inconvenient.
2020-10-06 00:36:28 -07:00
Kartik Agaram
e41bc160a0 6967
Function expand/contract still works, but the implementation is totally
different under the hood.
2020-10-05 22:21:27 -07:00
Kartik Agaram
a9e56c46c6 6966 2020-10-05 21:35:46 -07:00
Kartik Agaram
88e23b97df 6965 2020-10-05 21:32:45 -07:00
Kartik Agaram
c2844535f3 6964 - tile: start tracking word index in fn body 2020-10-05 21:22:42 -07:00
Kartik Agaram
21387ef514 6963 - tile: more idiomatic conventional repl 2020-10-05 21:09:42 -07:00
Kartik Agaram
6833b4542c 6962
Slowly hoist cursor-word from environment to sandbox. This isn't its final
destination.
2020-10-05 20:44:50 -07:00
Kartik Agaram
c626219e3f 6961 2020-10-05 20:37:47 -07:00
Kartik Agaram
5fa8e972d6 6960 2020-10-05 18:36:28 -07:00
Kartik Agaram
4f5562c243 6959 2020-10-05 11:01:25 -07:00
Kartik Agaram
d3a9db3aff 6958 2020-10-05 11:00:05 -07:00
Kartik Agaram
f13576b5d2 6957
The final fix to the raytracing program involves rounding modes. It turns
out x86 processors round floats by default, unlike C which has trained
me to expect truncation. Rather than mess with the MXCSR register, I added
another instruction for truncation. Now milestone 3 emits perfectly correct
results.
2020-10-05 10:25:25 -07:00
Kartik Agaram
bb3ce6cdea 6956 2020-10-05 10:16:46 -07:00
Kartik Agaram
fe34dc4718 6955 2020-10-05 10:12:34 -07:00
Kartik Agaram
5c3d495dbe 6954 2020-10-05 09:28:19 -07:00
Kartik Agaram
fa2092a024 6953 2020-10-05 09:26:54 -07:00
Kartik Agaram
cdff5d73ce 6952 - raytracing: much better
The image is now visually indistinguishable from the baseline, though the
file isn't quite bit-for-bit correct.

I found 3 bugs:
a) I forgot to normalize the ray. After creating a helper to "automatically"
do it for me, it turns out said helper requires manually using.
b) I forgot to multiply by t at one place.
c) vec3-length was half-written.

For the umpteenth time, the bugs were all in the last place I looked. I
was worried about spending a lot of time transcribing `main` without any
feedback, but that turned out to be perfect.
2020-10-04 23:12:21 -07:00
Kartik Agaram
00af72ccb0 6951 - 4 colors for Mu as well 2020-10-04 21:24:46 -07:00
Kartik Agaram
fbe6797c2c 6950 2020-10-04 21:16:38 -07:00
Kartik Agaram
5c105a7aca 6949 - snapshot of next raytracing milestone
Not yet right, but worth a snapshot just because it gives a cool result.
Here, try it out:
  $ ./translate_mu_debug apps/raytracing/3.mu
  $ ./a.elf > x.ppm
Now view x.ppm as an image.

In general, this was quite tedious to write. And a still-open question
is how to emit the progress bar to stderr. My options are to either duplicate
all my print-* functions (already proliferating) or add global variables
to Mu.
2020-10-04 21:15:28 -07:00
Kartik Agaram
f5e1656d15 6948 - stress-testing prints of floats
Looks good.
2020-10-04 11:55:55 -07:00
Kartik Agaram
9f182aefbe 6947 - change exponent separator since 'e' is hex 2020-10-04 11:19:23 -07:00
Kartik Agaram
b8d613e7c2 6946 - print floats somewhat intuitively in hex 2020-10-04 11:18:23 -07:00
Kartik Agaram
0371140abe 6945 2020-10-04 01:33:49 -07:00
Kartik Agaram
21ff6d831a 6944 2020-10-04 01:25:02 -07:00
Kartik Agaram
93c6352dda 6943
Move some implementation around for floating-point.

I originally thought I wouldn't bother supporting sigils like %xmm0. But
it turns out I need them to pass floats into SubX function calls. And it
turns out the sigils work fine for free.
2020-10-04 00:54:57 -07:00
Kartik Agaram
1bf5d5f44e 6942 2020-10-04 00:19:54 -07:00
Kartik Agaram
faeeef34f5 6941 - detective story for the day 2020-10-03 23:17:17 -07:00
Kartik Agaram
2f5a8496e6 6940 2020-10-03 22:55:19 -07:00
Kartik Agaram
b6cf4f1db3 6939 2020-10-03 22:53:05 -07:00
Kartik Agaram
93a4ada6a1 6938 - start colorizing floating-point registers 2020-10-03 20:29:31 -07:00
Kartik Agaram
f6eba67645 6937 2020-10-03 20:24:14 -07:00
Kartik Agaram
6112864aea 6936 2020-10-03 20:17:43 -07:00
Kartik Agaram
cce9cda971 6935 - raytracing using floats 2020-10-03 20:17:08 -07:00
Kartik Agaram
4787d7d4b8 6934 2020-10-03 20:06:27 -07:00
Kartik Agaram
7b85e97ea8 6933 2020-10-03 19:50:24 -07:00
Kartik Agaram
42500e3f47 6932 - another bug related to floats
For most of Mu's history we've selected between primitives based on types
just by checking whether a type is a literal or not. Now we've started
checking if it's a float as well. However, floats need one additional check:
the call site may have an (addr float) that is dereferenced.
2020-10-03 13:55:52 -07:00
Kartik Agaram
c2ec9e21c9 6931 - support fp registers in variable lookup 2020-10-03 12:05:53 -07:00
Kartik Agaram
8719ea906d 6930 2020-10-03 11:40:26 -07:00
Kartik Agaram
ac608bc72e 6929 2020-10-03 00:25:55 -07:00
Kartik Agaram
04dcb8f3c2 6928 2020-10-03 00:25:13 -07:00
Kartik Agaram
b94e94e035 6927 - working on a raytracing tutorial
https://raytracing.github.io/books/RayTracingInOneWeekend.html
2020-10-03 00:24:57 -07:00
Kartik Agaram
ab1cf1593a 6926 2020-10-02 09:24:16 -07:00
Kartik Agaram
4230946e6a 6925 - tile: don't try to print escape sequences 2020-10-01 22:49:31 -07:00
Kartik Agaram
8e607b128c 6924 2020-10-01 21:43:04 -07:00