• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

stack, frame pointer, heap

 
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!


A frame pointer, on the other hand, usually points to the beginning
of the storage space allocated for any one function, and does not
change during the execution of that function.



http://bytes.com/topic/c/answers/551201-stack-pointer-frame-pointer

As far as I know, while calling function, calling function knows the address ,By offset from the frame pointer.Frame pointer is choosed for this purpose because its constant and don't move like stack pointer.

I have two questions:

1-I know for every calling, a new frame created.Does it mean that every frame has its own frame pointer?

2- about heap,If there is not any static member or using function like allocate(), Then there is no heap?becuase I read heap keeps these.

3-According this site:

http://www.phrack.com/issues.html?issue=49&id=14

Processes are divided into three regions:
Text, Data, and Stack.



Does it mean that heap is not necessary ?
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Anyone help?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your references are discussing native code concepts, but you're asking in a forum about Java. The answers -- and the words used to describe them -- would be different if we answered them as Java questions. No-one ever refers to a "frame pointer" in Java, and in fact, folks talking about other architectures often say "base pointer" instead. We're not sure what context you're after, which is probably why nobody answered you.

Here is a reasonably accurate introductory article on the memory architecture of the Java Virtual Machine.
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In fact, at first I wanted to know how does frame work, and after that How does stack work in JAVA.

Does it work Like C?
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

No-one ever refers to a "frame pointer" in Java, and in fact, folks talking about other architectures often say "base pointer" instead. We're not sure what context you're after, which is probably why nobody answered you.



From this site:

http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/stack.html

We've added a new pointer called FP which stands for frame pointer. The frame pointer points to the location where the stack pointer was, just before foo() moved the stack pointer for foo()'s own local variables.

Having a frame pointer is convenient when a function is likely to move the stack pointer several times throughout the course of running the function. The idea is to keep the frame pointer fixed for the duration of foo()'s stack frame. The stack pointer, in the meanwhile, can change values.



why does it use stack?why don't use data segment to keep her data
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

abalfazl hossein wrote:

http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/stack.html

We've added a new pointer called FP which stands for frame pointer. . . .

That link is to a site about assembly language, something completely different.
 
reply
    Bookmark Topic Watch Topic
  • New Topic