[Mono-dev] [PATCH] HSSA!

Massimiliano Mantione massi at ximian.com
Tue Nov 22 11:53:07 EST 2005

On Tue, 2005-11-22 at 00:47 +0000, Mike Hearn wrote:
> On Fri, 18 Nov 2005 22:36:38 +0100, Massimiliano Mantione wrote:
> > +#define CHECK_HEAP_STATE_LENGTH(__hssa,__bb) do {\
> > +		int __i = 0;\
> > +		MonoHssaHeapAddress *__ca = (__hssa)->addresses_with_known_value;\
> > +		MonoHssaHeapAddress *__slow_ca = __ca;\
> > +		while (__ca != NULL) {\
> I'm no expert for sure, but why use these huge "macro-functions" instead
> of regular always inlined functions, eg
> static __attribute__((always_inline)) check_heap_state_length ...
> Does Mono have to be buildable with compilers that don't support that?

Nice catch :-)

IIRC there's the possibility to compile Mono with the MS compiler
on Windows, and I'm not sure about other compilers/platforms.

Anyway, this particular macro ("CHECK_HEAP_STATE_LENGTH") is huge,
but it is only used if "DEBUG_HSSA" is true.
It started small, and grew up during a hard debugging session :-)

Since when "DEBUG_HSSA" is true performance is not important (and
the computations performed in the macro kill performance anyway!),
it could just be turned into a proper static function, with the
whole function definition put inside an "#if (DEBUG_HSSA)" to make
it disappear in the normal case.

I'll likely do this, it's nicer than a monster macro ;-)


More information about the Mono-devel-list mailing list