Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @01:11AM
(#8130432)
I have been working on this project on and off for about 6 months. I would love feedback on the code, design - whatever!
[ Parent
| on HN ]
Re:Show HN: A small virtual machine written in C
by dsturnbull2049 on Monday August 04, 2014 @01:27AM
(#8130470)
Very concise implementation. I keep thinking there's missing files or at least I'm missing something in my understanding. :)
I wrote a 0-operand VM in C a few years ago that used a lot of the same concepts but considerably more code, like 10x at least. I will learn a lot from this.
Re:Show HN: A small virtual machine written in C
by listic on Sunday August 10, 2014 @05:46AM
(#8159327)
Unfortunately, with the ever-increasing processor-memory gap (the growing discrepancy between processor and memory speeds, also called Memory Wall, if I'm not mistaken), 0-operand, or stack VM's are seeing ever-increasing performance penalties.
Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @01:27AM
(#8130472)
What kinds of files look missing? I'm curious.
What is a 0 operand VM? I'd love to see it!
Re:Show HN: A small virtual machine written in C
by chewxy on Monday August 04, 2014 @02:00AM
(#8130552)
Using only PUSH and POP I think. i.e a stack machine.
also, OP, your code looks great.
Re:Show HN: A small virtual machine written in C
by dsturnbull2049 on Wednesday August 06, 2014 @03:29AM
(#8141437)
Yeah, a stack machine.
https://github.com/dsturnbull/stack_cpu
What I mean by missing files is that it's so clean that at first glance it didn't look like the whole deal :)
Re:Show HN: A small virtual machine written in C
by tekknolagi on Wednesday August 06, 2014 @11:36AM
(#8142998)
Oh well thanks — that's quite a compliment.
This is pretty cool!
Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @02:03AM
(#8130556)
Oh interesting. That sounds... complicated.
Thanks! It's my first big C project that isn't hideous :D
Re:Show HN: A small virtual machine written in C
by Hytosys on Monday August 04, 2014 @02:08AM
(#8130564)
Just for anyone looking for more information: http://en.wikipedia.org/wiki/Instruction_set#Number_of_opera...
Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @02:16AM
(#8130586)
Awesome!
Re:Show HN: A small virtual machine written in C
by ghkbrew on Monday August 04, 2014 @02:12AM
(#8130572)
Is there a reason for the combination of register-based (logical ops) and stack-based (arithmetic ops) operations?
Otherwise fun project.
Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @02:25AM
(#8130613)
Probably just my sloppiness. Things like OR were implemented while looking at other projects like tinyvm, so it's not perfectly consistent.
Re:Show HN: A small virtual machine written in C
by zura on Monday August 04, 2014 @09:36AM
(#8131639)
Nice. Any particular tutorial/article/book you're following?
Re:Show HN: A small virtual machine written in C
by wsc981 on Monday August 04, 2014 @05:05PM
(#8134023)
Perhaps, if you're interested in learning to write well-written C code, you might be interested in the book "C Programming: A Modern Approach"[0] by King. Coding style is an important topic in his book.
[0]: http://www.amazon.com/Programming-Modern-Approach-2nd-Editio...
Re:Show HN: A small virtual machine written in C
by zura on Tuesday August 05, 2014 @05:06PM
(#8139427)
Thank you, seems very interesting. Usually, I only write pure C code when I really have to. Otherwise, I see no reason why someone should restrict "shimself" from using C++.
Re:Show HN: A small virtual machine written in C
by tekknolagi on Monday August 04, 2014 @12:03PM
(#8132395)
Nope :) Lots of small web resources.