8264734: Some SA classes could use better hashCode() implementation

Reviewed-by: cjplummer, kevinw
This commit is contained in:
Mitsuru Kariya 2021-05-17 09:49:57 +00:00 committed by Kevin Walls
parent 2313a2187a
commit a555fd89d0
11 changed files with 20 additions and 26 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ class BsdAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,8 +56,7 @@ class DummyAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ public class LinuxAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ class ProcAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ class RemoteAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -387,7 +387,7 @@ public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
return remoteDebugger.getThreadHashCode(id, false);
} catch (RemoteException e) {
}
return (int) id;
return Long.hashCode(id);
}
public ThreadProxy getThreadForIdentifierAddress(Address addr) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,7 @@ class WindbgAddress implements Address {
}
public int hashCode() {
// FIXME: suggestions on a better hash code?
return (int) addr;
return Long.hashCode(addr);
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -75,7 +75,7 @@ class WindbgAARCH64Thread implements ThreadProxy {
}
public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,7 @@ class WindbgAMD64Thread implements ThreadProxy {
}
public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}
public String toString() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ class WindbgX86Thread implements ThreadProxy {
}
public int hashCode() {
return (int) getThreadID();
return Long.hashCode(getThreadID());
}
public String toString() {

View File

@ -127,7 +127,7 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
@Override
public int hashCode() {
return (int)index();
return Long.hashCode(index());
}
@Override