review (S) for 6911204: generated adapters with large signatures can fill up the code cache

John Rose John.Rose at Sun.COM
Wed Jan 13 20:48:45 PST 2010


On Jan 13, 2010, at 4:09 PM, Tom Rodriguez wrote:

> http://cr.openjdk.java.net/~never/6911204

It looks good.

It would be good to include a comment about size statistics, so the future reader can get an idea about how common the compressed and uncompressed cases are.

You might put the union first, before _length:

+   union {
+     signed char  _compact[12];
+     intptr_t* _fingerprint;
+   } _value;
+   int _length; // A negative length indicates that the _value is a C
+                // heap allocated array.

That way on LP64 systems you won't get 4 dead bytes.

This expression gave me the willies, even though it's correct.  It's best to parenthesize such things routinely:
+       hash = hash << 7 ^ value(i);

If it were me, I'd compress the series of reg values down to a series of bytes using CompressedWriteStream::write_signed_int, and just do hashes and equality checks on the actual compressed bytes.  There'd be no need for value().  The bytes would never be decoded except for debugging routines like as_string.  The union trick would be the same, except that the pointer would point to an array of chars.  The actual equality comparisons could be done with memcmp.

But it doesn't make a big difference, since this isn't hot code.

-- John


More information about the hotspot-compiler-dev mailing list