I've been testing serviceability support for AArch64, and I keep getting bad pointers and NullPointerExceptions.
I thought it was a bug in my back-end, but it's not. The problem is that we read a Symbol pointer out of the constant pool and then try to use it. Unfortunately, the bottom two bits of a symbol pointer in the constant pool have special meanings and we must mask them before use. This is my fix: diff -r 11b7f6b12521 agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java Fri Apr 24 16:28:29 2015 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java Tue Apr 28 19:23:18 2015 +0100 @@ -43,6 +43,8 @@ }); } + static class TagBits { final static int _resolved_value = 0, _symbol_bit = 1, _pseudo_bit = 2, _symbol_mask = 3; } + private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("Symbol"); length = type.getCIntegerField("_length"); @@ -60,7 +62,8 @@ if (addr == null) { return null; } - return new Symbol(addr); + return new Symbol(addr.andWithMask(~ TagBits._symbol_mask)); } I'm not at all sure this is the right place to fix it, but it works. I'm just really surprised no-one noticed this before. Andrew.