Talk:Stack machine

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Examples[edit]

It would be nice to have some code examples. --Crazy2k 15:16, 24 August 2009 (UTC) —Preceding unsigned comment added by 186.136.149.162 (talk)

So what's a stack machine?[edit]

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)
There is now a section explaining that 1-stack machines are less powerful than even deterministic pushdown automata, so they can't be the same as pushdown automata. But a formal definition, from which we could actually see this, is still lacking. Rp (talk) 15:25, 9 July 2008 (UTC)
Now covered in 2nd sentence of section on practical expression-stack machines. DBSand (talk) 05:37, 1 April 2011 (UTC)DBSand

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

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)
Nearly all current machines and languages use call stacks, so that property is no longer useful in distinguishing the rare-bird stack machines from the near-universal register machines. I've change the definitions to treat these separately. DBSand (talk) 05:30, 1 April 2011 (UTC)DBSand
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.
Added x87 as an example of hybrids between stack and register machines. DBSand (talk) 05:30, 1 April 2011 (UTC)DBSand
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)

merge with pushdown automaton[edit]

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)

The present text of this article makes it clear that the two are not the same, so merging is a bad idea. Rp (talk) 15:26, 9 July 2008 (UTC)
I agree with Rp. This article discusses the stack machine concept (computational model) in computer science whereas the pushdown automation article discusses the pushdown finite automation concept, which may use a stack (which is just an array with LIFO-based access). The two articles discuss completely different concepts. No merge should be done. -- Burningmace 00:03, 23 December 2008 (UTC) —Preceding unsigned comment added by Burningmace (talkcontribs)
The merge is not really a good idea. The term "stack machine" was specifically used to describe a particular sort of widely implemented CPU architecture. A "pushdown automaton" is a formal concept, that does not carry the same connotations. I will remove the tag. --pbannister (talk) 11:55, 12 February 2009 (UTC)

Interrupt latency[edit]

I have gotten the impression that many, if not all, stack processors tend to have short interrupt latencies. The Intersil RTX2010 e.g. has a an interrupt latency of only four processor cycles. Can the same be said for other stack processor architectures? Johan G (talk) 16:32, 7 March 2009 (UTC)

Added RTX2010 as example of fast interrupt response due to minimal processor state. DBSand (talk) 05:35, 1 April 2011 (UTC)DBSand

(CONSIDER REVISION, NOT QUITE RIGHT)[edit]

Someone added this phrase to the section heading in the article this morning. My understanding is that that sort of thing doesn't belong in the article, so I've removed it. However, the editor is correct: that example is wrong; it confuses pushdown automata with a stack machine. A 'stack machine' is a general purpose computer that has a stack AND random-access memory, as discussed in "merge with pushdown automaton".

In fact, it may be better if that section was removed, or replaced with one explaining why a "stack machine" has nothing to do with pushdown automaton. 152.23.116.140 (talk) 15:34, 10 November 2009 (UTC)

Should we mention the SECD machine here?[edit]

The SECD Stack Environment Code Dump, machine is a device used to implement the lispkit language, a lisp dialect similar to scheme used by Peter Henderson in his book Functional Programming, prentice hall, 1980. There is an article in wikipedia about SECD, It should remain as a separate entry. I suggest just to mention it. Maybe just the first paragraph in this comment is enough. —Preceding unsigned comment added by 189.140.221.202 (talk) 07:38, 5 December 2010 (UTC)

Separate articles for automata theory stack machines and practical stack machines[edit]

This article now covers three different topics with no overlap.

The sections on automata theory stack machines and practical stack machines should become separate stand-alone articles, with a disambiguation page.

The section on computers using stack frames should probably have its details moved into the existing stack frame article, and leave only a note here within the practical stack machine article, explaining that nearly all machines use stack frames, and most of them are considered register machines, not stack machines.

The existing article on register machines only covers automata theory, with nothing about practical real machines. It would be good to create a similar article about practical register machines.

DBSand (talk) 05:01, 1 April 2011 (UTC)DBSand


The subject of automata theory stack machines and the languages they can parse is covered in existing articles pushdown automaton and deterministic pushdown automaton; the example here should be merged into one of those articles. DBSand (talk) 15:18, 14 June 2012 (UTC)
Done DBSand (talk) 22:38, 16 June 2012 (UTC)

Density of content, assumption reader will understand terms[edit]

This article, in many parts, reads like it is a slab of text taken out of a compiler or computer organization textbook. The article goes too deep (tons of irrelevant detail). There is an assumption the reader will understand many technical terms, with no attempt at definition or linkage to other wikipedia articles. The entire section on call stacks should jsut be a link to the call stack wikipedia article (which is very well written). This article, however, is just an extremely poorly written article, overall. — Preceding unsigned comment added by 131.170.90.2 (talk) 07:06, 10 September 2011 (UTC)