OpenJDK / jdk / jdk
changeset 57861:9fb094231eee
8238083: Crash: assert(is_object_aligned(v)) failed: address not aligned: 0xfffffffffffffff1
Reviewed-by: mgronlun
author | egahlin |
---|---|
date | Wed, 29 Jan 2020 11:04:00 +0100 |
parents | 2a46b7b81e78 |
children | b53fdc9fd058 |
files | src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java Wed Jan 29 10:37:22 2020 +0100 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java Wed Jan 29 11:04:00 2020 +0100 @@ -328,17 +328,23 @@ static synchronized EventHandler getHandler(Class<? extends jdk.internal.event.Event> eventClass) { Utils.ensureValidEventSubclass(eventClass); - Object handler = JVM.getJVM().getHandler(eventClass); - if (handler == null || handler instanceof EventHandler) { - return (EventHandler) handler; + try { + Field f = eventClass.getDeclaredField(EventInstrumentation.FIELD_EVENT_HANDLER); + SecuritySupport.setAccessible(f); + return (EventHandler) f.get(null); + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { + throw new InternalError("Could not access event handler"); } - throw new InternalError("Could not access event handler"); } static synchronized void setHandler(Class<? extends jdk.internal.event.Event> eventClass, EventHandler handler) { Utils.ensureValidEventSubclass(eventClass); - if (!JVM.getJVM().setHandler(eventClass, handler)) { - throw new InternalError("Could not set event handler"); + try { + Field field = eventClass.getDeclaredField(EventInstrumentation.FIELD_EVENT_HANDLER); + SecuritySupport.setAccessible(field); + field.set(null, handler); + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { + throw new InternalError("Could not access event handler"); } }