[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: sun/jvm/hotspot/oops/Symbol.java
From:       Dmitry Samersoff <dmitry.samersoff () oracle ! com>
Date:       2015-04-28 20:00:36
Message-ID: 553FE6E4.5010502 () oracle ! com
[Download RAW message or body]

Andrew,

Thank you for the fix, I'll take a look at it

-Dmitry (current SA owner)

On 2015-04-28 21:27, Andrew Haley wrote:
> 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.
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic