mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
Merge
This commit is contained in:
commit
3b29cc06ea
14 changed files with 235 additions and 190 deletions
|
@ -35,8 +35,9 @@ sapkg.c1 = sapkg.hotspot.c1;
|
||||||
sapkg.code = sapkg.hotspot.code;
|
sapkg.code = sapkg.hotspot.code;
|
||||||
sapkg.compiler = sapkg.hotspot.compiler;
|
sapkg.compiler = sapkg.hotspot.compiler;
|
||||||
|
|
||||||
// 'debugger' is a JavaScript keyword :-(
|
// 'debugger' is a JavaScript keyword, but ES5 relaxes the
|
||||||
// sapkg.debugger = sapkg.hotspot.debugger;
|
// restriction of using keywords as property name
|
||||||
|
sapkg.debugger = sapkg.hotspot.debugger;
|
||||||
|
|
||||||
sapkg.interpreter = sapkg.hotspot.interpreter;
|
sapkg.interpreter = sapkg.hotspot.interpreter;
|
||||||
sapkg.jdi = sapkg.hotspot.jdi;
|
sapkg.jdi = sapkg.hotspot.jdi;
|
||||||
|
@ -116,27 +117,36 @@ function main(globals, jvmarg) {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle __has__ specially to avoid metacircularity problems
|
||||||
|
// when called from __get__.
|
||||||
|
// Calling
|
||||||
|
// this.__has__(name)
|
||||||
|
// will in turn call
|
||||||
|
// this.__call__('__has__', name)
|
||||||
|
// which is not handled below
|
||||||
|
function __has__(name) {
|
||||||
|
if (typeof(name) == 'number') {
|
||||||
|
return so["has(int)"](name);
|
||||||
|
} else {
|
||||||
|
if (name == '__wrapped__') {
|
||||||
|
return true;
|
||||||
|
} else if (so["has(java.lang.String)"](name)) {
|
||||||
|
return true;
|
||||||
|
} else if (name.equals('toString')) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (so instanceof sapkg.utilities.soql.ScriptObject) {
|
if (so instanceof sapkg.utilities.soql.ScriptObject) {
|
||||||
return new JSAdapter() {
|
return new JSAdapter() {
|
||||||
__getIds__: function() {
|
__getIds__: function() {
|
||||||
return so.getIds();
|
return so.getIds();
|
||||||
},
|
},
|
||||||
|
|
||||||
__has__ : function(name) {
|
__has__ : __has__,
|
||||||
if (typeof(name) == 'number') {
|
|
||||||
return so["has(int)"](name);
|
|
||||||
} else {
|
|
||||||
if (name == '__wrapped__') {
|
|
||||||
return true;
|
|
||||||
} else if (so["has(java.lang.String)"](name)) {
|
|
||||||
return true;
|
|
||||||
} else if (name.equals('toString')) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
__delete__ : function(name) {
|
__delete__ : function(name) {
|
||||||
if (typeof(name) == 'number') {
|
if (typeof(name) == 'number') {
|
||||||
|
@ -147,7 +157,8 @@ function main(globals, jvmarg) {
|
||||||
},
|
},
|
||||||
|
|
||||||
__get__ : function(name) {
|
__get__ : function(name) {
|
||||||
if (! this.__has__(name)) {
|
// don't call this.__has__(name); see comments above function __has__
|
||||||
|
if (! __has__.call(this, name)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (typeof(name) == 'number') {
|
if (typeof(name) == 'number') {
|
||||||
|
@ -162,7 +173,7 @@ function main(globals, jvmarg) {
|
||||||
var args = prepareArgsArray(arguments);
|
var args = prepareArgsArray(arguments);
|
||||||
var r;
|
var r;
|
||||||
try {
|
try {
|
||||||
r = value.call(args);
|
r = value.call(Java.to(args, 'java.lang.Object[]'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
println("call to " + name + " failed!");
|
println("call to " + name + " failed!");
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -204,6 +215,18 @@ function main(globals, jvmarg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// define "writeln" and "write" if not defined
|
// define "writeln" and "write" if not defined
|
||||||
|
if (typeof(println) == 'undefined') {
|
||||||
|
println = function (str) {
|
||||||
|
java.lang.System.out.println(String(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(print) == 'undefined') {
|
||||||
|
print = function (str) {
|
||||||
|
java.lang.System.out.print(String(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof(writeln) == 'undefined') {
|
if (typeof(writeln) == 'undefined') {
|
||||||
writeln = println;
|
writeln = println;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +258,7 @@ function main(globals, jvmarg) {
|
||||||
|
|
||||||
this.jclasses = function() {
|
this.jclasses = function() {
|
||||||
forEachKlass(function (clazz) {
|
forEachKlass(function (clazz) {
|
||||||
writeln(clazz.getName().asString() + " @" + clazz.getHandle().toString());
|
writeln(clazz.getName().asString() + " @" + clazz.getAddress().toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
registerCommand("classes", "classes", "jclasses");
|
registerCommand("classes", "classes", "jclasses");
|
||||||
|
@ -490,14 +513,14 @@ function systemLoader() {
|
||||||
function forEachKlass(callback) {
|
function forEachKlass(callback) {
|
||||||
var VisitorClass = sapkg.memory.SystemDictionary.ClassVisitor;
|
var VisitorClass = sapkg.memory.SystemDictionary.ClassVisitor;
|
||||||
var visitor = new VisitorClass() { visit: callback };
|
var visitor = new VisitorClass() { visit: callback };
|
||||||
sa.sysDict["classesDo(sun.jvm.hotspot.memory.SystemDictionary$ClassVisitor)"](visitor);
|
sa.sysDict["classesDo(sun.jvm.hotspot.memory.SystemDictionary.ClassVisitor)"](visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate system dictionary for each 'Klass' and initiating loader
|
// iterate system dictionary for each 'Klass' and initiating loader
|
||||||
function forEachKlassAndLoader(callback) {
|
function forEachKlassAndLoader(callback) {
|
||||||
var VisitorClass = sapkg.memory.SystemDictionary.ClassAndLoaderVisitor;
|
var VisitorClass = sapkg.memory.SystemDictionary.ClassAndLoaderVisitor;
|
||||||
var visitor = new VisitorClass() { visit: callback };
|
var visitor = new VisitorClass() { visit: callback };
|
||||||
sa.sysDict["classesDo(sun.jvm.hotspot.memory.SystemDictionary$ClassAndLoaderVisitor)"](visitor);
|
sa.sysDict["classesDo(sun.jvm.hotspot.memory.SystemDictionary.ClassAndLoaderVisitor)"](visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate system dictionary for each primitive array klass
|
// iterate system dictionary for each primitive array klass
|
||||||
|
@ -522,7 +545,12 @@ function obj2oop(obj) {
|
||||||
|
|
||||||
// iterates Java heap for each Oop
|
// iterates Java heap for each Oop
|
||||||
function forEachOop(callback) {
|
function forEachOop(callback) {
|
||||||
sa.objHeap.iterate(new sapkg.oops.HeapVisitor() { doObj: callback });
|
function empty() { }
|
||||||
|
sa.objHeap.iterate(new sapkg.oops.HeapVisitor() {
|
||||||
|
prologue: empty,
|
||||||
|
doObj: callback,
|
||||||
|
epilogue: empty
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterates Java heap for each Oop of given 'klass'.
|
// iterates Java heap for each Oop of given 'klass'.
|
||||||
|
@ -536,8 +564,14 @@ function forEachOopOfKlass(callback, klass, includeSubtypes) {
|
||||||
if (includeSubtypes == undefined) {
|
if (includeSubtypes == undefined) {
|
||||||
includeSubtypes = true;
|
includeSubtypes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function empty() { }
|
||||||
sa.objHeap.iterateObjectsOfKlass(
|
sa.objHeap.iterateObjectsOfKlass(
|
||||||
new sapkg.oops.HeapVisitor() { doObj: callback },
|
new sapkg.oops.HeapVisitor() {
|
||||||
|
prologue: empty,
|
||||||
|
doObj: callback,
|
||||||
|
epilogue: empty
|
||||||
|
},
|
||||||
klass, includeSubtypes);
|
klass, includeSubtypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,9 +780,9 @@ while (tmp.itr.hasNext()) {
|
||||||
// ignore;
|
// ignore;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// some type names have ':'. replace to make it as a
|
// some type names have ':', '<', '>', '*', ' '. replace to make it as a
|
||||||
// JavaScript identifier
|
// JavaScript identifier
|
||||||
tmp.name = tmp.name.replace(':', '_').replace('<', '_').replace('>', '_').replace('*', '_').replace(' ', '_');
|
tmp.name = ("" + tmp.name).replace(/[:<>* ]/g, '_');
|
||||||
eval("function read" + tmp.name + "(addr) {" +
|
eval("function read" + tmp.name + "(addr) {" +
|
||||||
" return readVMType('" + tmp.name + "', addr);}");
|
" return readVMType('" + tmp.name + "', addr);}");
|
||||||
eval("function print" + tmp.name + "(addr) {" +
|
eval("function print" + tmp.name + "(addr) {" +
|
||||||
|
|
|
@ -42,8 +42,6 @@ else
|
||||||
MKS_HOME=`dirname "$SH"`
|
MKS_HOME=`dirname "$SH"`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "EXPORTS" > vm1.def
|
|
||||||
|
|
||||||
AWK="$MKS_HOME/awk.exe"
|
AWK="$MKS_HOME/awk.exe"
|
||||||
if [ ! -e $AWK ]; then
|
if [ ! -e $AWK ]; then
|
||||||
AWK="$MKS_HOME/gawk.exe"
|
AWK="$MKS_HOME/gawk.exe"
|
||||||
|
@ -55,6 +53,22 @@ CAT="$MKS_HOME/cat.exe"
|
||||||
RM="$MKS_HOME/rm.exe"
|
RM="$MKS_HOME/rm.exe"
|
||||||
DUMPBIN="link.exe /dump"
|
DUMPBIN="link.exe /dump"
|
||||||
|
|
||||||
|
if [ "$1" = "-nosa" ]; then
|
||||||
|
echo EXPORTS > vm.def
|
||||||
|
echo ""
|
||||||
|
echo "***"
|
||||||
|
echo "*** Not building SA: BUILD_WIN_SA != 1"
|
||||||
|
echo "*** C++ Vtables NOT included in vm.def"
|
||||||
|
echo "*** This jvm.dll will NOT work properly with SA."
|
||||||
|
echo "***"
|
||||||
|
echo "*** When in doubt, set BUILD_WIN_SA=1, clean and rebuild."
|
||||||
|
echo "***"
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "EXPORTS" > vm1.def
|
||||||
|
|
||||||
# When called from IDE the first param should contain the link version, otherwise may be nill
|
# When called from IDE the first param should contain the link version, otherwise may be nill
|
||||||
if [ "x$1" != "x" ]; then
|
if [ "x$1" != "x" ]; then
|
||||||
LD_VER="$1"
|
LD_VER="$1"
|
||||||
|
|
|
@ -49,9 +49,6 @@ HS_BUILD_ID=$(HS_BUILD_VER)-debug
|
||||||
# Force resources to be rebuilt every time
|
# Force resources to be rebuilt every time
|
||||||
$(Res_Files): FORCE
|
$(Res_Files): FORCE
|
||||||
|
|
||||||
vm.def: $(Obj_Files)
|
|
||||||
sh $(WorkSpace)/make/windows/build_vm_def.sh
|
|
||||||
|
|
||||||
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
||||||
$(LD) @<<
|
$(LD) @<<
|
||||||
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
||||||
|
|
|
@ -48,9 +48,6 @@ HS_BUILD_ID=$(HS_BUILD_VER)-fastdebug
|
||||||
# Force resources to be rebuilt every time
|
# Force resources to be rebuilt every time
|
||||||
$(Res_Files): FORCE
|
$(Res_Files): FORCE
|
||||||
|
|
||||||
vm.def: $(Obj_Files)
|
|
||||||
sh $(WorkSpace)/make/windows/build_vm_def.sh
|
|
||||||
|
|
||||||
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
||||||
$(LD) @<<
|
$(LD) @<<
|
||||||
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
||||||
|
|
|
@ -51,9 +51,6 @@ HS_BUILD_ID=$(HS_BUILD_VER)
|
||||||
# Force resources to be rebuilt every time
|
# Force resources to be rebuilt every time
|
||||||
$(Res_Files): FORCE
|
$(Res_Files): FORCE
|
||||||
|
|
||||||
vm.def: $(Obj_Files)
|
|
||||||
sh $(WorkSpace)/make/windows/build_vm_def.sh
|
|
||||||
|
|
||||||
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
$(AOUT): $(Res_Files) $(Obj_Files) vm.def
|
||||||
$(LD) @<<
|
$(LD) @<<
|
||||||
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
|
||||||
|
|
|
@ -92,6 +92,10 @@ ProjectCreatorIDEOptions = \
|
||||||
-disablePch getThread_windows_$(Platform_arch).cpp \
|
-disablePch getThread_windows_$(Platform_arch).cpp \
|
||||||
-disablePch_compiler2 opcodes.cpp
|
-disablePch_compiler2 opcodes.cpp
|
||||||
|
|
||||||
|
!if "$(BUILD_WIN_SA)" != "1"
|
||||||
|
BUILD_VM_DEF_FLAG=-nosa
|
||||||
|
!endif
|
||||||
|
|
||||||
# Common options for the IDE builds for c1, and c2
|
# Common options for the IDE builds for c1, and c2
|
||||||
ProjectCreatorIDEOptions=\
|
ProjectCreatorIDEOptions=\
|
||||||
$(ProjectCreatorIDEOptions) \
|
$(ProjectCreatorIDEOptions) \
|
||||||
|
@ -104,7 +108,7 @@ ProjectCreatorIDEOptions=\
|
||||||
-jdkTargetRoot $(HOTSPOTJDKDIST) \
|
-jdkTargetRoot $(HOTSPOTJDKDIST) \
|
||||||
-define ALIGN_STACK_FRAMES \
|
-define ALIGN_STACK_FRAMES \
|
||||||
-define VM_LITTLE_ENDIAN \
|
-define VM_LITTLE_ENDIAN \
|
||||||
-prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LD_VER)" \
|
-prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(BUILD_VM_DEF_FLAG) $(LD_VER)" \
|
||||||
-ignoreFile jsig.c \
|
-ignoreFile jsig.c \
|
||||||
-ignoreFile jvmtiEnvRecommended.cpp \
|
-ignoreFile jvmtiEnvRecommended.cpp \
|
||||||
-ignoreFile jvmtiEnvStub.cpp \
|
-ignoreFile jvmtiEnvStub.cpp \
|
||||||
|
|
|
@ -393,3 +393,11 @@ default::
|
||||||
_build_pch_file.obj:
|
_build_pch_file.obj:
|
||||||
@echo #include "precompiled.hpp" > ../generated/_build_pch_file.cpp
|
@echo #include "precompiled.hpp" > ../generated/_build_pch_file.cpp
|
||||||
$(CXX) $(CXX_FLAGS) /Fp"vm.pch" /Yc"precompiled.hpp" /c ../generated/_build_pch_file.cpp
|
$(CXX) $(CXX_FLAGS) /Fp"vm.pch" /Yc"precompiled.hpp" /c ../generated/_build_pch_file.cpp
|
||||||
|
|
||||||
|
!if "$(BUILD_WIN_SA)" != "1"
|
||||||
|
BUILD_VM_DEF_FLAG=-nosa
|
||||||
|
!endif
|
||||||
|
|
||||||
|
vm.def: $(Obj_Files)
|
||||||
|
sh $(WorkSpace)/make/windows/build_vm_def.sh $(BUILD_VM_DEF_FLAG)
|
||||||
|
|
||||||
|
|
|
@ -642,13 +642,14 @@ objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NU
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static uint64_t locate_unique_thread_id() {
|
static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) {
|
||||||
// Additional thread_id used to correlate threads in SA
|
// Additional thread_id used to correlate threads in SA
|
||||||
thread_identifier_info_data_t m_ident_info;
|
thread_identifier_info_data_t m_ident_info;
|
||||||
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
|
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
|
||||||
|
|
||||||
thread_info(::mach_thread_self(), THREAD_IDENTIFIER_INFO,
|
thread_info(mach_thread_port, THREAD_IDENTIFIER_INFO,
|
||||||
(thread_info_t) &m_ident_info, &count);
|
(thread_info_t) &m_ident_info, &count);
|
||||||
|
|
||||||
return m_ident_info.thread_id;
|
return m_ident_info.thread_id;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -679,9 +680,14 @@ static void *java_start(Thread *thread) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// thread_id is mach thread on macos
|
// thread_id is mach thread on macos, which pthreads graciously caches and provides for us
|
||||||
osthread->set_thread_id(::mach_thread_self());
|
mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
|
||||||
osthread->set_unique_thread_id(locate_unique_thread_id());
|
guarantee(thread_id != 0, "thread id missing from pthreads");
|
||||||
|
osthread->set_thread_id(thread_id);
|
||||||
|
|
||||||
|
uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
|
||||||
|
guarantee(unique_thread_id != 0, "unique thread id was not found");
|
||||||
|
osthread->set_unique_thread_id(unique_thread_id);
|
||||||
#else
|
#else
|
||||||
// thread_id is pthread_id on BSD
|
// thread_id is pthread_id on BSD
|
||||||
osthread->set_thread_id(::pthread_self());
|
osthread->set_thread_id(::pthread_self());
|
||||||
|
@ -843,8 +849,14 @@ bool os::create_attached_thread(JavaThread* thread) {
|
||||||
|
|
||||||
// Store pthread info into the OSThread
|
// Store pthread info into the OSThread
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
osthread->set_thread_id(::mach_thread_self());
|
// thread_id is mach thread on macos, which pthreads graciously caches and provides for us
|
||||||
osthread->set_unique_thread_id(locate_unique_thread_id());
|
mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
|
||||||
|
guarantee(thread_id != 0, "just checking");
|
||||||
|
osthread->set_thread_id(thread_id);
|
||||||
|
|
||||||
|
uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
|
||||||
|
guarantee(unique_thread_id != 0, "just checking");
|
||||||
|
osthread->set_unique_thread_id(unique_thread_id);
|
||||||
#else
|
#else
|
||||||
osthread->set_thread_id(::pthread_self());
|
osthread->set_thread_id(::pthread_self());
|
||||||
#endif
|
#endif
|
||||||
|
@ -1115,7 +1127,7 @@ size_t os::lasterror(char *buf, size_t len) {
|
||||||
|
|
||||||
intx os::current_thread_id() {
|
intx os::current_thread_id() {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
return (intx)::mach_thread_self();
|
return (intx)::pthread_mach_thread_np(::pthread_self());
|
||||||
#else
|
#else
|
||||||
return (intx)::pthread_self();
|
return (intx)::pthread_self();
|
||||||
#endif
|
#endif
|
||||||
|
@ -3275,11 +3287,15 @@ void os::Bsd::install_signal_handlers() {
|
||||||
// and if UserSignalHandler is installed all bets are off
|
// and if UserSignalHandler is installed all bets are off
|
||||||
if (CheckJNICalls) {
|
if (CheckJNICalls) {
|
||||||
if (libjsig_is_loaded) {
|
if (libjsig_is_loaded) {
|
||||||
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
|
if (PrintJNIResolving) {
|
||||||
|
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
|
||||||
|
}
|
||||||
check_signals = false;
|
check_signals = false;
|
||||||
}
|
}
|
||||||
if (AllowUserSignalHandlers) {
|
if (AllowUserSignalHandlers) {
|
||||||
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
|
if (PrintJNIResolving) {
|
||||||
|
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
|
||||||
|
}
|
||||||
check_signals = false;
|
check_signals = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1554,18 +1554,22 @@ bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rewrite sourc file name index:
|
// rewrite source file name index:
|
||||||
u2 source_file_name_idx = scratch_class->source_file_name_index();
|
u2 source_file_name_idx = scratch_class->source_file_name_index();
|
||||||
if (source_file_name_idx != 0) {
|
if (source_file_name_idx != 0) {
|
||||||
u2 new_source_file_name_idx = find_new_index(source_file_name_idx);
|
u2 new_source_file_name_idx = find_new_index(source_file_name_idx);
|
||||||
scratch_class->set_source_file_name_index(new_source_file_name_idx);
|
if (new_source_file_name_idx != 0) {
|
||||||
|
scratch_class->set_source_file_name_index(new_source_file_name_idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rewrite class generic signature index:
|
// rewrite class generic signature index:
|
||||||
u2 generic_signature_index = scratch_class->generic_signature_index();
|
u2 generic_signature_index = scratch_class->generic_signature_index();
|
||||||
if (generic_signature_index != 0) {
|
if (generic_signature_index != 0) {
|
||||||
u2 new_generic_signature_index = find_new_index(generic_signature_index);
|
u2 new_generic_signature_index = find_new_index(generic_signature_index);
|
||||||
scratch_class->set_generic_signature_index(new_generic_signature_index);
|
if (new_generic_signature_index != 0) {
|
||||||
|
scratch_class->set_generic_signature_index(new_generic_signature_index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1737,7 +1741,10 @@ void VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle method,
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
const u2 cp_index = elem[i].name_cp_index;
|
const u2 cp_index = elem[i].name_cp_index;
|
||||||
elem[i].name_cp_index = find_new_index(cp_index);
|
const u2 new_cp_index = find_new_index(cp_index);
|
||||||
|
if (new_cp_index != 0) {
|
||||||
|
elem[i].name_cp_index = new_cp_index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end rewrite_cp_refs_in_method()
|
} // end rewrite_cp_refs_in_method()
|
||||||
|
|
|
@ -124,13 +124,15 @@ Monitor* GCTaskManager_lock = NULL;
|
||||||
|
|
||||||
Mutex* Management_lock = NULL;
|
Mutex* Management_lock = NULL;
|
||||||
Monitor* Service_lock = NULL;
|
Monitor* Service_lock = NULL;
|
||||||
Mutex* Stacktrace_lock = NULL;
|
Monitor* PeriodicTask_lock = NULL;
|
||||||
|
|
||||||
Monitor* JfrQuery_lock = NULL;
|
#ifdef INCLUDE_TRACE
|
||||||
|
Mutex* JfrStacktrace_lock = NULL;
|
||||||
Monitor* JfrMsg_lock = NULL;
|
Monitor* JfrMsg_lock = NULL;
|
||||||
Mutex* JfrBuffer_lock = NULL;
|
Mutex* JfrBuffer_lock = NULL;
|
||||||
Mutex* JfrStream_lock = NULL;
|
Mutex* JfrStream_lock = NULL;
|
||||||
Monitor* PeriodicTask_lock = NULL;
|
Mutex* JfrThreadGroups_lock = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_NUM_MUTEX 128
|
#define MAX_NUM_MUTEX 128
|
||||||
static Monitor * _mutex_array[MAX_NUM_MUTEX];
|
static Monitor * _mutex_array[MAX_NUM_MUTEX];
|
||||||
|
@ -206,7 +208,6 @@ void mutex_init() {
|
||||||
def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
|
def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
|
||||||
def(ObjAllocPost_lock , Monitor, special, false);
|
def(ObjAllocPost_lock , Monitor, special, false);
|
||||||
def(Service_lock , Monitor, special, true ); // used for service thread operations
|
def(Service_lock , Monitor, special, true ); // used for service thread operations
|
||||||
def(Stacktrace_lock , Mutex, special, true ); // used for JFR stacktrace database
|
|
||||||
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
|
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
|
||||||
|
|
||||||
def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
|
def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
|
||||||
|
@ -272,11 +273,16 @@ void mutex_init() {
|
||||||
def(Debug3_lock , Mutex , nonleaf+4, true );
|
def(Debug3_lock , Mutex , nonleaf+4, true );
|
||||||
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
|
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
|
||||||
def(CompileThread_lock , Monitor, nonleaf+5, false );
|
def(CompileThread_lock , Monitor, nonleaf+5, false );
|
||||||
|
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
|
||||||
|
|
||||||
|
#ifdef INCLUDE_TRACE
|
||||||
def(JfrMsg_lock , Monitor, leaf, true);
|
def(JfrMsg_lock , Monitor, leaf, true);
|
||||||
def(JfrBuffer_lock , Mutex, nonleaf+1, true);
|
def(JfrBuffer_lock , Mutex, nonleaf+1, true);
|
||||||
|
def(JfrThreadGroups_lock , Mutex, nonleaf+1, true);
|
||||||
def(JfrStream_lock , Mutex, nonleaf+2, true);
|
def(JfrStream_lock , Mutex, nonleaf+2, true);
|
||||||
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
|
def(JfrStacktrace_lock , Mutex, special, true );
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
|
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
|
||||||
|
|
|
@ -137,13 +137,15 @@ extern Mutex* HotCardCache_lock; // protects the hot card cache
|
||||||
|
|
||||||
extern Mutex* Management_lock; // a lock used to serialize JVM management
|
extern Mutex* Management_lock; // a lock used to serialize JVM management
|
||||||
extern Monitor* Service_lock; // a lock used for service thread operation
|
extern Monitor* Service_lock; // a lock used for service thread operation
|
||||||
extern Mutex* Stacktrace_lock; // used to guard access to the stacktrace table
|
extern Monitor* PeriodicTask_lock; // protects the periodic task structure
|
||||||
|
|
||||||
extern Monitor* JfrQuery_lock; // protects JFR use
|
#ifdef INCLUDE_TRACE
|
||||||
|
extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table
|
||||||
extern Monitor* JfrMsg_lock; // protects JFR messaging
|
extern Monitor* JfrMsg_lock; // protects JFR messaging
|
||||||
extern Mutex* JfrBuffer_lock; // protects JFR buffer operations
|
extern Mutex* JfrBuffer_lock; // protects JFR buffer operations
|
||||||
extern Mutex* JfrStream_lock; // protects JFR stream access
|
extern Mutex* JfrStream_lock; // protects JFR stream access
|
||||||
extern Monitor* PeriodicTask_lock; // protects the periodic task structure
|
extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups
|
||||||
|
#endif
|
||||||
|
|
||||||
// A MutexLocker provides mutual exclusion with respect to a given mutex
|
// A MutexLocker provides mutual exclusion with respect to a given mutex
|
||||||
// for the scope which contains the locker. The lock is an OS lock, not
|
// for the scope which contains the locker. The lock is an OS lock, not
|
||||||
|
|
|
@ -876,8 +876,6 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
|
||||||
total_used += u.used();
|
total_used += u.used();
|
||||||
total_committed += u.committed();
|
total_committed += u.committed();
|
||||||
|
|
||||||
// if any one of the memory pool has undefined init_size or max_size,
|
|
||||||
// set it to -1
|
|
||||||
if (u.init_size() == (size_t)-1) {
|
if (u.init_size() == (size_t)-1) {
|
||||||
has_undefined_init_size = true;
|
has_undefined_init_size = true;
|
||||||
}
|
}
|
||||||
|
@ -894,6 +892,15 @@ JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if any one of the memory pool has undefined init_size or max_size,
|
||||||
|
// set it to -1
|
||||||
|
if (has_undefined_init_size) {
|
||||||
|
total_init = (size_t)-1;
|
||||||
|
}
|
||||||
|
if (has_undefined_max_size) {
|
||||||
|
total_max = (size_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
MemoryUsage usage((heap ? InitialHeapSize : total_init),
|
MemoryUsage usage((heap ? InitialHeapSize : total_init),
|
||||||
total_used,
|
total_used,
|
||||||
total_committed,
|
total_committed,
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2011, 2012, 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 Xchecksig.sh
|
|
||||||
# @bug 7051189
|
|
||||||
# @summary Need to suppress info message if -xcheck:jni used with libjsig.so
|
|
||||||
# @run shell Xchecksig.sh
|
|
||||||
#
|
|
||||||
|
|
||||||
if [ "${TESTSRC}" = "" ]
|
|
||||||
then
|
|
||||||
TESTSRC=${PWD}
|
|
||||||
echo "TESTSRC not set. Using "${TESTSRC}" as default"
|
|
||||||
fi
|
|
||||||
echo "TESTSRC=${TESTSRC}"
|
|
||||||
## Adding common setup Variables for running shell tests.
|
|
||||||
. ${TESTSRC}/../../test_env.sh
|
|
||||||
|
|
||||||
OS=`uname -s`
|
|
||||||
case "$OS" in
|
|
||||||
Windows_* | CYGWIN_* )
|
|
||||||
printf "Not testing libjsig.so on Windows. PASSED.\n "
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
JAVA=${TESTJAVA}${FS}bin${FS}java
|
|
||||||
|
|
||||||
# LD_PRELOAD arch needs to match the binary we run, so run the java
|
|
||||||
# 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
|
|
||||||
# Check if TESTVMOPS contains -d64, but cannot use
|
|
||||||
# java ${TESTVMOPS} to run "java -d64" with LD_PRELOAD.
|
|
||||||
|
|
||||||
if [ ${OS} -eq "SunOS" ]
|
|
||||||
then
|
|
||||||
printf "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
|
|
||||||
printf ${TESTVMOPTS} | grep d64 > /dev/null
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
printf "SunOS 64-bit test\n"
|
|
||||||
BIT_FLAG=-d64
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
ARCH=`uname -p`
|
|
||||||
case $ARCH in
|
|
||||||
i386)
|
|
||||||
if [ X${BIT_FLAG} != "X" ]
|
|
||||||
then
|
|
||||||
ARCH=amd64
|
|
||||||
JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
sparc)
|
|
||||||
if [ X${BIT_FLAG} != "X" ]
|
|
||||||
then
|
|
||||||
ARCH=sparcv9
|
|
||||||
JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
printf "Not testing architecture $ARCH, skipping test.\n"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
LIBJSIG=${COMPILEJAVA}${FS}jre${FS}lib${FS}${ARCH}${FS}libjsig.so
|
|
||||||
|
|
||||||
# If libjsig and binary do not match, skip test.
|
|
||||||
|
|
||||||
A=`file ${LIBJSIG} | awk '{ print $3 }'`
|
|
||||||
B=`file ${JAVA} | awk '{ print $3 }'`
|
|
||||||
|
|
||||||
if [ $A -ne $B ]
|
|
||||||
then
|
|
||||||
printf "Mismatching binary and library to preload, skipping test.\n"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f ${LIBJSIG} ]
|
|
||||||
then
|
|
||||||
printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
# Use java -version to test, java version info appears on stderr,
|
|
||||||
# the libjsig message we are removing appears on stdout.
|
|
||||||
|
|
||||||
# grep returns zero meaning found, non-zero means not found:
|
|
||||||
|
|
||||||
LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1 | grep "libjsig is activated"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "PASSED\n"
|
|
||||||
exit 0
|
|
||||||
|
|
82
hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java
Normal file
82
hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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 7051189 8023393
|
||||||
|
* @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
|
||||||
|
* @library /testlibrary
|
||||||
|
* @run main XCheckJSig
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
|
public class XCheckJSig {
|
||||||
|
public static void main(String args[]) throws Throwable {
|
||||||
|
|
||||||
|
System.out.println("Regression test for bugs 7051189 and 8023393");
|
||||||
|
if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
|
||||||
|
System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String jdk_path = System.getProperty("test.jdk");
|
||||||
|
String os_arch = Platform.getOsArch();
|
||||||
|
String libjsig;
|
||||||
|
String env_var;
|
||||||
|
if (Platform.isOSX()) {
|
||||||
|
libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
|
||||||
|
env_var = "DYLD_INSERT_LIBRARIES";
|
||||||
|
} else {
|
||||||
|
libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
|
||||||
|
env_var = "LD_PRELOAD";
|
||||||
|
}
|
||||||
|
String java_program;
|
||||||
|
if (Platform.isSolaris()) {
|
||||||
|
// On Solaris, need to call the 64-bit Java directly in order for
|
||||||
|
// LD_PRELOAD to work because libjsig.so is 64-bit.
|
||||||
|
java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
|
||||||
|
} else {
|
||||||
|
java_program = JDKToolFinder.getJDKTool("java");
|
||||||
|
}
|
||||||
|
// If this test fails, these might be useful to know.
|
||||||
|
System.out.println("libjsig: " + libjsig);
|
||||||
|
System.out.println("osArch: " + os_arch);
|
||||||
|
System.out.println("java_program: " + java_program);
|
||||||
|
|
||||||
|
ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version");
|
||||||
|
Map<String, String> env = pb.environment();
|
||||||
|
env.put(env_var, libjsig);
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldNotContain("libjsig is activated");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version");
|
||||||
|
env = pb.environment();
|
||||||
|
env.put(env_var, libjsig);
|
||||||
|
output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldContain("libjsig is activated");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue