Replace full GC macros with CRTP templates

Erik Österlund erik.osterlund at lnu.se
Tue Sep 30 15:39:17 UTC 2014


Hi,

I didn't like the macros in memory/space.inline.hpp so I replaced them with good old templates instead so I could sleep at night.
In particular, the Curiously Recurring Template Pattern (CRTP) C++ idiom was used to solve the problem of writing code referencing the code of the derived subclasses without needing virtual calls (static polymorphism).

The macros (e.g. finding out if a block is an object etc) passed in as arguments to the other macros (oh God) have been replaced with intuitive closures.
All in all macros passed to macros are now closures, the main macros themselves are now inlined template methods achieving the same goals.

If you, like me, want to sleep well at night, do the right thing and vote yes and I will provide a patch. :)

/Erik


More information about the hotspot-gc-dev mailing list