Skip to content

Commit

Permalink
8253089: Windows (MSVC 2017) build fails after JDK-8243208
Browse files Browse the repository at this point in the history
Reviewed-by: mdoerr, goetz, iklam
  • Loading branch information
shipilev committed Sep 15, 2020
1 parent af8c678 commit 3f455f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/flags/jvmFlagLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#define DO_FLAG(type, name,...) DO_HASH(FLAG_MEMBER_ENUM(name), XSTR(name))

#define DO_HASH(flag_enum, flag_name) { \
unsigned int hash = hash_code(flag_name); \
u2 hash = hash_code(flag_name); \
int bucket_index = (int)(hash % NUM_BUCKETS); \
_hashes[flag_enum] = (u2)(hash); \
_hashes[flag_enum] = hash; \
_table[flag_enum] = _buckets[bucket_index]; \
_buckets[bucket_index] = (short)flag_enum; \
}
Expand All @@ -54,10 +54,10 @@ constexpr JVMFlagLookup::JVMFlagLookup() : _buckets(), _table(), _hashes() {
constexpr JVMFlagLookup _flag_lookup_table;

JVMFlag* JVMFlagLookup::find_impl(const char* name, size_t length) const {
unsigned int hash = hash_code(name, length);
u2 hash = hash_code(name, length);
int bucket_index = (int)(hash % NUM_BUCKETS);
for (int flag_enum = _buckets[bucket_index]; flag_enum >= 0; ) {
if (_hashes[flag_enum] == (u2)hash) {
if (_hashes[flag_enum] == hash) {
JVMFlag* flag = JVMFlag::flags + flag_enum;
if (strncmp(name, flag->_name, length) == 0) {
// We know flag->_name has at least <length> bytes.
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/flags/jvmFlagLookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class JVMFlagLookup {

// This is executed at build-time only, so it doesn't matter if we walk
// the string twice.
static constexpr unsigned int hash_code(const char* s) {
static constexpr u2 hash_code(const char* s) {
return hash_code(s, string_len(s));
}

static constexpr unsigned int hash_code(const char* s, size_t len) {
unsigned int h = 0;
static constexpr u2 hash_code(const char* s, size_t len) {
u2 h = 0;
while (len -- > 0) {
h = 31*h + (unsigned int) *s;
h = (u2)(31*h + (u2) *s);
s++;
}
return h;
Expand Down

2 comments on commit 3f455f0

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 3f455f0 Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 3f455f0 Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.