<AWT Dev> RFR: 8263363: Minor cleanup of Lanai code - unused code removal and comments correction [v2]

Ajit Ghaisas aghaisas at openjdk.java.net
Thu Apr 8 10:48:38 UTC 2021


On Wed, 7 Apr 2021 02:50:03 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review fixes
>
> src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java line 149:
> 
>> 147:         try {
>> 148:             // getMTLConfigInfo() creates new MTLContext, so we should first
>> 149:             // invalidate the current Java-level context and flush the queue...
> 
> The old discussion was related not only to the comment but to the invalidateCurrentContext, do we need to do it?

This is the only place where we use MTLContext.invalidateCurrentContext() - which when processed in MTLRenderQueue - clears some native stuff and nulls out both mtlc and dstOps pointers maintained in MTLRenderQueue.m. I think, this will be important once we get rid of SET_SCRATCH_SURFACE under JDK-8263309.

> src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m line 152:
> 
>> 150:     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
>> 151: 
>> 152: 
> 
> Please also check how this function is called, looks like previously it was called as a selector+an array as a parameter, and then reworked as a performOnMainThreadWaiting+block, but it still use an array as a parameter. I think it is similar to JDK-8238075.

Excellent point! Thanks for the pointer to the bug. 
A lot of code in this file can be cleaned up. I will update the PR soon.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3357


More information about the awt-dev mailing list