This commit is contained in:
J. Duke 2017-07-05 16:38:53 +02:00
commit 9b106d9dcc
604 changed files with 72329 additions and 2377 deletions

View File

@ -4,3 +4,4 @@ cbc8ad9dd0e085a607427ea35411990982f19a36 jdk7-b25
11b4dc9f2be3523ef989a0db8459eb56b3045c3a jdk7-b27
56652b46f328937f6b9b5130f1e4cd80f48868ef jdk7-b28
31e08f70e88d77c2053f91c21b49a04296bdc59a jdk7-b29
2dab2f712e1832c92acfa63ec0337048b9422c20 jdk7-b30

View File

@ -4,3 +4,4 @@
e84e9018bebbf3e5bafc5706e7882a15cb1c7d99 jdk7-b27
27509b7d21ed783b3f6eb7b7612781c675a30c2f jdk7-b28
8b71960f79ce0a6fb8ddfeec03f03d400a361747 jdk7-b29
c0252adbb2abbfdd6c35595429ac6fbdd98e20ac jdk7-b30

View File

@ -2,3 +2,6 @@
^dist/
^nbproject/private/
^src/share/tools/hsdis/bin/
^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
^src/share/tools/IdealGraphVisualizer/build/
^src/share/tools/IdealGraphVisualizer/dist/

View File

@ -4,3 +4,4 @@ ad0b851458ff9d1d490ed2d79bb84f75a9fdb753 jdk7-b26
e3d2692f8442e2d951166dc9bd9a330684754438 jdk7-b27
c14dab40ed9bf45ad21150bd70c9c80cdf655415 jdk7-b28
4f91c08b3e4498213a9c5a24898f7d9c38cf86fb jdk7-b29
d1605aabd0a15ecf93787c47de63073c33fba52d jdk7-b30

View File

@ -316,6 +316,14 @@ public class ObjectHeap {
iterateLiveRegions(liveRegions, visitor, null);
}
public boolean isValidMethod(OopHandle handle) {
OopHandle klass = Oop.getKlassForOopHandle(handle);
if (klass != null && klass.equals(methodKlassHandle)) {
return true;
}
return false;
}
// Creates an instance from the Oop hierarchy based based on the handle
public Oop newOop(OopHandle handle) {
// The only known way to detect the right type of an oop is
@ -375,8 +383,10 @@ public class ObjectHeap {
}
}
System.err.println("Unknown oop at " + handle);
System.err.println("Oop's klass is " + klass);
if (DEBUG) {
System.err.println("Unknown oop at " + handle);
System.err.println("Oop's klass is " + klass);
}
throw new UnknownOopException();
}

View File

@ -215,11 +215,11 @@ public class JavaThread extends Thread {
if (f == null) return null;
boolean imprecise = true;
if (f.isInterpretedFrame() && !f.isInterpretedFrameValid()) {
if (DEBUG) {
System.out.println("Correcting for invalid interpreter frame");
}
f = f.sender(regMap);
imprecise = false;
if (DEBUG) {
System.out.println("Correcting for invalid interpreter frame");
}
f = f.sender(regMap);
imprecise = false;
}
VFrame vf = VFrame.newVFrame(f, regMap, this, true, imprecise);
if (vf == null) {
@ -228,10 +228,7 @@ public class JavaThread extends Thread {
}
return null;
}
if (vf.isJavaFrame()) {
return (JavaVFrame) vf;
}
return (JavaVFrame) vf.javaSender();
return vf.isJavaFrame() ? (JavaVFrame)vf : vf.javaSender();
}
/** In this system, a JavaThread is the top-level factory for a

View File

@ -121,6 +121,13 @@ public class SolarisSPARCJavaThreadPDAccess implements JavaThreadPDAccess {
}
public Frame getCurrentFrameGuess(JavaThread thread, Address addr) {
// If java stack is walkable then both last_Java_sp and last_Java_pc are
// non null and we can start stack walk from this frame.
if (thread.getLastJavaSP() != null && thread.getLastJavaPC() != null) {
return new SPARCFrame(SPARCFrame.biasSP(thread.getLastJavaSP()), thread.getLastJavaPC());
}
ThreadProxy t = getThreadProxy(addr);
SPARCThreadContext context = (SPARCThreadContext) t.getContext();
// For now, let's see what happens if we do a similar thing to

View File

@ -422,6 +422,13 @@ public class SPARCFrame extends Frame {
if (getFP().addOffsetTo(INTERPRETER_FRAME_VM_LOCAL_WORDS * VM.getVM().getAddressSize()).lessThan(getSP())) {
return false;
}
OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0);
if (VM.getVM().getObjectHeap().isValidMethod(methodHandle) == false) {
return false;
}
// These are hacks to keep us out of trouble.
// The problem with these is that they mask other problems
if (getFP().lessThanOrEqual(getSP())) { // this attempts to deal with unsigned comparison above
@ -433,9 +440,18 @@ public class SPARCFrame extends Frame {
// FIXME: this is not atomic with respect to GC and is unsuitable
// for use in a non-debugging, or reflective, system. Need to
// figure out how to express this.
if (addressOfInterpreterFrameBCX().getAddressAt(0) == null) {
return false; // BCP not yet set up
Address bcx = addressOfInterpreterFrameBCX().getAddressAt(0);
Method method;
try {
method = (Method) VM.getVM().getObjectHeap().newOop(methodHandle);
} catch (UnknownOopException ex) {
return false;
}
int bci = bcpToBci(bcx, method);
//validate bci
if (bci < 0) return false;
return true;
}
@ -471,7 +487,7 @@ public class SPARCFrame extends Frame {
// will update it accordingly
map.setIncludeArgumentOops(false);
if (cb == null && isEntryFrame()) {
if (isEntryFrame()) {
return senderForEntryFrame(map);
}
@ -539,7 +555,6 @@ public class SPARCFrame extends Frame {
int SP_OFFSET_IN_GREGSET = 17;
raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET);
Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET);
// System.out.println(" next frame's SP: " + sp + " PC: " + pc);
return new SPARCFrame(raw_sp, pc);
}
}
@ -562,10 +577,8 @@ public class SPARCFrame extends Frame {
// sender's _interpreter_sp_adjustment field.
if (VM.getVM().getInterpreter().contains(pc)) {
isInterpreted = true;
if (VM.getVM().isClientCompiler()) {
map.makeIntegerRegsUnsaved();
map.shiftWindow(sp, youngerSP);
}
map.makeIntegerRegsUnsaved();
map.shiftWindow(sp, youngerSP);
} else {
// Find a CodeBlob containing this frame's pc or elide the lookup and use the
// supplied blob which is already known to be associated with this frame.

View File

@ -87,12 +87,13 @@ public class PStack extends Tool {
while (f != null) {
ClosestSymbol sym = f.closestSymbolToPC();
Address pc = f.pc();
out.print(pc + "\t");
if (sym != null) {
String name = sym.getName();
if (cdbgCanDemangle) {
name = cdbg.demangle(name);
}
out.print(pc + "\t" + name);
out.print(name);
long diff = sym.getOffset();
if (diff != 0L) {
out.print(" + 0x" + Long.toHexString(diff));
@ -120,7 +121,6 @@ public class PStack extends Tool {
// look for known code blobs
CodeCache c = VM.getVM().getCodeCache();
if (c.contains(pc)) {
out.print(pc + "\t");
CodeBlob cb = c.findBlobUnsafe(pc);
if (cb.isNMethod()) {
names = getJavaNames(th, f.localVariableBase());
@ -144,18 +144,18 @@ public class PStack extends Tool {
out.println("<Unknown code blob>");
}
} else {
printUnknown(out,pc);
printUnknown(out);
}
}
// print java frames, if any
if (names != null && names.length != 0) {
// print java frame(s)
for (int i = 0; i < names.length; i++) {
out.println(pc + "\t" + names[i]);
out.println(names[i]);
}
}
} else {
printUnknown(out,pc);
printUnknown(out);
}
}
f = f.sender();
@ -220,8 +220,8 @@ public class PStack extends Tool {
}
}
private void printUnknown(PrintStream out, Address pc) {
out.println(pc + "\t????????");
private void printUnknown(PrintStream out) {
out.println("\t????????");
}
private String[] getJavaNames(ThreadProxy th, Address fp) {

View File

@ -228,6 +228,7 @@ endif
# Required make macro settings for all platforms
MAKE_ARGS += JAVA_HOME=$(ABS_BOOTDIR)
MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)

View File

@ -33,9 +33,9 @@
# Don't put quotes (fail windows build).
HOTSPOT_VM_COPYRIGHT=Copyright 2008
HS_MAJOR_VER=13
HS_MAJOR_VER=14
HS_MINOR_VER=0
HS_BUILD_NUMBER=02
HS_BUILD_NUMBER=01
JDK_MAJOR_VER=1
JDK_MINOR_VER=7

Binary file not shown.

View File

@ -328,18 +328,19 @@ JAVA_FLAG/64 = -d64
WRONG_DATA_MODE_MSG = \
echo "JAVA_HOME must point to $(DATA_MODE)bit JDK."
test_gamma: $(BUILDTREE_MAKE)
test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java
@echo Creating $@ ...
$(QUIETLY) ( \
echo '#!/bin/sh'; \
$(BUILDTREE_COMMENT); \
echo '. ./env.sh'; \
echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \
echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>1 > /dev/null"; \
echo "if ! \$${JAVA_HOME}/bin/java $(JAVA_FLAG) -fullversion 2>&1 > /dev/null"; \
echo "then"; \
echo " $(WRONG_DATA_MODE_MSG); exit 0;"; \
echo "fi"; \
echo 'CLASSPATH="$(GAMMADIR)/make/$(OS_FAMILY):$$CLASSPATH"'; \
echo "rm -f Queens.class"; \
echo "\$${JAVA_HOME}/bin/javac -d . $(GAMMADIR)/make/test/Queens.java"; \
echo '[ -f gamma_g ] && { gamma=gamma_g; }'; \
echo './$${gamma:-gamma} $(TESTFLAGS) Queens < /dev/null'; \
) > $@

View File

@ -50,14 +50,7 @@ PICFLAG = -fPIC
VM_PICFLAG/LIBJVM = $(PICFLAG)
VM_PICFLAG/AOUT =
ifneq ($(BUILDARCH), i486)
VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
else
# PIC has significant overhead on x86, build nonpic VM for now.
# Link JVM at a "good" base location to avoid unnecessary .text patching.
JVM_BASE_ADDR = 0x06000000
endif
CFLAGS += $(VM_PICFLAG)
CFLAGS += -fno-rtti
@ -91,8 +84,17 @@ endif
# Compiler warnings are treated as errors
WARNINGS_ARE_ERRORS = -Werror
# Except for a few acceptable ones
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
# conversions which might affect the values. To avoid that, we need to turn
# it off explicitly.
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
else
ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
endif
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
# Special cases
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))

View File

@ -89,6 +89,7 @@ SUNWprivate_1.1 {
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;

View File

@ -89,6 +89,7 @@ SUNWprivate_1.1 {
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;

View File

@ -133,10 +133,25 @@ ifeq ($(findstring j,$(MFLAGS)),j)
COMPILE_DONE = && { echo Done with $<; }
endif
# Include $(NONPIC_OBJ_FILES) definition
ifndef LP64
include $(GAMMADIR)/make/pic.make
endif
# The non-PIC object files are only generated for 32 bit platforms.
ifdef LP64
%.o: %.cpp
@echo Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
else
%.o: %.cpp
@echo Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
$(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \
$(COMPILE.CC) -o $@ $< $(COMPILE_DONE))
endif
%.o: %.s
@echo Assembling $<

41
hotspot/make/pic.make Normal file
View File

@ -0,0 +1,41 @@
#
# Copyright 2006-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# A list of object files built without the platform specific PIC flags, e.g.
# -fPIC on linux. Performance measurements show that by compiling GC related
# code, we could significantly reduce the GC pause time on 32 bit Linux/Unix
# platforms. See 6454213 for more details.
include $(GAMMADIR)/make/scm.make
ifneq ($(OSNAME), windows)
ifndef LP64
NONPIC_DIRS = memory oops gc_implementation gc_interface
NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir))
# Look for source files under NONPIC_DIRS
NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\
$(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \
-name '*.cpp' -print))
NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES)))
endif
endif

Binary file not shown.

View File

@ -340,7 +340,7 @@ JAVA_FLAG/64 = -d64
WRONG_DATA_MODE_MSG = \
echo "JAVA_HOME must point to $(DATA_MODE)bit JDK."
test_gamma: $(BUILDTREE_MAKE)
test_gamma: $(BUILDTREE_MAKE) $(GAMMADIR)/make/test/Queens.java
@echo Creating $@ ...
$(QUIETLY) ( \
echo '#!/bin/ksh'; \
@ -351,7 +351,8 @@ test_gamma: $(BUILDTREE_MAKE)
echo "then"; \
echo " $(WRONG_DATA_MODE_MSG); exit 0;"; \
echo "fi"; \
echo 'CLASSPATH="$(GAMMADIR)/make/$(OS_FAMILY):$$CLASSPATH"'; \
echo "rm -f Queens.class"; \
echo "\$${JAVA_HOME}/bin/javac -d . $(GAMMADIR)/make/test/Queens.java"; \
echo '[ -f gamma_g ] && { gamma=gamma_g; }'; \
echo './$${gamma:-gamma} $(TESTFLAGS) Queens < /dev/null'; \
) > $@

View File

@ -30,7 +30,7 @@ DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)
ifeq ("${Platform_compiler}", "sparcWorks")
ifeq ($(COMPILER_REV),5.8))
ifeq ($(COMPILER_REV),5.8)
# SS11 SEGV when compiling with -g and -xarch=v8, using different backend
DEBUG_CFLAGS/compileBroker.o = $(DEBUG_CFLAGS) -xO0
DEBUG_CFLAGS/jvmtiTagMap.o = $(DEBUG_CFLAGS) -xO0

View File

@ -89,6 +89,7 @@ SUNWprivate_1.1 {
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;

View File

@ -2175,6 +2175,7 @@ text: .text%__1cQjava_lang_StringGlength6FpnHoopDesc__i_;
text: .text%jni_GetStringUTFRegion: jni.o;
text: .text%__1cQjava_lang_StringOas_utf8_string6FpnHoopDesc_ii_pc_;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%JVM_IsInterface;
text: .text%JVM_GetClassDeclaredConstructors;
text: .text%__1cNmethodOopDescOis_initializer6kM_i_;

View File

@ -1500,6 +1500,7 @@ text: .text%__1cQjava_lang_StringGlength6FpnHoopDesc__i_;
text: .text%jni_GetStringUTFRegion: jni.o;
text: .text%__1cQjava_lang_StringOas_utf8_string6FpnHoopDesc_ii_pc_;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%JVM_IsInterface;
text: .text%JVM_GetClassDeclaredConstructors;
text: .text%__1cNmethodOopDescOis_initializer6kM_i_;

View File

@ -4339,6 +4339,7 @@ text: .text%__1cSComputeAdapterInfoIdo_float6M_v_;
text: .text%__1cFParseLarray_store6MnJBasicType__v_;
text: .text%__1cOmangle_name_on6FpnMoutputStream_pnNsymbolOopDesc_ii_v_: nativeLookup.o;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cZCallInterpreterDirectNodeSalignment_required6kM_i_;
text: .text%__1cZCallInterpreterDirectNodePoper_input_base6kM_I_;
text: .text%__1cZCallInterpreterDirectNodeEemit6kMrnKCodeBuffer_pnNPhaseRegAlloc__v_;

View File

@ -4755,6 +4755,7 @@ text: .text%__1cbCAbstractInterpreterGeneratorVgenerate_and_dispatch6MpnITemplat
text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cNTemplateTableDdef6FnJBytecodesECode_inITosState_3pFi_vi_v_;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cPshrI_eReg_1NodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cHi2bNodeMideal_Opcode6kM_i_: ad_i486_misc.o;
text: .text%__1cMmatch_option6FpknMJavaVMOption_pkcp4_i_: arguments.o;

View File

@ -3713,6 +3713,7 @@ text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cITemplateIgenerate6MpnZInterpreterMacroAssembler__v_;
text: .text%__1cQregI_to_stkINodeHis_Copy6kM_I_: ad_sparc_misc.o;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%signalHandler;
text: .text%__1cTtypeArrayKlassKlassIoop_size6kMpnHoopDesc__i_: typeArrayKlassKlass.o;
text: .text%JVM_handle_solaris_signal;

View File

@ -3735,6 +3735,7 @@ text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cQjava_lang_ThreadRget_thread_status6FpnHoopDesc__n0AMThreadStatus__;
text: .text%__1cIMulINodeGadd_id6kM_pknEType__: classes.o;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cHTypePtrFempty6kM_i_;
text: .text%__1cQaddP_reg_regNodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cbFunnecessary_membar_volatileNodePoper_input_base6kM_I_: ad_sparc_misc.o;

View File

@ -4339,6 +4339,7 @@ text: .text%__1cSComputeAdapterInfoIdo_float6M_v_;
text: .text%__1cFParseLarray_store6MnJBasicType__v_;
text: .text%__1cOmangle_name_on6FpnMoutputStream_pnNsymbolOopDesc_ii_v_: nativeLookup.o;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cZCallInterpreterDirectNodeSalignment_required6kM_i_;
text: .text%__1cZCallInterpreterDirectNodePoper_input_base6kM_I_;
text: .text%__1cZCallInterpreterDirectNodeEemit6kMrnKCodeBuffer_pnNPhaseRegAlloc__v_;

View File

@ -4755,6 +4755,7 @@ text: .text%__1cbCAbstractInterpreterGeneratorVgenerate_and_dispatch6MpnITemplat
text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cNTemplateTableDdef6FnJBytecodesECode_inITosState_3pFi_vi_v_;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cPshrI_eReg_1NodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cHi2bNodeMideal_Opcode6kM_i_: ad_i486_misc.o;
text: .text%__1cMmatch_option6FpknMJavaVMOption_pkcp4_i_: arguments.o;

View File

@ -3713,6 +3713,7 @@ text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cITemplateIgenerate6MpnZInterpreterMacroAssembler__v_;
text: .text%__1cQregI_to_stkINodeHis_Copy6kM_I_: ad_sparc_misc.o;
text: .text%JVM_FindClassFromClassLoader;
text: .text%JVM_FindClassFromBootLoader;
text: .text%signalHandler;
text: .text%__1cTtypeArrayKlassKlassIoop_size6kMpnHoopDesc__i_: typeArrayKlassKlass.o;
text: .text%JVM_handle_solaris_signal;

View File

@ -133,19 +133,10 @@ ifeq ($(findstring j,$(MFLAGS)),j)
COMPILE_DONE = && { echo Done with $<; }
endif
# A list of directories under which all source code are built without -KPIC/-Kpic
# flag. Performance measurements show that compiling GC related code will
# dramatically reduce the gc pause time. See bug 6454213 for more details.
include $(GAMMADIR)/make/scm.make
NONPIC_DIRS = memory oops gc_implementation gc_interface
NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir))
# Look for source code under NONPIC_DIRS
NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\
$(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \
-name '*.cpp' -print))
NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES)))
# Include NONPIC_OBJ_FILES definition
ifndef LP64
include $(GAMMADIR)/make/pic.make
endif
# Sun compiler for 64 bit Solaris does not support building non-PIC object files.
ifdef LP64

View File

@ -88,13 +88,20 @@ AGCT_EXPORT=/export:AsyncGetCallTrace
!endif
!endif
LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
/export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM \
/export:JNI_GetCreatedJavaVMs /export:jio_snprintf \
/export:jio_printf /export:jio_fprintf \
/export:jio_vfprintf /export:jio_vsnprintf $(AGCT_EXPORT) \
/export:JVM_GetVersionInfo \
/export:JVM_GetThreadStateNames /export:JVM_GetThreadStateValues \
LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
/export:JNI_GetDefaultJavaVMInitArgs \
/export:JNI_CreateJavaVM \
/export:JVM_FindClassFromBootLoader \
/export:JNI_GetCreatedJavaVMs \
/export:jio_snprintf \
/export:jio_printf \
/export:jio_fprintf \
/export:jio_vfprintf \
/export:jio_vsnprintf \
$(AGCT_EXPORT) \
/export:JVM_GetVersionInfo \
/export:JVM_GetThreadStateNames \
/export:JVM_GetThreadStateValues \
/export:JVM_InitAgentProperties
CPP_INCLUDE_DIRS=\

View File

@ -5955,7 +5955,7 @@ instruct storeA8B(memory mem, regD src) %{
// Convert oop pointer into compressed form
instruct encodeHeapOop(iRegN dst, iRegP src) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull);
predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull);
match(Set dst (EncodeP src));
format %{ "encode_heap_oop $src, $dst" %}
ins_encode %{
@ -5965,7 +5965,7 @@ instruct encodeHeapOop(iRegN dst, iRegP src) %{
%}
instruct encodeHeapOop_not_null(iRegN dst, iRegP src) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull);
predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull);
match(Set dst (EncodeP src));
format %{ "encode_heap_oop_not_null $src, $dst" %}
ins_encode %{

View File

@ -307,6 +307,10 @@ void VM_Version::get_processor_features() {
// Use it on new AMD cpus starting from Opteron.
UseAddressNop = true;
}
if( supports_sse2() && FLAG_IS_DEFAULT(UseNewLongLShift) ) {
// Use it on new AMD cpus starting from Opteron.
UseNewLongLShift = true;
}
if( FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper) ) {
if( supports_sse4a() ) {
UseXmmLoadAndClearUpper = true; // use movsd only on '10h' Opteron

View File

@ -4754,6 +4754,33 @@ operand immI_32_63() %{
interface(CONST_INTER);
%}
operand immI_1() %{
predicate( n->get_int() == 1 );
match(ConI);
op_cost(0);
format %{ %}
interface(CONST_INTER);
%}
operand immI_2() %{
predicate( n->get_int() == 2 );
match(ConI);
op_cost(0);
format %{ %}
interface(CONST_INTER);
%}
operand immI_3() %{
predicate( n->get_int() == 3 );
match(ConI);
op_cost(0);
format %{ %}
interface(CONST_INTER);
%}
// Pointer Immediate
operand immP() %{
match(ConP);
@ -8943,6 +8970,63 @@ instruct xorl_eReg_mem(eRegL dst, load_long_memory mem, eFlagsReg cr) %{
ins_pipe( ialu_reg_long_mem );
%}
// Shift Left Long by 1
instruct shlL_eReg_1(eRegL dst, immI_1 cnt, eFlagsReg cr) %{
predicate(UseNewLongLShift);
match(Set dst (LShiftL dst cnt));
effect(KILL cr);
ins_cost(100);
format %{ "ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi" %}
ins_encode %{
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
%}
ins_pipe( ialu_reg_long );
%}
// Shift Left Long by 2
instruct shlL_eReg_2(eRegL dst, immI_2 cnt, eFlagsReg cr) %{
predicate(UseNewLongLShift);
match(Set dst (LShiftL dst cnt));
effect(KILL cr);
ins_cost(100);
format %{ "ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi\n\t"
"ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi" %}
ins_encode %{
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
%}
ins_pipe( ialu_reg_long );
%}
// Shift Left Long by 3
instruct shlL_eReg_3(eRegL dst, immI_3 cnt, eFlagsReg cr) %{
predicate(UseNewLongLShift);
match(Set dst (LShiftL dst cnt));
effect(KILL cr);
ins_cost(100);
format %{ "ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi\n\t"
"ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi\n\t"
"ADD $dst.lo,$dst.lo\n\t"
"ADC $dst.hi,$dst.hi" %}
ins_encode %{
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
__ addl($dst$$Register,$dst$$Register);
__ adcl(HIGH_FROM_LOW($dst$$Register),HIGH_FROM_LOW($dst$$Register));
%}
ins_pipe( ialu_reg_long );
%}
// Shift Left Long by 1-31
instruct shlL_eReg_1_31(eRegL dst, immI_1_31 cnt, eFlagsReg cr) %{
match(Set dst (LShiftL dst cnt));

View File

@ -7060,7 +7060,7 @@ instruct castP2X(rRegL dst, rRegP src)
// Convert oop pointer into compressed form
instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull);
predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull);
match(Set dst (EncodeP src));
effect(KILL cr);
format %{ "encode_heap_oop $dst,$src" %}
@ -7076,7 +7076,7 @@ instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{
%}
instruct encodeHeapOop_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull);
predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull);
match(Set dst (EncodeP src));
effect(KILL cr);
format %{ "encode_heap_oop_not_null $dst,$src" %}

View File

@ -70,6 +70,10 @@ inline int hpi::send(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
}
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
return send(fd, buf, nBytes, flags);
}
inline int hpi::timeout(int fd, long timeout) {
julong prevtime,newtime;
struct timeval t;

View File

@ -132,7 +132,7 @@ JVM_END
*/
struct siglabel {
char *name;
const char *name;
int number;
};

