8267303: Replace MinObjectAlignmentSize usages for non-Java heap objects
Reviewed-by: kbarrett, tschatzl, minqi
This commit is contained in:
parent
3586a233a4
commit
2dc5486415
@ -323,7 +323,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||
Symbol* name_and_id() const { return _name_and_id; }
|
||||
|
||||
unsigned identity_hash() const {
|
||||
return (unsigned)((uintptr_t)this >> 3);
|
||||
return (unsigned)((uintptr_t)this >> LogBytesPerWord);
|
||||
}
|
||||
|
||||
JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -155,7 +155,7 @@ class Symbol : public MetaspaceObj {
|
||||
// Returns the largest size symbol we can safely hold.
|
||||
static int max_length() { return max_symbol_length; }
|
||||
unsigned identity_hash() const {
|
||||
unsigned addr_bits = (unsigned)((uintptr_t)this >> (LogMinObjAlignmentInBytes + 3));
|
||||
unsigned addr_bits = (unsigned)((uintptr_t)this >> (LogBytesPerWord + 3));
|
||||
return ((unsigned)extract_hash(_hash_and_refcount) & 0xffff) |
|
||||
((addr_bits ^ (length() << 8) ^ (( _body[0] << 8) | _body[1])) << 16);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2020, 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
|
||||
@ -84,7 +84,7 @@ public class Symbol extends VMObject {
|
||||
public long identityHash() {
|
||||
long addr_value = getAddress().asLongValue();
|
||||
long addr_bits =
|
||||
(addr_value >> (VM.getVM().getLogMinObjAlignmentInBytes() + 3)) & 0xffffffffL;
|
||||
(addr_value >> (VM.getVM().getLogBytesPerWord() + 3)) & 0xffffffffL;
|
||||
int length = (int)getLength();
|
||||
int byte0 = getByteAt(0);
|
||||
int byte1 = getByteAt(1);
|
||||
|
@ -98,6 +98,7 @@ public class VM {
|
||||
private boolean isLP64;
|
||||
private int bytesPerLong;
|
||||
private int bytesPerWord;
|
||||
private int logBytesPerWord;
|
||||
private int objectAlignmentInBytes;
|
||||
private int minObjAlignmentInBytes;
|
||||
private int logMinObjAlignmentInBytes;
|
||||
@ -477,6 +478,7 @@ public class VM {
|
||||
}
|
||||
bytesPerLong = db.lookupIntConstant("BytesPerLong").intValue();
|
||||
bytesPerWord = db.lookupIntConstant("BytesPerWord").intValue();
|
||||
logBytesPerWord = db.lookupIntConstant("LogBytesPerWord").intValue();
|
||||
heapWordSize = db.lookupIntConstant("HeapWordSize").intValue();
|
||||
Flags_DEFAULT = db.lookupIntConstant("JVMFlagOrigin::DEFAULT").intValue();
|
||||
Flags_COMMAND_LINE = db.lookupIntConstant("JVMFlagOrigin::COMMAND_LINE").intValue();
|
||||
@ -688,6 +690,10 @@ public class VM {
|
||||
return bytesPerWord;
|
||||
}
|
||||
|
||||
public int getLogBytesPerWord() {
|
||||
return logBytesPerWord;
|
||||
}
|
||||
|
||||
/** Get minimum object alignment in bytes. */
|
||||
public int getMinObjAlignmentInBytes() {
|
||||
return minObjAlignmentInBytes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user