krithika rajan wrote:
> hai frnz i have just started my android developer training..i came across
> a term called 'register based'..can anyone tell what is register based..and
> pls explain the difference between
What is "fmz"? What is "pls"?
> stack based and register based
This is fundamental, basic, introductory, beginning-level computer
"Stack" is a region of memory pointed to by the "stack pointer", and
bounded in size to be
smaller than all of memory. It is distinct from "heap", a bunch of the rest
of memory, in
how it is found and accessed. Each subregion of stack holds a group of data
the execution state for a particular method or segment of code, that method
segment-worth of data being known as the "context" for that method or
A "register" is a word, or doubleword or quadword of very, very, very fast
storage on the CPU
used to hold a single value (data or instruction).
"Stack-based" means that arguments are passed (e.g., to methods) on the
stack, i.e., pushed onto
the top of the function-local memory, along with whatever other state is
needed for that function.
Upon return (e.g., from the method) the stack pointer resets to where it
was before the call,
effectively erasing all knowledge of the portion of stack that was local to
the method (or code
segment). It is that push-on, pull-off action that makes that memory region
A stack is a fundamental, basic, introductory data structure.
"Register-based" means that data is passed directly in a register, not in
memory such as stack.
Generally there are not many registers available so only key data are
passed through registers,
the rest being kept in the context on the stack.
Register-based access tends to be faster than stack-based if the right
values are passed via