State of MapWord on HeapObjects during a full GC

15 views
Skip to first unread message

bil...@microsoft.com

unread,
Jun 19, 2019, 12:17:44 PM6/19/19
to v8-dev
Trying to clarify how the Map tagged pointer on objects is modified during GC. The MapWord class (objects.h) has the below comment I can't quite parse - specifically in the parens at the end. Am I reading right that the Map word isn't a heap object pointer during a full GC? Or is this comment incorrect/outdated?
 
  // True if this map word is a forwarding address for a scavenge
  // collection.  Only valid during a scavenge collection (specifically,
  // when all map words are heap object pointers, i.e. not during a full GC).
  inline bool IsForwardingAddress() const;

Ben Noordhuis

unread,
Jun 22, 2019, 5:11:50 AM6/22/19
to v8-...@googlegroups.com
The comment at the top of class MapWord in src/objects/objects.h explains it:

// Heap objects typically have a map pointer in their first word. However,
// during GC other data (e.g. mark bits, forwarding addresses) is sometimes
// encoded in the first word. The class MapWord is an abstraction of the
// value in a heap object's first word.

More specifically, when MapWord::IsForwardingAddress() returns true,
the map word is a SMI, not a HeapObject (i.e., bit 0 is clear.)

I'm not 100% sure but I think that condition can arise during both
minor and major GCs.

Yang Guo

unread,
Jun 22, 2019, 7:06:16 AM6/22/19
to v8-...@googlegroups.com
Iirc we use forwarding addresses whenever we move during GC. Since maps are in map space, there is not a differentiation between minor and major GC.

This info may be outdated though :)

Yang

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAHQurc9BLw4k53GPQBOusOPR2-aprRnb2iNy6iE%2BnOBr_wnwvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages