8075967: Zero interpreter asserts for SafeFetch<32,N> calls in ObjectMonitor

Implement SafeFetchX unsafely and make CanUseSafeFetchX false for Zero

Reviewed-by: sgehwolf, dholmes
This commit is contained in:
Coleen Phillimore 2015-03-25 22:27:51 -04:00
parent 3e6cf09c39
commit b115f80cb5
4 changed files with 29 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -213,7 +213,7 @@ void frame::zero_print_on_error(int frame_index,
valuebuf[buflen - 1] = '\0';
// Print the result
st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
st->print_cr(" " PTR_FORMAT ": %-21s = %s", p2i(addr), fieldbuf, valuebuf);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -144,6 +144,7 @@ int MethodHandles::method_handle_entry_linkToVirtual(Method* method, intptr_t UN
oop recv = STACK_OBJECT(-numArgs);
Klass* clazz = recv->klass();
Klass* klass_part = InstanceKlass::cast(clazz);
ResourceMark rm(THREAD);
klassVtable* vtable = klass_part->vtable();
Method* vmtarget = vtable->method_at(vmindex);

View file

@ -176,6 +176,19 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_oop_arraycopy;
}
// NYI: SafeFetch for Zero isn't actually safe.
static int SafeFetch32(int *adr, int errValue) {
int value = errValue;
value = *adr;
return value;
}
static intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) {
intptr_t value = errValue;
value = *adr;
return value;
}
void generate_initial() {
// Generates all stubs and initializes the entry points
@ -228,11 +241,11 @@ class StubGenerator: public StubCodeGenerator {
generate_arraycopy_stubs();
// Safefetch stubs.
StubRoutines::_safefetch32_entry = NULL;
StubRoutines::_safefetch32_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetch32);
StubRoutines::_safefetch32_fault_pc = NULL;
StubRoutines::_safefetch32_continuation_pc = NULL;
StubRoutines::_safefetchN_entry = NULL;
StubRoutines::_safefetchN_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetchN);
StubRoutines::_safefetchN_fault_pc = NULL;
StubRoutines::_safefetchN_continuation_pc = NULL;
}

View file

@ -450,7 +450,15 @@ inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) {
// returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated)
inline bool CanUseSafeFetch32() { return StubRoutines::SafeFetch32_stub() ? true : false; }
inline bool CanUseSafeFetchN() { return StubRoutines::SafeFetchN_stub() ? true : false; }
inline bool CanUseSafeFetch32() {
// All platforms have the stub but ZERO isn't safe.
assert(StubRoutines::SafeFetch32_stub() != NULL, "should have generated stub");
return NOT_ZERO(true) ZERO_ONLY(false);
}
inline bool CanUseSafeFetchN() {
// All platforms have the stub but ZERO isn't safe.
assert(StubRoutines::SafeFetchN_stub() != NULL, "should have generated stub");
return NOT_ZERO(true) ZERO_ONLY(false);
}
#endif // SHARE_VM_RUNTIME_STUBROUTINES_HPP