On Fri, 13 Oct 2023 15:19:53 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

>> Please review this patch that removes a number of unused exports from 
>> java.desktop native libraries.
>> 
>> In most cases I removed JNIEXPORT from methods and variables that are only 
>> used within a single shared library. Other than that:
>> - removed `getSunFontIDs` that was reportedly used by rasterizer; as far as 
>> I could tell, rasterizer project is dead now, but if that's incorrect I can 
>> restore that export.
>> - removed `colorValueID` in X11Color; that field was not used.
>> - removed `J2dTraceInit` from header file. That method is only used 
>> internally by `J2dTraceImpl`.
>> 
>> The methods `Transform_GetInfo` and `Transform_transform` are declared in 
>> GraphicsPrimitiveMgr, but are only used in TransformHelper. Let me know if I 
>> should move them to where they are used.
>> 
>> The method `img_makePalette`, currently located in 
>> `share/native/libawt/awt/image/cvutils/img_colors.c`, is only used by 
>> `unix/native/common/awt/X11Color.c`; it could be moved to the same directory 
>> to avoid exporting the method from libawt. The files `img_colors.[ch]` do 
>> not have any references to other files in `cvutils`.
>> 
>> Manually verified that the exports are no longer present after these 
>> changes. Tier1-3 and client libs tests still pass.
>
> Daniel Jeliński has updated the pull request incrementally with seven 
> additional commits since the last revision:
> 
>  - Revert "Remove Color_initIDs"
>    
>    This reverts commit 8a8c9a63de14773905a64a8067ddd68c8a6ab137.
>  - Revert "Remove KeyboardFocusManager_initIDs"
>    
>    This reverts commit 66bd9a136b4c34d7d600ad49ce67fcd060160fb8.
>  - Revert "Remove Rectangle_initIDs"
>    
>    This reverts commit 0d21e361cd92215bbc8bb971b5c3f26898b96a0b.
>  - Revert "Remove Button_initIDs"
>    
>    This reverts commit 423afbf3b61cad504ae10a99ceb02c318f3a83ae.
>  - Revert "Remove FileDialog_initIDs"
>    
>    This reverts commit e66a9ffdda6e451c4298f59786adbd434dd1adb5.
>  - Revert "Remove TextField_initIDs"
>    
>    This reverts commit 0c3b78d27b899d4301f8326f90f1cc36703cbd3d.
>  - Revert "Update copyright"
>    
>    This reverts commit 5808c65e5fbabc08b43da982736b40db87000cb5.

Thanks for your comments!

> I identified several more exports which don't seem to be used:

I'm not sure about removing functions from a family; 
`Region_CountIterationRects` can be hidden, but `Region_NextIteration` can not. 
Similarly, `SurfaceData_IntersectBoundsXYWH` can be hidden, but not 
`SurfaceData_IntersectBoundsXYXY`. And again, `mul8table` can be hidden but not 
`div8table`. I'd rather have a separate PR for them, if we decide we should 
hide them.

> `AWTIsHeadless`

This one is interesting. Looks like the Windows symbol is not used anywhere 
(not even inside awt.dll) and could be removed entirely. I can do it in a 
separate PR.

> `jvm`

That's an odd beast; it is used to retrieve a pointer to JNIEnv. The pointer to 
JNIEnv is available in all JNI functions, so we could do without a global jvm 
variable.

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

PR Comment: https://git.openjdk.org/jdk/pull/13261#issuecomment-1775631229

Reply via email to