RFR: 8227054: ServiceThread needs to know about all OopStorage objects

Per Liden per.liden at oracle.com
Mon Aug 12 09:28:15 UTC 2019


Hi Kim & Erik,

First, thanks Kim for taking this for a second round. I also like you're 
new proposal a lot better.

On 8/12/19 10:52 AM, Erik Österlund wrote:
[...]
>> Can you describe the IDE confusion?  I can think of lots of potential
>> issues, depending on how smart/not-so-smart a given IDE might be, but
>> I don't know what actual problems you might be worried about.
> 
> The two main ones I am concerned about is go-to-definition. There is no 
> real definition now, so you will get to a macro instead. The other 
> concern is the inability to list all callers of the getter. Since there 
> is no definition outside of macro land, you can't do that, and will have 
> to resort to raw text search instead.
> 
> I for example use the rtags plugin to Emacs to find my way around 
> hotspot using such functionality. But obviously there are lots of other 
> tools doing similar things.
> 
> I usually try not to break the ability to navigate the code by having it 
> generated by macros, unless it's somehow painful not to do it with 
> macros, keeping that as a plan B. But here it looks trivial, and it 
> doesn't look like the use of macros buys us anything more than another 
> mental indirection to look through.
> 
>> For me, the macros improve readability by emphasizing the parts that
>> are different (the interesting parts) and deemphasizing the parts that
>> are the same (the boring parts).
> 
> For me it's the opposite. :/
> If I want to know the name of e.g. the JNI weak getter, I have to first 
> read the OOPSTORAGE_ACCESSOR(jni_weak) line, then go to the definition 
> of OOPSTORAGE_ACCESSOR, and read the macro to figure out how that 
> invocation will generate the getter, instead of just reading the 
> one-liner getter, like this:
> static OopStorage* jni_weak() { return storage(jni_weak_index); }

I can only eco Erik's opinion. I can understand if one might want to use 
macros in this way for long or complicated functions to avoid lots of 
code duplication and cut-and-paste errors. But for trivial stuff, I 
think it just hurts readability and confuses IDEs.

cheers,
Per


More information about the hotspot-dev mailing list