View File

@ -75,8 +75,8 @@ int os::Linux::_page_size = -1;
bool os::Linux::_is_floating_stack = false;
bool os::Linux::_is_NPTL = false;
bool os::Linux::_supports_fast_thread_cpu_time = false;
char * os::Linux::_glibc_version = NULL;
char * os::Linux::_libpthread_version = NULL;
const char * os::Linux::_glibc_version = NULL;
const char * os::Linux::_libpthread_version = NULL;
static jlong initial_time_count=0;
@ -213,9 +213,9 @@ pid_t os::Linux::gettid() {
// the system call returns 1. This causes the VM to act as if it is
// a single processor and elide locking (see is_MP() call).
static bool unsafe_chroot_detected = false;
static char *unstable_chroot_error = "/proc file system not found.\n"
"Java may be unstable running multithreaded in a chroot "
"environment on Linux when /proc filesystem is not mounted.";
static const char *unstable_chroot_error = "/proc file system not found.\n"
"Java may be unstable running multithreaded in a chroot "
"environment on Linux when /proc filesystem is not mounted.";
void os::Linux::initialize_system_info() {
_processor_count = sysconf(_SC_NPROCESSORS_CONF);
@ -544,26 +544,23 @@ void os::Linux::libpthread_init() {
if (n > 0) {
char *str = (char *)malloc(n);
confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
// Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells
// us "NPTL-0.29" even we are running with LinuxThreads. Check if this
// is the case:
// is the case. LinuxThreads has a hard limit on max number of threads.
// So sysconf(_SC_THREAD_THREADS_MAX) will return a positive value.
// On the other hand, NPTL does not have such a limit, sysconf()
// will return -1 and errno is not changed. Check if it is really NPTL.
if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 &&
strstr(str, "NPTL")) {
// LinuxThreads has a hard limit on max number of threads. So
// sysconf(_SC_THREAD_THREADS_MAX) will return a positive value.
// On the other hand, NPTL does not have such a limit, sysconf()
// will return -1 and errno is not changed. Check if it is really
// NPTL:
if (sysconf(_SC_THREAD_THREADS_MAX) > 0) {
free(str);
str = "linuxthreads";
}
strstr(str, "NPTL") &&
sysconf(_SC_THREAD_THREADS_MAX) > 0) {
free(str);
os::Linux::set_libpthread_version("linuxthreads");
} else {
os::Linux::set_libpthread_version(str);
}
os::Linux::set_libpthread_version(str);
} else {
// glibc before 2.3.2 only has LinuxThreads.
os::Linux::set_libpthread_version("linuxthreads");
// glibc before 2.3.2 only has LinuxThreads.
os::Linux::set_libpthread_version("linuxthreads");
}
if (strstr(libpthread_version(), "NPTL")) {
@ -4632,11 +4629,7 @@ extern char** environ;
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) {
char * argv[4];
argv[0] = "sh";
argv[1] = "-c";
argv[2] = cmd;
argv[3] = NULL;
const char * argv[4] = {"sh", "-c", cmd, NULL};
// fork() in LinuxThreads/NPTL is not async-safe. It needs to run
// pthread_atfork handlers and reset pthread library. All we need is a
@ -4661,7 +4654,7 @@ int os::fork_and_exec(char* cmd) {
// IA64 should use normal execve() from glibc to match the glibc fork()
// above.
NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
IA64_ONLY(execve("/bin/sh", argv, environ);)
IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
// execve failed
_exit(-1);

View File

@ -52,8 +52,8 @@ class Linux {
static address _initial_thread_stack_bottom;
static uintptr_t _initial_thread_stack_size;
static char *_glibc_version;
static char *_libpthread_version;
static const char *_glibc_version;
static const char *_libpthread_version;
static bool _is_floating_stack;
static bool _is_NPTL;
@ -72,8 +72,8 @@ class Linux {
static julong physical_memory() { return _physical_memory; }
static void initialize_system_info();
static void set_glibc_version(char *s) { _glibc_version = s; }
static void set_libpthread_version(char *s) { _libpthread_version = s; }
static void set_glibc_version(const char *s) { _glibc_version = s; }
static void set_libpthread_version(const char *s) { _libpthread_version = s; }
static bool supports_variable_stack_size();
@ -134,8 +134,8 @@ class Linux {
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
// GNU libc and libpthread version strings
static char *glibc_version() { return _glibc_version; }
static char *libpthread_version() { return _libpthread_version; }
static const char *glibc_version() { return _glibc_version; }
static const char *libpthread_version() { return _libpthread_version; }
// NPTL or LinuxThreads?
static bool is_LinuxThreads() { return !_is_NPTL; }

View File

@ -71,6 +71,10 @@ inline int hpi::send(int fd, char *buf, int nBytes, int flags) {
INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
}
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
}
// As both poll and select can be interrupted by signals, we have to be
// prepared to restart the system call after updating the timeout, unless
// a poll() is done with timeout == -1, in which case we repeat with this

View File

@ -102,6 +102,10 @@ HPIDECL(send, "send", _socket, Send, int, "%d",
fd, buf, nBytes, flags),
(fd, buf, nBytes, flags));
inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
return send(fd, buf, nBytes, flags);
}
HPIDECL(timeout, "timeout", _socket, Timeout, int, "%d",
(int fd, long timeout),
("fd = %d, timeout = %ld", fd, timeout),

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.sun.hotspot.igv.svg" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.sun.hotspot.igv.svg.</description>
<import file="nbproject/build-impl.xml"/>
</project>

View File

@ -0,0 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: com.sun.hotspot.igv.svg
OpenIDE-Module-Layer: com/sun/hotspot/igv/svg/layer.xml
OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/svg/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.sun.hotspot.igv.svg-impl" basedir="..">
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
<condition>
<not>
<available file="${harness.dir}" type="dir"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=ebcf0422
build.xml.script.CRC32=d7a2678d
build.xml.stylesheet.CRC32=79c3b980
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=ebcf0422
nbproject/build-impl.xml.script.CRC32=57997f94
nbproject/build-impl.xml.stylesheet.CRC32=deb65f65

View File

@ -0,0 +1,2 @@
javac.source=1.5
javac.compilerargs=-Xlint -Xlint:-serial

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.sun.hotspot.igv.svg</code-name-base>
<suite-component/>
<module-dependencies/>
<public-packages>
<package>com.sun.hotspot.igv.svg</package>
</public-packages>
</data>
</configuration>
</project>

View File

@ -0,0 +1 @@
suite.dir=${basedir}/..

View File

@ -0,0 +1,86 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.svg;
import java.awt.Graphics2D;
import java.io.Writer;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.w3c.dom.DOMImplementation;
/**
*
* @author Thomas Wuerthinger
*/
public class BatikSVG {
private static Constructor SVGGraphics2DConstructor;
private static Method Method_stream;
private static Method Method_createDefault;
private static Method Method_getDOMImplementation;
private static Method Method_setEmbeddedFontsOn;
public static Graphics2D createGraphicsObject() {
try {
if (SVGGraphics2DConstructor == null) {
ClassLoader cl = BatikSVG.class.getClassLoader();
Class Class_GenericDOMImplementation = cl.loadClass("org.apache.batik.dom.GenericDOMImplementation");
Class Class_SVGGeneratorContext = cl.loadClass("org.apache.batik.svggen.SVGGeneratorContext");
Class Class_SVGGraphics2D = cl.loadClass("org.apache.batik.svggen.SVGGraphics2D");
Method_getDOMImplementation = Class_GenericDOMImplementation.getDeclaredMethod("getDOMImplementation", new Class[0]);
Method_createDefault = Class_SVGGeneratorContext.getDeclaredMethod("createDefault", new Class[]{org.w3c.dom.Document.class});
Method_setEmbeddedFontsOn = Class_SVGGeneratorContext.getDeclaredMethod("setEmbeddedFontsOn", new Class[]{boolean.class});
Method_stream = Class_SVGGraphics2D.getDeclaredMethod("stream", Writer.class, boolean.class);
SVGGraphics2DConstructor = Class_SVGGraphics2D.getConstructor(Class_SVGGeneratorContext, boolean.class);
}
DOMImplementation dom = (DOMImplementation) Method_getDOMImplementation.invoke(null);
org.w3c.dom.Document document = dom.createDocument("http://www.w3.org/2000/svg", "svg", null);
Object ctx = Method_createDefault.invoke(null, document);
Method_setEmbeddedFontsOn.invoke(ctx, true);
Graphics2D svgGenerator = (Graphics2D) SVGGraphics2DConstructor.newInstance(ctx, true);
return svgGenerator;
} catch (ClassNotFoundException e) {
return null;
} catch (NoSuchMethodException e) {
return null;
} catch (IllegalAccessException e) {
return null;
} catch (InvocationTargetException e) {
return null;
} catch (InstantiationException e) {
return null;
}
}
public static void printToStream(Graphics2D svgGenerator, Writer stream, boolean useCSS) {
try {
Method_stream.invoke(svgGenerator, stream, useCSS);
} catch (IllegalAccessException e) {
assert false;
} catch (InvocationTargetException e) {
assert false;
}
}
}

View File

@ -0,0 +1 @@
OpenIDE-Module-Name=BatikSVGProxy

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
<filesystem>
</filesystem>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.sun.hotspot.igv.bytecodes" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.sun.hotspot.igv.bytecodes.</description>
<import file="nbproject/build-impl.xml"/>
</project>

View File

@ -0,0 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: com.sun.hotspot.igv.bytecodes
OpenIDE-Module-Layer: com/sun/hotspot/igv/bytecodes/layer.xml
OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/bytecodes/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.sun.hotspot.igv.bytecodes-impl" basedir="..">
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
<condition>
<not>
<available file="${harness.dir}" type="dir"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=1dee290d
build.xml.script.CRC32=d594034f
build.xml.stylesheet.CRC32=79c3b980
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=1dee290d
nbproject/build-impl.xml.script.CRC32=b4dab126
nbproject/build-impl.xml.stylesheet.CRC32=deb65f65

View File

@ -0,0 +1,29 @@
# Deprecated since 5.0u1; for compatibility with 5.0:
disabled.clusters=\
apisupport1,\
harness,\
ide8,\
java1,\
nb6.0,\
profiler2
disabled.modules=\
org.netbeans.core.execution,\
org.netbeans.core.multiview,\
org.netbeans.core.output2,\
org.netbeans.modules.applemenu,\
org.netbeans.modules.autoupdate.services,\
org.netbeans.modules.autoupdate.ui,\
org.netbeans.modules.core.kit,\
org.netbeans.modules.favorites,\
org.netbeans.modules.javahelp,\
org.netbeans.modules.masterfs,\
org.netbeans.modules.options.keymap,\
org.netbeans.modules.sendopts,\
org.netbeans.modules.templates,\
org.openide.compat,\
org.openide.execution,\
org.openide.util.enumerations
enabled.clusters=\
platform7
nbjdk.active=JDK_1.6
nbplatform.active=default

View File

@ -0,0 +1,2 @@
javac.source=1.5
javac.compilerargs=-Xlint -Xlint:-serial

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.sun.hotspot.igv.bytecodes</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>com.sun.hotspot.igv.data</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.jdesktop.layout</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.4</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.explorer</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.11</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.nodes</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.2.0.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.9.0.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.windows</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.16</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
</data>
</configuration>
</project>

View File

@ -0,0 +1 @@
suite.dir=${basedir}/..

View File

@ -0,0 +1,5 @@
CTL_BytecodeViewAction=Open BytecodeView Window
CTL_BytecodeViewTopComponent=BytecodeView Window
CTL_SelectBytecodesAction=Select nodes
HINT_BytecodeViewTopComponent=This is a BytecodeView window
OpenIDE-Module-Name=Bytecodes

View File

@ -0,0 +1,100 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import com.sun.hotspot.igv.data.InputBytecode;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.InputNode;
import com.sun.hotspot.igv.data.Properties;
import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher;
import java.awt.Image;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.swing.Action;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.Utilities;
/**
*
* @author Thomas Wuerthinger
*/
public class BytecodeNode extends AbstractNode {
private Set<InputNode> nodes;
public BytecodeNode(InputBytecode bytecode, InputGraph graph, String bciValue) {
super(Children.LEAF);
this.setDisplayName(bytecode.getBci() + " " + bytecode.getName());
bciValue = bytecode.getBci() + " " + bciValue;
bciValue = bciValue.trim();
Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(graph.getNodes());
StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
List<InputNode> nodeList = selector.selectMultiple(matcher);
if (nodeList.size() > 0) {
nodes = new HashSet<InputNode>();
for (InputNode n : nodeList) {
nodes.add(n);
}
this.setDisplayName(this.getDisplayName() + " (" + nodes.size() + " nodes)");
}
}
@Override
public Image getIcon(int i) {
if (nodes != null) {
return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/link.gif");
} else {
return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/bytecode.gif");
}
}
@Override
public Image getOpenedIcon(int i) {
return getIcon(i);
}
@Override
public Action[] getActions(boolean b) {
return new Action[]{(Action) SelectBytecodesAction.findObject(SelectBytecodesAction.class, true)};
}
@Override
public Action getPreferredAction() {
return (Action) SelectBytecodesAction.findObject(SelectBytecodesAction.class, true);
}
@Override
public <T extends Node.Cookie> T getCookie(Class<T> aClass) {
if (aClass == SelectBytecodesCookie.class && nodes != null) {
return (T) (new SelectBytecodesCookie(nodes));
}
return super.getCookie(aClass);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
/**
* @author Thomas Wuerthinger
*/
public class BytecodeViewAction extends AbstractAction {
public BytecodeViewAction() {
super(NbBundle.getMessage(BytecodeViewAction.class, "CTL_BytecodeViewAction"));
}
public void actionPerformed(ActionEvent evt) {
TopComponent win = BytecodeViewTopComponent.findInstance();
win.open();
win.requestActive();
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -0,0 +1,172 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import com.sun.hotspot.igv.data.Group;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.services.InputGraphProvider;
import java.awt.BorderLayout;
import java.io.Serializable;
import org.openide.ErrorManager;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils;
import org.openide.explorer.view.BeanTreeView;
import org.openide.util.Lookup;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
/**
* @author Thomas Wuerthinger
*/
final class BytecodeViewTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener {
private static BytecodeViewTopComponent instance;
private static final String PREFERRED_ID = "BytecodeViewTopComponent";
private ExplorerManager manager;
private BeanTreeView treeView;
private Lookup.Result result = null;
private MethodNode rootNode;
private BytecodeViewTopComponent() {
initComponents();
setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));
manager = new ExplorerManager();
rootNode = new MethodNode(null, null, "");
manager.setRootContext(rootNode);
setLayout(new BorderLayout());
treeView = new BeanTreeView();
treeView.setRootVisible(false);
this.add(BorderLayout.CENTER, treeView);
associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
* To obtain the singleton instance, use {@link findInstance}.
*/
public static synchronized BytecodeViewTopComponent getDefault() {
if (instance == null) {
instance = new BytecodeViewTopComponent();
}
return instance;
}
/**
* Obtain the BytecodeViewTopComponent instance. Never call {@link #getDefault} directly!
*/
public static synchronized BytecodeViewTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
if (win == null) {
ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find BytecodeView component. It will not be located properly in the window system.");
return getDefault();
}
if (win instanceof BytecodeViewTopComponent) {
return (BytecodeViewTopComponent) win;
}
ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
return getDefault();
}
@Override
public int getPersistenceType() {
return TopComponent.PERSISTENCE_ALWAYS;
}
@Override
public void componentOpened() {
Lookup.Template tpl = new Lookup.Template(Object.class);
result = Utilities.actionsGlobalContext().lookup(tpl);
result.addLookupListener(this);
}
@Override
public void componentClosed() {
result.removeLookupListener(this);
result = null;
}
@Override
public Object writeReplace() {
return new ResolvableHelper();
}
@Override
protected String preferredID() {
return PREFERRED_ID;
}
public ExplorerManager getExplorerManager() {
return manager;
}
public void resultChanged(LookupEvent lookupEvent) {
InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
if (p != null) {
InputGraph graph = p.getGraph();
if (graph != null) {
Group g = graph.getGroup();
rootNode.update(graph, g.getMethod());
}
}
}
final static class ResolvableHelper implements Serializable {
private static final long serialVersionUID = 1L;
public Object readResolve() {
return BytecodeViewTopComponent.getDefault();
}
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<module name="com.sun.hotspot.igv.bytecodes" spec="1.0"/>
<instanceof class="org.openide.windows.TopComponent"/>
<instanceof class="com.sun.hotspot.igv.bytecodes.BytecodeViewTopComponent"/>
<instance class="com.sun.hotspot.igv.bytecodes.BytecodeViewTopComponent" method="getDefault"/>
</settings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
<tc-ref version="2.0" >
<module name="com.sun.hotspot.igv.bytecodes" spec="1.0"/>
<tc-id id="BytecodeViewTopComponent"/>
<state opened="true"/>
</tc-ref>

View File

@ -0,0 +1,102 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import com.sun.hotspot.igv.data.InputBytecode;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.InputMethod;
import java.awt.Image;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.Utilities;
/**
*
* @author Thomas Wuerthinger
*/
public class MethodNode extends AbstractNode {
private static class MethodNodeChildren extends Children.Keys {
private InputMethod method;
private InputGraph graph;
private String bciString;
public MethodNodeChildren(InputMethod method, InputGraph graph, String bciString) {
this.method = method;
this.bciString = bciString;
this.graph = graph;
}
protected Node[] createNodes(Object object) {
assert object instanceof InputBytecode;
InputBytecode bc = (InputBytecode) object;
if (bc.getInlined() == null) {
return new Node[]{new BytecodeNode(bc, graph, bciString)};
} else {
return new Node[]{new BytecodeNode(bc, graph, bciString), new MethodNode(bc.getInlined(), graph, bc.getBci() + " " + bciString)};
}
}
@Override
public void addNotify() {
if (method != null) {
setKeys(method.getBytecodes());
}
}
public void setMethod(InputMethod method, InputGraph graph) {
this.method = method;
this.graph = graph;
addNotify();
}
}
/** Creates a new instance of MethodNode */
public MethodNode(InputMethod method, InputGraph graph, String bciString) {
super((method != null && method.getBytecodes().size() == 0) ? Children.LEAF : new MethodNodeChildren(method, graph, bciString));
if (method != null) {
this.setDisplayName(method.getName());
}
}
@Override
public Image getIcon(int i) {
return Utilities.loadImage("com/sun/hotspot/igv/bytecodes/images/method.gif");
}
@Override
public Image getOpenedIcon(int i) {
return getIcon(i);
}
public void update(InputGraph graph, InputMethod method) {
((MethodNodeChildren) this.getChildren()).setMethod(method, graph);
if (method != null) {
this.setDisplayName(method.getName());
}
}
}

View File

@ -0,0 +1,75 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import com.sun.hotspot.igv.data.services.InputGraphProvider;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
/**
*
* @author Thomas Wuerthinger
*/
public final class SelectBytecodesAction extends CookieAction {
protected void performAction(Node[] activatedNodes) {
SelectBytecodesCookie c = activatedNodes[0].getCookie(SelectBytecodesCookie.class);
InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
if (p != null) {
p.setSelectedNodes(c.getNodes());
}
}
protected int mode() {
return CookieAction.MODE_EXACTLY_ONE;
}
public String getName() {
return NbBundle.getMessage(SelectBytecodesAction.class, "CTL_SelectBytecodesAction");
}
protected Class[] cookieClasses() {
return new Class[]{
SelectBytecodesCookie.class
};
}
@Override
protected void initialize() {
super.initialize();
putValue("noIconInMenu", Boolean.TRUE);
}
public HelpCtx getHelpCtx() {
return HelpCtx.DEFAULT_HELP;
}
@Override
protected boolean asynchronous() {
return false;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.bytecodes;
import com.sun.hotspot.igv.data.InputNode;
import java.util.Collections;
import java.util.Set;
import org.openide.nodes.Node;
/**
*
* @author Thomas Wuerthinger
*/
public class SelectBytecodesCookie implements Node.Cookie {
private Set<InputNode> nodes;
/** Creates a new instance of SelectBytecodesCookie */
public SelectBytecodesCookie(Set<InputNode> nodes) {
this.nodes = nodes;
}
public Set<InputNode> getNodes() {
return Collections.unmodifiableSet(nodes);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
<filesystem>
<folder name="Actions">
<folder name="Edit">
<file name="com-sun-hotspot-igv-bytecodes-SelectBytecodesAction.instance"/>
</folder>
<folder name="Window">
<file name="com-sun-hotspot-igv-bytecodes-BytecodeViewAction.instance"/>
</folder>
</folder>
<folder name="Menu">
<folder name="Window">
<file name="BytecodeViewAction.shadow">
<attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-bytecodes-BytecodeViewAction.instance"/>
</file>
</folder>
</folder>
<folder name="Windows2">
<folder name="Components">
<file name="BytecodeViewTopComponent.settings" url="BytecodeViewTopComponentSettings.xml"/>
</folder>
<folder name="Modes">
<folder name="customRightTopMode">
<file name="BytecodeViewTopComponent.wstcref" url="BytecodeViewTopComponentWstcref.xml"/>
</folder>
</folder>
</folder>
</filesystem>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.sun.hotspot.igv.controlflow" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.sun.hotspot.igv.controlflow.</description>
<import file="nbproject/build-impl.xml"/>
</project>

View File

@ -0,0 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: com.sun.hotspot.igv.controlflow
OpenIDE-Module-Layer: com/sun/hotspot/igv/controlflow/layer.xml
OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/controlflow/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.sun.hotspot.igv.controlflow-impl" basedir="..">
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
<condition>
<not>
<available file="${harness.dir}" type="dir"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=b524efb3
build.xml.script.CRC32=79a27be9
build.xml.stylesheet.CRC32=79c3b980
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=b524efb3
nbproject/build-impl.xml.script.CRC32=582bdab7
nbproject/build-impl.xml.stylesheet.CRC32=deb65f65

View File

@ -0,0 +1,29 @@
# Deprecated since 5.0u1; for compatibility with 5.0:
disabled.clusters=\
apisupport1,\
harness,\
ide8,\
java1,\
nb6.0,\
profiler2
disabled.modules=\
org.netbeans.core.execution,\
org.netbeans.core.multiview,\
org.netbeans.core.output2,\
org.netbeans.modules.applemenu,\
org.netbeans.modules.autoupdate.services,\
org.netbeans.modules.autoupdate.ui,\
org.netbeans.modules.core.kit,\
org.netbeans.modules.favorites,\
org.netbeans.modules.javahelp,\
org.netbeans.modules.masterfs,\
org.netbeans.modules.options.keymap,\
org.netbeans.modules.sendopts,\
org.netbeans.modules.templates,\
org.openide.compat,\
org.openide.execution,\
org.openide.util.enumerations
enabled.clusters=\
platform7
nbjdk.active=JDK_1.6
nbplatform.active=default

View File

@ -0,0 +1,2 @@
javac.source=1.5
javac.compilerargs=-Xlint -Xlint:-serial

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.sun.hotspot.igv.controlflow</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>com.sun.hotspot.igv.data</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.sun.hotspot.igv.hierarchicallayout</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.sun.hotspot.igv.layout</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.jdesktop.layout</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.4</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.api.visual</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>2.9</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.9.0.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.windows</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.16</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
</data>
</configuration>
</project>

View File

@ -0,0 +1 @@
suite.dir=${basedir}/..

View File

@ -0,0 +1,83 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import com.sun.hotspot.igv.data.InputBlockEdge;
import com.sun.hotspot.igv.layout.Link;
import com.sun.hotspot.igv.layout.Port;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import org.netbeans.api.visual.widget.ConnectionWidget;
/**
*
* @author Thomas Wuerthinger
*/
public class BlockConnectionWidget extends ConnectionWidget implements Link {
private BlockWidget from;
private BlockWidget to;
private Port inputSlot;
private Port outputSlot;
private List<Point> points;
private InputBlockEdge edge;
public BlockConnectionWidget(ControlFlowScene scene, InputBlockEdge edge) {
super(scene);
this.edge = edge;
this.from = (BlockWidget) scene.findWidget(edge.getFrom());
this.to = (BlockWidget) scene.findWidget(edge.getTo());
inputSlot = to.getInputSlot();
outputSlot = from.getOutputSlot();
points = new ArrayList<Point>();
}
public InputBlockEdge getEdge() {
return edge;
}
public Port getTo() {
return inputSlot;
}
public Port getFrom() {
return outputSlot;
}
public void setControlPoints(List<Point> p) {
this.points = p;
}
@Override
public List<Point> getControlPoints() {
return points;
}
@Override
public String toString() {
return "Connection[ " + from.toString() + " - " + to.toString() + "]";
}
}

View File

@ -0,0 +1,160 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import com.sun.hotspot.igv.data.InputBlock;
import com.sun.hotspot.igv.layout.Cluster;
import com.sun.hotspot.igv.layout.Port;
import com.sun.hotspot.igv.layout.Vertex;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import org.netbeans.api.visual.border.BorderFactory;
import org.netbeans.api.visual.model.ObjectState;
import org.netbeans.api.visual.widget.LabelWidget;
/**
*
* @author Thomas Wuerthinger
*/
public class BlockWidget extends LabelWidget implements Vertex {
public static final Dimension SIZE = new Dimension(20, 20);
private InputBlock block;
private Port inputSlot;
private Port outputSlot;
private Cluster cluster;
private boolean root;
private static final Font font = new Font(Font.SERIF, Font.PLAIN, 12);
private static final Font boldFont = font.deriveFont(Font.BOLD);
public static final Color NORMAL_FOREGROUND_COLOR = Color.BLACK;
public static final Color HOVER_FOREGROUND_COLOR = Color.BLUE;
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
super(scene);
this.block = block;
this.setLabel(block.getName());
this.setForeground(NORMAL_FOREGROUND_COLOR);
this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
this.setMinimumSize(SIZE);
this.setMaximumSize(SIZE);
this.setFont(font);
final BlockWidget widget = this;
inputSlot = new Port() {
public Point getRelativePosition() {
return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
}
public Vertex getVertex() {
return widget;
}
};
outputSlot = new Port() {
public Point getRelativePosition() {
return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
}
public Vertex getVertex() {
return widget;
}
};
}
public Port getInputSlot() {
return inputSlot;
}
public Port getOutputSlot() {
return outputSlot;
}
public InputBlock getBlock() {
return block;
}
public Dimension getSize() {
return SIZE;
}
public void setPosition(Point p) {
this.setPreferredLocation(p);
}
@Override
public String toString() {
return block.getName();
}
public Point getPosition() {
return this.getPreferredLocation();
}
public Cluster getCluster() {
return cluster;
}
public boolean isRoot() {
return root;
}
public void setCluster(Cluster c) {
cluster = c;
}
public void setRoot(boolean b) {
root = b;
}
public int compareTo(Vertex o) {
return toString().compareTo(o.toString());
}
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
super.notifyStateChanged(previousState, state);
if (previousState.isHovered() != state.isHovered()) {
if (state.isHovered()) {
this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
} else {
this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
}
}
if (previousState.isSelected() != state.isSelected()) {
if (state.isSelected()) {
this.setFont(boldFont);
} else {
this.setFont(font);
}
}
}
}

View File

@ -0,0 +1,4 @@
CTL_ControlFlowAction=Open ControlFlow Window
CTL_ControlFlowTopComponent=ControlFlow Window
HINT_ControlFlowTopComponent=This is a ControlFlow window
OpenIDE-Module-Name=ControlFlow

View File

@ -0,0 +1,46 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
/**
*
* @author Thomas Wuerthinger
*/
public class ControlFlowAction extends AbstractAction {
public ControlFlowAction() {
super(NbBundle.getMessage(ControlFlowAction.class, "CTL_ControlFlowAction"));
}
public void actionPerformed(ActionEvent evt) {
TopComponent win = ControlFlowTopComponent.findInstance();
win.open();
win.requestActive();
}
}

View File

@ -0,0 +1,296 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import com.sun.hotspot.igv.data.InputBlock;
import com.sun.hotspot.igv.data.InputBlockEdge;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.services.InputGraphProvider;
import com.sun.hotspot.igv.data.InputNode;
import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
import javax.swing.BorderFactory;
import org.netbeans.api.visual.action.ActionFactory;
import org.netbeans.api.visual.action.MoveProvider;
import org.netbeans.api.visual.action.RectangularSelectDecorator;
import org.netbeans.api.visual.action.RectangularSelectProvider;
import org.netbeans.api.visual.action.SelectProvider;
import org.netbeans.api.visual.action.WidgetAction;
import org.netbeans.api.visual.anchor.AnchorFactory;
import org.netbeans.api.visual.anchor.AnchorShape;
import com.sun.hotspot.igv.controlflow.HierarchicalGraphLayout;
import org.netbeans.api.visual.layout.LayoutFactory;
import org.netbeans.api.visual.router.RouterFactory;
import org.netbeans.api.visual.widget.LayerWidget;
import org.netbeans.api.visual.widget.Widget;
import org.netbeans.api.visual.graph.GraphScene;
import org.netbeans.api.visual.graph.layout.GraphLayout;
import org.netbeans.api.visual.layout.SceneLayout;
import org.netbeans.api.visual.widget.ConnectionWidget;
import org.openide.util.Lookup;
/**
*
* @author Thomas Wuerthinger
*/
public class ControlFlowScene extends GraphScene<InputBlock, InputBlockEdge> implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider {
private Set<BlockWidget> selection;
private Hashtable<InputBlock, BlockWidget> blockMap;
private InputGraph oldGraph;
private LayerWidget edgeLayer;
private LayerWidget mainLayer;
private LayerWidget selectLayer;
private WidgetAction hoverAction = this.createWidgetHoverAction();
private WidgetAction selectAction = ActionFactory.createSelectAction(this);
private WidgetAction moveAction = ActionFactory.createMoveAction(null, this);
public ControlFlowScene() {
selection = new HashSet<BlockWidget>();
this.getInputBindings().setZoomActionModifiers(0);
this.setLayout(LayoutFactory.createAbsoluteLayout());
mainLayer = new LayerWidget(this);
this.addChild(mainLayer);
edgeLayer = new LayerWidget(this);
this.addChild(edgeLayer);
selectLayer = new LayerWidget(this);
this.addChild(selectLayer);
this.getActions().addAction(hoverAction);
this.getActions().addAction(selectAction);
this.getActions().addAction(ActionFactory.createRectangularSelectAction(this, selectLayer, this));
this.getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));
}
public void setGraph(InputGraph g) {
if (g == oldGraph) {
return;
}
oldGraph = g;
ArrayList<InputBlock> blocks = new ArrayList<InputBlock>(this.getNodes());
for (InputBlock b : blocks) {
removeNode(b);
}
ArrayList<InputBlockEdge> edges = new ArrayList<InputBlockEdge>(this.getEdges());
for (InputBlockEdge e : edges) {
removeEdge(e);
}
for (InputBlock b : g.getBlocks()) {
addNode(b);
}
for (InputBlock b : g.getBlocks()) {
for (InputBlockEdge e : b.getOutputs()) {
addEdge(e);
assert g.getBlocks().contains(e.getFrom());
assert g.getBlocks().contains(e.getTo());
this.setEdgeSource(e, e.getFrom());
this.setEdgeTarget(e, e.getTo());
}
}
GraphLayout layout = new HierarchicalGraphLayout();//GridGraphLayout();
SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout);
sceneLayout.invokeLayout();
this.validate();
}
public BlockWidget getBlockWidget(InputBlock b) {
return blockMap.get(b);
}
public void clearSelection() {
for (BlockWidget w : selection) {
w.setState(w.getState().deriveSelected(false));
}
selection.clear();
selectionChanged();
}
public void selectionChanged() {
InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
if (p != null) {
Set<InputNode> inputNodes = new HashSet<InputNode>();
for (BlockWidget w : selection) {
inputNodes.addAll(w.getBlock().getNodes());
}
p.setSelectedNodes(inputNodes);
}
}
public void addToSelection(BlockWidget widget) {
widget.setState(widget.getState().deriveSelected(true));
selection.add(widget);
selectionChanged();
}
public void removeFromSelection(BlockWidget widget) {
widget.setState(widget.getState().deriveSelected(false));
selection.remove(widget);
selectionChanged();
}
public boolean isAimingAllowed(Widget widget, Point point, boolean b) {
return false;
}
public boolean isSelectionAllowed(Widget widget, Point point, boolean b) {
return true;
}
public void select(Widget widget, Point point, boolean change) {
if (widget == this) {
clearSelection();
} else {
assert widget instanceof BlockWidget;
BlockWidget bw = (BlockWidget) widget;
if (change) {
if (selection.contains(bw)) {
removeFromSelection(bw);
} else {
addToSelection(bw);
}
} else {
if (!selection.contains(bw)) {
clearSelection();
addToSelection(bw);
}
}
}
}
public void movementStarted(Widget widget) {
}
public void movementFinished(Widget widget) {
}
public Point getOriginalLocation(Widget widget) {
return widget.getPreferredLocation();
}
public void setNewLocation(Widget widget, Point location) {
Point originalLocation = getOriginalLocation(widget);
int xOffset = location.x - originalLocation.x;
int yOffset = location.y - originalLocation.y;
for (Widget w : this.selection) {
Point p = new Point(w.getPreferredLocation());
p.translate(xOffset, yOffset);
w.setPreferredLocation(p);
}
}
public Widget createSelectionWidget() {
Widget widget = new Widget(this);
widget.setOpaque(false);
widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
widget.setForeground(Color.red);
return widget;
}
public void performSelection(Rectangle rectangle) {
if (rectangle.width < 0) {
rectangle.x += rectangle.width;
rectangle.width *= -1;
}
if (rectangle.height < 0) {
rectangle.y += rectangle.height;
rectangle.height *= -1;
}
boolean changed = false;
for (InputBlock b : this.getNodes()) {
BlockWidget w = (BlockWidget) findWidget(b);
Rectangle r = new Rectangle(w.getBounds());
r.setLocation(w.getLocation());
if (r.intersects(rectangle)) {
if (!selection.contains(w)) {
changed = true;
selection.add(w);
w.setState(w.getState().deriveSelected(true));
}
} else {
if (selection.contains(w)) {
changed = true;
selection.remove(w);
w.setState(w.getState().deriveSelected(false));
}
}
}
if (changed) {
selectionChanged();
}
}
protected Widget attachNodeWidget(InputBlock node) {
BlockWidget w = new BlockWidget(this, node);
mainLayer.addChild(w);
w.getActions().addAction(hoverAction);
w.getActions().addAction(selectAction);
w.getActions().addAction(moveAction);
return w;
}
protected Widget attachEdgeWidget(InputBlockEdge edge) {
ConnectionWidget w = new BlockConnectionWidget(this, edge);
w.setRouter(RouterFactory.createDirectRouter());
w.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
edgeLayer.addChild(w);
return w;
}
protected void attachEdgeSourceAnchor(InputBlockEdge edge, InputBlock oldSourceNode, InputBlock sourceNode) {
Widget w = this.findWidget(edge);
assert w instanceof ConnectionWidget;
ConnectionWidget cw = (ConnectionWidget) w;
cw.setSourceAnchor(AnchorFactory.createRectangularAnchor(findWidget(sourceNode)));
}
protected void attachEdgeTargetAnchor(InputBlockEdge edge, InputBlock oldTargetNode, InputBlock targetNode) {
Widget w = this.findWidget(edge);
assert w instanceof ConnectionWidget;
ConnectionWidget cw = (ConnectionWidget) w;
cw.setTargetAnchor(AnchorFactory.createRectangularAnchor(findWidget(targetNode)));
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -0,0 +1,179 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import com.sun.hotspot.igv.data.InputGraph;
import com.sun.hotspot.igv.data.services.InputGraphProvider;
import java.awt.BorderLayout;
import java.io.Serializable;
import javax.swing.JScrollPane;
import org.openide.ErrorManager;
import org.openide.util.Lookup;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
/**
*
* @author Thomas Wuerthinger
*/
final class ControlFlowTopComponent extends TopComponent implements LookupListener {
private static ControlFlowTopComponent instance;
private Lookup.Result result = null;
private static final String PREFERRED_ID = "ControlFlowTopComponent";
private ControlFlowScene scene;
private ControlFlowTopComponent() {
initComponents();
setName(NbBundle.getMessage(ControlFlowTopComponent.class, "CTL_ControlFlowTopComponent"));
setToolTipText(NbBundle.getMessage(ControlFlowTopComponent.class, "HINT_ControlFlowTopComponent"));
scene = new ControlFlowScene();
this.setLayout(new BorderLayout());
this.associateLookup(scene.getLookup());
JScrollPane panel = new JScrollPane(scene.createView());
this.add(panel, BorderLayout.CENTER);
}
@Override
public void requestFocus() {
super.requestFocus();
scene.getView().requestFocus();
}
@Override
public boolean requestFocusInWindow() {
super.requestFocusInWindow();
return scene.getView().requestFocusInWindow();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
* To obtain the singleton instance, use {@link findInstance}.
*/
public static synchronized ControlFlowTopComponent getDefault() {
if (instance == null) {
instance = new ControlFlowTopComponent();
}
return instance;
}
/**
* Obtain the ControlFlowTopComponent instance. Never call {@link #getDefault} directly!
*/
public static synchronized ControlFlowTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
if (win == null) {
ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find ControlFlow component. It will not be located properly in the window system.");
return getDefault();
}
if (win instanceof ControlFlowTopComponent) {
return (ControlFlowTopComponent) win;
}
ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
return getDefault();
}
@Override
public int getPersistenceType() {
return TopComponent.PERSISTENCE_ALWAYS;
}
@Override
public void componentOpened() {
Lookup.Template tpl = new Lookup.Template(Object.class);
result = Utilities.actionsGlobalContext().lookup(tpl);
result.addLookupListener(this);
}
@Override
public void componentClosed() {
result.removeLookupListener(this);
result = null;
}
public void resultChanged(LookupEvent lookupEvent) {
InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
if (p != null) {
InputGraph g = p.getGraph();
if (g != null) {
scene.setGraph(g);
}
}
}
@Override
public Object writeReplace() {
return new ResolvableHelper();
}
@Override
protected String preferredID() {
return PREFERRED_ID;
}
@Override
public void requestActive() {
scene.getView().requestFocusInWindow();
super.requestActive();
}
final static class ResolvableHelper implements Serializable {
private static final long serialVersionUID = 1L;
public Object readResolve() {
return ControlFlowTopComponent.getDefault();
}
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<module name="com.sun.hotspot.igv.controlflow" spec="1.0"/>
<instanceof class="org.openide.windows.TopComponent"/>
<instanceof class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent"/>
<instance class="com.sun.hotspot.igv.controlflow.ControlFlowTopComponent" method="getDefault"/>
</settings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
<tc-ref version="2.0" >
<module name="com.sun.hotspot.igv.controlflow" spec="1.0"/>
<tc-id id="ControlFlowTopComponent"/>
<state opened="true"/>
</tc-ref>

View File

@ -0,0 +1,167 @@
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.igv.controlflow;
import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager;
import com.sun.hotspot.igv.layout.Cluster;
import com.sun.hotspot.igv.layout.LayoutGraph;
import com.sun.hotspot.igv.layout.Link;
import com.sun.hotspot.igv.layout.Port;
import com.sun.hotspot.igv.layout.Vertex;
import java.awt.Dimension;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.visual.graph.layout.GraphLayout;
import org.netbeans.api.visual.graph.layout.UniversalGraph;
import org.netbeans.api.visual.widget.Widget;
/**
*
* @author Thomas Wuerthinger
*/
public class HierarchicalGraphLayout<N, E> extends GraphLayout<N, E> {
public HierarchicalGraphLayout() {
}
private class LinkWrapper implements Link {
private VertexWrapper from;
private VertexWrapper to;
public LinkWrapper(VertexWrapper from, VertexWrapper to) {
this.from = from;
this.to = to;
}
public Port getFrom() {
return from.getSlot();
}
public Port getTo() {
return to.getSlot();
}
public List<Point> getControlPoints() {
return new ArrayList<Point>();
}
public void setControlPoints(List<Point> list) {
// Do nothing for now
}
}
private class VertexWrapper implements Vertex {
private N node;
private UniversalGraph<N, E> graph;
private Port slot;
private Point position;
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
this.node = node;
this.graph = graph;
final VertexWrapper vertex = this;
this.slot = new Port() {
public Vertex getVertex() {
return vertex;
}
public Point getRelativePosition() {
return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
}
};
Widget w = graph.getScene().findWidget(node);
this.position = w.getPreferredLocation();
}
public Cluster getCluster() {
return null;
}
public Dimension getSize() {
Widget w = graph.getScene().findWidget(node);
return w.getBounds().getSize();
}
public Point getPosition() {
return position;
}
public void setPosition(Point p) {
HierarchicalGraphLayout.this.setResolvedNodeLocation(graph, node, p);
position = p;
}
public boolean isRoot() {
return false;
}
public int compareTo(Vertex o) {
VertexWrapper vw = (VertexWrapper) o;
return node.toString().compareTo(vw.node.toString());
}
public Port getSlot() {
return slot;
}
}
protected void performGraphLayout(UniversalGraph<N, E> graph) {
Set<LinkWrapper> links = new HashSet<LinkWrapper>();
Set<VertexWrapper> vertices = new HashSet<VertexWrapper>();
Map<N, VertexWrapper> vertexMap = new HashMap<N, VertexWrapper>();
for (N node : graph.getNodes()) {
VertexWrapper v = new VertexWrapper(node, graph);
vertexMap.put(node, v);
vertices.add(v);
}
for (E edge : graph.getEdges()) {
N source = graph.getEdgeSource(edge);
N target = graph.getEdgeTarget(edge);
LinkWrapper l = new LinkWrapper(vertexMap.get(source), vertexMap.get(target));
links.add(l);
}
HierarchicalLayoutManager m = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.NONE);
LayoutGraph layoutGraph = new LayoutGraph(links, vertices);
m.doLayout(layoutGraph);
}
protected void performNodesLayout(UniversalGraph<N, E> graph, Collection<N> nodes) {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
<filesystem>
<folder name="Actions">
<folder name="Window">
<file name="com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
</folder>
</folder>
<folder name="Menu">
<folder name="Window">
<file name="ControlFlowAction.shadow">
<attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-controlflow-ControlFlowAction.instance"/>
</file>
</folder>
</folder>
<folder name="Windows2">
<folder name="Components">
<file name="ControlFlowTopComponent.settings" url="ControlFlowTopComponentSettings.xml"/>
</folder>
<folder name="Modes">
<folder name="customRightTopMode">
<file name="ControlFlowTopComponent.wstcref" url="ControlFlowTopComponentWstcref.xml"/>
</folder>
</folder>
</folder>
</filesystem>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.sun.hotspot.igv.coordinator" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.sun.hotspot.igv.coordinator.</description>
<import file="nbproject/build-impl.xml"/>
</project>

View File

@ -0,0 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: com.sun.hotspot.igv.coordinator
OpenIDE-Module-Layer: com/sun/hotspot/igv/coordinator/layer.xml
OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/coordinator/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.sun.hotspot.igv.coordinator-impl" basedir="..">
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
<condition>
<not>
<available file="${harness.dir}" type="dir"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=077de97c
build.xml.script.CRC32=d29d586c
build.xml.stylesheet.CRC32=79c3b980
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=077de97c
nbproject/build-impl.xml.script.CRC32=03daa42d
nbproject/build-impl.xml.stylesheet.CRC32=deb65f65

View File

@ -0,0 +1,29 @@
# Deprecated since 5.0u1; for compatibility with 5.0:
disabled.clusters=\
apisupport1,\
harness,\
ide8,\
java1,\
nb6.0,\
profiler2
disabled.modules=\
org.netbeans.core.execution,\
org.netbeans.core.multiview,\
org.netbeans.core.output2,\
org.netbeans.modules.applemenu,\
org.netbeans.modules.autoupdate.services,\
org.netbeans.modules.autoupdate.ui,\
org.netbeans.modules.core.kit,\
org.netbeans.modules.favorites,\
org.netbeans.modules.javahelp,\
org.netbeans.modules.masterfs,\
org.netbeans.modules.options.keymap,\
org.netbeans.modules.sendopts,\
org.netbeans.modules.templates,\
org.openide.compat,\
org.openide.execution,\
org.openide.util.enumerations
enabled.clusters=\
platform7
nbjdk.active=JDK_1.6
nbplatform.active=default

View File

@ -0,0 +1,2 @@
javac.source=1.5
javac.compilerargs=-Xlint -Xlint:-serial

Some files were not shown because too many files have changed in this diff Show More