From ad940d3154267298a0b4cd9939ea236584159f84 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Mon, 25 May 2020 16:36:34 +0200 Subject: [PATCH] 8245120: JFR: Parser unable to return typed version Reviewed-by: mgronlun --- .../share/classes/jdk/jfr/internal/LongMap.java | 10 ++++++++++ .../classes/jdk/jfr/internal/consumer/ConstantMap.java | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java index e4d83db107e..29a8d2736b1 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java @@ -77,6 +77,13 @@ public final class LongMap { bitSet.set(bitSetIndex, false); } + public void clearId(long id) { + int bitSetIndex = bitSetIndex(tableIndexOf(id), 0); + for (int i = 0; i < bitCount; i++) { + bitSet.set(bitSetIndex + i, false); + } + } + public boolean isSetId(long id, int bitIndex) { int bitSetIndex = bitSetIndex(tableIndexOf(id), bitIndex); return bitSet.get(bitSetIndex); @@ -103,6 +110,9 @@ public final class LongMap { } public boolean hasKey(long id) { + if (keys == EMPTY_KEYS) { + return false; + } int index = index(id); while (true) { if (objects[index] == null) { diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java index 72b68092818..670df148b54 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java @@ -156,6 +156,9 @@ final class ConstantMap { } public void put(long key, Object value) { + if (objects.hasKey(key)) { + objects.clearId(key); + } objects.put(key, value); }