RFR: 8035648: Don't use Handle in java_lang_String::print (original) (raw)
David Holmes david.holmes at oracle.com
Mon Feb 24 18:37:39 PST 2014
- Previous message: RFR: 8035648: Don't use Handle in java_lang_String::print
- Next message: RFR: 8035648: Don't use Handle in java_lang_String::print
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 24/02/2014 11:08 PM, Stefan Karlsson wrote:
On 2014-02-24 13:11, David Holmes wrote: Stefan,
On 24/02/2014 7:44 PM, Stefan Karlsson wrote: Hi all,
Please, review this change to let javalangString::print take a raw String oop instead of a Handle to a String oop. This change makes javalangString::print callable from code that has no HandleMark setup. I don't think you can do that. The printing code can encounter a safepoint and block thus allowing a raw oop to be exposed over a potential GC point. If that's the case, then the code was already buggy before my change: 1) Before the patch the first thing we did was to convert the Handle to a raw oop. IMHO, there's no difference in safepoint safeness here. void javalangString::print(Handle javastring, outputStream* st) { oop obj = javastring(); 2) the 'value' object would also be susceptible to this kind of bug: for (int index = 0; index < length; index++) {_ _st->print("%c", value->charat(index + offset)); } Do you know of an implementation of outputStream that allows us to block for a safepoint? If not, would you be fine with the change if I add a NoSafepointVerifier?
Sorry for the noise - I was misremembering how outputstream locking was performed.
David
thanks, StefanK
David E.g. when calling from a debugger. Webrev: http://cr.openjdk.java.net/~stefank/8035648/webrev.00/ RFE: https://bugs.openjdk.java.net/browse/JDK-8035648 thanks, StefanK
- Previous message: RFR: 8035648: Don't use Handle in java_lang_String::print
- Next message: RFR: 8035648: Don't use Handle in java_lang_String::print
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]