[Vm-dev] HackerNews + vm-dev = a lightbulb saying "STACK!"
bert at freudenbergs.de
Tue Oct 9 18:24:04 UTC 2012
On 06.10.2012, at 16:13, Chris Cunnington <smalltalktelevision at gmail.com> wrote:
> How are stack languages related to Smalltalk?
The Squeak VM *is* a stack machine. For passing arguments to a method it uses a stack exclusively (in contrast to most microprocessors, which use registers, and only use the stack for larger function calls). E.g., you can switch a Squeak browser to show byte codes. That demonstrates how the stack is used:
^ 3 + 4
switch to byte codes:
21 <20> pushConstant: 3
22 <21> pushConstant: 4
23 <B0> send: +
24 <7C> returnTop
> And then I realized the StackVM is called a StackVM because it uses a ... STACK.
No, every Squeak VM (interpreter, Cog, etc) with the current byte code set uses a stack. The Stack VM is so called because it maps the Smalltalk stack to the native C code stack for speed.
- Bert -
More information about the Vm-dev