@@ -287,10 +287,11 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
287
287
288
288
// The implementation of java.lang.StringUTF16.toBytes(char[],int,int) will
289
289
// throw a NegativeArraySizeException or OutOfMemoryError if the specified
290
- // length is outside the range [0,0x3fffffff]. In order to avoid deciding
291
- // which to throw in the IL, fall back to the out-of-line call if the length
292
- // is negative or too great. Otherwise, create the byte array and copy the
293
- // input char array to it with java.lang.String.decompressedArrayCopy
290
+ // length is outside the range [0,0x3fffffff] or [0,0x3ffffffe], depending on
291
+ // the JDK level. In order to avoid deciding which to throw in the IL, fall
292
+ // back to the out-of-line call if the length is negative or greater than or
293
+ // equal to 0x3fffffff. Otherwise, create the byte array and copy the input
294
+ // char array to it with java.lang.String.decompressedArrayCopy
294
295
//
295
296
// Before:
296
297
//
@@ -312,7 +313,7 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
312
313
// | iload off |
313
314
// | istore lenTemp |
314
315
// | iload len |
315
- // | ifiucmpgt --> fallbackPathBlock -----------------+
316
+ // | ifiucmpge --> fallbackPathBlock -----------------+
316
317
// | iload lenTemp | |
317
318
// | iconst 0x3fffffff | |
318
319
// +--------------------+-------------------+ |
@@ -355,7 +356,7 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
355
356
// +----------------------------------------+
356
357
//
357
358
TR::Node *upperBoundConstNode = TR::Node::iconst (node, TR::getMaxSigned<TR::Int32>() >> 1 );
358
- TR::Node *ifCmpNode = TR::Node::createif (TR::ifiucmpgt , lenNode, upperBoundConstNode);
359
+ TR::Node *ifCmpNode = TR::Node::createif (TR::ifiucmpge , lenNode, upperBoundConstNode);
359
360
TR::TreeTop *ifCmpTreeTop = TR::TreeTop::create (comp (), treetop->getPrevTreeTop (), ifCmpNode);
360
361
361
362
// Create temporary variable that will be used to hold result
@@ -410,7 +411,7 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
410
411
TR::Node::recreate (node, comp ()->il .opCodeForDirectLoad (resultDataType));
411
412
node->setSymbolReference (resultSymRef);
412
413
413
- // Split the current block right after the ifuicmpgt
414
+ // Split the current block right after the ifiucmpge
414
415
TR::Block *ifCmpBlock = ifCmpTreeTop->getEnclosingBlock ();
415
416
416
417
// Then split the inline version of the code into its own block
@@ -429,7 +430,7 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
429
430
fallThroughPathBlock->getExit ()->insertBefore (gotoTree);
430
431
431
432
// Now we have fall-through block, fallback block and tail/merge block.
432
- // Set the ifuicmp 's destination to the fallback block and update the CFG as well.
433
+ // Set the ifiucmp 's destination to the fallback block and update the CFG as well.
433
434
ifCmpNode->setBranchDestination (fallbackPathBlock->getEntry ());
434
435
cfg->addEdge (ifCmpBlock, fallbackPathBlock);
435
436
cfg->addEdge (fallThroughPathBlock, tailBlock);
0 commit comments