1 Replies - 127 Views - Last Post: 02 March 2018 - 05:08 AM Rate Topic: -----

#1 dgupta111   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 28-August 17

need of symbol table when we have activation record as storage alloc

Posted 02 March 2018 - 04:41 AM

I read that symbol table store the mapping between identifier and location.But activation record also does the same with the variables of the procedure.I also read that we can have stack,dynamic as storage allocation scheme .So what is the difference between the two and in which scenarios symbol table or activation record is used?
Is This A Good Question/Topic? 0
  • +

Replies To: need of symbol table when we have activation record as storage alloc

#2 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2620
  • View blog
  • Posts: 4,175
  • Joined: 21-June 11

Re: need of symbol table when we have activation record as storage alloc

Posted 02 March 2018 - 05:08 AM

The symbol table of an object file maps the global symbols (i.e. functions and global variables that aren't static) to their location within the file. It exists in the object file.

The symbol table that the compiler uses internally maps any symbol (global or otherwise) to its location. For global symbols that's their location in the object file and for local ones it's the offset on the stack. This symbol table exists in memory while the compiler is running and stops existing when the compiler has finished.

The activation records on the stack contain values of local variables. They do not contain any symbols.

Disclaimer: This answer completely ignores the existence of debug symbols to keep things simple.

Quote

I also read that we can have stack,dynamic as storage allocation scheme


I'm not sure what you mean by that. If you're asking about the difference between automatic and dynamic allocation (i.e. stack vs. heap), that's a different matter entirely. In particular nothing that gets stored on the heap (which would happen via calls to malloc in C or new in C++) ever has a name, so symbols have nothing to do with it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1