While thinking and playing with a few ideas, I realised that my parameter stack isn’t going to be very big. Because I was only planning on having push and pops (no direct access) there isn’t a way to use much more than is required to complete an expression (eg a = a + b - c). So this means I will be using local variables a lot more. The parameters passed to a function were going to be popped off and put into local variables so they can be used.
All this got me thinking that I could use a register based machine instead. I’ve heard that they are faster, and possibly a bit easier to program in the compiler. Either a register based vm, or a stack based one that can address offsets from the stack - so I can use it for temp variables and leave the parameters on it.
Another question that popped up concerns the variable stack. I was planning to be able to increase and decrease the section of the variable stack that the current funciton is using. This is good because a function will only use up as much variable stack space as needed when it calls other functions.
My first impression is to have it stack based with the ability to access offsets, and keep the dynamic sized local variable stack.
Another thing to think about is that I want to implement static-closure code block things - the ability to come back to sections of code within a function from other funcitons higher up on the stack. These bits of code can access and modify the local variables that are in the original function as well as have their own variables. Nested static-closures as well. I was planning on having independant local variable stacks in each ‘frame’. The closure uses the parameter stack normally (it’s a function in it’s own right) but uses the original function’s variable stack for it’s variables.
Ok well I didn’t understand the whole closure thing, but other than that…
I don’t understand how a register based machine improves performance. Is it just that pushing and poping the whole time is slower than assigning a register or is there more to it? Mine is stack based, for a given value of based. I use the registers in place of the stack where possible. But it doesn’t make alot of odds, because a. It only happens once and b. It’s not the bottleneck by a long shot (I’d guess anyway). In fact it’s a bit more confusing than that, I’ve actually got about 3 stacks of various sorts, but whatever.
I’m just going on what I’ve heard, so it’s confusing to me as well.
Do you have the specifics on how your vm works written down somewhere? I’m having a look at a few to help me make up my mind. I’ve downloaded kaffe, an open source jvm and I’ve looked through the ruby source a bit. I’d be interested if I could have a look at yours. No obligation or anything, I’m just interested in how other people have designed and built vm’s.
Looked at your site and saw that your source is available. I’m going to have a mosey.
You need RSS for your site :(. Or change it to a blog or something…
Edit: Then again, it’s an executable…
Actually the source isn’t available. I thought it would be a bit too shamefull. I’d release the backend, but the compiler? Bleh. It’s a single source file piece of… I don’t know how to use spirit :(. Besides, even the backend is confusing, I couldn’t think of good names for anything. I’ll write up a bit about it if you’d like, but I didn’t really intend for it to be high performance anyway, so it’s probly not much use.
Fair enough, I’ll have a look at other things. I have a fairly good idea of how I want to do things, so I’ll probably stick with that. Thanks for the info you gave.
How does RSS work? I searched a tiny bit and found it’s some xml thing and it’s used to automatically check if sites have been updated, but I’ve never used it myself and have no idea how I’d add it to my site…
RSS is a basic duplicate of your main page (or whatever page the rss is for). If you go to http://blog.voodoolabs.net/feed/ and your browser doesn’t support RSS and doesn’t have a helper application for it, it just shows up as xml text.
Your biggest bet is to see if the software you are using (geeklog) has an addition or mod that enables RSS. Or use another piece of blog / content management software. You could also hack it into your webpage through php or whatever geeklog uses.
As an aside, if you are looking at other systems I’m quite a fan of WordPress (what this site runs on). I’ve heard moveable type is good. Mambo is a fully featured content management system and drupal is another.
Try http://www.razor.byethost.com/backend/geeklog.rdf Man, I don’t even know how my own website works…
Sold, it works. Only the title is available, but at least I will know if you post anything new…