mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
Merge
This commit is contained in:
commit
e5e78099db
15 changed files with 658 additions and 74 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2013, 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
|
||||
|
@ -260,6 +260,55 @@ FILE* os::open(int fd, const char* mode) {
|
|||
return ::fdopen(fd, mode);
|
||||
}
|
||||
|
||||
void* os::get_default_process_handle() {
|
||||
return (void*)::dlopen(NULL, RTLD_LAZY);
|
||||
}
|
||||
|
||||
// Builds a platform dependent Agent_OnLoad_<lib_name> function name
|
||||
// which is used to find statically linked in agents.
|
||||
// Parameters:
|
||||
// sym_name: Symbol in library we are looking for
|
||||
// lib_name: Name of library to look in, NULL for shared libs.
|
||||
// is_absolute_path == true if lib_name is absolute path to agent
|
||||
// such as "/a/b/libL.so"
|
||||
// == false if only the base name of the library is passed in
|
||||
// such as "L"
|
||||
char* os::build_agent_function_name(const char *sym_name, const char *lib_name,
|
||||
bool is_absolute_path) {
|
||||
char *agent_entry_name;
|
||||
size_t len;
|
||||
size_t name_len;
|
||||
size_t prefix_len = strlen(JNI_LIB_PREFIX);
|
||||
size_t suffix_len = strlen(JNI_LIB_SUFFIX);
|
||||
const char *start;
|
||||
|
||||
if (lib_name != NULL) {
|
||||
len = name_len = strlen(lib_name);
|
||||
if (is_absolute_path) {
|
||||
// Need to strip path, prefix and suffix
|
||||
if ((start = strrchr(lib_name, *os::file_separator())) != NULL) {
|
||||
lib_name = ++start;
|
||||
}
|
||||
if (len <= (prefix_len + suffix_len)) {
|
||||
return NULL;
|
||||
}
|
||||
lib_name += prefix_len;
|
||||
name_len = strlen(lib_name) - suffix_len;
|
||||
}
|
||||
}
|
||||
len = (lib_name != NULL ? name_len : 0) + strlen(sym_name) + 2;
|
||||
agent_entry_name = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtThread);
|
||||
if (agent_entry_name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
strcpy(agent_entry_name, sym_name);
|
||||
if (lib_name != NULL) {
|
||||
strcat(agent_entry_name, "_");
|
||||
strncat(agent_entry_name, lib_name, name_len);
|
||||
}
|
||||
return agent_entry_name;
|
||||
}
|
||||
|
||||
os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
|
||||
assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
|
||||
}
|
||||
|
|
|
@ -5399,6 +5399,75 @@ inline BOOL os::Advapi32Dll::AdvapiAvailable() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void* os::get_default_process_handle() {
|
||||
return (void*)GetModuleHandle(NULL);
|
||||
}
|
||||
|
||||
// Builds a platform dependent Agent_OnLoad_<lib_name> function name
|
||||
// which is used to find statically linked in agents.
|
||||
// Additionally for windows, takes into account __stdcall names.
|
||||
// Parameters:
|
||||
// sym_name: Symbol in library we are looking for
|
||||
// lib_name: Name of library to look in, NULL for shared libs.
|
||||
// is_absolute_path == true if lib_name is absolute path to agent
|
||||
// such as "C:/a/b/L.dll"
|
||||
// == false if only the base name of the library is passed in
|
||||
// such as "L"
|
||||
char* os::build_agent_function_name(const char *sym_name, const char *lib_name,
|
||||
bool is_absolute_path) {
|
||||
char *agent_entry_name;
|
||||
size_t len;
|
||||
size_t name_len;
|
||||
size_t prefix_len = strlen(JNI_LIB_PREFIX);
|
||||
size_t suffix_len = strlen(JNI_LIB_SUFFIX);
|
||||
const char *start;
|
||||
|
||||
if (lib_name != NULL) {
|
||||
len = name_len = strlen(lib_name);
|
||||
if (is_absolute_path) {
|
||||
// Need to strip path, prefix and suffix
|
||||
if ((start = strrchr(lib_name, *os::file_separator())) != NULL) {
|
||||
lib_name = ++start;
|
||||
} else {
|
||||
// Need to check for C:
|
||||
if ((start = strchr(lib_name, ':')) != NULL) {
|
||||
lib_name = ++start;
|
||||
}
|
||||
}
|
||||
if (len <= (prefix_len + suffix_len)) {
|
||||
return NULL;
|
||||
}
|
||||
lib_name += prefix_len;
|
||||
name_len = strlen(lib_name) - suffix_len;
|
||||
}
|
||||
}
|
||||
len = (lib_name != NULL ? name_len : 0) + strlen(sym_name) + 2;
|
||||
agent_entry_name = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtThread);
|
||||
if (agent_entry_name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (lib_name != NULL) {
|
||||
const char *p = strrchr(sym_name, '@');
|
||||
if (p != NULL && p != sym_name) {
|
||||
// sym_name == _Agent_OnLoad@XX
|
||||
strncpy(agent_entry_name, sym_name, (p - sym_name));
|
||||
agent_entry_name[(p-sym_name)] = '\0';
|
||||
// agent_entry_name == _Agent_OnLoad
|
||||
strcat(agent_entry_name, "_");
|
||||
strncat(agent_entry_name, lib_name, name_len);
|
||||
strcat(agent_entry_name, p);
|
||||
// agent_entry_name == _Agent_OnLoad_lib_name@XX
|
||||
} else {
|
||||
strcpy(agent_entry_name, sym_name);
|
||||
strcat(agent_entry_name, "_");
|
||||
strncat(agent_entry_name, lib_name, name_len);
|
||||
}
|
||||
} else {
|
||||
strcpy(agent_entry_name, sym_name);
|
||||
}
|
||||
return agent_entry_name;
|
||||
}
|
||||
|
||||
#else
|
||||
// Kernel32 API
|
||||
typedef BOOL (WINAPI* SwitchToThread_Fn)(void);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
|
||||
<!--
|
||||
Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2002, 2013, 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
|
||||
|
@ -358,7 +358,7 @@
|
|||
<specification label="JVM(TM) Tool Interface"
|
||||
majorversion="1"
|
||||
minorversion="2"
|
||||
microversion="2">
|
||||
microversion="3">
|
||||
<title subtitle="Version">
|
||||
<tm>JVM</tm> Tool Interface
|
||||
</title>
|
||||
|
@ -431,6 +431,7 @@
|
|||
On the <tm>Solaris</tm> Operating Environment, an agent library is a shared
|
||||
object (<code>.so</code> file).
|
||||
<p/>
|
||||
|
||||
An agent may be started at VM startup by specifying the agent library
|
||||
name using a <internallink id="starting">command line option</internallink>.
|
||||
Some implementations may support a mechanism to <internallink id="onattach">
|
||||
|
@ -438,6 +439,39 @@
|
|||
The details of how this is initiated are implementation specific.
|
||||
</intro>
|
||||
|
||||
<intro id="entry point" label="Statically Linked Agents (since version 1.2.3)">
|
||||
|
||||
A native JVMTI Agent may be <i>statically linked</i> with the VM.
|
||||
The manner in which the library and VM image are combined is
|
||||
implementation-dependent.
|
||||
An agent L whose image has been combined with the VM is defined as
|
||||
<i>statically linked</i> if and only if the agent exports a function
|
||||
called Agent_OnLoad_L.
|
||||
<p/>
|
||||
If a <i>statically linked</i> agent L exports a function called
|
||||
Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad
|
||||
function will be ignored.
|
||||
If an agent L is <i>statically linked</i>, an Agent_OnLoad_L
|
||||
function will be invoked with the same arguments and expected return
|
||||
value as specified for the Agent_OnLoad function.
|
||||
An agent L that is <i>statically linked</i> will prohibit an agent of
|
||||
the same name from being loaded dynamically.
|
||||
<p/>
|
||||
The VM will invoke the Agent_OnUnload_L function of the agent, if such
|
||||
a function is exported, at the same point during startup as it would
|
||||
have called the dynamic entry point Agent_OnUnLoad.
|
||||
If a <i>statically linked</i> agent L exports a function called
|
||||
Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
|
||||
function will be ignored.
|
||||
<p/>
|
||||
If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function
|
||||
will be invoked with the same arguments and expected return value as
|
||||
specified for the Agent_OnAttach function.
|
||||
If a <i>statically linked</i> agent L exports a function called
|
||||
Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
|
||||
function will be ignored.
|
||||
</intro>
|
||||
|
||||
<intro id="starting" label="Agent Command Line Options">
|
||||
The term "command-line option" is used below to
|
||||
mean options supplied in the <code>JavaVMInitArgs</code> argument
|
||||
|
@ -463,7 +497,11 @@
|
|||
<code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to
|
||||
load the shared library <code>foo.dll</code> from the system <code>PATH</code>
|
||||
under <tm>Windows</tm> or <code>libfoo.so</code> from the
|
||||
<code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating environment.
|
||||
<code>LD_LIBRARY_PATH</code> under the <tm>Solaris</tm> operating
|
||||
environment.
|
||||
If the agent library is statically linked into the executable
|
||||
then no actual loading takes place.
|
||||
<p/>
|
||||
</dd>
|
||||
<dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt>
|
||||
<dd>
|
||||
|
@ -473,11 +511,20 @@
|
|||
The <i><options></i> will be passed to the agent on start-up.
|
||||
For example, if the option
|
||||
<code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to
|
||||
load the shared library <code>c:\myLibs\foo.dll</code>.
|
||||
load the shared library <code>c:\myLibs\foo.dll</code>. If the agent
|
||||
library is statically linked into the executable
|
||||
then no actual loading takes place.
|
||||
<p/>
|
||||
</dd>
|
||||
</dl>
|
||||
The start-up routine <internallink id="onload"><code>Agent_OnLoad</code></internallink>
|
||||
in the library will be invoked.
|
||||
For a dynamic shared library agent, the start-up routine
|
||||
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
|
||||
in the library will be invoked. If the agent library is statically linked
|
||||
into the executable then the system will attempt to invoke the
|
||||
<code>Agent_OnLoad_<agent-lib-name></code> entry point where
|
||||
<agent-lib-name> is the basename of the
|
||||
agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,
|
||||
the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.
|
||||
<p/>
|
||||
Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>
|
||||
will be searched for JNI native method implementations to facilitate the
|
||||
|
@ -502,11 +549,13 @@
|
|||
If the agent is started in the <code>OnLoad</code>
|
||||
<functionlink id="GetPhase">phase</functionlink> the function
|
||||
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
|
||||
will be invoked.
|
||||
or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>
|
||||
for statically linked agents will be invoked.
|
||||
If the agent is started in the live
|
||||
<functionlink id="GetPhase">phase</functionlink> the function
|
||||
<internallink id="onattach"><code>Agent_OnAttach</code></internallink>
|
||||
will be invoked.
|
||||
or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>
|
||||
for statically linked agents will be invoked.
|
||||
Exactly one call to a start-up function is made per agent.
|
||||
</intro>
|
||||
|
||||
|
@ -516,6 +565,11 @@
|
|||
<example>
|
||||
JNIEXPORT jint JNICALL
|
||||
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
|
||||
Or for a statically linked agent named 'L':
|
||||
<example>
|
||||
JNIEXPORT jint JNICALL
|
||||
Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>
|
||||
|
||||
The VM will start the agent by calling this function.
|
||||
It will be called early enough in VM initialization that:
|
||||
<ul>
|
||||
|
@ -531,7 +585,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
|
|||
<li>no objects have been created</li>
|
||||
</ul>
|
||||
<p/>
|
||||
The VM will call the <code>Agent_OnLoad</code> function with
|
||||
The VM will call the <code>Agent_OnLoad</code> or
|
||||
<code>Agent_OnLoad_<agent-lib-name></code> function with
|
||||
<i><options></i> as the second argument -
|
||||
that is, using the command-line option examples,
|
||||
<code>"opt1,opt2"</code> will be passed to the <code>char *options</code>
|
||||
|
@ -540,7 +595,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
|
|||
<internallink id="mUTF">modified UTF-8</internallink> string.
|
||||
If <i>=<options></i> is not specified,
|
||||
a zero length string is passed to <code>options</code>.
|
||||
The lifespan of the <code>options</code> string is the <code>Agent_OnLoad</code>
|
||||
The lifespan of the <code>options</code> string is the
|
||||
<code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code>
|
||||
call. If needed beyond this time the string or parts of the string must
|
||||
be copied.
|
||||
The period between when <code>Agent_OnLoad</code> is called and when it
|
||||
|
@ -570,7 +626,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
|
|||
their functionality.
|
||||
</rationale>
|
||||
<p/>
|
||||
The return value from <code>Agent_OnLoad</code> is used to indicate an error.
|
||||
The return value from <code>Agent_OnLoad</code> or
|
||||
<code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error.
|
||||
Any value other than zero indicates an error and causes termination of the VM.
|
||||
</intro>
|
||||
|
||||
|
@ -587,6 +644,11 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
|
|||
<example>
|
||||
JNIEXPORT jint JNICALL
|
||||
Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
|
||||
Or for a statically linked agent named 'L':
|
||||
<example>
|
||||
JNIEXPORT jint JNICALL
|
||||
Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>
|
||||
|
||||
<p/>
|
||||
The VM will start the agent by calling this function.
|
||||
It will be called in the context of a thread
|
||||
|
@ -596,13 +658,14 @@ Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
|
|||
</internallink> string.
|
||||
If startup options were not provided, a zero length string is passed to
|
||||
<code>options</code>. The lifespan of the <code>options</code> string is the
|
||||
<code>Agent_OnAttach</code> call. If needed beyond this time the string or parts of
|
||||
the string must be copied.
|
||||
<code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call.
|
||||
If needed beyond this time the string or parts of the string must be copied.
|
||||
<p/>
|
||||
Note that some <internallink id="capability">capabilities</internallink>
|
||||
may not be available in the live phase.
|
||||
<p/>
|
||||
The <code>Agent_OnAttach</code> function initializes the agent and returns a value
|
||||
The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name
|
||||
></code> function initializes the agent and returns a value
|
||||
to the VM to indicate if an error occurred. Any value other than zero indicates an error.
|
||||
An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
|
||||
some implementation specific action -- for example it might print an error to standard error,
|
||||
|
@ -615,8 +678,14 @@ Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
|
|||
<example>
|
||||
JNIEXPORT void JNICALL
|
||||
Agent_OnUnload(JavaVM *vm)</example>
|
||||
Or for a statically linked agent named 'L':
|
||||
<example>
|
||||
JNIEXPORT void JNICALL
|
||||
Agent_OnUnload_L(JavaVM *vm)</example>
|
||||
|
||||
This function will be called by the VM when the library is about to be unloaded.
|
||||
The library will be unloaded and this function will be called if some platform specific
|
||||
The library will be unloaded (unless it is statically linked into the
|
||||
executable) and this function will be called if some platform specific
|
||||
mechanism causes the unload (an unload mechanism is not specified in this document)
|
||||
or the library is (in effect) unloaded by the termination of the VM whether through
|
||||
normal termination or VM failure, including start-up failure.
|
||||
|
@ -625,8 +694,9 @@ Agent_OnUnload(JavaVM *vm)</example>
|
|||
<eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event
|
||||
to be sent, the VM must have run at least to the point of initialization and a valid
|
||||
<jvmti/> environment must exist which has set a callback for VMDeath
|
||||
and enabled the event
|
||||
None of these are required for <code>Agent_OnUnload</code> and this function
|
||||
and enabled the event.
|
||||
None of these are required for <code>Agent_OnUnload</code> or
|
||||
<code>Agent_OnUnload_<agent-lib-name></code> and this function
|
||||
is also called if the library is unloaded for other reasons.
|
||||
In the case that a VM Death event is sent, it will be sent before this
|
||||
function is called (assuming this function is called due to VM termination).
|
||||
|
@ -10701,10 +10771,14 @@ myInit() {
|
|||
<constants id="jvmtiPhase" label="Phases of execution" kind="enum">
|
||||
<constant id="JVMTI_PHASE_ONLOAD" num="1">
|
||||
<code>OnLoad</code> phase: while in the
|
||||
<internallink id="onload"><code>Agent_OnLoad</code></internallink> function.
|
||||
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
|
||||
or, for statically linked agents, the <internallink id="onload">
|
||||
<code>Agent_OnLoad_<agent-lib-name>
|
||||
</code></internallink> function.
|
||||
</constant>
|
||||
<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
|
||||
Primordial phase: between return from <code>Agent_OnLoad</code> and the
|
||||
Primordial phase: between return from <code>Agent_OnLoad</code>
|
||||
or <code>Agent_OnLoad_<agent-lib-name></code> and the
|
||||
<code>VMStart</code> event.
|
||||
</constant>
|
||||
<constant id="JVMTI_PHASE_START" num="6">
|
||||
|
@ -14261,6 +14335,9 @@ typedef void (JNICALL *jvmtiEventVMInit)
|
|||
<change date="11 October 2012" version="1.2.2">
|
||||
Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
|
||||
</change>
|
||||
<change date="19 June 2013" version="1.2.3">
|
||||
Added support for statically linked agents.
|
||||
</change>
|
||||
</changehistory>
|
||||
|
||||
</specification>
|
||||
|
|
|
@ -2191,6 +2191,8 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
|
|||
char buffer[JVM_MAXPATHLEN];
|
||||
void* library = NULL;
|
||||
jint result = JNI_ERR;
|
||||
const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS;
|
||||
size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols);
|
||||
|
||||
// get agent name and options
|
||||
const char* agent = op->arg(0);
|
||||
|
@ -2200,43 +2202,48 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
|
|||
// The abs paramter should be "true" or "false"
|
||||
bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0);
|
||||
|
||||
// Initially marked as invalid. It will be set to valid if we can find the agent
|
||||
AgentLibrary *agent_lib = new AgentLibrary(agent, options, is_absolute_path, NULL);
|
||||
|
||||
// If the path is absolute we attempt to load the library. Otherwise we try to
|
||||
// load it from the standard dll directory.
|
||||
// Check for statically linked in agent. If not found then if the path is
|
||||
// absolute we attempt to load the library. Otherwise we try to load it
|
||||
// from the standard dll directory.
|
||||
|
||||
if (is_absolute_path) {
|
||||
library = os::dll_load(agent, ebuf, sizeof ebuf);
|
||||
} else {
|
||||
// Try to load the agent from the standard dll directory
|
||||
if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
|
||||
agent)) {
|
||||
library = os::dll_load(buffer, ebuf, sizeof ebuf);
|
||||
}
|
||||
if (library == NULL) {
|
||||
// not found - try local path
|
||||
char ns[1] = {0};
|
||||
if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) {
|
||||
if (!os::find_builtin_agent(agent_lib, on_attach_symbols, num_symbol_entries)) {
|
||||
if (is_absolute_path) {
|
||||
library = os::dll_load(agent, ebuf, sizeof ebuf);
|
||||
} else {
|
||||
// Try to load the agent from the standard dll directory
|
||||
if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
|
||||
agent)) {
|
||||
library = os::dll_load(buffer, ebuf, sizeof ebuf);
|
||||
}
|
||||
if (library == NULL) {
|
||||
// not found - try local path
|
||||
char ns[1] = {0};
|
||||
if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) {
|
||||
library = os::dll_load(buffer, ebuf, sizeof ebuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (library != NULL) {
|
||||
agent_lib->set_os_lib(library);
|
||||
agent_lib->set_valid();
|
||||
}
|
||||
}
|
||||
|
||||
// If the library was loaded then we attempt to invoke the Agent_OnAttach
|
||||
// function
|
||||
if (library != NULL) {
|
||||
|
||||
if (agent_lib->valid()) {
|
||||
// Lookup the Agent_OnAttach function
|
||||
OnAttachEntry_t on_attach_entry = NULL;
|
||||
const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS;
|
||||
for (uint symbol_index = 0; symbol_index < ARRAY_SIZE(on_attach_symbols); symbol_index++) {
|
||||
on_attach_entry =
|
||||
CAST_TO_FN_PTR(OnAttachEntry_t, os::dll_lookup(library, on_attach_symbols[symbol_index]));
|
||||
if (on_attach_entry != NULL) break;
|
||||
}
|
||||
|
||||
on_attach_entry = CAST_TO_FN_PTR(OnAttachEntry_t,
|
||||
os::find_agent_function(agent_lib, false, on_attach_symbols, num_symbol_entries));
|
||||
if (on_attach_entry == NULL) {
|
||||
// Agent_OnAttach missing - unload library
|
||||
os::dll_unload(library);
|
||||
if (!agent_lib->is_static_lib()) {
|
||||
os::dll_unload(library);
|
||||
}
|
||||
delete agent_lib;
|
||||
} else {
|
||||
// Invoke the Agent_OnAttach function
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
|
@ -2256,7 +2263,9 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
|
|||
// If OnAttach returns JNI_OK then we add it to the list of
|
||||
// agent libraries so that we can call Agent_OnUnload later.
|
||||
if (result == JNI_OK) {
|
||||
Arguments::add_loaded_agent(agent, (char*)options, is_absolute_path, library);
|
||||
Arguments::add_loaded_agent(agent_lib);
|
||||
} else {
|
||||
delete agent_lib;
|
||||
}
|
||||
|
||||
// Agent_OnAttach executed so completion status is JNI_OK
|
||||
|
|
|
@ -128,7 +128,7 @@ WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
|
|||
WB_END
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
#ifdef INCLUDE_NMT
|
||||
#if INCLUDE_NMT
|
||||
// Alloc memory using the test memory type so that we can use that to see if
|
||||
// NMT picks it up correctly
|
||||
WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size))
|
||||
|
@ -181,6 +181,10 @@ WB_ENTRY(jboolean, WB_NMTWaitForDataMerge(JNIEnv* env))
|
|||
return MemTracker::wbtest_wait_for_data_merge();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jboolean, WB_NMTIsDetailSupported(JNIEnv* env))
|
||||
return MemTracker::tracking_level() == MemTracker::NMT_detail;
|
||||
WB_END
|
||||
|
||||
#endif // INCLUDE_NMT
|
||||
|
||||
static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
|
||||
|
@ -439,7 +443,7 @@ static JNINativeMethod methods[] = {
|
|||
{CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions },
|
||||
{CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize },
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
#ifdef INCLUDE_NMT
|
||||
#if INCLUDE_NMT
|
||||
{CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
|
||||
{CC"NMTFree", CC"(J)V", (void*)&WB_NMTFree },
|
||||
{CC"NMTReserveMemory", CC"(J)J", (void*)&WB_NMTReserveMemory },
|
||||
|
@ -447,6 +451,7 @@ static JNINativeMethod methods[] = {
|
|||
{CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory },
|
||||
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
|
||||
{CC"NMTWaitForDataMerge", CC"()Z", (void*)&WB_NMTWaitForDataMerge},
|
||||
{CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported},
|
||||
#endif // INCLUDE_NMT
|
||||
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
|
||||
{CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
|
||||
|
|
|
@ -118,11 +118,21 @@ class SystemProperty: public CHeapObj<mtInternal> {
|
|||
// For use by -agentlib, -agentpath and -Xrun
|
||||
class AgentLibrary : public CHeapObj<mtInternal> {
|
||||
friend class AgentLibraryList;
|
||||
public:
|
||||
// Is this library valid or not. Don't rely on os_lib == NULL as statically
|
||||
// linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
|
||||
enum AgentState {
|
||||
agent_invalid = 0,
|
||||
agent_valid = 1
|
||||
};
|
||||
|
||||
private:
|
||||
char* _name;
|
||||
char* _options;
|
||||
void* _os_lib;
|
||||
bool _is_absolute_path;
|
||||
bool _is_static_lib;
|
||||
AgentState _state;
|
||||
AgentLibrary* _next;
|
||||
|
||||
public:
|
||||
|
@ -133,6 +143,11 @@ class AgentLibrary : public CHeapObj<mtInternal> {
|
|||
void* os_lib() const { return _os_lib; }
|
||||
void set_os_lib(void* os_lib) { _os_lib = os_lib; }
|
||||
AgentLibrary* next() const { return _next; }
|
||||
bool is_static_lib() const { return _is_static_lib; }
|
||||
void set_static_lib(bool static_lib) { _is_static_lib = static_lib; }
|
||||
bool valid() { return (_state == agent_valid); }
|
||||
void set_valid() { _state = agent_valid; }
|
||||
void set_invalid() { _state = agent_invalid; }
|
||||
|
||||
// Constructor
|
||||
AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
|
||||
|
@ -147,6 +162,8 @@ class AgentLibrary : public CHeapObj<mtInternal> {
|
|||
_is_absolute_path = is_absolute_path;
|
||||
_os_lib = os_lib;
|
||||
_next = NULL;
|
||||
_state = agent_invalid;
|
||||
_is_static_lib = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -276,6 +293,8 @@ class Arguments : AllStatic {
|
|||
{ _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }
|
||||
|
||||
// Late-binding agents not started via arguments
|
||||
static void add_loaded_agent(AgentLibrary *agentLib)
|
||||
{ _agentList.add(agentLib); }
|
||||
static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
|
||||
{ _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }
|
||||
|
||||
|
|
|
@ -443,6 +443,67 @@ void* os::native_java_library() {
|
|||
return _native_java_library;
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for finding Agent_On(Un)Load/Attach<_lib_name> if it exists.
|
||||
* If check_lib == true then we are looking for an
|
||||
* Agent_OnLoad_lib_name or Agent_OnAttach_lib_name function to determine if
|
||||
* this library is statically linked into the image.
|
||||
* If check_lib == false then we will look for the appropriate symbol in the
|
||||
* executable if agent_lib->is_static_lib() == true or in the shared library
|
||||
* referenced by 'handle'.
|
||||
*/
|
||||
void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
|
||||
const char *syms[], size_t syms_len) {
|
||||
const char *lib_name;
|
||||
void *handle = agent_lib->os_lib();
|
||||
void *entryName = NULL;
|
||||
char *agent_function_name;
|
||||
size_t i;
|
||||
|
||||
// If checking then use the agent name otherwise test is_static_lib() to
|
||||
// see how to process this lookup
|
||||
lib_name = ((check_lib || agent_lib->is_static_lib()) ? agent_lib->name() : NULL);
|
||||
for (i = 0; i < syms_len; i++) {
|
||||
agent_function_name = build_agent_function_name(syms[i], lib_name, agent_lib->is_absolute_path());
|
||||
if (agent_function_name == NULL) {
|
||||
break;
|
||||
}
|
||||
entryName = dll_lookup(handle, agent_function_name);
|
||||
FREE_C_HEAP_ARRAY(char, agent_function_name, mtThread);
|
||||
if (entryName != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return entryName;
|
||||
}
|
||||
|
||||
// See if the passed in agent is statically linked into the VM image.
|
||||
bool os::find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
|
||||
size_t syms_len) {
|
||||
void *ret;
|
||||
void *proc_handle;
|
||||
void *save_handle;
|
||||
|
||||
if (agent_lib->name() == NULL) {
|
||||
return false;
|
||||
}
|
||||
proc_handle = get_default_process_handle();
|
||||
// Check for Agent_OnLoad/Attach_lib_name function
|
||||
save_handle = agent_lib->os_lib();
|
||||
// We want to look in this process' symbol table.
|
||||
agent_lib->set_os_lib(proc_handle);
|
||||
ret = find_agent_function(agent_lib, true, syms, syms_len);
|
||||
agent_lib->set_os_lib(save_handle);
|
||||
if (ret != NULL) {
|
||||
// Found an entry point like Agent_OnLoad_lib_name so we have a static agent
|
||||
agent_lib->set_os_lib(proc_handle);
|
||||
agent_lib->set_valid();
|
||||
agent_lib->set_static_lib(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------- heap allocation utilities ---------------------
|
||||
|
||||
char *os::strdup(const char *str, MEMFLAGS flags) {
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
# include <setjmp.h>
|
||||
#endif
|
||||
|
||||
class AgentLibrary;
|
||||
|
||||
// os defines the interface to operating system; this includes traditional
|
||||
// OS services (time, I/O) as well as other functionality with system-
|
||||
// dependent code.
|
||||
|
@ -537,6 +539,17 @@ class os: AllStatic {
|
|||
// Unload library
|
||||
static void dll_unload(void *lib);
|
||||
|
||||
// Return the handle of this process
|
||||
static void* get_default_process_handle();
|
||||
|
||||
// Check for static linked agent library
|
||||
static bool find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
|
||||
size_t syms_len);
|
||||
|
||||
// Find agent entry point
|
||||
static void *find_agent_function(AgentLibrary *agent_lib, bool check_lib,
|
||||
const char *syms[], size_t syms_len);
|
||||
|
||||
// Print out system information; they are called by fatal error handler.
|
||||
// Output format may be different on different platforms.
|
||||
static void print_os_info(outputStream* st);
|
||||
|
@ -806,6 +819,11 @@ class os: AllStatic {
|
|||
// ResumeThread call)
|
||||
static void pause();
|
||||
|
||||
// Builds a platform dependent Agent_OnLoad_<libname> function name
|
||||
// which is used to find statically linked in agents.
|
||||
static char* build_agent_function_name(const char *sym, const char *cname,
|
||||
bool is_absolute_path);
|
||||
|
||||
class SuspendedThreadTaskContext {
|
||||
public:
|
||||
SuspendedThreadTaskContext(Thread* thread, void *ucontext) : _thread(thread), _ucontext(ucontext) {}
|
||||
|
|
|
@ -3696,15 +3696,18 @@ extern "C" {
|
|||
// num_symbol_entries must be passed-in since only the caller knows the number of symbols in the array.
|
||||
static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_symbols[], size_t num_symbol_entries) {
|
||||
OnLoadEntry_t on_load_entry = NULL;
|
||||
void *library = agent->os_lib(); // check if we have looked it up before
|
||||
void *library = NULL;
|
||||
|
||||
if (library == NULL) {
|
||||
if (!agent->valid()) {
|
||||
char buffer[JVM_MAXPATHLEN];
|
||||
char ebuf[1024];
|
||||
const char *name = agent->name();
|
||||
const char *msg = "Could not find agent library ";
|
||||
|
||||
if (agent->is_absolute_path()) {
|
||||
// First check to see if agent is statcally linked into executable
|
||||
if (os::find_builtin_agent(agent, on_load_symbols, num_symbol_entries)) {
|
||||
library = agent->os_lib();
|
||||
} else if (agent->is_absolute_path()) {
|
||||
library = os::dll_load(name, ebuf, sizeof ebuf);
|
||||
if (library == NULL) {
|
||||
const char *sub_msg = " in absolute path, with error: ";
|
||||
|
@ -3738,13 +3741,15 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_sym
|
|||
}
|
||||
}
|
||||
agent->set_os_lib(library);
|
||||
agent->set_valid();
|
||||
}
|
||||
|
||||
// Find the OnLoad function.
|
||||
for (size_t symbol_index = 0; symbol_index < num_symbol_entries; symbol_index++) {
|
||||
on_load_entry = CAST_TO_FN_PTR(OnLoadEntry_t, os::dll_lookup(library, on_load_symbols[symbol_index]));
|
||||
if (on_load_entry != NULL) break;
|
||||
}
|
||||
on_load_entry =
|
||||
CAST_TO_FN_PTR(OnLoadEntry_t, os::find_agent_function(agent,
|
||||
false,
|
||||
on_load_symbols,
|
||||
num_symbol_entries));
|
||||
return on_load_entry;
|
||||
}
|
||||
|
||||
|
@ -3819,22 +3824,23 @@ extern "C" {
|
|||
void Threads::shutdown_vm_agents() {
|
||||
// Send any Agent_OnUnload notifications
|
||||
const char *on_unload_symbols[] = AGENT_ONUNLOAD_SYMBOLS;
|
||||
size_t num_symbol_entries = ARRAY_SIZE(on_unload_symbols);
|
||||
extern struct JavaVM_ main_vm;
|
||||
for (AgentLibrary* agent = Arguments::agents(); agent != NULL; agent = agent->next()) {
|
||||
|
||||
// Find the Agent_OnUnload function.
|
||||
for (uint symbol_index = 0; symbol_index < ARRAY_SIZE(on_unload_symbols); symbol_index++) {
|
||||
Agent_OnUnload_t unload_entry = CAST_TO_FN_PTR(Agent_OnUnload_t,
|
||||
os::dll_lookup(agent->os_lib(), on_unload_symbols[symbol_index]));
|
||||
Agent_OnUnload_t unload_entry = CAST_TO_FN_PTR(Agent_OnUnload_t,
|
||||
os::find_agent_function(agent,
|
||||
false,
|
||||
on_unload_symbols,
|
||||
num_symbol_entries));
|
||||
|
||||
// Invoke the Agent_OnUnload function
|
||||
if (unload_entry != NULL) {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadToNativeFromVM ttn(thread);
|
||||
HandleMark hm(thread);
|
||||
(*unload_entry)(&main_vm);
|
||||
break;
|
||||
}
|
||||
// Invoke the Agent_OnUnload function
|
||||
if (unload_entry != NULL) {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadToNativeFromVM ttn(thread);
|
||||
HandleMark hm(thread);
|
||||
(*unload_entry)(&main_vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
# This file identifies the root of the test-suite hierarchy.
|
||||
# It also contains test-suite configuration information.
|
||||
# DO NOT EDIT without first contacting hotspot-regtest@sun.com
|
||||
|
||||
# The list of keywords supported in this test suite
|
||||
keys=cte_test jcmd nmt regression gc
|
||||
|
||||
groups=TEST.groups [closed/TEST.groups]
|
||||
|
|
192
hotspot/test/TEST.groups
Normal file
192
hotspot/test/TEST.groups
Normal file
|
@ -0,0 +1,192 @@
|
|||
#
|
||||
# Copyright (c) 2013, 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.
|
||||
#
|
||||
|
||||
# Profile-based Test Group Definitions
|
||||
#
|
||||
# These groups define the tests that cover the different possible runtimes:
|
||||
# - compact1, compact2, compact3, full JRE, JDK
|
||||
#
|
||||
# In addition they support testing of the minimal VM on compact1 and compact2.
|
||||
# Essentially this defines groups based around the specified API's and VM
|
||||
# services available in the runtime.
|
||||
#
|
||||
# The groups are defined hierarchically in two forms:
|
||||
# - The need_xxx groups list all the tests that have a dependency on
|
||||
# a specific profile. This is either because it tests a feature in
|
||||
# that profile, or the test infrastructure uses a feature in that
|
||||
# profile.
|
||||
# - The primary groups are defined in terms of the other primary groups
|
||||
# combined with the needs_xxx groups (including and excluding them as
|
||||
# appropriate). For example the jre can run all tests from compact3, plus
|
||||
# those from needs_jre, but excluding those from need_jdk.
|
||||
#
|
||||
# The bottom group defines all the actual tests to be considered, simply
|
||||
# by listing the top-level test directories.
|
||||
#
|
||||
# To use a group simply list it on the jtreg command line eg:
|
||||
# jtreg :jdk
|
||||
# runs all tests. While
|
||||
# jtreg :compact2
|
||||
# runs those tests that only require compact1 and compact2 API's.
|
||||
#
|
||||
|
||||
# Full JDK can run all tests
|
||||
#
|
||||
jdk = \
|
||||
:jre \
|
||||
:needs_jdk
|
||||
|
||||
# Tests that require a full JDK to execute. Either they test a feature
|
||||
# only in the JDK or they use tools that are only in the JDK. The latter
|
||||
# can be resolved in some cases by using tools from the compile-jdk.
|
||||
#
|
||||
needs_jdk = \
|
||||
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
|
||||
gc/metaspace/ClassMetaspaceSizeInJmapHeap.java \
|
||||
gc/metaspace/TestMetaspacePerfCounters.java \
|
||||
runtime/6819213/TestBootNativeLibraryPath.java \
|
||||
runtime/6878713/Test6878713.sh \
|
||||
runtime/6925573/SortMethodsTest.java \
|
||||
runtime/7107135/Test7107135.sh \
|
||||
runtime/7158988/FieldMonitor.java \
|
||||
runtime/7194254/Test7194254.java \
|
||||
runtime/jsig/Test8017498.sh \
|
||||
runtime/Metaspace/FragmentMetaspace.java \
|
||||
runtime/NMT/BaselineWithParameter.java \
|
||||
runtime/NMT/JcmdScale.java \
|
||||
runtime/NMT/JcmdWithNMTDisabled.java \
|
||||
runtime/NMT/MallocTestType.java \
|
||||
runtime/NMT/ReleaseCommittedMemory.java \
|
||||
runtime/NMT/ShutdownTwice.java \
|
||||
runtime/NMT/SummaryAfterShutdown.java \
|
||||
runtime/NMT/SummarySanityCheck.java \
|
||||
runtime/NMT/ThreadedMallocTestType.java \
|
||||
runtime/NMT/ThreadedVirtualAllocTestType.java \
|
||||
runtime/NMT/VirtualAllocTestType.java \
|
||||
runtime/RedefineObject/TestRedefineObject.java \
|
||||
serviceability/attach/AttachWithStalePidFile.java
|
||||
|
||||
# JRE adds further tests to compact3
|
||||
#
|
||||
jre = \
|
||||
:compact3 \
|
||||
:needs_jre \
|
||||
-:needs_jdk
|
||||
|
||||
# Tests that require the full JRE
|
||||
#
|
||||
needs_jre = \
|
||||
compiler/6852078/Test6852078.java \
|
||||
compiler/7047069/Test7047069.java \
|
||||
runtime/6294277/SourceDebugExtension.java
|
||||
|
||||
# Compact 3 adds further tests to compact2
|
||||
#
|
||||
compact3 = \
|
||||
:compact2 \
|
||||
:needs_compact3 \
|
||||
-:needs_jre \
|
||||
-:needs_jdk
|
||||
|
||||
|
||||
# Tests that require compact3 API's
|
||||
#
|
||||
needs_compact3 = \
|
||||
compiler/whitebox/DeoptimizeMethodTest.java \
|
||||
compiler/whitebox/SetForceInlineMethodTest.java \
|
||||
compiler/whitebox/SetDontInlineMethodTest.java \
|
||||
compiler/whitebox/DeoptimizeAllTest.java \
|
||||
compiler/whitebox/MakeMethodNotCompilableTest.java \
|
||||
compiler/whitebox/ClearMethodStateTest.java \
|
||||
compiler/whitebox/EnqueueMethodForCompilationTest.java \
|
||||
compiler/whitebox/IsMethodCompilableTest.java \
|
||||
gc/6581734/Test6581734.java \
|
||||
gc/7072527/TestFullGCCount.java \
|
||||
gc/7168848/HumongousAlloc.java \
|
||||
gc/arguments/TestG1HeapRegionSize.java \
|
||||
gc/metaspace/TestMetaspaceMemoryPool.java \
|
||||
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
|
||||
serviceability/threads/TestFalseDeadLock.java
|
||||
|
||||
# Compact 2 adds full VM tests
|
||||
compact2 = \
|
||||
:compact2_minimal \
|
||||
:compact1 \
|
||||
:needs_full_vm_compact2 \
|
||||
-:needs_compact3 \
|
||||
-:needs_jre \
|
||||
-:needs_jdk
|
||||
|
||||
# Tests that require compact2 API's and a full VM
|
||||
#
|
||||
needs_full_vm_compact2 =
|
||||
|
||||
# Compact 1 adds full VM tests
|
||||
#
|
||||
compact1 = \
|
||||
:compact1_minimal \
|
||||
:needs_full_vm_compact1 \
|
||||
-:needs_compact2 \
|
||||
-:needs_full_vm_compact2 \
|
||||
-:needs_compact3 \
|
||||
-:needs_jre \
|
||||
-:needs_jdk
|
||||
|
||||
# Tests that require compact1 API's and a full VM
|
||||
#
|
||||
needs_full_vm_compact1 = \
|
||||
runtime/NMT \
|
||||
gc/g1/TestRegionAlignment.java \
|
||||
gc/g1/TestShrinkToOneRegion.java \
|
||||
gc/metaspace/G1AddMetaspaceDependency.java \
|
||||
runtime/6929067/Test6929067.sh
|
||||
|
||||
# Minimal VM on Compact 2 adds in some compact2 tests
|
||||
#
|
||||
compact2_minimal = \
|
||||
:compact1_minimal \
|
||||
:needs_compact2 \
|
||||
-:needs_full_vm_compact2 \
|
||||
-:needs_compact3 \
|
||||
-:needs_jre \
|
||||
-:needs_jdk
|
||||
|
||||
# Tests that require compact2 API's
|
||||
#
|
||||
needs_compact2 = \
|
||||
compiler/6589834/Test_ia32.java
|
||||
|
||||
# All tests that run on the most minimal configuration: Minimal VM on Compact 1
|
||||
compact1_minimal = \
|
||||
serviceability/ \
|
||||
compiler/ \
|
||||
testlibrary/ \
|
||||
sanity/ \
|
||||
runtime/ \
|
||||
gc/ \
|
||||
-:needs_full_vm_compact1 \
|
||||
-:needs_full_vm_compact2 \
|
||||
-:needs_compact2 \
|
||||
-:needs_compact3 \
|
||||
-:needs_jre \
|
||||
-:needs_jdk
|
56
hotspot/test/compiler/8004051/Test8004051.java
Normal file
56
hotspot/test/compiler/8004051/Test8004051.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 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 8004051
|
||||
* @bug 8005722
|
||||
* @summary assert(_oprs_len[mode] < maxNumberOfOperands) failed: array overflow
|
||||
*
|
||||
* @run main/othervm -Xcomp -client Test8004051
|
||||
*/
|
||||
|
||||
public class Test8004051 {
|
||||
public static void main(String[] argv) {
|
||||
Object o = new Object();
|
||||
fillPrimRect(1.1f, 1.2f, 1.3f, 1.4f,
|
||||
o, o,
|
||||
1.5f, 1.6f, 1.7f, 1.8f,
|
||||
2.0f, 2.1f, 2.2f, 2.3f,
|
||||
2.4f, 2.5f, 2.6f, 2.7f,
|
||||
100, 101);
|
||||
System.out.println("Test passed, test did not assert");
|
||||
}
|
||||
|
||||
static boolean fillPrimRect(float x, float y, float w, float h,
|
||||
Object rectTex, Object wrapTex,
|
||||
float bx, float by, float bw, float bh,
|
||||
float f1, float f2, float f3, float f4,
|
||||
float f5, float f6, float f7, float f8,
|
||||
int i1, int i2 ) {
|
||||
System.out.println(x + " " + y + " " + w + " " + h + " " +
|
||||
bx + " " + by + " " + bw + " " + bh);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -45,6 +45,13 @@ public class ThreadedVirtualAllocTestType {
|
|||
String pid = Integer.toString(ProcessTools.getProcessId());
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
|
||||
boolean has_nmt_detail = wb.NMTIsDetailSupported();
|
||||
if (has_nmt_detail) {
|
||||
System.out.println("NMT detail support detected.");
|
||||
} else {
|
||||
System.out.println("NMT detail support not detected.");
|
||||
}
|
||||
|
||||
Thread reserveThread = new Thread() {
|
||||
public void run() {
|
||||
addr = wb.NMTReserveMemory(reserveSize);
|
||||
|
@ -58,7 +65,9 @@ public class ThreadedVirtualAllocTestType {
|
|||
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Test (reserved=512KB, committed=0KB)");
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
|
||||
if (has_nmt_detail) {
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
|
||||
}
|
||||
|
||||
Thread commitThread = new Thread() {
|
||||
public void run() {
|
||||
|
@ -72,7 +81,9 @@ public class ThreadedVirtualAllocTestType {
|
|||
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Test (reserved=512KB, committed=128KB)");
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
|
||||
if (has_nmt_detail) {
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
|
||||
}
|
||||
|
||||
Thread uncommitThread = new Thread() {
|
||||
public void run() {
|
||||
|
|
|
@ -46,13 +46,22 @@ public class VirtualAllocTestType {
|
|||
String pid = Integer.toString(ProcessTools.getProcessId());
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
|
||||
boolean has_nmt_detail = wb.NMTIsDetailSupported();
|
||||
if (has_nmt_detail) {
|
||||
System.out.println("NMT detail support detected.");
|
||||
} else {
|
||||
System.out.println("NMT detail support not detected.");
|
||||
}
|
||||
|
||||
addr = wb.NMTReserveMemory(reserveSize);
|
||||
mergeData();
|
||||
|
||||
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
|
||||
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Test (reserved=256KB, committed=0KB)");
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
|
||||
if (has_nmt_detail) {
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
|
||||
}
|
||||
|
||||
wb.NMTCommitMemory(addr, commitSize);
|
||||
|
||||
|
@ -60,7 +69,9 @@ public class VirtualAllocTestType {
|
|||
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Test (reserved=256KB, committed=128KB)");
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
|
||||
if (has_nmt_detail) {
|
||||
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
|
||||
}
|
||||
|
||||
wb.NMTUncommitMemory(addr, commitSize);
|
||||
|
||||
|
@ -71,7 +82,6 @@ public class VirtualAllocTestType {
|
|||
output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed");
|
||||
|
||||
wb.NMTReleaseMemory(addr, reserveSize);
|
||||
|
||||
mergeData();
|
||||
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
|
|
|
@ -90,6 +90,7 @@ public class WhiteBox {
|
|||
public native void NMTUncommitMemory(long addr, long size);
|
||||
public native void NMTReleaseMemory(long addr, long size);
|
||||
public native boolean NMTWaitForDataMerge();
|
||||
public native boolean NMTIsDetailSupported();
|
||||
|
||||
// Compiler
|
||||
public native void deoptimizeAll();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue