--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Tue Dec 04 16:28:18 2007 -0800
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Wed Dec 05 09:00:00 2007 -0800
@@ -153,7 +153,7 @@
// Round up to align_object_offset boundary
__ round_to_q(rbx, BytesPerLong);
}
- Label hit, next, entry;
+ Label hit, next, entry, throw_icce;
__ jmpb(entry);
@@ -162,22 +162,13 @@
__ bind(entry);
-#ifdef ASSERT
- // Check that the entry is non-null
- if (DebugVtables) {
- Label L;
- __ pushq(rbx);
- __ movq(rbx, Address(rbx, itableOffsetEntry::interface_offset_in_bytes()));
- __ testq(rbx, rbx);
- __ jcc(Assembler::notZero, L);
- __ stop("null entry point found in itable's offset table");
- __ bind(L);
- __ popq(rbx);
- }
-#endif
-
- __ cmpq(rax, Address(rbx, itableOffsetEntry::interface_offset_in_bytes()));
- __ jcc(Assembler::notEqual, next);
+ // If the entry is NULL then we've reached the end of the table
+ // without finding the expected interface, so throw an exception
+ __ movq(j_rarg1, Address(rbx, itableOffsetEntry::interface_offset_in_bytes()));
+ __ testq(j_rarg1, j_rarg1);
+ __ jcc(Assembler::zero, throw_icce);
+ __ cmpq(rax, j_rarg1);
+ __ jccb(Assembler::notEqual, next);
// We found a hit, move offset into j_rarg1
__ movl(j_rarg1, Address(rbx, itableOffsetEntry::offset_offset_in_bytes()));
@@ -203,23 +194,31 @@
#ifdef ASSERT
- if (DebugVtables) {
- Label L2;
- __ cmpq(method, (int)NULL);
- __ jcc(Assembler::equal, L2);
- __ cmpq(Address(method, methodOopDesc::from_compiled_offset()), (int)NULL_WORD);
- __ jcc(Assembler::notZero, L2);
- __ stop("compiler entrypoint is null");
- __ bind(L2);
- }
+ if (DebugVtables) {
+ Label L2;
+ __ cmpq(method, (int)NULL);
+ __ jcc(Assembler::equal, L2);
+ __ cmpq(Address(method, methodOopDesc::from_compiled_offset()), (int)NULL_WORD);
+ __ jcc(Assembler::notZero, L2);
+ __ stop("compiler entrypoint is null");
+ __ bind(L2);
+ }
#endif // ASSERT
- // rbx: methodOop
- // j_rarg0: receiver
- address ame_addr = __ pc();
- __ jmp(Address(method, methodOopDesc::from_compiled_offset()));
+ // rbx: methodOop
+ // j_rarg0: receiver
+ address ame_addr = __ pc();
+ __ jmp(Address(method, methodOopDesc::from_compiled_offset()));
+
+ __ bind(throw_icce);
+ // Restore saved register
+ __ popq(j_rarg1);
+ __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
__ flush();
+
+ guarantee(__ pc() <= s->code_end(), "overflowed buffer");
+
s->set_exception_points(npe_addr, ame_addr);
return s;
}
@@ -230,7 +229,7 @@
return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0);
} else {
// Itable stub size
- return (DebugVtables ? 636 : 64) + (CountCompiledCalls ? 13 : 0);
+ return (DebugVtables ? 636 : 72) + (CountCompiledCalls ? 13 : 0);
}
}