Talk:Stack machine

From Wikipedia, the free encyclopedia

[edit] So what's a stack machine?

As far as I can gather, a stack machine is essentially a computer without general-purpose storage registers by using stacks in their place? If so, the article should put this up front as it would be the most clear explanation. If not...well, then I don't get it. --Apantomimehorse 09:58, 18 September 2006 (UTC)

Could you clarify what you think is unclear? I think the intro already states what you just wrote in the very first sentences. — Tobias Bergemann 12:42, 18 September 2006 (UTC)

[edit] Please support the contention that "two-stack" machines are more prelevant.

I just upgraded the skecpticism tag from "citation needed" to "dubious."

One-stack machines include x86 (8086 through Core 2), PowerPC, M68000, SPARC, and MIPS architectures. This covers "most" of todays machines easily. so where are the "two-stack" machines? Yes, these are not "pure" stack machines, as they have registers in addition to stacks, but they still fundamentally use stacks.

Note that the ability to switch between multiple stacks quickly is a hallmark of a "one-stack" architecture. do not confuse this with a two-stack architecture.

From the article:

"A machine using processor registers for operands can easily simulate a stack machine."

From this text in the article it's clear to me that neither of the above mentioned processors are defined as stack machines, even though they implement a stack. If this is false, then we need to change the definition of what a stack machine is. Pipatron 09:46, 30 November 2006 (UTC)
Why do you think those machines are "one-stack" machines? Forth implementations on the 8086 typically use the "SP" and "BP" registers as the 2 stack pointers[1]. The M68000 can directly support up to 8 stacks, such that standard stack operations can be done in a single instruction. Not just "push" and "pop", but also addition/subtraction/multiply/logical ops, in a single instruction.
You may be surprised to learn that the above list does *not*, in fact, cover the majority of CPUs. "about 55% of all CPUs sold in the world are 8-bit" -- see microprocessor.
--68.0.120.35 06:05, 9 February 2007 (UTC)
A stack machine is a machine that accually "thinks" of its -operands- in terms of stacks at the microcode level, logic level, or basicly a level below the code that it accaully executes, not at the level of the program running on it. The 8086 does not directly support an operand stack, just a local variable/return (combined) stack. "Stack machines" and "machines that can implement a stack" are two very different things. Further, I find it strange that you reference PowerPC, SPARC and MIPS, because although their variable/return (combined) stack is almost universally used because of their respective UNIX System V ABIs, nothing in the processors themselves mandates the stack structure that they use. Look at the System V ABIs to verify this yourself. Further, althouth the 8086 and M68000 have push, pop, call, ret, and iret instructions that increment/decrement the stack pointer and store new/retreive existing data stored at it, neither have instructions to accually preform operations on the retreved data as it is being retreived. In other words, you must preform a "POP AX" then an "ADD AX, ...", and further a "PUSH AX" before you get the same result that a stack machine gives. Thus, it is not a good practice to program this way on those architechtures. The 8087 (The floating point math coprocessor) is a stack machine, though.
Most stack machines are, infact two-stack machines. One for operands and one for loop counters. It also happens that the loop counter stack is used for return values in most stack machines, because its a convienant place for them. Look at Patriot Scientific, or Forth Machines, or varius Postscript processors found in many printers... They are all 2 stack (or more in the case of Postscript) machines.
I am pretty sure you are right -- most stack machines are two-stack machines. However, one of the little games we play on Wikipedia is to find a reference for facts, even when we are pretty sure they are true. Could you find a reference for us? --68.0.124.33 (talk) 05:05, 2 June 2008 (UTC)

[edit] merge with pushdown automaton

I have tagged this article to merge with pushdown automaton. The two are formally the same. I am creating a similar article called queue machine which would list both theoretical and practical concerns, as I believe that is the main difference between the two articles. —Preceding unsigned comment added by SamuelRiv (talkcontribs) 03:30, 6 November 2007 (UTC)