diff --git a/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp b/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp index 773bf20..495d888 100644 --- a/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp +++ b/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp @@ -3427,14 +3427,14 @@ uint32 JavaByteCodeTranslator::getNumeri uint32 constPoolIndex = su8(byteCodes + (off++)); // load 32-bit quantity from constant pool Type* constantType = compilationInterface.getConstantType(&methodToCompile,constPoolIndex); + if ( !(constantType->isInt4() || constantType->isSingle()) ) { + // only integer and floating-point types + // are implemented for streamed array loads + return 0; + } const void* constantAddress = compilationInterface.getConstantValue(&methodToCompile,constPoolIndex); - if (constantType->isInt4() || constantType->isSingle()) { - value = *(uint32*)constantAddress; - } else { - // Invalid type! - assert(0); - } + value = *(uint32*)constantAddress; } break; case 0x13: // ldc_w @@ -3443,14 +3443,14 @@ uint32 JavaByteCodeTranslator::getNumeri uint32 constPoolIndex = su16(byteCodes + off); // load 32-bit quantity from constant pool Type* constantType = compilationInterface.getConstantType(&methodToCompile,constPoolIndex); + if ( !(constantType->isInt4() || constantType->isSingle()) ) { + // only integer and floating-point types + // are implemented for streamed array loads + return 0; + } const void* constantAddress = compilationInterface.getConstantValue(&methodToCompile,constPoolIndex); - if (constantType->isInt4() || constantType->isSingle()) { - value = *(uint32*)constantAddress; - } else { - // Invalid type! - assert(0); - } + value = *(uint32*)constantAddress; } off += 2; break; @@ -3458,16 +3458,16 @@ uint32 JavaByteCodeTranslator::getNumeri { if ((off + 1) >= byteCodeLength) return 0; uint32 constPoolIndex = su16(byteCodes + off); - // load 32-bit quantity from constant pool + // load 64-bit quantity from constant pool Type* constantType = compilationInterface.getConstantType(&methodToCompile,constPoolIndex); + if ( !(constantType->isInt8() || constantType->isDouble()) ) { + // only integer and floating-point types + // are implemented for streamed array loads + return 0; + } const void* constantAddress = compilationInterface.getConstantValue(&methodToCompile,constPoolIndex); - if (constantType->isInt8() || constantType->isDouble()) { - value = *(uint64*)constantAddress; - } else { - // Invalid type! - assert(0); - } + value = *(uint64*)constantAddress; } off += 2; break; diff --git a/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h b/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h index 19b9eca..b737ce7 100644 --- a/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h +++ b/vm/jitrino/src/translator/java/JavaByteCodeTranslator.h @@ -388,7 +388,7 @@ private: // If they are then substitute array initializers with jit helper array copy instruction. // Returns the length of bytecodes converted by this routine. uint32 checkForArrayInitializer(Opnd* arrayOpnd, const uint8* byteCodes, uint32 offset, const uint32 byteCodeLength); - // Obtain the next numeric value from the bytecode. + // Obtain the next numeric value from the bytecode in array initialization sequence // Returns number of bytes read from the byteCodes array. uint32 getNumericValue(const uint8* byteCodes, uint32 offset, const uint32 byteCodeLength, uint64& value);