Do you happen to have any documents, or know a good place to start searching for Stack versus Register Virtual Machines? I know Lua is register based, and its speed seems to come from the lack of opcodes necessary in its bytecode.
The way I have mine set up now, it is stack based and requires 2 codes for each function, and 2 for each parameter. That means the simplest function with have 4 opcodes! I am desperately looking for a way to cut this down, but can't really think of anything too good.
Anyway, I was planning to develop the compiler first, so I could know exactly what my opcode would look like for my virtual machine to handle. Do you think this is a bad idea? I mean, I essentially know all the opcodes for everything already, except one or two minor additions at the end...but their opcodes will just be the last opcode + 1. So those are easy to implement.
Why would you say VM before compiler?
What kinds of things did you have to optimize with your C++ code? I was planning on using std::vectors, lists, and strings simply for ease of usage (and honestly, since it is only a school project, to cut down a little work.) Besides those, what did you find that slowed down your VM by using C++ instead of C? I personally have only been doing C++ for a year and have done C for 4, so the project is feasible in C for me...it just seems easier to do in C++. Maybe there are key spots that you could highlight for me the spots you ran into speed issues with.
I appreciate the input. The Feature List is a great idea. While my abstract in my design document kind of outlays my goals for the project, I never actually state what I want the language to be able to do in programming terms.
Thanks a lot for taking a look and helping me out!
-visage
My design document
A Word on Optimization:
you seem to be worrying about speed a bit,
at this stage dont worry too much about optimization.
just use a language you are confident in. (by speed i mean
the difference of ~15ms when executing several million opcodes per second ie. hardcore speed)
VM mechanics:
one general thing is that register based designs work
better on register based (physical) CPU's BUT writing
a compiler that makes good use of this can be challanging.
the only reason i chose Stack based is because im 18, in
University doing engineering, so time is not my friend :)
Why VM First?
Flow of Work, if you think about it the compiler is just a
tool to generate code to run on the VM, how can you generate
solid code in a good time without fully trusting your VM.
i found that because i was confident in the quality of my VM
i didn't have to factor the VM in strongly whenever a script
compiled and ran incorrectly, this saved so much time.
Cheers,
Danu
you seem to be worrying about speed a bit,
at this stage dont worry too much about optimization.
just use a language you are confident in. (by speed i mean
the difference of ~15ms when executing several million opcodes per second ie. hardcore speed)
VM mechanics:
one general thing is that register based designs work
better on register based (physical) CPU's BUT writing
a compiler that makes good use of this can be challanging.
the only reason i chose Stack based is because im 18, in
University doing engineering, so time is not my friend :)
Why VM First?
Flow of Work, if you think about it the compiler is just a
tool to generate code to run on the VM, how can you generate
solid code in a good time without fully trusting your VM.
i found that because i was confident in the quality of my VM
i didn't have to factor the VM in strongly whenever a script
compiled and ran incorrectly, this saved so much time.
Cheers,
Danu
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)
http://www.silvermace.com/ -- My personal website
http://www.silvermace.com/ -- My personal website
Well, im 17 in High School, so I definitely feel the time thing. I didn't know whether you had experienced any MAJOR slow downs. I personally dont care about ~15ms. I would prefer knowing that my code works.
Also, your reasoning for the VM creation then the script creation completely makes sense in my book. Thanks.
You have been a really, really big help. Thanks for everything.
-visage
Also, your reasoning for the VM creation then the script creation completely makes sense in my book. Thanks.
You have been a really, really big help. Thanks for everything.
-visage
no problem at all, dorp me a PM or an email if you have
any questions regarding your implementaion.
silvermace007 at hot mail dot com
any questions regarding your implementaion.
silvermace007 at hot mail dot com
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)
http://www.silvermace.com/ -- My personal website
http://www.silvermace.com/ -- My personal website
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement