void Bytecode::assert_same_format_as(Bytecodes::Code testbc, bool is_wide) const { Bytecodes::Code thisbc = Bytecodes::cast(byte_at(0)); if (thisbc == Bytecodes::_breakpoint) return; // let the assertion fail silently if (is_wide) { assert(thisbc == Bytecodes::_wide, "expected a wide instruction"); thisbc = Bytecodes::cast(byte_at(1)); if (thisbc == Bytecodes::_breakpoint) return; } int thisflags = Bytecodes::flags(testbc, is_wide) & Bytecodes::_all_fmt_bits; int testflags = Bytecodes::flags(thisbc, is_wide) & Bytecodes::_all_fmt_bits; if (thisflags != testflags) tty->print_cr("assert_same_format_as(%d) failed on bc=%d%s; %d != %d", (int)testbc, (int)thisbc, (is_wide?"/wide":""), testflags, thisflags); assert(thisflags == testflags, "expected format"); }
BasicType Signature::return_type(bool fast) { GUARANTEE(ObjectHeap::is_gc_active() || is_valid_method_signature(), "sanity"); juint chr = byte_at(2); if (chr < 0x80) { return primitive_field_basic_type_for(chr); } else if (fast) { return T_OBJECT; } else { return object_basic_type_at(2); } }
/************************************************* * Convert this number to a u32bit, if possible * *************************************************/ u32bit BigInt::to_u32bit() const { if(is_negative()) throw Encoding_Error("BigInt::to_u32bit: Number is negative"); if(bits() >= 32) throw Encoding_Error("BigInt::to_u32bit: Number is too big to convert"); u32bit out = 0; for(u32bit j = 0; j != 4; ++j) out = (out << 8) | byte_at(3-j); return out; }
/************************************************* * Return bits {offset...offset+length} * *************************************************/ u32bit BigInt::get_substring(u32bit offset, u32bit length) const { if(length > 32) throw Invalid_Argument("BigInt::get_substring: Substring size too big"); u64bit piece = 0; for(u32bit j = 0; j != 8; ++j) piece = (piece << 8) | byte_at((offset / 8) + (7-j)); u64bit mask = (1 << length) - 1; u32bit shift = (offset % 8); return static_cast<u32bit>((piece >> shift) & mask); }
void symbolOopDesc::print_symbol_on(outputStream* st) { st = st ? st : std; for (int index = 1; index <= length(); index++) st->put(byte_at(index)); }
/************************************************* * Encode this number into bytes * *************************************************/ void BigInt::binary_encode(byte output[]) const { const u32bit sig_bytes = bytes(); for(u32bit j = 0; j != sig_bytes; ++j) output[sig_bytes-j-1] = byte_at(j); }