Your VM will work much faster if you take the time to do a second pass over the generated "code" and resolve the jumps to LABELs all at once instead of linearly scanning the code for the appropriate target on each jump.
JSVM
11–17 of 17 posts
Re: JSVM
#12If I make make a few suggestions (mostly from a desire to see a more familiar sort of spec): > Add arithmetic shift left/right > Add logical shift left/right > Add exclusive OR (XOR) > Pick a word size so your integer and bit ops have meaning Questions: > How do I set the program counter from my assembly? > Do I have registers (seems like a stack-based VM, so no)? If not, can I have more stacks? > Can you setup a ded…
> How do I set the program counter from my assembly? The only way to set PC is through branching
> Do I have registers (seems like a stack-based VM, so no)? If not, can I have more stacks? Like you said it's a stack-based VM, so no registers. Currently it's a single stack since it's enough. I never encountered a machine with multiple stacks, can you enlighten me about this ?
> Can you setup a dedicated block of memory to use as a framebuffer and render it to a tag I made this machine to be used by students to test compilers, But I think I'll add this feature in case there is any ambitious student who wants to embed a graphics library in his language :)
Thanks,
Re: JSVM
#13Better name it VM.js !!
I real disappointed when I discovered this was not an amateur JS vm that I could read in a weekend or two, that would be awesome to have :(
Re: JSVM
#14Better name it VM.js !!
Re: JSVM
#15If I make make a few suggestions (mostly from a desire to see a more familiar sort of spec): > Add arithmetic shift left/right > Add logical shift left/right > Add exclusive OR (XOR) > Pick a word size so your integer and bit ops have meaning Questions: > How do I set the program counter from my assembly? > Do I have registers (seems like a stack-based VM, so no)? If not, can I have more stacks? > Can you setup a ded…
> Add arithmetic shift left/right .. I'll add > Add logical shift left/right .. I'll add > Add exclusive OR (XOR) .. I'll add > Pick a word size so your integer and bit ops have meaning .. I think I'll just rely on js types to keep things simple, If you see any reason not to please explain further > How do I set the program counter from my assembly? The only way to set PC is through branching > Do I have registers (s…
Re: JSVM
#16Earlier quoted context omitted.
> Add arithmetic shift left/right .. I'll add > Add logical shift left/right .. I'll add > Add exclusive OR (XOR) .. I'll add > Pick a word size so your integer and bit ops have meaning .. I think I'll just rely on js types to keep things simple, If you see any reason not to please explain further > How do I set the program counter from my assembly? The only way to set PC is through branching > Do I have registers (s…
I think I understand the thing about word size, thank you I'll fix it
Having a fixed word size in a machine is important for being able to say, for example, what the largest and smallest integers are (assuming twos-complement arithmetic).
Re: JSVM
#17Earlier quoted context omitted.
I think I understand the thing about word size, thank you I'll fix it
No worries--nothing broken, just undefined. :) Having a fixed word size in a machine is important for being able to say, for example, what the largest and smallest integers are (assuming twos-complement arithmetic).