Integrated: 8266675: Optimize IntHashTable for encapsulation and ease of use

Guoxiong Li gli at openjdk.java.net
Sat May 8 03:13:23 UTC 2021


On Fri, 7 May 2021 03:27:25 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> 
> Currently, the class `com.sun.tools.javac.util.IntHashTable` exposes methods `hash(Object key)` and `lookup(Object key)` to users. It is not good because they are internal methods to achieve the features.
> 
> On the other hand, the index of the mapping (key or value) is the internal data struct. The users should not know or use it actually. So the parameters of the following methods should be revised.
> 
> 1. lookup(Object key, int hash) -> lookup(Object key)
> 2. getFromIndex(int index) -> get(Object key)
> 3. putAtIndex(Object key, int value, int index) -> put(Object key, int value)
> 
> And the corresponding places where they are used need to be adjusted too.
> 
> The patch optimizes them, adds some comments and cleans the code.
> Thank you for taking the time to review.
> 
> Best Regards,
> -- Guoxiong

This pull request has now been integrated.

Changeset: ff77ca8b
Author:    Guoxiong Li <gli at openjdk.org>
Committer: Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/ff77ca8bd41ece778cf6f1af6dd1b7a7dfc50eab
Stats:     46 lines in 2 files changed: 10 ins; 19 del; 17 mod

8266675: Optimize IntHashTable for encapsulation and ease of use

Reviewed-by: mcimadamore

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

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


More information about the compiler-dev mailing list