(10) RFR (actually S) 8169881: Remove implicit Handle conversions oop->Handle (original) (raw)
serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Wed Feb 15 20:36:24 UTC 2017
- Previous message: (10) RFR (actually S) 8169881: Remove implicit Handle conversions oop->Handle
- Next message: (10) RFR (actually S) 8169881: Remove implicit Handle conversions oop->Handle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/15/17 10:42, coleen.phillimore at oracle.com wrote:
Thank you Serguei, one tiny comment below.
On 2/15/17 11:50 AM, serguei.spitsyn at oracle.com wrote: Coleen,
On 2/15/17 07:43, coleen.phillimore at oracle.com wrote: Hi Serguei, Thank you for reviewing this. On 2/15/17 2:18 AM, serguei.spitsyn at oracle.com wrote: . . .
Handle result; if (!klass.isnull()) { - result = CompilerToVM::getjvmcitype(klass, CHECKNULL); + oop resultoop = CompilerToVM::getjvmcitype(klass, CHECKNULL); + result = Handle(THREAD, resultoop); } else { result = javalangString::createfromsymbol(symbol, CHECKNULL); } return JNIHandles::makelocal(THREAD, result()); Not clear, why does the result need to be a handle. There's no reason this had to be a Handle, but javalangString::createfromsymbol returns a Handle. That's why. This seems better, agree? oop resultoop; if (!klass.isnull()) { oop resultoop = CompilerToVM::getjvmcitype(klass, CHECKNULL); } else { Handle result = javalangString::createfromsymbol(symbol, CHECKNULL); resultoop = result(); } return JNIHandles::makelocal(THREAD, resultoop); Agreed. Alternatively, this can be used: resultoop = javalangString::createfromsymbol(symbol, CHECKNULL)(); The function createfromsymbol returns a Handle. It seems like it'd be better for all functions to pass Handle but return oops, but there are some that return Handle because the last argument is CHECK which becomes: THREAD); if (HASPENDINGEXCEPTION) { return NULL; } And if you try to Handle the result in one statement, like this: result = Handle(THREAD, javalangString::createfromsymbol(symbol, CHECKNULL)); it won't compile because of the CHECKNULL. So we made many functions like this return Handle.
Ok, thanks. Serguei
Thanks, Coleen
- Previous message: (10) RFR (actually S) 8169881: Remove implicit Handle conversions oop->Handle
- Next message: (10) RFR (actually S) 8169881: Remove implicit Handle conversions oop->Handle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]