about summary refs log tree commit diff stats
path: root/subx/apps/factorial
Commit message (Collapse)AuthorAgeFilesLines
* 4768Kartik Agaram2018-11-241-0/+0
|
* 4756Kartik Agaram2018-11-191-0/+0
| | | | | Long-standing and long-copied typo has been messing with our exit status on test failures.
* 4755 - read-byte (sometimes called getchar)Kartik Agaram2018-11-191-0/+0
|
* 4747 - subx: 'read' primitiveKartik Agaram2018-11-181-0/+0
|
* 4745Kartik Agaram2018-11-171-0/+0
|
* 4743Kartik Agaram2018-11-121-0/+0
|
* 4741Kartik Agaram2018-10-301-0/+0
| | | | Extract a helper that we'll need for 'read'.
* 4740Kartik Agaram2018-10-301-0/+0
|
* 4736Kartik Agaram2018-10-291-0/+0
| | | | | | | | | We'll use a common stream data structure for input and output streams. Having separate types makes more sense in a more high-level language, where we have type checking and where functions for handling the different types are more concise. But in machine code the sweet spot is more toward fewer types.
* 4729Kartik Agaram2018-10-281-0/+0
| | | | | | Start injecting all dependencies in the Crenshaw compiler app. In the process I realized the non-fake code path of 'stop' had a bug.
* 4721Kartik Agaram2018-10-241-0/+0
|
* 4713Kartik Agaram2018-10-211-0/+0
| | | | | | | | Initial sketch of a dependency-injected wrapper around the exit() syscall. I don't have the primitives yet, just a sketch of how they should work -- and a passing test for non-local jumps without support for passing the exit status to the caller.
* 4711Kartik Agaram2018-10-171-0/+0
| | | | | | | Extract a helper for appending strings to raw buffers. I'd been resisting this idea, but it actually turns out to be a pretty clean abstraction in the end.
* 4710Kartik Agaram2018-10-171-0/+0
| | | | | Start using write() instead of _write().. and we promptly find a typo when dealing with real file descriptors.
* 4707 - subx: dependency-injected write() primitiveKartik Agaram2018-10-161-0/+0
|
* 4699Kartik Agaram2018-10-141-0/+0
|
* 4697Kartik Agaram2018-10-141-0/+0
|
* 4691Kartik Agaram2018-10-131-0/+0
| | | | All tests now once again run the same natively and on VM.
* 4684Kartik Agaram2018-10-111-0/+0
| | | | | | | | | | Turns out the tests for 'trace' have been broken in native mode since the original commit (4674). Dangers of running my tests on Darwin, where I can't run them natively. The test failures didn't get flagged on CI because I'd forgotten to update the exit code of the factorial app in commit 4664. At least that's fixed in this commit.
* 4682 - subx: start testing all layers of 'library'Kartik Agaram2018-10-101-0/+0
|
* 4674Kartik Agaram2018-10-081-0/+0
| | | | subx: append to trace
* 4667Kartik Agaram2018-10-051-0/+0
| | | | | Standardize on hyphens in all names. And we'll use colons for namespacing labels in functions.
* 4664 - subx: reflect test failures in exit statusKartik Agaram2018-10-051-0/+0
|
* 4661Kartik Agaram2018-10-041-0/+0
| | | | | Make segment management a little more consistent between initial segments and add-on segments (using `mmap`).
* 4658 - subx: string_equalKartik Agaram2018-10-021-0/+0
|
* 4644Kartik Agaram2018-10-011-0/+0
|
* 4641Kartik Agaram2018-10-011-0/+0
|
* 4638 - extract some common libraries from appsKartik Agaram2018-10-011-0/+0
| | | | | | | I'm still trying to figure out what the defaults should be. At the moment you have to explicitly pass in every file you want loaded into the output binary. Maybe that control is a good thing. The examples need no libraries so far.
* 4518Kartik Agaram2018-09-241-0/+0
|
* 4516Kartik K. Agaram2018-09-241-0/+0
| | | | | | | More calling convention tweaks. Use EBP to get consistently at parameters and locals. Always put the first function argument closest to EBP.
* 4514Kartik Agaram2018-09-241-0/+0
| | | | Get the calling convention right, per http://www.cs.virginia.edu/~evans/cs216/guides/x86.html
* 4513Kartik Agaram2018-09-241-0/+0
|
* 4511Kartik Agaram2018-09-231-0/+0
|
* 4508Kartik Agaram2018-09-231-0/+0
| | | | Upgrade the test harness for the factorial "app" from ex11.
* 4506Kartik Agaram2018-09-231-0/+0
| | | | | | | | | | | | check_ints_equal now prints a newline after the failure message on failure. We still don't know how to print a final newline after all the tests have run, for the common case when all tests pass. Ideally I could just emit a few instructions to `run_tests`. But I'd also need to add a variable for the newline to the data segment. Or I need some literal syntax for newlines in strings. We don't have support for backslash-escapes yet.
* 4505Kartik Agaram2018-09-231-0/+0
| | | | | | | | | | | | Extract a helper from the factorial unit test: check_ints_equal. Start of a vocabulary for unit tests. I *could* also start thinking of supporting multi-file programs, but I'm going to resist the temptation for now. Copy helpers as necessary, and allow them to mutate and diverge for a while before we pummel them into a Procrustean "standard library". Extracting a body of shared code immediately starts to discourage innovation in the shared code.
* 4586 - factorial checks commandline to run testsKartik Agaram2018-09-211-0/+0
| | | | | No automated tests for argv_equal because we need it to run automated tests. But maybe we should have them anyway.
* 4567 - support automated tests in SubXKartik Agaram2018-09-211-0/+0
| | | | | | | | | All it takes is to code-generate a simple function called 'run_tests' that calls all functions starting with 'test_' one by one. I've temporarily switched the factorial app to run as a test. But that's temporary, because all the code to print '.' vs 'F' needs to get extracted out into a helper.
* 4554Kartik Agaram2018-09-201-0/+0
|
* 4537Kartik Agaram2018-09-071-0/+0
| | | | | | | | | | | | | | | Streamline the factorial function; we don't need to save a stack variable into a register before operating on it. All instructions can take a stack variable directly. In the process we found two bugs: a) Opcode f7 was not implemented correctly. It was internally consistent but I'd never validated it against a natively running program. Turns out it encodes multiple instructions, not just 'not'. b) The way we look up imm32 operands was sometimes reading them before disp8/disp32 operands.
* 4530 - create an apps/ directoryKartik Agaram2018-09-011-0/+0