OpenJDK / amber / amber
changeset 816:ef16801b95b1
Merge
author | duke |
---|---|
date | Wed, 05 Jul 2017 16:38:58 +0200 |
parents | bcb5c0d7c1ab c8e0e5219f85 |
children | cd8b8f500fac |
files | hotspot/make/linux/Queens.class hotspot/make/solaris/Queens.class jdk/make/tools/winver/Makefile jdk/make/tools/winver/bin/winver.exe jdk/make/tools/winver/src/StdAfx.cpp jdk/make/tools/winver/src/StdAfx.h jdk/make/tools/winver/src/winver.cpp |
diffstat | 609 files changed, 72433 insertions(+), 2480 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags-top-repo Fri Jul 04 15:06:27 2008 -0700 +++ b/.hgtags-top-repo Wed Jul 05 16:38:58 2017 +0200 @@ -4,3 +4,4 @@ 11b4dc9f2be3523ef989a0db8459eb56b3045c3a jdk7-b27 56652b46f328937f6b9b5130f1e4cd80f48868ef jdk7-b28 31e08f70e88d77c2053f91c21b49a04296bdc59a jdk7-b29 +2dab2f712e1832c92acfa63ec0337048b9422c20 jdk7-b30
--- a/corba/.hgtags Fri Jul 04 15:06:27 2008 -0700 +++ b/corba/.hgtags Wed Jul 05 16:38:58 2017 +0200 @@ -4,3 +4,4 @@ e84e9018bebbf3e5bafc5706e7882a15cb1c7d99 jdk7-b27 27509b7d21ed783b3f6eb7b7612781c675a30c2f jdk7-b28 8b71960f79ce0a6fb8ddfeec03f03d400a361747 jdk7-b29 +c0252adbb2abbfdd6c35595429ac6fbdd98e20ac jdk7-b30
--- a/hotspot/.hgignore Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/.hgignore Wed Jul 05 16:38:58 2017 +0200 @@ -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/
--- a/hotspot/.hgtags Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/.hgtags Wed Jul 05 16:38:58 2017 +0200 @@ -4,3 +4,4 @@ e3d2692f8442e2d951166dc9bd9a330684754438 jdk7-b27 c14dab40ed9bf45ad21150bd70c9c80cdf655415 jdk7-b28 4f91c08b3e4498213a9c5a24898f7d9c38cf86fb jdk7-b29 +d1605aabd0a15ecf93787c47de63073c33fba52d jdk7-b30
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Wed Jul 05 16:38:58 2017 +0200 @@ -316,6 +316,14 @@ 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 @@ } } - 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(); }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java Wed Jul 05 16:38:58 2017 +0200 @@ -215,11 +215,11 @@ 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 @@ } 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
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/solaris_sparc/SolarisSPARCJavaThreadPDAccess.java Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/solaris_sparc/SolarisSPARCJavaThreadPDAccess.java Wed Jul 05 16:38:58 2017 +0200 @@ -121,6 +121,13 @@ } 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
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java Wed Jul 05 16:38:58 2017 +0200 @@ -422,6 +422,13 @@ 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 @@ // 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 @@ // will update it accordingly map.setIncludeArgumentOops(false); - if (cb == null && isEntryFrame()) { + if (isEntryFrame()) { return senderForEntryFrame(map); } @@ -539,7 +555,6 @@ 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 @@ // 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.
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Wed Jul 05 16:38:58 2017 +0200 @@ -87,12 +87,13 @@ 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 @@ // 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 @@ 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 @@ } } - 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) {
--- a/hotspot/make/defs.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/defs.make Wed Jul 05 16:38:58 2017 +0200 @@ -228,6 +228,7 @@ # 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)
--- a/hotspot/make/hotspot_version Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/hotspot_version Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- a/hotspot/make/linux/makefiles/buildtree.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/linux/makefiles/buildtree.make Wed Jul 05 16:38:58 2017 +0200 @@ -328,18 +328,19 @@ 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'; \ ) > $@
--- a/hotspot/make/linux/makefiles/gcc.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/linux/makefiles/gcc.make Wed Jul 05 16:38:58 2017 +0200 @@ -50,14 +50,7 @@ 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 @@ # 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/$@))
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Wed Jul 05 16:38:58 2017 +0200 @@ -89,6 +89,7 @@ JVM_FillInStackTrace; JVM_FindClassFromClass; JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; JVM_FindLibraryEntry; JVM_FindLoadedClass; JVM_FindPrimitiveClass;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-product Wed Jul 05 16:38:58 2017 +0200 @@ -89,6 +89,7 @@ JVM_FillInStackTrace; JVM_FindClassFromClass; JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; JVM_FindLibraryEntry; JVM_FindLoadedClass; JVM_FindPrimitiveClass;
--- a/hotspot/make/linux/makefiles/rules.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/linux/makefiles/rules.make Wed Jul 05 16:38:58 2017 +0200 @@ -133,10 +133,25 @@ 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 $<
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/make/pic.make Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- a/hotspot/make/solaris/makefiles/buildtree.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/buildtree.make Wed Jul 05 16:38:58 2017 +0200 @@ -340,7 +340,7 @@ 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 @@ 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'; \ ) > $@
--- a/hotspot/make/solaris/makefiles/jvmg.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/jvmg.make Wed Jul 05 16:38:58 2017 +0200 @@ -30,7 +30,7 @@ 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
--- a/hotspot/make/solaris/makefiles/mapfile-vers Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/mapfile-vers Wed Jul 05 16:38:58 2017 +0200 @@ -89,6 +89,7 @@ JVM_FillInStackTrace; JVM_FindClassFromClass; JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; JVM_FindLibraryEntry; JVM_FindLoadedClass; JVM_FindPrimitiveClass;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER1_i486 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER1_i486 Wed Jul 05 16:38:58 2017 +0200 @@ -2175,6 +2175,7 @@ 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_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER1_sparc Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER1_sparc Wed Jul 05 16:38:58 2017 +0200 @@ -1500,6 +1500,7 @@ 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_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_amd64 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_amd64 Wed Jul 05 16:38:58 2017 +0200 @@ -4339,6 +4339,7 @@ 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_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_i486 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_i486 Wed Jul 05 16:38:58 2017 +0200 @@ -4755,6 +4755,7 @@ 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;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparc Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparc Wed Jul 05 16:38:58 2017 +0200 @@ -3713,6 +3713,7 @@ 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;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparcv9 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparcv9 Wed Jul 05 16:38:58 2017 +0200 @@ -3735,6 +3735,7 @@ 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;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_amd64 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_TIERED_amd64 Wed Jul 05 16:38:58 2017 +0200 @@ -4339,6 +4339,7 @@ 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_;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_i486 Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_TIERED_i486 Wed Jul 05 16:38:58 2017 +0200 @@ -4755,6 +4755,7 @@ 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;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_sparc Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/reorder_TIERED_sparc Wed Jul 05 16:38:58 2017 +0200 @@ -3713,6 +3713,7 @@ 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;
--- a/hotspot/make/solaris/makefiles/rules.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/solaris/makefiles/rules.make Wed Jul 05 16:38:58 2017 +0200 @@ -133,19 +133,10 @@ 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
--- a/hotspot/make/windows/makefiles/vm.make Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/make/windows/makefiles/vm.make Wed Jul 05 16:38:58 2017 +0200 @@ -88,13 +88,20 @@ !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=\
--- a/hotspot/src/cpu/sparc/vm/sparc.ad Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/cpu/sparc/vm/sparc.ad Wed Jul 05 16:38:58 2017 +0200 @@ -5955,7 +5955,7 @@ // 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_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 %{
--- a/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp Wed Jul 05 16:38:58 2017 +0200 @@ -307,6 +307,10 @@ // 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
--- a/hotspot/src/cpu/x86/vm/x86_32.ad Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/cpu/x86/vm/x86_32.ad Wed Jul 05 16:38:58 2017 +0200 @@ -4754,6 +4754,33 @@ 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 @@ 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));
--- a/hotspot/src/cpu/x86/vm/x86_64.ad Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/cpu/x86/vm/x86_64.ad Wed Jul 05 16:38:58 2017 +0200 @@ -7060,7 +7060,7 @@ // 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_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" %}
--- a/hotspot/src/os/linux/vm/hpi_linux.hpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/linux/vm/hpi_linux.hpp Wed Jul 05 16:38:58 2017 +0200 @@ -70,6 +70,10 @@ 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;
--- a/hotspot/src/os/linux/vm/jvm_linux.cpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/linux/vm/jvm_linux.cpp Wed Jul 05 16:38:58 2017 +0200 @@ -132,7 +132,7 @@ */ struct siglabel { - char *name; + const char *name; int number; };
--- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 16:38:58 2017 +0200 @@ -75,8 +75,8 @@ 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 @@ // 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 @@ 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 @@ // 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 @@ // 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);
--- a/hotspot/src/os/linux/vm/os_linux.hpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.hpp Wed Jul 05 16:38:58 2017 +0200 @@ -52,8 +52,8 @@ 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 @@ 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 @@ 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; }
--- a/hotspot/src/os/solaris/vm/hpi_solaris.hpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/solaris/vm/hpi_solaris.hpp Wed Jul 05 16:38:58 2017 +0200 @@ -71,6 +71,10 @@ 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
--- a/hotspot/src/os/windows/vm/hpi_windows.hpp Fri Jul 04 15:06:27 2008 -0700 +++ b/hotspot/src/os/windows/vm/hpi_windows.hpp Wed Jul 05 16:38:58 2017 +0200 @@ -102,6 +102,10 @@ 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),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/build.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/manifest.mf Wed Jul 05 16:38:58 2017 +0200 @@ -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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/build-impl.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/genfiles.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/project.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/nbproject/suite.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/BatikSVG.java Wed Jul 05 16:38:58 2017 +0200 @@ -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; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=BatikSVGProxy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/BatikSVGProxy/src/com/sun/hotspot/igv/svg/layer.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/build.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/manifest.mf Wed Jul 05 16:38:58 2017 +0200 @@ -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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/build-impl.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/genfiles.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/platform.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/project.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/nbproject/suite.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java Wed Jul 05 16:38:58 2017 +0200 @@ -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); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.form Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java Wed Jul 05 16:38:58 2017 +0200 @@ -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(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentSettings.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponentWstcref.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/MethodNode.java Wed Jul 05 16:38:58 2017 +0200 @@ -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()); + } + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -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; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/SelectBytecodesCookie.java Wed Jul 05 16:38:58 2017 +0200 @@ -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 hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/bytecode.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/link.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/images/method.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/layer.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/build.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/manifest.mf Wed Jul 05 16:38:58 2017 +0200 @@ -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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/build-impl.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/genfiles.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/platform.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/project.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/nbproject/suite.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java Wed Jul 05 16:38:58 2017 +0200 @@ -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() + "]"; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java Wed Jul 05 16:38:58 2017 +0200 @@ -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); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,4 @@ +CTL_ControlFlowAction=Open ControlFlow Window +CTL_ControlFlowTopComponent=ControlFlow Window +HINT_ControlFlowTopComponent=This is a ControlFlow window +OpenIDE-Module-Name=ControlFlow
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java Wed Jul 05 16:38:58 2017 +0200 @@ -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))); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.form Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java Wed Jul 05 16:38:58 2017 +0200 @@ -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(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentSettings.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponentWstcref.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java Wed Jul 05 16:38:58 2017 +0200 @@ -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(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/layer.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/build.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/manifest.mf Wed Jul 05 16:38:58 2017 +0200 @@ -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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/build-impl.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/genfiles.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/platform.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/project.xml Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,126 @@ +<?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.coordinator</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.difference</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.settings</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.util</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.api.progress</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.10.0.1</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.actions</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>6.6.1.1</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.awt</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>6.11.0.1</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.dialogs</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.5.1</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.filesystems</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.3</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.loaders</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>6.7</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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/nbproject/suite.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/META-INF/services/com.sun.hotspot.igv.data.services.GroupOrganizer Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +com.sun.hotspot.igv.coordinator.StandardGroupOrganizer +com.sun.hotspot.igv.coordinator.GraphCountGroupOrganizer \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,7 @@ + +AdvancedOption_DisplayName_Coordinator=Settings +AdvancedOption_Tooltip_Coordinator=Visualization Tool Settings +CTL_OutlineTopComponent=Outline Window +CTL_SomeAction=test +HINT_OutlineTopComponent=This is a Outline window +OpenIDE-Module-Name=Coordinator
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,139 @@ +/* + * 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.coordinator; + +import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.services.GroupOrganizer; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.Pair; +import java.awt.Image; +import java.util.ArrayList; +import java.util.List; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Utilities; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; + +/** + * + * @author Thomas Wuerthinger + */ +public class FolderNode extends AbstractNode { + + private GroupOrganizer organizer; + private InstanceContent content; + private List<Pair<String, List<Group>>> structure; + private List<String> subFolders; + private FolderChildren children; + + private static class FolderChildren extends Children.Keys { + + private FolderNode parent; + + public void setParent(FolderNode parent) { + this.parent = parent; + } + + @Override + protected Node[] createNodes(Object arg0) { + + Pair<String, List<Group>> p = (Pair<String, List<Group>>) arg0; + if (p.getLeft().length() == 0) { + + List<Node> curNodes = new ArrayList<Node>(); + for (Group g : p.getRight()) { + for (InputGraph graph : g.getGraphs()) { + curNodes.add(new GraphNode(graph)); + } + } + + Node[] result = new Node[curNodes.size()]; + for (int i = 0; i < curNodes.size(); i++) { + result[i] = curNodes.get(i); + } + return result; + + } else { + return new Node[]{new FolderNode(p.getLeft(), parent.organizer, parent.subFolders, p.getRight())}; + } + } + + @Override + public void addNotify() { + this.setKeys(parent.structure); + + } + } + + protected InstanceContent getContent() { + return content; + } + + @Override + public Image getIcon(int i) { + return Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/folder.gif"); + } + + protected FolderNode(String name, GroupOrganizer organizer, List<String> subFolders, List<Group> groups) { + this(name, organizer, subFolders, groups, new FolderChildren(), new InstanceContent()); + } + + private FolderNode(String name, GroupOrganizer organizer, List<String> oldSubFolders, final List<Group> groups, FolderChildren children, InstanceContent content) { + super(children, new AbstractLookup(content)); + children.setParent(this); + this.content = content; + this.children = children; + content.add(new RemoveCookie() { + + public void remove() { + for (Group g : groups) { + if (g.getDocument() != null) { + g.getDocument().removeGroup(g); + } + } + } + }); + init(name, organizer, oldSubFolders, groups); + } + + public void init(String name, GroupOrganizer organizer, List<String> oldSubFolders, List<Group> groups) { + this.setDisplayName(name); + this.organizer = organizer; + this.subFolders = new ArrayList<String>(oldSubFolders); + if (name.length() > 0) { + this.subFolders.add(name); + } + structure = organizer.organize(subFolders, groups); + assert structure != null; + children.addNotify(); + } + + @Override + public Image getOpenedIcon(int i) { + return getIcon(i); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator; + +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.Pair; +import com.sun.hotspot.igv.data.services.GroupOrganizer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; + +/** + * + * @author Thomas Wuerthinger + */ +public class GraphCountGroupOrganizer implements GroupOrganizer { + + public String getName() { + return "Graph count structure"; + } + + public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) { + + List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>(); + + if (subFolders.size() == 0) { + Map<Integer, List<Group>> map = new HashMap<Integer, List<Group>>(); + for (Group g : groups) { + Integer cur = g.getGraphs().size(); + if (!map.containsKey(cur)) { + map.put(cur, new ArrayList<Group>()); + } + map.get(cur).add(g); + } + + SortedSet<Integer> keys = new TreeSet<Integer>(map.keySet()); + for (Integer i : keys) { + result.add(new Pair<String, List<Group>>("Graph count " + i, map.get(i))); + } + + } else if (subFolders.size() == 1) { + for (Group g : groups) { + List<Group> children = new ArrayList<Group>(); + children.add(g); + Pair<String, List<Group>> p = new Pair<String, List<Group>>(); + p.setLeft(g.getName()); + p.setRight(children); + result.add(p); + } + } else if (subFolders.size() == 2) { + result.add(new Pair<String, List<Group>>("", groups)); + } + + return result; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,130 @@ +/* + * 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.coordinator; + +import com.sun.hotspot.igv.coordinator.actions.DiffGraphAction; +import com.sun.hotspot.igv.coordinator.actions.DiffGraphCookie; +import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.services.GraphViewer; +import com.sun.hotspot.igv.data.services.InputGraphProvider; +import com.sun.hotspot.igv.util.PropertiesSheet; +import java.awt.Image; +import javax.swing.Action; +import org.openide.actions.OpenAction; +import org.openide.cookies.OpenCookie; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.Lookup; +import org.openide.util.Utilities; +import org.openide.util.lookup.AbstractLookup; +import org.openide.util.lookup.InstanceContent; + +/** + * + * @author Thomas Wuerthinger + */ +public class GraphNode extends AbstractNode { + + private InputGraph graph; + + /** Creates a new instance of GraphNode */ + public GraphNode(InputGraph graph) { + this(graph, new InstanceContent()); + } + + private GraphNode(final InputGraph graph, InstanceContent content) { + super(Children.LEAF, new AbstractLookup(content)); + this.graph = graph; + this.setDisplayName(graph.getName()); + content.add(graph); + + final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class); + + if (viewer != null) { + // Action for opening the graph + content.add(new OpenCookie() { + + public void open() { + viewer.view(graph); + } + }); + } + + // Action for removing a graph + content.add(new RemoveCookie() { + + public void remove() { + graph.getGroup().removeGraph(graph); + } + }); + } + + @Override + protected Sheet createSheet() { + Sheet s = super.createSheet(); + PropertiesSheet.initializeSheet(graph.getProperties(), s); + return s; + } + + @Override + public Image getIcon(int i) { + return Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/graph.gif"); + } + + @Override + public Image getOpenedIcon(int i) { + return getIcon(i); + } + + @Override + public <T extends Node.Cookie> T getCookie(Class<T> aClass) { + if (aClass == DiffGraphCookie.class) { + InputGraphProvider graphProvider = Utilities.actionsGlobalContext().lookup(InputGraphProvider.class); + + InputGraph graphA = null; + if (graphProvider != null) { + graphA = graphProvider.getGraph(); + } + + if (graphA != null && !graphA.isDifferenceGraph()) { + return (T) new DiffGraphCookie(graphA, graph); + } + } + + return super.getCookie(aClass); + } + + @Override + public Action[] getActions(boolean b) { + return new Action[]{(Action) DiffGraphAction.findObject(DiffGraphAction.class, true), (Action) OpenAction.findObject(OpenAction.class, true)}; + } + + @Override + public Action getPreferredAction() { + return (Action) OpenAction.findObject(OpenAction.class, true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.form Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.2" maxVersion="1.2" 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"/> + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel2"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="Center"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/> + </AuxValues> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="Center"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + </Container> + </SubComponents> + </Container> + </SubComponents> +</Form>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,271 @@ +/* + * 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.coordinator; + +import com.sun.hotspot.igv.coordinator.actions.ImportAction; +import com.sun.hotspot.igv.coordinator.actions.RemoveAction; +import com.sun.hotspot.igv.coordinator.actions.RemoveAllAction; +import com.sun.hotspot.igv.coordinator.actions.SaveAllAction; +import com.sun.hotspot.igv.coordinator.actions.SaveAsAction; +import com.sun.hotspot.igv.coordinator.actions.StructuredViewAction; +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.ChangedListener; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.services.GroupCallback; +import com.sun.hotspot.igv.data.services.GroupOrganizer; +import com.sun.hotspot.igv.data.services.GroupReceiver; +import java.awt.BorderLayout; +import java.awt.Component; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import javax.swing.BoxLayout; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.border.Border; +import org.openide.ErrorManager; +import org.openide.awt.Toolbar; +import org.openide.awt.ToolbarPool; +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.actions.NodeAction; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; + +/** + * + * @author Thomas Wuerthinger + */ +public final class OutlineTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener { + + public static OutlineTopComponent instance; + public static final String PREFERRED_ID = "OutlineTopComponent"; + private ExplorerManager manager; + private GraphDocument document; + private FolderNode root; + private GroupOrganizer organizer; + + private OutlineTopComponent() { + initComponents(); + + setName(NbBundle.getMessage(OutlineTopComponent.class, "CTL_OutlineTopComponent")); + setToolTipText(NbBundle.getMessage(OutlineTopComponent.class, "HINT_OutlineTopComponent")); + + document = new GraphDocument(); + initListView(); + initToolbar(); + initReceivers(); + } + + private void initListView() { + manager = new ExplorerManager(); + organizer = new StandardGroupOrganizer(); + root = new FolderNode("", organizer, new ArrayList<String>(), document.getGroups()); + manager.setRootContext(root); + ((BeanTreeView) this.jScrollPane1).setRootVisible(false); + + document.getChangedEvent().addListener(new ChangedListener<GraphDocument>() { + + public void changed(GraphDocument document) { + updateStructure(); + } + }); + + associateLookup(ExplorerUtils.createLookup(manager, getActionMap())); + } + + private void initToolbar() { + + Toolbar toolbar = new Toolbar(); + Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N + toolbar.setBorder(b); + this.add(toolbar, BorderLayout.NORTH); + + toolbar.add(ImportAction.get(ImportAction.class)); + toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup())); + toolbar.add(RemoveAllAction.get(RemoveAllAction.class)); + + toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup())); + toolbar.add(SaveAllAction.get(SaveAllAction.class)); + + toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter()); + + for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) { + tb.setVisible(false); + } + + initOrganizers(); + } + + public void setOrganizer(GroupOrganizer organizer) { + this.organizer = organizer; + updateStructure(); + } + + private void initOrganizers() { + + } + + private void initReceivers() { + + final GroupCallback callback = new GroupCallback() { + + public void started(Group g) { + getDocument().addGroup(g); + } + }; + + Collection<? extends GroupReceiver> receivers = Lookup.getDefault().lookupAll(GroupReceiver.class); + if (receivers.size() > 0) { + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + + for (GroupReceiver r : receivers) { + Component c = r.init(callback); + panel.add(c); + } + + jPanel2.add(panel, BorderLayout.PAGE_START); + } + } + + private void updateStructure() { + root.init("", organizer, new ArrayList<String>(), document.getGroups()); + } + + public void clear() { + document.clear(); + } + + public ExplorerManager getExplorerManager() { + return manager; + } + + public GraphDocument getDocument() { + return document; + } + + /** + * 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 OutlineTopComponent getDefault() { + if (instance == null) { + instance = new OutlineTopComponent(); + } + return instance; + } + + /** + * Obtain the OutlineTopComponent instance. Never call {@link #getDefault} directly! + */ + public static synchronized OutlineTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Outline component. It will not be located properly in the window system."); + return getDefault(); + } + if (win instanceof OutlineTopComponent) { + return (OutlineTopComponent) 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() { + this.requestActive(); + } + + @Override + public void componentClosed() { + } + + @Override + protected String preferredID() { + return PREFERRED_ID; + } + + public void resultChanged(LookupEvent lookupEvent) { + } + + @Override + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { + // Not called when user starts application for the first time + super.readExternal(objectInput); + ((BeanTreeView) this.jScrollPane1).setRootVisible(false); + } + + @Override + public void writeExternal(ObjectOutput objectOutput) throws IOException { + super.writeExternal(objectOutput); + } + + static final class ResolvableHelper implements Serializable { + + private static final long serialVersionUID = 1L; + + public Object readResolve() { + return OutlineTopComponent.getDefault(); + } + } + + /** 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() { + + jPanel2 = new javax.swing.JPanel(); + jScrollPane1 = new BeanTreeView(); + + setLayout(new java.awt.BorderLayout()); + + jPanel2.setLayout(new java.awt.BorderLayout()); + jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER); + + add(jPanel2, java.awt.BorderLayout.CENTER); + }// </editor-fold>//GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JPanel jPanel2; + private javax.swing.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentSettings.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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.coordinator" spec="1.0"/> + <instanceof class="at.openide.windows.TopComponent"/> + <instanceof class="com.sun.hotspot.igv.coordinator.OutlineTopComponent"/> + <instance class="com.sun.hotspot.igv.coordinator.OutlineTopComponent" method="getDefault"/> +</settings>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponentWstcref.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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.coordinator" spec="1.0"/> + <tc-id id="OutlineTopComponent"/> + <state opened="true"/> +</tc-ref>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardConfiguration.xml Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN" "http://www.netbeans.org/dtds/toolbar.dtd"> +<Configuration> + <Row> + <Toolbar name="Edit" position="1" visible="false"/> + <Toolbar name="File" position="1" visible="false" /> + <Toolbar name="Memory" position="1" visible="false" /> + </Row> + <Row> + <Toolbar name="WorkspaceSwitcher" /> + <Toolbar name="StatusLine" /> + </Row> +</Configuration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,62 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator; + +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.services.GroupOrganizer; +import com.sun.hotspot.igv.data.Pair; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Thomas Wuerthinger + */ +public class StandardGroupOrganizer implements GroupOrganizer { + + public String getName() { + return "-- None --"; + } + + public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) { + + List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>(); + + if (groups.size() == 1 && subFolders.size() > 0) { + result.add(new Pair<String, List<Group>>("", groups)); + } else { + for (Group g : groups) { + List<Group> children = new ArrayList<Group>(); + children.add(g); + Pair<String, List<Group>> p = new Pair<String, List<Group>>(); + p.setLeft(g.getName()); + p.setRight(children); + result.add(p); + } + } + + return result; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,18 @@ +CTL_EditFilterAction=Edit... +CTL_ImportAction=Open... +CTL_OpenGraphAction=View graph +CTL_DiffGraphAction=Difference to current graph +CTL_RemoveAction=Remove methods +CTL_ApplyFilterAction=Apply +CTL_FilterAction=Open Filter Window +CTL_AppliedFilterAction=Open AppliedFilter Window +CTL_OutlineAction=Open Outline Window +CTL_MoveFilterUpAction=Move upwards +CTL_MoveFilterDownAction=Move downwards +CTL_RemoveFilterAction=Remove +CTL_RemoveFilterSettingsAction=Remove filter setting +CTL_SaveAsAction=Save selected methods... +CTL_SaveAllAction=Save all... +CTL_SaveFilterSettingsAction=Save filter settings... +CTL_PropertiesAction=Open Properties Window +CTL_NewFilterAction=New filter...
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,70 @@ +/* + * 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.coordinator.actions; + +import org.openide.nodes.Node; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.CookieAction; + +/** + * + * @author Thomas Wuerthinger + */ +public final class DiffGraphAction extends CookieAction { + + protected void performAction(Node[] activatedNodes) { + DiffGraphCookie c = activatedNodes[0].getCookie(DiffGraphCookie.class); + c.openDiff(); + } + + protected int mode() { + return CookieAction.MODE_EXACTLY_ONE; + } + + public String getName() { + return NbBundle.getMessage(DiffGraphAction.class, "CTL_DiffGraphAction"); + } + + protected Class[] cookieClasses() { + return new Class[]{ + DiffGraphCookie.class + }; + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/diff.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,56 @@ +/* + * 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.coordinator.actions; + +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.services.GraphViewer; +import com.sun.hotspot.igv.difference.Difference; +import org.openide.nodes.Node; +import org.openide.util.Lookup; + +/** + * + * @author Thomas Wuerthinger + */ +public class DiffGraphCookie implements Node.Cookie { + + private InputGraph a; + private InputGraph b; + + public DiffGraphCookie(InputGraph a, InputGraph b) { + this.a = a; + this.b = b; + } + + public void openDiff() { + + final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class); + + if(viewer != null) { + InputGraph diffGraph = Difference.createDiffGraph(a, b); + viewer.view(diffGraph); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,175 @@ +/* + * 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.coordinator.actions; + +import com.sun.hotspot.igv.coordinator.OutlineTopComponent; +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.serialization.Parser; +import com.sun.hotspot.igv.settings.Settings; +import com.sun.hotspot.igv.data.serialization.XMLParser; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import javax.swing.Action; +import javax.swing.JFileChooser; +import javax.swing.KeyStroke; +import javax.swing.filechooser.FileFilter; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressHandleFactory; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.RequestProcessor; +import org.openide.util.actions.CallableSystemAction; +import org.openide.xml.XMLUtil; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +/** + * + * @author Thomas Wuerthinger + */ +public final class ImportAction extends CallableSystemAction { + + public static FileFilter getFileFilter() { + return new FileFilter() { + + public boolean accept(File f) { + return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory(); + } + + public String getDescription() { + return "XML files (*.xml)"; + } + }; + } + + public void performAction() { + + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(ImportAction.getFileFilter()); + fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); + + if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + + File dir = file; + if (!dir.isDirectory()) { + dir = dir.getParentFile(); + } + + Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); + + try { + final XMLReader reader = XMLUtil.createXMLReader(); + final FileInputStream inputStream = new FileInputStream(file); + final InputSource is = new InputSource(inputStream); + + final ProgressHandle handle = ProgressHandleFactory.createHandle("Opening file " + file.getName()); + final int basis = 1000; + handle.start(basis); + final int start = inputStream.available(); + + final XMLParser.ParseMonitor parseMonitor = new XMLParser.ParseMonitor() { + + public void setProgress(double d) { + try { + int curAvailable = inputStream.available(); + int prog = (int) (basis * (double) (start - curAvailable) / (double) start); + handle.progress(prog); + } catch (IOException ex) { + } + } + + public void setState(String state) { + setProgress(0.0); + handle.progress(state); + } + }; + final Parser parser = new Parser(); + final OutlineTopComponent component = OutlineTopComponent.findInstance(); + + component.requestActive(); + + RequestProcessor.getDefault().post(new Runnable() { + + public void run() { + GraphDocument document = null; + try { + document = parser.parse(reader, is, parseMonitor); + parseMonitor.setState("Finishing"); + component.getDocument().addGraphDocument(document); + } catch (SAXException ex) { + String s = "Exception during parsing the XML file, could not load document!"; + if (ex instanceof XMLParser.MissingAttributeException) { + XMLParser.MissingAttributeException e = (XMLParser.MissingAttributeException) ex; + s += "\nMissing attribute \"" + e.getAttributeName() + "\""; + } + ex.printStackTrace(); + NotifyDescriptor d = new NotifyDescriptor.Message(s, NotifyDescriptor.ERROR_MESSAGE); + DialogDisplayer.getDefault().notify(d); + } + handle.finish(); + } + }); + + } catch (SAXException ex) { + ex.printStackTrace(); + } catch (FileNotFoundException ex) { + ex.printStackTrace(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + public String getName() { + return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction"); + } + + public ImportAction() { + putValue(Action.SHORT_DESCRIPTION, "Open an XML graph document"); + putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/import.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/OutlineAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,48 @@ +/* + * 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.coordinator.actions; + +import com.sun.hotspot.igv.coordinator.*; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import org.openide.util.NbBundle; +import org.openide.windows.TopComponent; + +/** + * + * @author Thomas Wuerthinger + */ +public class OutlineAction extends AbstractAction { + + public OutlineAction() { + super(NbBundle.getMessage(OutlineAction.class, "CTL_OutlineAction")); + } + + public void actionPerformed(ActionEvent evt) { + TopComponent win = OutlineTopComponent.findInstance(); + win.open(); + win.requestActive(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,73 @@ +/* + * 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.coordinator.actions; + +import javax.swing.Action; +import org.openide.nodes.Node; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.NodeAction; + +/** + * + * @author Thomas Wuerthinger + */ +public final class RemoveAction extends NodeAction { + + protected void performAction(Node[] activatedNodes) { + for (Node n : activatedNodes) { + RemoveCookie removeCookie = n.getCookie(RemoveCookie.class); + if (removeCookie != null) { + removeCookie.remove(); + } + } + } + + public RemoveAction() { + putValue(Action.SHORT_DESCRIPTION, "Remove"); + } + + public String getName() { + return NbBundle.getMessage(RemoveAction.class, "CTL_RemoveAction"); + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/remove.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } + + protected boolean enable(Node[] nodes) { + return nodes.length > 0; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveAllAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,70 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator.actions; + +import com.sun.hotspot.igv.coordinator.OutlineTopComponent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import javax.swing.Action; +import javax.swing.KeyStroke; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.CallableSystemAction; + +/** + * + * @author Thomas Wuerthinger + */ +public final class RemoveAllAction extends CallableSystemAction { + + + public String getName() { + return NbBundle.getMessage(RemoveAllAction.class, "CTL_ImportAction"); + } + + public RemoveAllAction() { + putValue(Action.SHORT_DESCRIPTION, "Remove all methods"); + putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SHIFT, InputEvent.CTRL_MASK)); + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/removeall.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } + + @Override + public void performAction() { + OutlineTopComponent.findInstance().clear(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/RemoveCookie.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,36 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator.actions; + +import org.openide.nodes.Node; + +/** + * + * @author Thomas Wuerthinger + */ +public interface RemoveCookie extends Node.Cookie { + void remove(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator.actions; + +import com.sun.hotspot.igv.coordinator.OutlineTopComponent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import javax.swing.Action; +import javax.swing.KeyStroke; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.CallableSystemAction; + +/** + * + * @author Thomas Wuerthinger + */ +public final class SaveAllAction extends CallableSystemAction { + + public void performAction() { + final OutlineTopComponent component = OutlineTopComponent.findInstance(); + SaveAsAction.save(component.getDocument()); + } + + public String getName() { + return NbBundle.getMessage(SaveAllAction.class, "CTL_SaveAllAction"); + } + + public SaveAllAction() { + putValue(Action.SHORT_DESCRIPTION, "Save all methods to XML file"); + putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/saveall.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAsAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,122 @@ +/* + * 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.coordinator.actions; + +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.serialization.Printer; +import com.sun.hotspot.igv.settings.Settings; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import javax.swing.JFileChooser; +import org.openide.nodes.Node; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.CookieAction; +import org.openide.util.actions.NodeAction; + +/** + * + * @author Thomas Wuerthinger + */ +public final class SaveAsAction extends NodeAction { + + protected void performAction(Node[] activatedNodes) { + + GraphDocument doc = new GraphDocument(); + for (Node n : activatedNodes) { + Group group = n.getLookup().lookup(Group.class); + doc.addGroup(group); + } + + save(doc); + } + + public static void save(GraphDocument doc) { + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(ImportAction.getFileFilter()); + fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); + + if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + if (!file.getName().contains(".")) { + file = new File(file.getAbsolutePath() + ".xml"); + } + + File dir = file; + if (!dir.isDirectory()) { + dir = dir.getParentFile(); + } + Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); + try { + Writer writer = new OutputStreamWriter(new FileOutputStream(file)); + Printer p = new Printer(); + p.export(writer, doc); + writer.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + + } + } + } + + protected int mode() { + return CookieAction.MODE_SOME; + } + + public String getName() { + return NbBundle.getMessage(SaveAsAction.class, "CTL_SaveAsAction"); + } + + @Override + protected String iconResource() { + return "com/sun/hotspot/igv/coordinator/images/save.gif"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } + + protected boolean enable(Node[] nodes) { + + int cnt = 0; + for (Node n : nodes) { + cnt += n.getLookup().lookupAll(Group.class).size(); + } + + return cnt > 0; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/StructuredViewAction.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,180 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.coordinator.actions; + +import com.sun.hotspot.igv.coordinator.OutlineTopComponent; +import com.sun.hotspot.igv.data.services.GroupOrganizer; +import java.awt.Component; +import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.swing.Action; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import org.openide.awt.DropDownButtonFactory; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; +import org.openide.util.Utilities; +import org.openide.util.actions.CallableSystemAction; + +public class StructuredViewAction extends CallableSystemAction { + + private static JButton dropDownButton; + private static ButtonGroup buttonGroup; + private static JPopupMenu popup; + private MyMenuItemListener menuItemListener; + private Map<JMenuItem, GroupOrganizer> map; + + public StructuredViewAction() { + + putValue(Action.SHORT_DESCRIPTION, "Cluster nodes into blocks"); + } + + @Override + public Component getToolbarPresenter() { + + Image iconImage = Utilities.loadImage("com/sun/hotspot/igv/coordinator/images/structure.gif"); + ImageIcon icon = new ImageIcon(iconImage); + + popup = new JPopupMenu(); + + menuItemListener = new MyMenuItemListener(); + + buttonGroup = new ButtonGroup(); + + Collection<? extends GroupOrganizer> organizersCollection = Lookup.getDefault().lookupAll(GroupOrganizer.class); + + List<GroupOrganizer> organizers = new ArrayList<GroupOrganizer>(organizersCollection); + Collections.sort(organizers, new Comparator<GroupOrganizer>() { + public int compare(GroupOrganizer a, GroupOrganizer b) { + return a.getName().compareTo(b.getName()); + } + }); + + map = new HashMap<JMenuItem, GroupOrganizer>(); + + boolean first = true; + for(GroupOrganizer organizer : organizers) { + JCheckBoxMenuItem item = new JCheckBoxMenuItem(organizer.getName()); + map.put(item, organizer); + item.addActionListener(menuItemListener); + buttonGroup.add(item); + popup.add(item); + if(first) { + item.setSelected(true); + first = false; + } + } + + dropDownButton = DropDownButtonFactory.createDropDownButton( + new ImageIcon( + new BufferedImage(32, 32, BufferedImage.TYPE_BYTE_GRAY)), + popup); + + dropDownButton.setIcon(icon); + + dropDownButton.setToolTipText("Insert Layer Registration"); + + dropDownButton.addItemListener(new ItemListener() { + + public void itemStateChanged(ItemEvent e) { + int state = e.getStateChange(); + if (state == ItemEvent.SELECTED) { + performAction(); + } + } + }); + + dropDownButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + performAction(); + } + }); + + popup.addPopupMenuListener(new PopupMenuListener() { + + public void popupMenuCanceled(PopupMenuEvent e) { + dropDownButton.setSelected(false); + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + dropDownButton.setSelected(false); + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + dropDownButton.setSelected(true); + } + }); + + return dropDownButton; + + } + + private class MyMenuItemListener implements ActionListener { + + public void actionPerformed(ActionEvent ev) { + JMenuItem item = (JMenuItem) ev.getSource(); + GroupOrganizer organizer = map.get(item); + assert organizer != null : "Organizer must exist!"; + OutlineTopComponent.findInstance().setOrganizer(organizer); + } + } + + + @Override + public void performAction() { + popup.show(dropDownButton, 0, dropDownButton.getHeight()); + } + + public String getName() { + return "Structured View"; + } + + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/customLeftWsmode.xml Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mode version="2.1"> + <name unique="customLeft" /> + <kind type="view" /> + <state type="joined" /> + <constraints> + <path orientation="horizontal" number="0" weight="0.779245283018868"/> + <path orientation="vertical" number="0" weight="0.7511825922421949"/> + <path orientation="horizontal" number="0" weight="0.5"/> + <path orientation="vertical" number="20" weight="0.7"/> + <path orientation="horizontal" number="40" weight="0.55"/> + <path orientation="horizontal" number="0" weight="0.2711864406779661"/> + </constraints> + <bounds x="0" y="0" width="0" height="0" /> + <frame state="0"/> + <active-tc id="OutlineTopComponent"/> + <empty-behavior permanent="false"/> +</mode>
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/diff.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/folder.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/graph.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/import.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/remove.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/removeall.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/save.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/saveall.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structure.gif has changed
Binary file hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/images/structured.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,114 @@ +<?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> + <attr name="Actions\Edit\com-sun-hotspot-igv-bytecodes-SelectBytecodesAction.instance\position" intvalue="200"/> + <attr name="Actions\Edit\org-netbeans-core-ui-sysopen-SystemOpenAction.instance\position" intvalue="100"/> + <attr name="Actions\Edit\org-openide-actions-CopyAction.instance\position" intvalue="1300"/> + <attr name="Actions\Edit\org-openide-actions-CutAction.instance\position" intvalue="1400"/> + <attr name="Actions\Edit\org-openide-actions-DeleteAction.instance\position" intvalue="1500"/> + <attr name="Actions\Edit\org-openide-actions-FindAction.instance\position" intvalue="1600"/> + <attr name="Actions\Edit\org-openide-actions-GotoAction.instance\position" intvalue="1700"/> + <attr name="Actions\Edit\org-openide-actions-PasteAction.instance\position" intvalue="1800"/> + <attr name="Actions\Edit\org-openide-actions-RedoAction.instance\position" intvalue="1900"/> + <attr name="Actions\Edit\org-openide-actions-ReplaceAction.instance\position" intvalue="2000"/> + <attr name="Actions\Edit\org-openide-actions-UndoAction.instance\position" intvalue="2100"/> + + <folder name="Actions"> + <folder name="File"> + <file name="com-sun-hotspot-igv-coordinator-actions-SaveAsAction.instance"> + <attr name="position" intvalue="700"/> + </file> + <file name="com-sun-hotspot-igv-coordinator-actions-SaveAllAction.instance"> + <attr name="position" intvalue="800"/> + </file> + <file name="com-sun-hotspot-igv-coordinator-actions-ImportAction.instance"> + <attr name="position" intvalue="1000"/> + </file> + </folder> + <folder name="Edit"> + + <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"> + <attr name="position" intvalue="1200"/> + </file> + </folder> + <folder name="Window"> + <file name="com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/> + </folder> + </folder> + <folder name="Menu"> + <folder name="File"> + <file name="com-sun-hotspot-igv-coordinator-actions-ImportAction.shadow"> + <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-ImportAction.instance"/> + <attr name="position" intvalue="100"/> + </file> + <file name="MySeparator2.instance"> + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> + <attr name="position" intvalue="300"/> + </file> + <file name="com-sun-hotspot-igv-coordinator-actions-SaveAsAction.shadow"> + <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-SaveAsAction.instance"/> + <attr name="position" intvalue="300"/> + </file> + <file name="com-sun-hotspot-igv-coordinator-actions-SaveAllAction.shadow"> + <attr name="originalFile" stringvalue="Actions/File/com-sun-hotspot-igv-coordinator-actions-SaveAllAction.instance"/> + <attr name="position" intvalue="400"/> + </file> + <file name="MySeparator3.instance"> + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/> + <attr name="position" intvalue="500"/> + </file> + + <file name="org-netbeans-modules-openfile-OpenFileAction.instance_hidden"/> + <file name="org-openide-actions-PageSetupAction.instance_hidden"/> + <file name="org-openide-actions-PrintAction.instance_hidden"/> + <file name="org-openide-actions-SaveAction.instance_hidden"/> + <file name="org-openide-actions-SaveAllAction.instance_hidden"/> + <file name="org-openide-actions-SaveAsAction.shadow_hidden"/> + </folder> + <folder name="Edit"> + <file name="com-sun-hotspot-igv-coordinator-actions-SaveFilterSettingsAction.shadow"> + <attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-SaveFilterSettingsAction.instance"/> + </file> + <file name="com-sun-hotspot-igv-coordinator-actions-RemoveAction.shadow"> + <attr name="originalFile" stringvalue="Actions/Edit/com-sun-hotspot-igv-coordinator-actions-RemoveAction.instance"/> + </file> + <file name="org-netbeans-core-actions-JumpNextAction.shadow_hidden"/> + <file name="org-netbeans-core-actions-JumpPrevAction.shadow_hidden"/> + <file name="org-openide-actions-CutAction.instance_hidden"/> + <file name="org-openide-actions-CopyAction.instance_hidden"/> + <file name="org-openide-actions-PasteAction.instance_hidden"/> + <file name="org-openide-actions-DeleteAction.instance_hidden"/> + <file name="org-openide-actions-FindAction.instance_hidden"/> + <file name="org-openide-actions-ReplaceAction.instance_hidden"/> + <file name="org-openide-actions-JumpNextAction.shadow_hidden"/> + <file name="org-openide-actions-JumpPrevAction.shadow_hidden"/> + </folder> + <file name="GoTo_hidden"/> + <folder name="View"> + <file name="Separator1.instance_hidden"/> + <file name="Separator2.instance_hidden"/> + <file name="org-netbeans-core-actions-HTMLViewAction.instance_hidden"/> + <file name="org-netbeans-core-actions-LogAction.instance_hidden"/> + <file name="org-netbeans-core-windows-actions-ToolbarsListAction.instance_hidden"/> + </folder> + <folder name="Window"> + <file name="OutlineAction.shadow"> + <attr name="originalFile" stringvalue="Actions/Window/com-sun-hotspot-igv-coordinator-actions-OutlineAction.instance"/> + </file> + </folder> + </folder> + <folder name="Toolbars"> + <file name="Standard.xml" url="StandardConfiguration.xml"/> + </folder> + <folder name="Windows2"> + <folder name="Components"> + <file name="OutlineTopComponent.settings" url="OutlineTopComponentSettings.xml"/> + </folder> + <folder name="Modes"> + <file name="customLeft.wsmode" url="customLeftWsmode.xml"/> + <folder name="customLeft"> + <file name="OutlineTopComponent.wstcref" url="OutlineTopComponentWstcref.xml"/> + </folder> + </folder> + </folder> +</filesystem>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/build.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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.data" default="netbeans" basedir="."> + <description>Builds, tests, and runs the project com.sun.hotspot.igv.data.</description> + <import file="nbproject/build-impl.xml"/> +</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/manifest.mf Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +OpenIDE-Module: com.sun.hotspot.igv.data +OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/data/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/build-impl.xml Wed Jul 05 16:38:58 2017 +0200 @@ -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.data-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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/genfiles.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=a403efd8 +build.xml.script.CRC32=b87f73ba +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=a403efd8 +nbproject/build-impl.xml.script.CRC32=cc649146 +nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/platform.properties Wed Jul 05 16:38:58 2017 +0200 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/project.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/project.xml Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,16 @@ +<?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.data</code-name-base> + <suite-component/> + <module-dependencies/> + <public-packages> + <package>com.sun.hotspot.igv.data</package> + <package>com.sun.hotspot.igv.data.serialization</package> + <package>com.sun.hotspot.igv.data.services</package> + </public-packages> + </data> + </configuration> +</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/nbproject/suite.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Bundle.properties Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Data
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ChangedEvent.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,44 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class ChangedEvent<T> extends Event<ChangedListener<T>> { + + private T object; + + public ChangedEvent() { + } + + public ChangedEvent(T object) { + this.object = object; + } + + protected void fire(ChangedListener<T> l) { + l.changed(object); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ChangedEventProvider.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright 1998-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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public interface ChangedEventProvider<T> { + + public ChangedEvent<T> getChangedEvent(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/ChangedListener.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,33 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public interface ChangedListener<T> { + + public void changed(T source); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,57 @@ +/* + * 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.data; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Thomas Wuerthinger + */ +public abstract class Event<L> { + + private List<L> listener; + + public Event() { + listener = new ArrayList<L>(); + } + + public void addListener(L l) { + listener.add(l); + } + + public void removeListener(L l) { + listener.remove(l); + } + + public void fire() { + List<L> tmpList = new ArrayList<L>(listener); + for (L l : tmpList) { + fire(l); + } + } + + protected abstract void fire(L l); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,91 @@ +/* + * 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.data; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * + * @author Thomas Wuerthinger + */ +public class GraphDocument extends Properties.Object implements ChangedEventProvider<GraphDocument> { + + private List<Group> groups; + private ChangedEvent<GraphDocument> changedEvent; + + public GraphDocument() { + groups = new ArrayList<Group>(); + changedEvent = new ChangedEvent<GraphDocument>(this); + } + + public void clear() { + groups.clear(); + getChangedEvent().fire(); + } + + public ChangedEvent<GraphDocument> getChangedEvent() { + return changedEvent; + } + + public List<Group> getGroups() { + return Collections.unmodifiableList(groups); + } + + public void addGroup(Group group) { + group.setDocument(this); + groups.add(group); + getChangedEvent().fire(); + } + + public void removeGroup(Group group) { + if (groups.contains(group)) { + group.setDocument(null); + groups.remove(group); + getChangedEvent().fire(); + } + } + + public void addGraphDocument(GraphDocument document) { + for (Group g : document.groups) { + this.addGroup(g); + } + document.clear(); + getChangedEvent().fire(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append("GraphDocument: " + getProperties().toString() + " \n\n"); + for (Group g : getGroups()) { + sb.append(g.toString()); + sb.append("\n\n"); + } + + return sb.toString(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,141 @@ +/* + * 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.data; + +import com.sun.hotspot.igv.data.ChangedEvent; +import com.sun.hotspot.igv.data.ChangedEventProvider; +import com.sun.hotspot.igv.data.Properties; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * + * @author Thomas Wuerthinger + */ +public class Group extends Properties.Object implements ChangedEventProvider<Group> { + + private List<InputGraph> graphs; + private transient ChangedEvent<Group> changedEvent; + private GraphDocument document; + private InputMethod method; + private String assembly; + + public Group() { + graphs = new ArrayList<InputGraph>(); + init(); + } + + private void init() { + changedEvent = new ChangedEvent<Group>(this); + } + + public void fireChangedEvent() { + changedEvent.fire(); + } + + public void setAssembly(String s) { + this.assembly = s; + } + + public String getAssembly() { + return assembly; + } + + public void setMethod(InputMethod method) { + this.method = method; + } + + public InputMethod getMethod() { + return method; + } + + void setDocument(GraphDocument document) { + this.document = document; + } + + public GraphDocument getDocument() { + return document; + } + + public ChangedEvent<Group> getChangedEvent() { + return changedEvent; + } + + public List<InputGraph> getGraphs() { + return Collections.unmodifiableList(graphs); + } + + public void addGraph(InputGraph g) { + assert g != null; + assert !graphs.contains(g); + graphs.add(g); + changedEvent.fire(); + } + + public void removeGraph(InputGraph g) { + int index = graphs.indexOf(g); + if (index != -1) { + graphs.remove(g); + changedEvent.fire(); + } + } + + public Set<Integer> getAllNodes() { + Set<Integer> result = new HashSet<Integer>(); + for (InputGraph g : graphs) { + Set<Integer> ids = g.getNodesAsSet(); + result.addAll(g.getNodesAsSet()); + for (Integer i : ids) { + result.add(-i); + } + } + return result; + } + + public InputGraph getLastAdded() { + if (graphs.size() == 0) { + return null; + } + return graphs.get(graphs.size() - 1); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Group " + getProperties().toString() + "\n"); + for (InputGraph g : graphs) { + sb.append(g.toString()); + sb.append("\n"); + } + return sb.toString(); + } + + public String getName() { + return getProperties().get("name"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,140 @@ +/* + * 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.data; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputBlock { + + private List<InputNode> nodes; + private List<String> successorNames; + private String name; + private InputGraph graph; + private Rectangle bounds; + private Set<InputBlock> successors; + private Set<InputBlock> predecessors; + private Set<InputBlockEdge> inputs; + private Set<InputBlockEdge> outputs; + + public InputBlock(InputGraph graph, String name) { + this.graph = graph; + this.name = name; + nodes = new ArrayList<InputNode>(); + successorNames = new ArrayList<String>(); + successors = new HashSet<InputBlock>(); + predecessors = new HashSet<InputBlock>(); + inputs = new HashSet<InputBlockEdge>(); + outputs = new HashSet<InputBlockEdge>(); + } + + public void removeSuccessor(InputBlock b) { + if (successors.contains(b)) { + successors.remove(b); + b.predecessors.remove(this); + InputBlockEdge e = new InputBlockEdge(this, b); + assert outputs.contains(e); + outputs.remove(e); + assert b.inputs.contains(e); + b.inputs.remove(e); + } + } + + public String getName() { + return name; + } + + public void setName(String s) { + name = s; + } + + public List<InputNode> getNodes() { + return Collections.unmodifiableList(nodes); + } + + public void addNode(int id) { + InputNode n = graph.getNode(id); + assert n != null; + graph.setBlock(n, this); + addNode(graph.getNode(id)); + } + + public void addNode(InputNode node) { + assert !nodes.contains(node); + nodes.add(node); + } + + public Set<InputBlock> getPredecessors() { + return Collections.unmodifiableSet(predecessors); + } + + public Set<InputBlock> getSuccessors() { + return Collections.unmodifiableSet(successors); + } + + public Set<InputBlockEdge> getInputs() { + return Collections.unmodifiableSet(inputs); + } + + public Set<InputBlockEdge> getOutputs() { + return Collections.unmodifiableSet(outputs); + } + + // resolveBlockLinks must be called afterwards + public void addSuccessor(String name) { + successorNames.add(name); + } + + public void resolveBlockLinks() { + for (String s : successorNames) { + InputBlock b = graph.getBlock(s); + addSuccessor(b); + } + + successorNames.clear(); + } + + public void addSuccessor(InputBlock b) { + if (!successors.contains(b)) { + successors.add(b); + b.predecessors.add(this); + InputBlockEdge e = new InputBlockEdge(this, b); + outputs.add(e); + b.inputs.add(e); + } + } + + @Override + public String toString() { + return this.getName(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlockEdge.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,65 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputBlockEdge { + + private InputBlock from; + private InputBlock to; + + public InputBlockEdge(InputBlock from, InputBlock to) { + assert from != null; + assert to != null; + this.from = from; + this.to = to; + } + + public InputBlock getFrom() { + return from; + } + + public InputBlock getTo() { + return to; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof InputBlockEdge && obj != null) { + InputBlockEdge e = (InputBlockEdge) obj; + return e.from.equals(from) && e.to.equals(to); + } + return super.equals(obj); + } + + @Override + public int hashCode() { + int hash = from.hashCode(); + hash = 59 * hash + to.hashCode(); + return hash; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBytecode.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,56 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputBytecode { + + private int bci; + private String name; + private InputMethod inlined; + + public InputBytecode(int bci, String name) { + this.bci = bci; + this.name = name; + } + + public InputMethod getInlined() { + return inlined; + } + + public void setInlined(InputMethod inlined) { + this.inlined = inlined; + } + + public int getBci() { + return bci; + } + + public String getName() { + return name; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputEdge.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,92 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputEdge { + + public enum State { + + SAME, + NEW, + DELETED + } + private char toIndex; + private int from; + private int to; + private State state; + + public InputEdge(char toIndex, int from, int to) { + this.toIndex = toIndex; + this.from = from; + this.to = to; + this.state = State.SAME; + } + + public State getState() { + return state; + } + + public void setState(State x) { + this.state = x; + } + + public char getToIndex() { + return toIndex; + } + + public String getName() { + return "in" + toIndex; + } + + public int getFrom() { + return from; + } + + public int getTo() { + return to; + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof InputEdge)) { + return false; + } + InputEdge conn2 = (InputEdge) o; + return conn2.toIndex == toIndex && conn2.from == from && conn2.to == to; + } + + @Override + public String toString() { + return "Edge from " + from + " to " + to + "(" + (int) toIndex + ") "; + } + + @Override + public int hashCode() { + return (from << 20 | to << 8 | toIndex); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,249 @@ +/* + * 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.data; + +import com.sun.hotspot.igv.data.Properties; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputGraph extends Properties.Object { + + private Map<Integer, InputNode> nodes; + private Set<InputEdge> edges; + private Group parent; + private Map<String, InputBlock> blocks; + private Map<Integer, InputBlock> nodeToBlock; + private boolean isDifferenceGraph; + + public InputGraph(Group parent) { + this(parent, null); + } + + public InputGraph(Group parent, InputGraph last) { + this(parent, last, ""); + } + + private void clearBlocks() { + blocks.clear(); + nodeToBlock.clear(); + } + + public InputGraph(Group parent, InputGraph last, String name) { + this.parent = parent; + setName(name); + nodes = new Hashtable<Integer, InputNode>(); + edges = new HashSet<InputEdge>(); + blocks = new Hashtable<String, InputBlock>(); + nodeToBlock = new Hashtable<Integer, InputBlock>(); + if (last != null) { + + for (InputNode n : last.getNodes()) { + addNode(n); + } + + for (InputEdge c : last.getEdges()) { + addEdge(c); + } + } + } + + public void schedule(Collection<InputBlock> newBlocks) { + clearBlocks(); + InputBlock noBlock = new InputBlock(this, "no block"); + Set<InputNode> scheduledNodes = new HashSet<InputNode>(); + + for (InputBlock b : newBlocks) { + for (InputNode n : b.getNodes()) { + assert !scheduledNodes.contains(n); + scheduledNodes.add(n); + } + } + + for (InputNode n : this.getNodes()) { + assert nodes.get(n.getId()) == n; + if (!scheduledNodes.contains(n)) { + noBlock.addNode(n.getId()); + } + } + + if (noBlock.getNodes().size() != 0) { + newBlocks.add(noBlock); + } + for (InputBlock b : newBlocks) { + addBlock(b); + } + + for (InputNode n : this.getNodes()) { + assert this.getBlock(n) != null; + } + } + + public void setBlock(InputNode node, InputBlock block) { + nodeToBlock.put(node.getId(), block); + } + + public InputBlock getBlock(int nodeId) { + return nodeToBlock.get(nodeId); + } + + public InputBlock getBlock(InputNode node) { + return getBlock(node.getId()); + } + + public InputGraph getNext() { + List<InputGraph> list = parent.getGraphs(); + if (!list.contains(this)) { + return null; + } + int index = list.indexOf(this); + if (index == list.size() - 1) { + return null; + } else { + return list.get(index + 1); + } + } + + public InputGraph getPrev() { + List<InputGraph> list = parent.getGraphs(); + if (!list.contains(this)) { + return null; + } + int index = list.indexOf(this); + if (index == 0) { + return null; + } else { + return list.get(index - 1); + } + } + + public String getName() { + return getProperties().get("name"); + } + + public String getAbsoluteName() { + String result = getName(); + if (this.parent != null) { + result = parent.getName() + ": " + result; + } + return result; + } + + public Collection<InputNode> getNodes() { + return Collections.unmodifiableCollection(nodes.values()); + } + + public Set<Integer> getNodesAsSet() { + return Collections.unmodifiableSet(nodes.keySet()); + } + + public Collection<InputBlock> getBlocks() { + return Collections.unmodifiableCollection(blocks.values()); + } + + public void addNode(InputNode node) { + nodes.put(node.getId(), node); + } + + public InputNode getNode(int id) { + return nodes.get(id); + } + + public InputNode removeNode(int index) { + return nodes.remove(index); + } + + public Set<InputEdge> getEdges() { + return Collections.unmodifiableSet(edges); + } + + public void removeEdge(InputEdge c) { + assert edges.contains(c); + edges.remove(c); + assert !edges.contains(c); + } + + public void addEdge(InputEdge c) { + assert !edges.contains(c); + edges.add(c); + assert edges.contains(c); + } + + public Group getGroup() { + return parent; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Graph " + getName() + " " + getProperties().toString() + "\n"); + for (InputNode n : nodes.values()) { + sb.append(n.toString()); + sb.append("\n"); + } + + for (InputEdge c : edges) { + sb.append(c.toString()); + sb.append("\n"); + } + return sb.toString(); + } + + public void addBlock(InputBlock b) { + blocks.put(b.getName(), b); + for (InputNode n : b.getNodes()) { + this.nodeToBlock.put(n.getId(), b); + } + } + + public void resolveBlockLinks() { + for (InputBlock b : blocks.values()) { + b.resolveBlockLinks(); + } + } + + public void setName(String s) { + getProperties().setProperty("name", s); + } + + public InputBlock getBlock(String s) { + return blocks.get(s); + } + + public boolean isDifferenceGraph() { + return this.isDifferenceGraph; + } + + public void setIsDifferenceGraph(boolean b) { + isDifferenceGraph = b; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,127 @@ +/* + * 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.data; + +import com.sun.hotspot.igv.data.Properties; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputMethod extends Properties.Object { + + private String name; + private int bci; + private String shortName; + private List<InputMethod> inlined; + private InputMethod parentMethod; + private Group group; + private List<InputBytecode> bytecodes; + + /** Creates a new instance of InputMethod */ + public InputMethod(Group parent, String name, String shortName, int bci) { + this.group = parent; + this.name = name; + this.bci = bci; + this.shortName = shortName; + inlined = new ArrayList<InputMethod>(); + bytecodes = new ArrayList<InputBytecode>(); + } + + public List<InputBytecode> getBytecodes() { + return Collections.unmodifiableList(bytecodes); + } + + public List<InputMethod> getInlined() { + return Collections.unmodifiableList(inlined); + } + + public void addInlined(InputMethod m) { + + // assert bci unique + for (InputMethod m2 : inlined) { + assert m2.getBci() != m.getBci(); + } + + inlined.add(m); + assert m.parentMethod == null; + m.parentMethod = this; + + for (InputBytecode bc : bytecodes) { + if (bc.getBci() == m.getBci()) { + bc.setInlined(m); + } + } + } + + public Group getGroup() { + return group; + } + + public String getShortName() { + return shortName; + } + + public void setBytecodes(String text) { + + String[] strings = text.split("\n"); + int oldNumber = -1; + for (String s : strings) { + + if (s.length() > 0 && Character.isDigit(s.charAt(0))) { + s = s.trim(); + int spaceIndex = s.indexOf(' '); + String numberString = s.substring(0, spaceIndex); + String tmpName = s.substring(spaceIndex + 1, s.length()); + + int number = -1; + number = Integer.parseInt(numberString); + + // assert correct order of bytecodes + assert number > oldNumber; + + InputBytecode bc = new InputBytecode(number, tmpName); + bytecodes.add(bc); + + for (InputMethod m : inlined) { + if (m.getBci() == number) { + bc.setInlined(m); + break; + } + } + } + } + } + + public String getName() { + return name; + } + + public int getBci() { + return bci; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,73 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class InputNode extends Properties.Object { + + private int id; + + public InputNode(InputNode n) { + super(n); + setId(n.id); + } + + public InputNode(int id) { + setId(id); + } + + public void setId(int id) { + this.id = id; + getProperties().setProperty("id", "" + id); + } + + public int getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof InputNode)) { + return false; + } + InputNode n = (InputNode) o; + if (n.id != id) { + return false; + } + return getProperties().equals(n.getProperties()); + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Node " + id + " " + getProperties().toString(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Pair.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,72 @@ +/* + * 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.data; + +/** + * + * @author Thomas Wuerthinger + */ +public class Pair<L, R> { + + private L l; + private R r; + + public Pair() { + } + + public Pair(L l, R r) { + this.l = l; + this.r = r; + } + + public L getLeft() { + return l; + } + + public void setLeft(L l) { + this.l = l; + } + + public R getRight() { + return r; + } + + public void setRight(R r) { + this.r = r; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Pair)) { + return false; + } + Pair obj = (Pair) o; + return l.equals(obj.l) && r.equals(obj.r); + } + + @Override + public int hashCode() { + return l.hashCode() * 71 + r.hashCode(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,288 @@ +/* + * 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.data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * + * @author Thomas Wuerthinger + */ +public class Properties implements Serializable { + + public static final long serialVersionUID = 1L; + private Map<String, Property> map; + + public Properties() { + map = new HashMap<String, Property>(5); + } + + @Override + public boolean equals(java.lang.Object o) { + if (!(o instanceof Properties)) { + return false; + } + + Properties p = (Properties) o; + + if (getProperties().size() != p.getProperties().size()) { + return false; + } + for (Property prop : getProperties()) { + String value = p.get(prop.getName()); + if (value == null || !value.equals(prop.getValue())) { + return false; + } + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 83 * hash + (this.map != null ? this.map.hashCode() : 0); + return hash; + } + + public Properties(String name, String value) { + this(); + this.add(new Property(name, value)); + } + + public Properties(String name, String value, String name1, String value1) { + this(name, value); + this.add(new Property(name1, value1)); + } + + public Properties(String name, String value, String name1, String value1, String name2, String value2) { + this(name, value, name1, value1); + this.add(new Property(name2, value2)); + } + + public Properties(Properties p) { + map = new HashMap<String, Property>(p.map); + } + + public static class Object implements Provider { + + private Properties properties; + + public Object() { + properties = new Properties(); + } + + public Object(Properties.Object object) { + properties = new Properties(object.getProperties()); + } + + public Properties getProperties() { + return properties; + } + } + + public interface PropertyMatcher { + + String getName(); + + boolean match(String value); + } + + public static class InvertPropertyMatcher implements PropertyMatcher { + + private PropertyMatcher matcher; + + public InvertPropertyMatcher(PropertyMatcher matcher) { + this.matcher = matcher; + } + + public String getName() { + return matcher.getName(); + } + + public boolean match(String p) { + return !matcher.match(p); + } + } + + public static class StringPropertyMatcher implements PropertyMatcher { + + private String name; + private String value; + + public StringPropertyMatcher(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public boolean match(String p) { + return p.equals(value); + } + } + + public static class RegexpPropertyMatcher implements PropertyMatcher { + + private String name; + private Pattern valuePattern; + + public RegexpPropertyMatcher(String name, String value) { + this.name = name; + valuePattern = Pattern.compile(value); + } + + public String getName() { + return name; + } + + public boolean match(String p) { + Matcher m = valuePattern.matcher(p); + return m.matches(); + } + } + + public Property selectSingle(PropertyMatcher matcher) { + + Property p = this.map.get(matcher.getName()); + if (p == null) { + return null; + } + if (matcher.match(p.getValue())) { + return p; + } else { + return null; + } + } + + public interface Provider { + + public Properties getProperties(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("["); + for (Property p : map.values()) { + sb.append(p.toString()); + } + return sb.append("]").toString(); + } + + public static class PropertySelector<T extends Properties.Provider> { + + private Collection<T> objects; + + public PropertySelector(Collection<T> objects) { + this.objects = objects; + } + + public T selectSingle(final String name, final String value) { + return selectSingle(new StringPropertyMatcher(name, value)); + } + + public T selectSingle(PropertyMatcher matcher) { + + for (T t : objects) { + Property p = t.getProperties().selectSingle(matcher); + if (p != null) { + return t; + } + } + + return null; + } + + public List<T> selectMultiple(final String name, final String value) { + return selectMultiple(new StringPropertyMatcher(name, value)); + } + + public List<T> selectMultiple(PropertyMatcher matcher) { + List<T> result = new ArrayList<T>(); + for (T t : objects) { + Property p = t.getProperties().selectSingle(matcher); + if (p != null) { + result.add(t); + } + } + return result; + } + } + + public String get(String key) { + Property p = map.get(key); + if (p == null) { + return null; + } else { + return p.getValue(); + } + } + + public String getProperty(String string) { + return get(string); + } + + public Property setProperty(String name, String value) { + + if (value == null) { + // remove this property + return map.remove(name); + } else { + Property p = map.get(name); + if (p == null) { + p = new Property(name, value); + map.put(name, p); + } else { + p.setValue(value); + } + return p; + } + } + + public Collection<Property> getProperties() { + return Collections.unmodifiableCollection(map.values()); + } + + public void add(Properties properties) { + for (Property p : properties.getProperties()) { + add(p); + } + } + + public void add(Property property) { + assert property.getName() != null; + assert property.getValue() != null; + map.put(property.getName(), property); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java Wed Jul 05 16:38:58 2017 +0200 @@ -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.data; + +import java.io.Serializable; + +/** + * + * @author Thomas Wuerthinger + */ +public class Property implements Serializable { + + public static final long serialVersionUID = 1L; + private String name; + private String value; + + public Property() { + this(null, null); + } + + public Property(Property p) { + this(p.getName(), p.getValue()); + } + + public Property(String name) { + this(name, null); + } + + public Property(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public void setName(String s) { + this.name = s; + } + + public void setValue(String s) { + this.value = s; + } + + @Override + public String toString() { + return name + " = " + value + "; "; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,422 @@ +/* + * 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.data.serialization; + +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.InputBlock; +import com.sun.hotspot.igv.data.InputEdge; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.InputMethod; +import com.sun.hotspot.igv.data.InputNode; +import com.sun.hotspot.igv.data.Properties; +import com.sun.hotspot.igv.data.Property; +import com.sun.hotspot.igv.data.services.GroupCallback; +import com.sun.hotspot.igv.data.serialization.XMLParser.ElementHandler; +import com.sun.hotspot.igv.data.serialization.XMLParser.HandoverElementHandler; +import com.sun.hotspot.igv.data.serialization.XMLParser.ParseMonitor; +import com.sun.hotspot.igv.data.serialization.XMLParser.TopElementHandler; +import java.io.IOException; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +/** + * + * @author Thomas Wuerthinger + */ +public class Parser { + + public static final String INDENT = " "; + public static final String TOP_ELEMENT = "graphDocument"; + public static final String GROUP_ELEMENT = "group"; + public static final String GRAPH_ELEMENT = "graph"; + public static final String ROOT_ELEMENT = "graphDocument"; + public static final String PROPERTIES_ELEMENT = "properties"; + public static final String EDGES_ELEMENT = "edges"; + public static final String PROPERTY_ELEMENT = "p"; + public static final String EDGE_ELEMENT = "edge"; + public static final String NODE_ELEMENT = "node"; + public static final String NODES_ELEMENT = "nodes"; + public static final String REMOVE_EDGE_ELEMENT = "removeEdge"; + public static final String REMOVE_NODE_ELEMENT = "removeNode"; + public static final String METHOD_NAME_PROPERTY = "name"; + public static final String METHOD_IS_PUBLIC_PROPERTY = "public"; + public static final String METHOD_IS_STATIC_PROPERTY = "static"; + public static final String TRUE_VALUE = "true"; + public static final String NODE_NAME_PROPERTY = "name"; + public static final String EDGE_NAME_PROPERTY = "name"; + public static final String NODE_ID_PROPERTY = "id"; + public static final String FROM_PROPERTY = "from"; + public static final String TO_PROPERTY = "to"; + public static final String PROPERTY_NAME_PROPERTY = "name"; + public static final String GRAPH_NAME_PROPERTY = "name"; + public static final String TO_INDEX_PROPERTY = "index"; + public static final String METHOD_ELEMENT = "method"; + public static final String INLINE_ELEMENT = "inline"; + public static final String BYTECODES_ELEMENT = "bytecodes"; + public static final String METHOD_BCI_PROPERTY = "bci"; + public static final String METHOD_SHORT_NAME_PROPERTY = "shortName"; + public static final String CONTROL_FLOW_ELEMENT = "controlFlow"; + public static final String BLOCK_NAME_PROPERTY = "name"; + public static final String BLOCK_ELEMENT = "block"; + public static final String SUCCESSORS_ELEMENT = "successors"; + public static final String SUCCESSOR_ELEMENT = "successor"; + public static final String ASSEMBLY_ELEMENT = "assembly"; + public static final String DIFFERENCE_PROPERTY = "difference"; + private TopElementHandler xmlDocument = new TopElementHandler(); + private boolean difference; + private GroupCallback groupCallback; + // <graphDocument> + private ElementHandler<GraphDocument, Object> topHandler = new ElementHandler<GraphDocument, Object>(TOP_ELEMENT) { + + @Override + protected GraphDocument start() throws SAXException { + return new GraphDocument(); + } + }; + // <group> + private ElementHandler<Group, GraphDocument> groupHandler = new XMLParser.ElementHandler<Group, GraphDocument>(GROUP_ELEMENT) { + + @Override + protected Group start() throws SAXException { + Group group = new Group(); + Parser.this.difference = false; + String differenceProperty = this.readAttribute(DIFFERENCE_PROPERTY); + if (differenceProperty != null && (differenceProperty.equals("1") || differenceProperty.equals("true"))) { + Parser.this.difference = true; + } + + ParseMonitor monitor = getMonitor(); + if (monitor != null) { + monitor.setState(group.getName()); + } + + return group; + } + + @Override + protected void end(String text) throws SAXException { + if (groupCallback == null) { + getParentObject().addGroup(getObject()); + } + } + }; + private HandoverElementHandler<Group> assemblyHandler = new XMLParser.HandoverElementHandler<Group>(ASSEMBLY_ELEMENT, true) { + + @Override + protected void end(String text) throws SAXException { + getParentObject().setAssembly(text); + } + }; + // <method> + private ElementHandler<InputMethod, Group> methodHandler = new XMLParser.ElementHandler<InputMethod, Group>(METHOD_ELEMENT) { + + @Override + protected InputMethod start() throws SAXException { + + InputMethod method = parseMethod(this, getParentObject()); + getParentObject().setMethod(method); + return method; + } + }; + + private InputMethod parseMethod(XMLParser.ElementHandler handler, Group group) throws SAXException { + String s = handler.readRequiredAttribute(METHOD_BCI_PROPERTY); + int bci = 0; + try { + bci = Integer.parseInt(s); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + InputMethod method = new InputMethod(group, handler.readRequiredAttribute(METHOD_NAME_PROPERTY), handler.readRequiredAttribute(METHOD_SHORT_NAME_PROPERTY), bci); + return method; + } + // <bytecodes> + private HandoverElementHandler<InputMethod> bytecodesHandler = new XMLParser.HandoverElementHandler<InputMethod>(BYTECODES_ELEMENT, true) { + + @Override + protected void end(String text) throws SAXException { + getParentObject().setBytecodes(text); + } + }; + // <inlined> + private HandoverElementHandler<InputMethod> inlinedHandler = new XMLParser.HandoverElementHandler<InputMethod>(INLINE_ELEMENT); + // <inlined><method> + private ElementHandler<InputMethod, InputMethod> inlinedMethodHandler = new XMLParser.ElementHandler<InputMethod, InputMethod>(METHOD_ELEMENT) { + + @Override + protected InputMethod start() throws SAXException { + InputMethod method = parseMethod(this, getParentObject().getGroup()); + getParentObject().addInlined(method); + return method; + } + }; + // <graph> + private ElementHandler<InputGraph, Group> graphHandler = new XMLParser.ElementHandler<InputGraph, Group>(GRAPH_ELEMENT) { + + private InputGraph graph; + + @Override + protected InputGraph start() throws SAXException { + + String name = readAttribute(GRAPH_NAME_PROPERTY); + InputGraph previous = getParentObject().getLastAdded(); + if (!difference) { + previous = null; + } + InputGraph curGraph = new InputGraph(getParentObject(), previous, name); + getParentObject().addGraph(curGraph); + this.graph = curGraph; + return curGraph; + } + + @Override + protected void end(String text) throws SAXException { + graph.resolveBlockLinks(); + } + }; + // <nodes> + private HandoverElementHandler<InputGraph> nodesHandler = new HandoverElementHandler<InputGraph>(NODES_ELEMENT); + // <controlFlow> + private HandoverElementHandler<InputGraph> controlFlowHandler = new HandoverElementHandler<InputGraph>(CONTROL_FLOW_ELEMENT); + // <block> + private ElementHandler<InputBlock, InputGraph> blockHandler = new ElementHandler<InputBlock, InputGraph>(BLOCK_ELEMENT) { + + @Override + protected InputBlock start() throws SAXException { + InputGraph graph = getParentObject(); + String name = readRequiredAttribute(BLOCK_NAME_PROPERTY); + InputBlock b = new InputBlock(getParentObject(), name); + graph.addBlock(b); + return b; + } + }; + // <nodes> + private HandoverElementHandler<InputBlock> blockNodesHandler = new HandoverElementHandler<InputBlock>(NODES_ELEMENT); + // <node> + private ElementHandler<InputBlock, InputBlock> blockNodeHandler = new ElementHandler<InputBlock, InputBlock>(NODE_ELEMENT) { + + @Override + protected InputBlock start() throws SAXException { + String s = readRequiredAttribute(NODE_ID_PROPERTY); + + int id = 0; + try { + id = Integer.parseInt(s); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + getParentObject().addNode(id); + return getParentObject(); + } + }; + // <successors> + private HandoverElementHandler<InputBlock> successorsHandler = new HandoverElementHandler<InputBlock>(SUCCESSORS_ELEMENT); + // <successor> + private ElementHandler<InputBlock, InputBlock> successorHandler = new ElementHandler<InputBlock, InputBlock>(SUCCESSOR_ELEMENT) { + + @Override + protected InputBlock start() throws SAXException { + String name = readRequiredAttribute(BLOCK_NAME_PROPERTY); + getParentObject().addSuccessor(name); + return getParentObject(); + } + }; + // <node> + private ElementHandler<InputNode, InputGraph> nodeHandler = new ElementHandler<InputNode, InputGraph>(NODE_ELEMENT) { + + @Override + protected InputNode start() throws SAXException { + String s = readRequiredAttribute(NODE_ID_PROPERTY); + int id = 0; + try { + id = Integer.parseInt(s); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + InputNode node = new InputNode(id); + getParentObject().addNode(node); + return node; + } + }; + // <removeNode> + private ElementHandler<InputNode, InputGraph> removeNodeHandler = new ElementHandler<InputNode, InputGraph>(REMOVE_NODE_ELEMENT) { + + @Override + protected InputNode start() throws SAXException { + String s = readRequiredAttribute(NODE_ID_PROPERTY); + int id = 0; + try { + id = Integer.parseInt(s); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + return getParentObject().removeNode(id); + } + }; + // <graph> + private HandoverElementHandler<InputGraph> edgesHandler = new HandoverElementHandler<InputGraph>(EDGES_ELEMENT); + + // Local class for edge elements + private static class EdgeElementHandler extends ElementHandler<InputEdge, InputGraph> { + + public EdgeElementHandler(String name) { + super(name); + } + + @Override + protected InputEdge start() throws SAXException { + int toIndex = 0; + int from = -1; + int to = -1; + + try { + String toIndexString = readAttribute(TO_INDEX_PROPERTY); + if (toIndexString != null) { + toIndex = Integer.parseInt(toIndexString); + } + + from = Integer.parseInt(readRequiredAttribute(FROM_PROPERTY)); + to = Integer.parseInt(readRequiredAttribute(TO_PROPERTY)); + } catch (NumberFormatException e) { + throw new SAXException(e); + } + + + InputEdge conn = new InputEdge((char) toIndex, from, to); + return start(conn); + } + + protected InputEdge start(InputEdge conn) throws SAXException { + return conn; + } + } + // <edge> + private EdgeElementHandler edgeHandler = new EdgeElementHandler(EDGE_ELEMENT) { + + @Override + protected InputEdge start(InputEdge conn) throws SAXException { + getParentObject().addEdge(conn); + return conn; + } + }; + // <removeEdge> + private EdgeElementHandler removeEdgeHandler = new EdgeElementHandler(REMOVE_EDGE_ELEMENT) { + + @Override + protected InputEdge start(InputEdge conn) throws SAXException { + getParentObject().removeEdge(conn); + return conn; + } + }; + // <properties> + private HandoverElementHandler<Properties.Provider> propertiesHandler = new HandoverElementHandler<Properties.Provider>(PROPERTIES_ELEMENT); + // <properties> + private HandoverElementHandler<Group> groupPropertiesHandler = new HandoverElementHandler<Group>(PROPERTIES_ELEMENT) { + + @Override + public void end(String text) throws SAXException { + if (groupCallback != null) { + groupCallback.started(getParentObject()); + } + } + }; + // <property> + private ElementHandler<Property, Properties.Provider> propertyHandler = new XMLParser.ElementHandler<Property, Properties.Provider>(PROPERTY_ELEMENT, true) { + + @Override + public Property start() throws SAXException { + String value = ""; + String name = readRequiredAttribute(PROPERTY_NAME_PROPERTY).intern(); + return getParentObject().getProperties().setProperty(name, value); + } + + @Override + public void end(String text) { + getObject().setValue(text.trim().intern()); + } + }; + + public Parser() { + this(null); + } + + public Parser(GroupCallback groupCallback) { + + this.groupCallback = groupCallback; + + // Initialize dependencies + xmlDocument.addChild(topHandler); + topHandler.addChild(groupHandler); + + groupHandler.addChild(methodHandler); + groupHandler.addChild(assemblyHandler); + groupHandler.addChild(graphHandler); + + methodHandler.addChild(inlinedHandler); + methodHandler.addChild(bytecodesHandler); + + inlinedHandler.addChild(inlinedMethodHandler); + inlinedMethodHandler.addChild(bytecodesHandler); + inlinedMethodHandler.addChild(inlinedHandler); + + graphHandler.addChild(nodesHandler); + graphHandler.addChild(edgesHandler); + graphHandler.addChild(controlFlowHandler); + + controlFlowHandler.addChild(blockHandler); + + blockHandler.addChild(successorsHandler); + successorsHandler.addChild(successorHandler); + blockHandler.addChild(blockNodesHandler); + blockNodesHandler.addChild(blockNodeHandler); + + nodesHandler.addChild(nodeHandler); + nodesHandler.addChild(removeNodeHandler); + edgesHandler.addChild(edgeHandler); + edgesHandler.addChild(removeEdgeHandler); + + methodHandler.addChild(propertiesHandler); + inlinedMethodHandler.addChild(propertiesHandler); + topHandler.addChild(propertiesHandler); + groupHandler.addChild(groupPropertiesHandler); + graphHandler.addChild(propertiesHandler); + nodeHandler.addChild(propertiesHandler); + propertiesHandler.addChild(propertyHandler); + groupPropertiesHandler.addChild(propertyHandler); + } + + // Returns a new GraphDocument object deserialized from an XML input source. + public GraphDocument parse(XMLReader reader, InputSource source, XMLParser.ParseMonitor monitor) throws SAXException { + reader.setContentHandler(new XMLParser(xmlDocument, monitor)); + try { + reader.parse(source); + } catch (IOException ex) { + throw new SAXException(ex); + } + + return topHandler.getObject(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java Wed Jul 05 16:38:58 2017 +0200 @@ -0,0 +1,217 @@ +/* + * 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.data.serialization; + +import com.sun.hotspot.igv.data.GraphDocument; +import com.sun.hotspot.igv.data.Group; +import com.sun.hotspot.igv.data.InputBlock;