提交 1838a959 编写于 作者: D dlong

Merge

......@@ -599,3 +599,5 @@ ebf89088c08ab0508b9002b48dd3d68a340259af hs25.60-b01
0fb1ac49ae7764c5d7c6dfb9fe046d0e1a4eb5aa hs25.60-b04
586a449cd30332dd53c0f74bf2ead6f3d4724bfc jdk8u60-b04
74931e85352be8556eaa511ca0dd7c38fe272ec3 hs25.60-b05
b13f1890afb8abc31ecb9c21fd2ba95aba3e33f8 jdk8u60-b05
b17a8a22a0344e3c93e2e4677de20d35f99cf4f5 hs25.60-b06
......@@ -314,7 +314,7 @@ static void * pathmap_dlopen(const char * name, int mode) {
handle = dlopen(name, mode);
}
if (_libsaproc_debug) {
printf("libsaproc DEBUG: pathmap_dlopen %s return 0x%x\n", name, handle);
printf("libsaproc DEBUG: pathmap_dlopen %s return 0x%lx\n", name, (unsigned long) handle);
}
return handle;
}
......@@ -661,30 +661,30 @@ init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name
// read FileMapHeader
size_t n = read(fd, pheader, sizeof(struct FileMapHeader));
if (n != sizeof(struct FileMapHeader)) {
free(pheader);
close(fd);
char errMsg[ERR_MSG_SIZE];
sprintf(errMsg, "unable to read shared archive file map header from %s", classes_jsa);
close(fd);
free(pheader);
THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1);
}
// check file magic
if (pheader->_magic != 0xf00baba2) {
free(pheader);
close(fd);
char errMsg[ERR_MSG_SIZE];
sprintf(errMsg, "%s has bad shared archive magic 0x%x, expecting 0xf00baba2",
classes_jsa, pheader->_magic);
close(fd);
free(pheader);
THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1);
}
// check version
if (pheader->_version != CURRENT_ARCHIVE_VERSION) {
free(pheader);
close(fd);
char errMsg[ERR_MSG_SIZE];
sprintf(errMsg, "%s has wrong shared archive version %d, expecting %d",
classes_jsa, pheader->_version, CURRENT_ARCHIVE_VERSION);
close(fd);
free(pheader);
THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1);
}
......
......@@ -51,6 +51,9 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
private static final int C_INT32_SIZE = 4;
private static final int C_INT64_SIZE = 8;
private static int pointerSize = UNINITIALIZED_SIZE;
// Counter to ensure read loops terminate:
private static final int MAX_DUPLICATE_DEFINITIONS = 100;
private int duplicateDefCount = 0;
private static final boolean DEBUG;
static {
......@@ -166,6 +169,10 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
typeEntrySizeOffset = getLongValueFromProcess("gHotSpotVMTypeEntrySizeOffset");
typeEntryArrayStride = getLongValueFromProcess("gHotSpotVMTypeEntryArrayStride");
if (typeEntryArrayStride == 0L) {
throw new RuntimeException("zero stride: cannot read types.");
}
// Start iterating down it until we find an entry with no name
Address typeNameAddr = null;
do {
......@@ -192,7 +199,11 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
}
entryAddr = entryAddr.addOffsetTo(typeEntryArrayStride);
} while (typeNameAddr != null);
} while (typeNameAddr != null && duplicateDefCount < MAX_DUPLICATE_DEFINITIONS);
if (duplicateDefCount >= MAX_DUPLICATE_DEFINITIONS) {
throw new RuntimeException("too many duplicate definitions");
}
}
private void initializePrimitiveTypes() {
......@@ -395,6 +406,10 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
structEntryAddressOffset = getLongValueFromProcess("gHotSpotVMStructEntryAddressOffset");
structEntryArrayStride = getLongValueFromProcess("gHotSpotVMStructEntryArrayStride");
if (structEntryArrayStride == 0L) {
throw new RuntimeException("zero stride: cannot read types.");
}
// Fetch the address of the VMStructEntry*
Address entryAddr = lookupInProcess("gHotSpotVMStructs");
// Dereference this once to get the pointer to the first VMStructEntry
......@@ -472,6 +487,11 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
intConstantEntryValueOffset = getLongValueFromProcess("gHotSpotVMIntConstantEntryValueOffset");
intConstantEntryArrayStride = getLongValueFromProcess("gHotSpotVMIntConstantEntryArrayStride");
if (intConstantEntryArrayStride == 0L) {
throw new RuntimeException("zero stride: cannot read types.");
}
// Fetch the address of the VMIntConstantEntry*
Address entryAddr = lookupInProcess("gHotSpotVMIntConstants");
// Dereference this once to get the pointer to the first VMIntConstantEntry
......@@ -501,12 +521,17 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
} else {
System.err.println("Warning: the int constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMIntConstants) " +
"had its value declared as " + value + " twice. Continuing.");
duplicateDefCount++;
}
}
}
entryAddr = entryAddr.addOffsetTo(intConstantEntryArrayStride);
} while (nameAddr != null);
} while (nameAddr != null && duplicateDefCount < MAX_DUPLICATE_DEFINITIONS);
if (duplicateDefCount >= MAX_DUPLICATE_DEFINITIONS) {
throw new RuntimeException("too many duplicate definitions");
}
}
private void readVMLongConstants() {
......@@ -519,6 +544,10 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
longConstantEntryValueOffset = getLongValueFromProcess("gHotSpotVMLongConstantEntryValueOffset");
longConstantEntryArrayStride = getLongValueFromProcess("gHotSpotVMLongConstantEntryArrayStride");
if (longConstantEntryArrayStride == 0L) {
throw new RuntimeException("zero stride: cannot read types.");
}
// Fetch the address of the VMLongConstantEntry*
Address entryAddr = lookupInProcess("gHotSpotVMLongConstants");
// Dereference this once to get the pointer to the first VMLongConstantEntry
......@@ -548,12 +577,17 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
} else {
System.err.println("Warning: the long constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMLongConstants) " +
"had its value declared as " + value + " twice. Continuing.");
duplicateDefCount++;
}
}
}
entryAddr = entryAddr.addOffsetTo(longConstantEntryArrayStride);
} while (nameAddr != null);
} while (nameAddr != null && duplicateDefCount < MAX_DUPLICATE_DEFINITIONS);
if (duplicateDefCount >= MAX_DUPLICATE_DEFINITIONS) {
throw new RuntimeException("too many duplicate definitions.");
}
}
private BasicType lookupOrFail(String typeName) {
......@@ -740,9 +774,10 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
}
if (!typeNameIsPointerType(typeName)) {
System.err.println("Warning: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " +
"had its size declared as " + size + " twice. Continuing.");
}
System.err.println("Warning: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " +
"had its size declared as " + size + " twice. Continuing.");
duplicateDefCount++;
}
}
}
......
......@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2015
HS_MAJOR_VER=25
HS_MINOR_VER=60
HS_BUILD_NUMBER=05
HS_BUILD_NUMBER=07
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
......
......@@ -337,47 +337,41 @@ else
# Note: The Itanium gcc compiler crashes when using -gstabs.
DEBUG_CFLAGS/ia64 = -g
DEBUG_CFLAGS/amd64 = -g
DEBUG_CFLAGS/arm = -g
DEBUG_CFLAGS/ppc = -g
DEBUG_CFLAGS/ppc64 = -g
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
ifeq ($(USE_CLANG), true)
# Clang doesn't understand -gstabs
DEBUG_CFLAGS += -g
DEBUG_CFLAGS/$(BUILDARCH) = -g
else
DEBUG_CFLAGS += -gstabs
DEBUG_CFLAGS/$(BUILDARCH) = -gstabs
endif
endif
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
FASTDEBUG_CFLAGS/ia64 = -g
FASTDEBUG_CFLAGS/amd64 = -g
FASTDEBUG_CFLAGS/arm = -g
FASTDEBUG_CFLAGS/ppc = -g
FASTDEBUG_CFLAGS/ppc64 = -g
FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
ifeq ($(USE_CLANG), true)
# Clang doesn't understand -gstabs
FASTDEBUG_CFLAGS += -g
FASTDEBUG_CFLAGS/$(BUILDARCH) = -g
else
FASTDEBUG_CFLAGS += -gstabs
FASTDEBUG_CFLAGS/$(BUILDARCH) = -gstabs
endif
endif
OPT_CFLAGS/ia64 = -g
OPT_CFLAGS/amd64 = -g
OPT_CFLAGS/arm = -g
OPT_CFLAGS/ppc = -g
OPT_CFLAGS/ppc64 = -g
OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
ifeq ($(USE_CLANG), true)
# Clang doesn't understand -gstabs
OPT_CFLAGS += -g
OPT_CFLAGS/$(BUILDARCH) = -g
else
OPT_CFLAGS += -gstabs
OPT_CFLAGS/$(BUILDARCH) = -gstabs
endif
endif
endif
......
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -41,7 +41,9 @@
* JNI conversion, which should be sorted out later.
*/
#define __USE_LEGACY_PROTOTYPES__
#include <dirent.h> /* For DIR */
#undef __USE_LEGACY_PROTOTYPES__
#include <sys/param.h> /* For MAXPATHLEN */
#include <sys/socket.h> /* For socklen_t */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
......
......@@ -42,7 +42,7 @@
#define TRACE_BCEA(level, code)
#endif
// Maintain a map of which aguments a local variable or
// Maintain a map of which arguments a local variable or
// stack slot may contain. In addition to tracking
// arguments, it tracks two special values, "allocated"
// which represents any object allocated in the current
......@@ -318,14 +318,16 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod*
bool must_record_dependencies = false;
for (i = arg_size - 1; i >= 0; i--) {
ArgumentMap arg = state.raw_pop();
if (!is_argument(arg))
// Check if callee arg is a caller arg or an allocated object
bool allocated = arg.contains_allocated();
if (!(is_argument(arg) || allocated))
continue;
for (int j = 0; j < _arg_size; j++) {
if (arg.contains(j)) {
_arg_modified[j] |= analyzer._arg_modified[i];
}
}
if (!is_arg_stack(arg)) {
if (!(is_arg_stack(arg) || allocated)) {
// arguments have already been recognized as escaping
} else if (analyzer.is_arg_stack(i) && !analyzer.is_arg_returned(i)) {
set_method_escape(arg);
......
......@@ -6634,7 +6634,6 @@ void CMSCollector::reset(bool asynch) {
}
void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer_cm->gc_id());
TraceCollectorStats tcs(counters());
......
......@@ -1297,7 +1297,6 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
// Timing
assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant");
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
{
......
......@@ -230,7 +230,6 @@ void VM_CGC_Operation::release_and_notify_pending_list_lock() {
}
void VM_CGC_Operation::doit() {
gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
SharedHeap* sh = SharedHeap::heap();
......
......@@ -167,7 +167,6 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
{
HandleMark hm;
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer->gc_id());
TraceCollectorStats tcs(counters());
......
......@@ -2054,7 +2054,6 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
gc_task_manager()->task_idle_workers();
heap->set_par_threads(gc_task_manager()->active_workers());
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
TraceCollectorStats tcs(counters());
......
......@@ -329,7 +329,6 @@ bool PSScavenge::invoke_no_policy() {
ResourceMark rm;
HandleMark hm;
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
TraceCollectorStats tcs(counters());
......
......@@ -49,10 +49,8 @@ GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* t
}
if (_doit) {
if (PrintGCTimeStamps) {
gclog_or_tty->stamp();
gclog_or_tty->print(": ");
}
gclog_or_tty->date_stamp(PrintGCDateStamps);
gclog_or_tty->stamp(PrintGCTimeStamps);
if (PrintGCID) {
gclog_or_tty->print("#%u: ", gc_id.id());
}
......
......@@ -384,7 +384,6 @@ void GenCollectedHeap::do_collection(bool full,
bool complete = full && (max_level == (n_gens()-1));
const char* gc_cause_prefix = complete ? "Full GC" : "GC";
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
// The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
// so we can assume here that the next GC id is what we want.
......
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -235,7 +235,7 @@ protected:
* @return the size of the user data.
*/
size_t get_user_size() const {
assert(_base_addr, "Not wrapping any memory");
assert(_base_addr != NULL, "Not wrapping any memory");
return get_head_guard()->get_user_size();
}
......@@ -245,7 +245,7 @@ protected:
* @return the user data pointer.
*/
u_char* get_user_ptr() const {
assert(_base_addr, "Not wrapping any memory");
assert(_base_addr != NULL, "Not wrapping any memory");
return _base_addr + sizeof(GuardHeader);
}
......@@ -281,7 +281,7 @@ protected:
memset(get_user_ptr(), ch, get_user_size());
}
public:
public:
/**
* Return the total size required for wrapping the given user size.
*
......
此差异已折叠。
......@@ -1572,7 +1572,7 @@ void Arguments::select_gc_ergonomically() {
void Arguments::select_gc() {
if (!gc_selected()) {
ArgumentsExt::select_gc_ergonomically();
select_gc_ergonomically();
}
}
......@@ -2067,7 +2067,7 @@ bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_hea
}
// Check consistency of GC selection
bool Arguments::check_gc_consistency_user() {
bool Arguments::check_gc_consistency() {
check_gclog_consistency();
bool status = true;
// Ensure that the user has not selected conflicting sets
......@@ -2233,7 +2233,7 @@ bool Arguments::check_vm_args_consistency() {
FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
}
status = status && check_gc_consistency_user();
status = status && check_gc_consistency();
status = status && check_stack_pages();
if (CMSIncrementalMode) {
......@@ -4006,7 +4006,7 @@ jint Arguments::apply_ergo() {
set_shared_spaces_flags();
// Check the GC selections again.
if (!ArgumentsExt::check_gc_consistency_ergo()) {
if (!check_gc_consistency()) {
return JNI_EINVAL;
}
......
......@@ -466,8 +466,7 @@ class Arguments : AllStatic {
static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);
// Check for consistency in the selection of the garbage collector.
static bool check_gc_consistency_user(); // Check user-selected gc
static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
static bool check_gc_consistency(); // Check user-selected gc
static void check_deprecated_gcs();
static void check_deprecated_gc_flags();
// Check consistecy or otherwise of VM argument settings
......@@ -615,8 +614,4 @@ bool Arguments::gc_selected() {
UseParNewGC || UseSerialGC;
}
bool Arguments::check_gc_consistency_ergo() {
return check_gc_consistency_user();
}
#endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP
......@@ -30,22 +30,12 @@
class ArgumentsExt: AllStatic {
public:
static inline void select_gc_ergonomically();
static inline void set_gc_specific_flags();
static inline bool check_gc_consistency_ergo();
static void process_options(const JavaVMInitArgs* args) {}
};
void ArgumentsExt::select_gc_ergonomically() {
Arguments::select_gc_ergonomically();
}
void ArgumentsExt::set_gc_specific_flags() {
Arguments::set_gc_specific_flags();
}
bool ArgumentsExt::check_gc_consistency_ergo() {
return Arguments::check_gc_consistency_ergo();
}
#endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -296,6 +296,7 @@ JNIHandleBlock* JNIHandleBlock::allocate_block(Thread* thread) {
block->_top = 0;
block->_next = NULL;
block->_pop_frame_link = NULL;
block->_planned_capacity = block_size_in_oops;
// _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
debug_only(block->_last = NULL);
debug_only(block->_free_list = NULL);
......@@ -529,6 +530,12 @@ int JNIHandleBlock::length() const {
return result;
}
const size_t JNIHandleBlock::get_number_of_live_handles() {
CountHandleClosure counter;
oops_do(&counter);
return counter.count();
}
// This method is not thread-safe, i.e., must be called whule holding a lock on the
// structure.
long JNIHandleBlock::memory_usage() const {
......
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -112,6 +112,9 @@ class JNIHandleBlock : public CHeapObj<mtInternal> {
oop* _free_list; // Handle free list
int _allocate_before_rebuild; // Number of blocks to allocate before rebuilding free list
// Check JNI, "planned capacity" for current frame (or push/ensure)
size_t _planned_capacity;
#ifndef PRODUCT
JNIHandleBlock* _block_list_link; // Link for list below
static JNIHandleBlock* _block_list; // List of all allocated blocks (for debugging only)
......@@ -152,6 +155,11 @@ class JNIHandleBlock : public CHeapObj<mtInternal> {
// Traversal of weak handles. Unreachable oops are cleared.
void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
// Checked JNI support
void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
const size_t get_planned_capacity() { return _planned_capacity; }
const size_t get_number_of_live_handles();
// Debugging
bool chain_contains(jobject handle) const; // Does this block or following blocks contain handle
bool contains(jobject handle) const; // Does this block contain handle
......
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1465,6 +1465,7 @@ void JavaThread::initialize() {
_thread_stat = new ThreadStatistics();
_blocked_on_compilation = false;
_jni_active_critical = 0;
_pending_jni_exception_check_fn = NULL;
_do_not_unlock_if_synchronized = false;
_cached_monitor_info = NULL;
_parker = Parker::Allocate(this) ;
......
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -926,6 +926,9 @@ class JavaThread: public Thread {
// support for JNI critical regions
jint _jni_active_critical; // count of entries into JNI critical region
// Checked JNI: function name requires exception check
char* _pending_jni_exception_check_fn;
// For deadlock detection.
int _depth_first_number;
......@@ -1408,6 +1411,12 @@ class JavaThread: public Thread {
assert(_jni_active_critical >= 0,
"JNI critical nesting problem?"); }
// Checked JNI, is the programmer required to check for exceptions, specify which function name
bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; }
void clear_pending_jni_exception_check() { _pending_jni_exception_check_fn = NULL; }
const char* get_pending_jni_exception_check() const { return _pending_jni_exception_check_fn; }
void set_pending_jni_exception_check(const char* fn_name) { _pending_jni_exception_check_fn = (char*) fn_name; }
// For deadlock detection
int depth_first_number() { return _depth_first_number; }
void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
......
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -33,7 +33,9 @@
# include <ctype.h>
#define __USE_LEGACY_PROTOTYPES__
# include <dirent.h>
#undef __USE_LEGACY_PROTOTYPES__
# include <string.h>
# include <strings.h> // for bsd'isms
# include <stdarg.h>
......
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8073956
* @summary Tests C2 EA with allocated object escaping through a call.
* @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
*/
public class TestEscapeThroughInvoke {
private A a;
public static void main(String[] args) {
TestEscapeThroughInvoke test = new TestEscapeThroughInvoke();
test.a = new A(42);
// Make sure run gets compiled by C2
for (int i = 0; i < 100_000; ++i) {
test.run();
}
}
private void run() {
// Allocate something to trigger EA
new Object();
// Create a new escaping instance of A and
// verify that it is always equal to 'a.saved'.
A escapingA = create(42);
a.check(escapingA);
}
// Create and return a new instance of A that escaped through 'A::saveInto'.
// The 'dummy' parameters are needed to avoid EA skipping the methods.
private A create(Integer dummy) {
A result = new A(dummy);
result.saveInto(a, dummy); // result escapes into 'a' here
return result;
}
}
class A {
private A saved;
public A(Integer dummy) { }
public void saveInto(A other, Integer dummy) {
other.saved = this;
}
public void check(A other) {
if (this.saved != other) {
throw new RuntimeException("TEST FAILED: Objects not equal.");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册