IRC channel logs

2020-11-19.log

back to list of logs

<OriansJ>I think the make rules might be accidentially recursive: https://paste.debian.net/1173171/
<siraben>OriansJ: I think you can remove the wasm and site-generation stuff
<siraben>`cobble` is Ben Lynn's own website generator
<OriansJ>siraben: true and to properly start fuzzing the vm, I'll need to make changes with how it handles input
<OriansJ>So it is going to be a rather major changes to get it into bootstrapping shape; which will probably not be liked upstream.
<OriansJ>But fortunately because you got them to license it under the GPLv3; that isn't going to be an issue for us.
<xentrac>hooray!
<OriansJ>But there remains alot of work to strip out everything implicit in the bootstrap and make it all explicit and obvious.
<OriansJ>and I am starting to think he never heard of >> in bash
<xentrac>hah
<OriansJ>well why do (cat rts.c && ./vm run effectively.hs < lonely.hs) > lonely.c; when cp rts.c lonely.c && ./vm run effectively.hs < lonely.hs >> lonely.c is more clear
<xentrac>de gustibus non est disputandum
<OriansJ>xentrac: huh?
<xentrac>it seems like a matter of subjective preference to me
<OriansJ>xentrac: fair but I also tend to work with a far more minimal shell (kaem)
<siraben>OriansJ: I noticed you used >| which I hadn't seen before
<siraben>Didn't know it was another operator altogether!
<OriansJ>siraben: noclobber is just standard for my ~/.bashrc because I make mistakes
<OriansJ>set -o noclobber
<xentrac>from csh
<OriansJ>So if I do thing > $foo and I got what $foo is wrong; it doesn't damage anything I might care about
<OriansJ>but if I am writing to thing > foo and I know that I am going to overwrite something; just toss on the |
<siraben>OriansJ: expect a *lot* of segfaults during fuzzing. One thing I'm tempted to do is port the assembler to Haskell for the earlier stages.
<siraben>the barely.hs compiler moves the assembler from C to Haskell https://github.com/blynn/compiler/blob/cc5288045ae13d1e02de6100840adfc5ab0d7cfc/type.lhs#L262
<OriansJ>siraben: I can fix alot of segfaults pretty quickly with require
<siraben>with require?
<OriansJ>think of it like M2-Planet's version of assert but it operates at runtime
<siraben>Ah, interesting.
<OriansJ>require(bool, message_string_when_error);
<OriansJ>so if foo != TYPE_H => require( foo != TYPE_H, "foo was type_h\n");
<OriansJ>and it will exit with EXIT_FAILURE
<siraben>I see.
<siraben>One thing I'd like to understand is the garbage collector `evac`, that's the only part I didn't read in detail
<OriansJ>siraben: well we are going to get deep into its guts and tear it to pieces squeezing out all the understanding that can be found in it.
<siraben>Let me know if you have any questions regarding how/why the VM works.
<siraben>Great!
<OriansJ>siraben: how VMs work is usually just a state machine, which I just need to map out.
<OriansJ>The why for primitives I might need to have a greater understanding of Haskell and I am sure that you can help with that.
<nimaje>(asserts are also at runtime, but normally defined to nothing in a release build)
<siraben>OriansJ: Sure thing.
<siraben>Ah, I also need to adjust the generated C code in the later stages to make it M2-Planet compatible.
<OriansJ>siraben: that definitely looks like it might take a while
<OriansJ>but I am sure you can handle it
<siraben>Yeah. I'll need to understand what subset of C I can use
<OriansJ>siraben: well start with this subset: https://bootstrapping.miraheze.org/wiki/Stage0#cc_.2A_.2B_family and if you need more of the C language let me know
<siraben>Looks like the C code generation starts from the guardedly.hs compiler
<siraben>How would you translate `static unsigned root[] = {1,2,3,4,5};`?
<OriansJ>well first I'd make it unsigned* root; do a root=calloc(5, sizeof(unsigned)); and then do root[0]=1; root[1]=2; etc but depending on how common that is we could implement that feature in M2-Planet
<siraben>It's going to be a large array storing the program, https://github.com/blynn/compiler/blob/42ff37bc98c8b6e9d4fb34510e804d6cfea25d33/guardedly.hs#L946
<siraben>That's the code generation, should be somewhat readable if you look at the strings.
<siraben>I could make it a sequence of array assignments, if needed.
<OriansJ>siraben: let me think on that a bit
<siraben>I wouldn't want to complicate the C source, it really wouldn't be a lot of work to generate the list of assignments.
<siraben>OTOH performance might suffer
<OriansJ>siraben: performance is not a priority for bootstrapping, just a nice to have
<OriansJ>keep things as simple as possible and later if it matters we can make it faster.
<xentrac>stacking layers of interpreters on top of each other suffers progressive slowdown, not layers of compilers
<siraben>Right.
<xentrac>making compilers slow usually requires making them sophisticated
<siraben>Depending on what the later stages look like, it could mean removing the intermediate C language altogether, going from Hex → ASM → blynn-compiler → mes
<xentrac>(although maybe if someone writes a bootstrapping compiler in prolog they'll create a counterexample)
<OriansJ>siraben: I would be surprised if it was easier to write a Haskell compiler in Assembly than to write a C compiler in assembly (cc_x86 only took 20 hours total)
<siraben>OriansJ: It would involve porting vm.c to assembly
<siraben>OriansJ: as a PoC, here is the vm ported to EVM assembly https://gist.github.com/siraben/cbf698c0455f55d41c01c14177e8d90a
<siraben>modulo the GC
<xentrac>nice job!
<xentrac>btw, not relevant to what we're doing here, but do you know about the B and C combinators?
<siraben>Did I not comment them in vm.c?
<xentrac>*blush* well uh I haven't actually looked...
<xentrac>sorry!
<OriansJ>siraben: problem that we don't have a bootstrapped EVM virtual machine to run said code
<xentrac>they are in fact mentioned in here
<siraben>OriansJ: haha of course, but I'm only using the basic opcodes of the EVM
<OriansJ>we have M1 macro assembly and bare metal to work with here (until I get M3 done)
<siraben>You have a Forth as well, right?
<OriansJ>siraben: yes
<siraben>I love Forth!
<OriansJ>I am glad it makes you happy.
<siraben>Of course for entirely different reasons than Haskell, Lisp, C, etc. lol
<OriansJ>here is our existing FORTH library: https://github.com/oriansj/stage0/blob/master/stage3/inital_library.fs and implementation: https://github.com/oriansj/stage0/blob/master/stage2/forth.s
<OriansJ>hmmm vm; does not like being moved to bin/vm
<OriansJ>guess I gotta fix vm.c to like it
<OriansJ>and a cleaned up makefile is now up
<siraben>Nice!
***ericonr- is now known as ericonr
<fossy>OriansJ: is VM.c complete in m2 planet now?
<fossy>This weekend we will see some further kaem improvements
<fossy>And fixes
***nckx is now known as jorts
***jorts is now known as nckx