Mercurial > hg > graal-jvmci-8
changeset 6806:f2e12eb74117 hs25-b03
Merge
author | kvn |
---|---|
date | Fri, 28 Sep 2012 10:16:29 -0700 |
parents | 15fba4382765 (diff) 69fb89ec6fa7 (current diff) |
children | 9f008ad79470 |
files | src/share/tools/ProjectCreator/DirectoryTree.java src/share/tools/ProjectCreator/DirectoryTreeNode.java src/share/tools/ProjectCreator/FileFormatException.java src/share/tools/ProjectCreator/WinGammaPlatformVC6.java src/share/vm/code/nmethod.cpp src/share/vm/code/nmethod.hpp src/share/vm/compiler/disassembler.cpp src/share/vm/compiler/disassembler.hpp |
diffstat | 356 files changed, 1657 insertions(+), 20757 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/make/ClosureFinder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -import java.io.*; -import java.util.*; - - -/** -<p> This class finds transitive closure of dependencies from a given -root set of classes. If your project has lots of .class files and you -want to ship only those .class files which are used (transitively) -from a root set of classes, then you can use this utility. </p> <p> -How does it work?</p> - -<p> We walk through all constant pool entries of a given class and -find all modified UTF-8 entries. Anything that looks like a class name is -considered as a class and we search for that class in the given -classpath. If we find a .class of that name, then we add that class to -list.</p> - -<p> We could have used CONSTANT_ClassInfo type constants only. But -that will miss classes used through Class.forName or xyz.class -construct. But, if you refer to a class name in some other string we -would include it as dependency :(. But this is quite unlikely -anyway. To look for exact Class.forName argument(s) would involve -bytecode analysis. Also, we handle only simple reflection. If you -accept name of a class from externally (for eg properties file or -command line args for example, this utility will not be able to find -that dependency. In such cases, include those classes in the root set. -</p> -*/ - -public class ClosureFinder { - private Collection roots; // root class names Collection<String> - private Map visitedClasses; // set of all dependencies as a Map - private String classPath; // classpath to look for .class files - private String[] pathComponents; // classpath components - private static final boolean isWindows = File.separatorChar != '/'; - - public ClosureFinder(Collection roots, String classPath) { - this.roots = roots; - this.classPath = classPath; - parseClassPath(); - } - - // parse classPath into pathComponents array - private void parseClassPath() { - List paths = new ArrayList(); - StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); - while (st.hasMoreTokens()) - paths.add(st.nextToken()); - - Object[] arr = paths.toArray(); - pathComponents = new String[arr.length]; - System.arraycopy(arr, 0, pathComponents, 0, arr.length); - } - - // if output is aleady not computed, compute it now - // result is a map from class file name to base path where the .class was found - public Map find() { - if (visitedClasses == null) { - visitedClasses = new HashMap(); - computeClosure(); - } - return visitedClasses; - } - - // compute closure for all given root classes - private void computeClosure() { - for (Iterator rootsItr = roots.iterator(); rootsItr.hasNext();) { - String name = (String) rootsItr.next(); - name = name.substring(0, name.indexOf(".class")); - computeClosure(name); - } - } - - - // looks up for .class in pathComponents and returns - // base path if found, else returns null - private String lookupClassFile(String classNameAsPath) { - for (int i = 0; i < pathComponents.length; i++) { - File f = new File(pathComponents[i] + File.separator + - classNameAsPath + ".class"); - if (f.exists()) { - if (isWindows) { - String name = f.getName(); - // Windows reports special devices AUX,NUL,CON as files - // under any directory. It does not care about file extention :-( - if (name.compareToIgnoreCase("AUX.class") == 0 || - name.compareToIgnoreCase("NUL.class") == 0 || - name.compareToIgnoreCase("CON.class") == 0) { - return null; - } - } - return pathComponents[i]; - } - } - return null; - } - - - // from JVM spec. 2'nd edition section 4.4 - private static final int CONSTANT_Class = 7; - private static final int CONSTANT_FieldRef = 9; - private static final int CONSTANT_MethodRef = 10; - private static final int CONSTANT_InterfaceMethodRef = 11; - private static final int CONSTANT_String = 8; - private static final int CONSTANT_Integer = 3; - private static final int CONSTANT_Float = 4; - private static final int CONSTANT_Long = 5; - private static final int CONSTANT_Double = 6; - private static final int CONSTANT_NameAndType = 12; - private static final int CONSTANT_Utf8 = 1; - - // whether a given string may be a class name? - private boolean mayBeClassName(String internalClassName) { - int len = internalClassName.length(); - for (int s = 0; s < len; s++) { - char c = internalClassName.charAt(s); - if (!Character.isJavaIdentifierPart(c) && c != '/') - return false; - } - return true; - } - - // compute closure for a given class - private void computeClosure(String className) { - if (visitedClasses.get(className) != null) return; - String basePath = lookupClassFile(className); - if (basePath != null) { - visitedClasses.put(className, basePath); - try { - File classFile = new File(basePath + File.separator + className + ".class"); - FileInputStream fis = new FileInputStream(classFile); - DataInputStream dis = new DataInputStream(fis); - // look for .class signature - if (dis.readInt() != 0xcafebabe) { - System.err.println(classFile.getAbsolutePath() + " is not a valid .class file"); - return; - } - - // ignore major and minor version numbers - dis.readShort(); - dis.readShort(); - - // read number of constant pool constants - int numConsts = (int) dis.readShort(); - String[] strings = new String[numConsts]; - - // zero'th entry is unused - for (int cpIndex = 1; cpIndex < numConsts; cpIndex++) { - int constType = (int) dis.readByte(); - switch (constType) { - case CONSTANT_Class: - case CONSTANT_String: - dis.readShort(); // string name index; - break; - - case CONSTANT_FieldRef: - case CONSTANT_MethodRef: - case CONSTANT_InterfaceMethodRef: - case CONSTANT_NameAndType: - case CONSTANT_Integer: - case CONSTANT_Float: - // all these are 4 byte constants - dis.readInt(); - break; - - case CONSTANT_Long: - case CONSTANT_Double: - // 8 byte constants - dis.readLong(); - // occupies 2 cp entries - cpIndex++; - break; - - - case CONSTANT_Utf8: { - strings[cpIndex] = dis.readUTF(); - break; - } - - default: - System.err.println("invalid constant pool entry"); - return; - } - } - - // now walk thru the string constants and look for class names - for (int s = 0; s < numConsts; s++) { - if (strings[s] != null && mayBeClassName(strings[s])) - computeClosure(strings[s].replace('/', File.separatorChar)); - } - - } catch (IOException exp) { - // ignore for now - } - - } - } - - // a sample main that accepts roots classes in a file and classpath as args - public static void main(String[] args) { - if (args.length != 2) { - System.err.println("Usage: ClosureFinder <root class file> <class path>"); - System.exit(1); - } - - List roots = new ArrayList(); - try { - FileInputStream fis = new FileInputStream(args[0]); - DataInputStream dis = new DataInputStream(fis); - String line = null; - while ((line = dis.readLine()) != null) { - if (isWindows) { - line = line.replace('/', File.separatorChar); - } - roots.add(line); - } - } catch (IOException exp) { - System.err.println(exp.getMessage()); - System.exit(2); - } - - ClosureFinder cf = new ClosureFinder(roots, args[1]); - Map out = cf.find(); - Iterator res = out.keySet().iterator(); - for(; res.hasNext(); ) { - String className = (String) res.next(); - System.out.println(className + ".class"); - } - } -}
--- a/agent/make/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/make/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -41,10 +41,7 @@ PKGLIST = \ sun.jvm.hotspot \ sun.jvm.hotspot.asm \ -sun.jvm.hotspot.asm.amd64 \ -sun.jvm.hotspot.asm.ia64 \ sun.jvm.hotspot.asm.sparc \ -sun.jvm.hotspot.asm.x86 \ sun.jvm.hotspot.bugspot \ sun.jvm.hotspot.bugspot.tree \ sun.jvm.hotspot.c1 \ @@ -138,10 +135,7 @@ FILELIST = \ sun/jvm/hotspot/*.java \ sun/jvm/hotspot/asm/*.java \ -sun/jvm/hotspot/asm/amd64/*.java \ -sun/jvm/hotspot/asm/ia64/*.java \ sun/jvm/hotspot/asm/sparc/*.java \ -sun/jvm/hotspot/asm/x86/*.java \ sun/jvm/hotspot/bugspot/*.java \ sun/jvm/hotspot/bugspot/tree/*.java \ sun/jvm/hotspot/c1/*.java \
--- a/agent/make/saenv.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/make/saenv.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/agent/make/start-debug-server-proc.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/make/start-debug-server-proc.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it
--- a/agent/src/os/bsd/MacosxDebuggerLocal.m Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/bsd/MacosxDebuggerLocal.m Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,13 @@ #import <mach/mach.h> #import <mach/mach_types.h> #import <sys/sysctl.h> +#import <stdio.h> +#import <stdarg.h> #import <stdlib.h> +#import <strings.h> +#import <dlfcn.h> +#import <limits.h> +#import <errno.h> jboolean debug = JNI_FALSE; @@ -60,6 +66,9 @@ #define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;} #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; } #define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;} +#define CHECK_EXCEPTION_CLEAR if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); } +#define CHECK_EXCEPTION_CLEAR_VOID if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); return; } +#define CHECK_EXCEPTION_CLEAR_(value) if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); return value; } static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg); @@ -404,3 +413,164 @@ } JNF_COCOA_EXIT(env); } + +/* + * Class: sun_jvm_hotspot_asm_Disassembler + * Method: load_library + * Signature: (Ljava/lang/String;)L + */ +JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_asm_Disassembler_load_1library(JNIEnv * env, + jclass disclass, + jstring jrepath_s, + jstring libname_s) { + uintptr_t func = 0; + const char* error_message = NULL; + const char* java_home; + jboolean isCopy; + uintptr_t *handle = NULL; + + const char * jrepath = (*env)->GetStringUTFChars(env, jrepath_s, &isCopy); // like $JAVA_HOME/jre/lib/sparc/ + const char * libname = (*env)->GetStringUTFChars(env, libname_s, &isCopy); + char buffer[128]; + + /* Load the hsdis library */ + void* hsdis_handle; + hsdis_handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL); + if (hsdis_handle == NULL) { + snprintf(buffer, sizeof(buffer), "%s%s", jrepath, libname); + hsdis_handle = dlopen(buffer, RTLD_LAZY | RTLD_GLOBAL); + } + if (hsdis_handle != NULL) { + func = (uintptr_t)dlsym(hsdis_handle, "decode_instructions_virtual"); + } + if (func == 0) { + error_message = dlerror(); + fprintf(stderr, "%s\n", error_message); + } + + (*env)->ReleaseStringUTFChars(env, libname_s, libname); + (*env)->ReleaseStringUTFChars(env, jrepath_s, jrepath); + + if (func == 0) { + /* Couldn't find entry point. error_message should contain some + * platform dependent error message. + */ + THROW_NEW_DEBUGGER_EXCEPTION(error_message); + } + return (jlong)func; +} + +/* signature of decode_instructions_virtual from hsdis.h */ +typedef void* (*decode_func)(uintptr_t start_va, uintptr_t end_va, + unsigned char* start, uintptr_t length, + void* (*event_callback)(void*, const char*, void*), + void* event_stream, + int (*printf_callback)(void*, const char*, ...), + void* printf_stream, + const char* options); + +/* container for call back state when decoding instructions */ +typedef struct { + JNIEnv* env; + jobject dis; + jobject visitor; + jmethodID handle_event; + jmethodID raw_print; + char buffer[4096]; +} decode_env; + + +/* event callback binding to Disassembler.handleEvent */ +static void* event_to_env(void* env_pv, const char* event, void* arg) { + decode_env* denv = (decode_env*)env_pv; + JNIEnv* env = denv->env; + jstring event_string = (*env)->NewStringUTF(env, event); + jlong result = (*env)->CallLongMethod(env, denv->dis, denv->handle_event, denv->visitor, + event_string, (jlong) (uintptr_t)arg); + /* ignore exceptions for now */ + CHECK_EXCEPTION_CLEAR_((void *)0); + return (void*)(uintptr_t)result; +} + +/* printing callback binding to Disassembler.rawPrint */ +static int printf_to_env(void* env_pv, const char* format, ...) { + jstring output; + va_list ap; + int cnt; + decode_env* denv = (decode_env*)env_pv; + JNIEnv* env = denv->env; + size_t flen = strlen(format); + const char* raw = NULL; + + if (flen == 0) return 0; + if (flen < 2 || + strchr(format, '%') == NULL) { + raw = format; + } else if (format[0] == '%' && format[1] == '%' && + strchr(format+2, '%') == NULL) { + // happens a lot on machines with names like %foo + flen--; + raw = format+1; + } + if (raw != NULL) { + jstring output = (*env)->NewStringUTF(env, raw); + (*env)->CallVoidMethod(env, denv->dis, denv->raw_print, denv->visitor, output); + CHECK_EXCEPTION_CLEAR; + return (int) flen; + } + va_start(ap, format); + cnt = vsnprintf(denv->buffer, sizeof(denv->buffer), format, ap); + va_end(ap); + + output = (*env)->NewStringUTF(env, denv->buffer); + (*env)->CallVoidMethod(env, denv->dis, denv->raw_print, denv->visitor, output); + CHECK_EXCEPTION_CLEAR; + return cnt; +} + +/* + * Class: sun_jvm_hotspot_asm_Disassembler + * Method: decode + * Signature: (Lsun/jvm/hotspot/asm/InstructionVisitor;J[BLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_asm_Disassembler_decode(JNIEnv * env, + jobject dis, + jobject visitor, + jlong startPc, + jbyteArray code, + jstring options_s, + jlong decode_instructions_virtual) { + jboolean isCopy; + jbyte* start = (*env)->GetByteArrayElements(env, code, &isCopy); + jbyte* end = start + (*env)->GetArrayLength(env, code); + const char * options = (*env)->GetStringUTFChars(env, options_s, &isCopy); + jclass disclass = (*env)->GetObjectClass(env, dis); + + decode_env denv; + denv.env = env; + denv.dis = dis; + denv.visitor = visitor; + + /* find Disassembler.handleEvent callback */ + denv.handle_event = (*env)->GetMethodID(env, disclass, "handleEvent", + "(Lsun/jvm/hotspot/asm/InstructionVisitor;Ljava/lang/String;J)J"); + CHECK_EXCEPTION_CLEAR_VOID + + /* find Disassembler.rawPrint callback */ + denv.raw_print = (*env)->GetMethodID(env, disclass, "rawPrint", + "(Lsun/jvm/hotspot/asm/InstructionVisitor;Ljava/lang/String;)V"); + CHECK_EXCEPTION_CLEAR_VOID + + /* decode the buffer */ + (*(decode_func)(uintptr_t)decode_instructions_virtual)(startPc, + startPc + end - start, + (unsigned char*)start, + end - start, + &event_to_env, (void*) &denv, + &printf_to_env, (void*) &denv, + options); + + /* cleanup */ + (*env)->ReleaseByteArrayElements(env, code, start, JNI_ABORT); + (*env)->ReleaseStringUTFChars(env, options_s, options); +}
--- a/agent/src/os/linux/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/linux/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -36,25 +36,33 @@ INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux -OBJS = $(SOURCES:.c=.o) +OBJS = $(SOURCES:%.c=$(ARCH)/%.o) $(ARCH)/sadis.o LIBS = -lthread_db -CFLAGS = -c -fPIC -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) -D_FILE_OFFSET_BITS=64 +CFLAGS = -c -fPIC -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) -I$(ARCH) LIBSA = $(ARCH)/libsaproc.so all: $(LIBSA) -LinuxDebuggerLocal.o: LinuxDebuggerLocal.c - $(JAVAH) -jni -classpath ../../../build/classes \ +$(ARCH): + mkdir $(ARCH) + +$(ARCH)/LinuxDebuggerLocal.o: LinuxDebuggerLocal.c + $(JAVAH) -jni -classpath ../../../build/classes -d $(ARCH) \ sun.jvm.hotspot.debugger.x86.X86ThreadContext \ sun.jvm.hotspot.debugger.sparc.SPARCThreadContext \ sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext - $(GCC) $(CFLAGS) $< + $(GCC) $(CFLAGS) $< -o $@ -.c.obj: - $(GCC) $(CFLAGS) +$(ARCH)/sadis.o: ../../share/native/sadis.c + $(JAVAH) -jni -classpath ../../../build/classes -d $(ARCH) \ + sun.jvm.hotspot.asm.Disassembler + $(GCC) $(CFLAGS) $< -o $@ + +$(ARCH)/%.o: %.c + $(GCC) $(CFLAGS) $< -o $@ ifndef LDNOMAP LFLAGS_LIBSA = -Xlinker --version-script=mapfile @@ -68,9 +76,8 @@ endif LFLAGS_LIBSA += $(LDFLAGS_HASH_STYLE) -$(LIBSA): $(OBJS) mapfile - if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi - $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS) +$(LIBSA): $(ARCH) $(OBJS) mapfile + $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS) test.o: test.c $(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c @@ -79,7 +86,4 @@ $(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS) clean: - rm -rf $(LIBSA) - rm -rf $(OBJS) - rmdir $(ARCH) - + rm -fr $(ARCH)
--- a/agent/src/os/linux/mapfile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/linux/mapfile Fri Sep 28 10:16:29 2012 -0700 @@ -1,7 +1,5 @@ # - -# -# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -22,7 +20,6 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # Define public interface. @@ -40,6 +37,10 @@ Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_readBytesFromProcess0; Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_getThreadIntegerRegisterSet0; + # Disassembler interface + Java_sun_jvm_hotspot_asm_Disassembler_decode; + Java_sun_jvm_hotspot_asm_Disassembler_load_1library; + # proc_service.h functions - to be used by libthread_db ps_getpid; ps_pglobal_lookup;
--- a/agent/src/os/solaris/proc/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/solaris/proc/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ # sparcv9: Build the 64 bit sparcv9 version in ./sparcv9 # i386: Build the 32 bit i386 version in ./i386 -.PHONY: sparc sparcv9 i386 +.PHONY: sparc sparcv9 i386 amd64 ARCH_ORIG = $(shell uname -p) @@ -36,6 +36,8 @@ MKDIRS := /usr/bin/mkdir -p CLASSES_DIR = ../../../../build/classes +SAPROC_INCLUDES=-I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris +SADIS=../../../share/native/sadis.c ifeq "$(ARCH_ORIG)" "i386" ALL_TARGET = i386 $(filter amd64,$(shell isalist)) @@ -43,6 +45,11 @@ ALL_TARGET = sparc sparcv9 endif +CFLAGS/i386 = +CFLAGS/amd64 = -xarch=amd64 +CFLAGS/sparc = -xarch=v8 +CFLAGS/sparv9 = -xarch=v9 + all:: $(ALL_TARGET) javahomecheck:: @@ -51,34 +58,13 @@ exit 1 ; \ fi -i386:: javahomecheck - $(MKDIRS) $@ - @javah -classpath $(CLASSES_DIR) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal - CC -G -KPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris saproc.cpp \ - -M mapfile -o $@/libsaproc.so -ldemangle - CC -o $@/libsaproc_audit.so -G -Kpic -z defs saproc_audit.cpp -lmapmalloc -ldl -lc - -amd64:: javahomecheck +i386 amd64 sparc sparcv9:: javahomecheck $(MKDIRS) $@ - @javah -classpath $(CLASSES_DIR) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal - CC -G -KPIC -xarch=amd64 -I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris saproc.cpp \ - -M mapfile -o $@/libsaproc.so -ldemangle - CC -xarch=amd64 -o $@/libsaproc_audit.so -G -Kpic -z defs saproc_audit.cpp -lmapmalloc -ldl -lc - -sparc:: javahomecheck - $(MKDIRS) $@ - @javah -classpath $(CLASSES_DIR) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal - CC -G -KPIC -xarch=v8 -I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris saproc.cpp \ - -M mapfile -o $@/libsaproc.so -ldemangle - CC -xarch=v8 -o $@/libsaproc_audit.so -G -Kpic -z defs saproc_audit.cpp -lmapmalloc -ldl -lc - -sparcv9:: javahomecheck - $(MKDIRS) $@ - @javah -classpath $(CLASSES_DIR) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal - CC -G -KPIC -xarch=v9 -I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris saproc.cpp \ - -M mapfile -o $@/libsaproc.so -ldemangle - CC -xarch=v9 -o $@/libsaproc_audit.so -G -Kpic -z defs saproc_audit.cpp -lmapmalloc -ldl -lc + @$(JAVA_HOME)/bin/javah -classpath $(CLASSES_DIR) -d $@ -jni sun.jvm.hotspot.asm.Disassembler sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal + CC $(CFLAGS/$@) -c -g -Kpic ${SAPROC_INCLUDES} -I$@ saproc.cpp -o $@/saproc.o + cc $(CFLAGS/$@) -c -g -Kpic ${SAPROC_INCLUDES} -I$@ $(SADIS) -o $@/sadis.o + CC $(CFLAGS/$@) -g -G -Kpic $@/saproc.o $@/sadis.o -M mapfile -o $@/libsaproc.so -ldemangle + CC $(CFLAGS/$@) -o $@/libsaproc_audit.so -G -Kpic -z defs saproc_audit.cpp -lmapmalloc -ldl -lc clean:: - $(RM) -rf sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal.h - $(RM) -rf sparc sparcv9 i386 + $(RM) -rf sparc sparcv9 i386 amd64
--- a/agent/src/os/solaris/proc/mapfile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/solaris/proc/mapfile Fri Sep 28 10:16:29 2012 -0700 @@ -1,7 +1,5 @@ # - -# -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -22,10 +20,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# # Define public interface. - SUNWprivate_1.1 { global: Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_attach0__Ljava_lang_String_2; @@ -47,6 +43,9 @@ Java_sun_jvm_hotspot_debugger_proc_ProcDebuggerLocal_writeBytesToProcess0; # this is needed by saproc_audit.c to redirect opens in libproc.so libsaproc_open; -local: + # Disassembler interface + Java_sun_jvm_hotspot_asm_Disassembler_decode; + Java_sun_jvm_hotspot_asm_Disassembler_load_1library; + local: *; };
--- a/agent/src/os/win32/windbg/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/os/win32/windbg/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ WINDBG_LIB_IA64=$(WINDBG_HOME)/sdk/lib/ia64 WINDBG_LIB_AMD64=$(WINDBG_HOME)/sdk/lib/amd64 +SADIS=../../../share/native/sadis.c + # These do not need to be optimized (don't run a lot of code) and it # will be useful to have the assertion checks in place @@ -57,23 +59,29 @@ amd64: amd64/$(SAWINDBGDLL) -i386/$(SAWINDBGDLL) : sawindbg.cpp +i386/$(SAWINDBGDLL) : sawindbg.cpp $(SADIS) @ mkdir -p i386 - @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal sun.jvm.hotspot.debugger.x86.X86ThreadContext + @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal sun.jvm.hotspot.debugger.x86.X86ThreadContext + @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.asm.Disassembler @ $(CPP32) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS32) /Fp"i386/sawindbg.pch" /Fo"i386/" /Fd"i386/" /c sawindbg.cpp - $(LINK32) /out:$@ /DLL i386/sawindbg.obj $(LIBS32) + @ $(CPP32) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS32) /Fp"i386/sadis.pch" /Fo"i386/" /Fd"i386/" /c $(SADIS) + $(LINK32) /out:$@ /DLL i386/sawindbg.obj i386/sadis.obj $(LIBS32) -ia64/$(SAWINDBGDLL) : sawindbg.cpp +ia64/$(SAWINDBGDLL) : sawindbg.cpp $(SADIS) @ mkdir -p ia64 @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal sun.jvm.hotspot.debugger.ia64.IA64ThreadContext + @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.asm.Disassembler @ $(CPP64) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS64) /Fp"ia64/sawindbg.pch" /Fo"ia64/" /Fd"ia64/" /c sawindbg.cpp - $(LINK64) /out:$@ /DLL ia64/sawindbg.obj $(LIBS_IA64) + @ $(CPP64) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS64) /Fp"ia64/sadis.pch" /Fo"ia64/" /Fd"ia64/" /c $(SADIS) + $(LINK64) /out:$@ /DLL ia64/sawindbg.obj ia64/sadis.obj $(LIBS_IA64) -amd64/$(SAWINDBGDLL) : sawindbg.cpp +amd64/$(SAWINDBGDLL) : sawindbg.cpp $(SADIS) @ mkdir -p amd64 @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext + @ $(JAVAH) -jni -classpath ../../../../build/classes sun.jvm.hotspot.asm.Disassembler @ $(CPP64) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS64) /Fp"amd64/sawindbg.pch" /Fo"amd64/" /Fd"amd64/" /c sawindbg.cpp - $(LINK64) /out:$@ /DLL amd64/sawindbg.obj $(LIBS_AMD64) + @ $(CPP64) /I$(JAVA_HOME)/include /I$(JAVA_HOME)/include/win32 /I$(WINDBG_INCLUDE) $(CFLAGS64) /Fp"amd64/sadis.pch" /Fo"amd64/" /Fd"amd64/" /c $(SADIS) + $(LINK64) /out:$@ /DLL amd64/sawindbg.obj amd64/sadis.obj $(LIBS_AMD64) clean: rm *.h
--- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Fri Sep 28 10:16:29 2012 -0700 @@ -42,6 +42,7 @@ import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.opto.*; import sun.jvm.hotspot.ci.*; +import sun.jvm.hotspot.asm.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.utilities.soql.*; @@ -564,6 +565,71 @@ } } }, + // decode raw address + new Command("dis", "dis address [length]", false) { + public void doit(Tokens t) { + int tokens = t.countTokens(); + if (tokens != 1 && tokens != 2) { + usage(); + return; + } + String name = t.nextToken(); + Address addr = null; + int len = 0x10; // default length + try { + addr = VM.getVM().getDebugger().parseAddress(name); + } catch (NumberFormatException e) { + out.println(e); + return; + } + if (tokens == 2) { + try { + len = Integer.parseInt(t.nextToken()); + } catch (NumberFormatException e) { + out.println(e); + return; + } + } + HTMLGenerator generator = new HTMLGenerator(false); + out.println(generator.genHTMLForRawDisassembly(addr, len)); + } + + }, + // decode codeblob or nmethod + new Command("disassemble", "disassemble address", false) { + public void doit(Tokens t) { + int tokens = t.countTokens(); + if (tokens != 1) { + usage(); + return; + } + String name = t.nextToken(); + Address addr = null; + try { + addr = VM.getVM().getDebugger().parseAddress(name); + } catch (NumberFormatException e) { + out.println(e); + return; + } + + HTMLGenerator generator = new HTMLGenerator(false); + out.println(generator.genHTML(addr)); + } + }, + // print Java bytecode disassembly + new Command("jdis", "jdis address", false) { + public void doit(Tokens t) { + int tokens = t.countTokens(); + if (tokens != 1) { + usage(); + return; + } + Address a = VM.getVM().getDebugger().parseAddress(t.nextToken()); + Method m = (Method)Metadata.instantiateWrapperFor(a); + HTMLGenerator html = new HTMLGenerator(false); + out.println(html.genHTML(m)); + } + }, new Command("revptrs", "revptrs address", false) { public void doit(Tokens t) { int tokens = t.countTokens();
--- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Fri Sep 28 10:16:29 2012 -0700 @@ -43,10 +43,6 @@ * highest-level factory for VM data structures. It makes it simple * to start up the debugging system. </P> * - * <P> FIXME: need to add a way to configure the paths to dbx and the - * DSO from the outside. However, this should work for now for - * internal use. </P> - * * <P> FIXME: especially with the addition of remote debugging, this * has turned into a mess; needs rethinking. </P> */ @@ -87,30 +83,7 @@ private String[] jvmLibNames; - // FIXME: make these configurable, i.e., via a dotfile; also - // consider searching within the JDK from which this Java executable - // comes to find them - private static final String defaultDbxPathPrefix = "/net/jano.sfbay/export/disk05/hotspot/sa"; - private static final String defaultDbxSvcAgentDSOPathPrefix = "/net/jano.sfbay/export/disk05/hotspot/sa"; - static void showUsage() { - System.out.println(" You can also pass these -D options to java to specify where to find dbx and the \n" + - " Serviceability Agent plugin for dbx:"); - System.out.println(" -DdbxPathName=<path-to-dbx-executable>\n" + - " Default is derived from dbxPathPrefix"); - System.out.println(" or"); - System.out.println(" -DdbxPathPrefix=<xxx>\n" + - " where xxx is the path name of a dir structure that contains:\n" + - " <os>/<arch>/bin/dbx\n" + - " The default is " + defaultDbxPathPrefix); - System.out.println(" and"); - System.out.println(" -DdbxSvcAgentDSOPathName=<path-to-dbx-serviceability-agent-module>\n" + - " Default is determined from dbxSvcAgentDSOPathPrefix"); - System.out.println(" or"); - System.out.println(" -DdbxSvcAgentDSOPathPrefix=<xxx>\n" + - " where xxx is the pathname of a dir structure that contains:\n" + - " <os>/<arch>/bin/lib/libsvc_agent_dbx.so\n" + - " The default is " + defaultDbxSvcAgentDSOPathPrefix); } public HotSpotAgent() {
--- a/agent/src/share/classes/sun/jvm/hotspot/TestDebugger.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.proc.*; - -// A test of the debugger backend. This should be used to connect to -// the helloWorld.cpp program. - -public class TestDebugger { - - private static void usage() { - System.out.println("usage: java TestDebugger [pid]"); - System.out.println("pid must be the process ID of the helloWorld process"); - System.exit(1); - } - - public static void main(String[] args) { - try { - if (args.length != 1) { - usage(); - } - - int pid = 0; - try { - pid = Integer.parseInt(args[0]); - } - catch (NumberFormatException e) { - usage(); - } - - JVMDebugger debugger = new ProcDebuggerLocal(null, true); - - try { - debugger.attach(pid); - } - catch (DebuggerException e) { - System.err.print("Error attaching to process ID " + pid + ": "); - if (e.getMessage() != null) { - System.err.print(e.getMessage()); - } - System.err.println(); - System.exit(1); - } - - // HACK: configure debugger with primitive type sizes to get - // Java types going - debugger.configureJavaPrimitiveTypeSizes(1, 1, 2, 8, 4, 4, 8, 2); - - // FIXME: figure out how to canonicalize and/or eliminate - // loadobject specification - String loadObjectName = "-"; - - // long strAddr = debugger.lookup("helloWorld", "helloWorldString"); - Address addr = debugger.lookup(loadObjectName, "helloWorldString"); - if (addr == null) { - System.err.println("Error looking up symbol \"helloWorldString\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - - // This is a pointer which points to the start of storage. - // Dereference it. - addr = addr.getAddressAt(0); - - // Read the number of bytes we know we need - int helloWorldLen = 13; - byte[] data = new byte[helloWorldLen]; - for (int i = 0; i < helloWorldLen; ++i) { - data[i] = (byte) addr.getCIntegerAt(i, 1, false); - } - - // Convert to characters - char[] chars = new char[data.length]; - for (int i = 0; i < data.length; ++i) { - chars[i] = (char) data[i]; - } - String helloWorldStr = new String(chars); - - System.out.println("Successfully read string \"" + helloWorldStr + "\" from target process\n"); - - // Test all Java data types (see helloWorld.cpp) - byte expectedByteValue = (byte) 132; - short expectedShortValue = (short) 27890; - int expectedIntValue = 1020304050; - long expectedLongValue = 102030405060708090L; - float expectedFloatValue = 35.4F; - double expectedDoubleValue = 1.23456789; - byte byteValue = 0; - short shortValue = 0; - int intValue = 0; - long longValue = 0; - float floatValue = 0; - double doubleValue = 0; - - addr = debugger.lookup(loadObjectName, "testByte"); - if (addr == null) { - System.err.println("Error looking up symbol \"testByte\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - byteValue = addr.getJByteAt(0); - if (byteValue != expectedByteValue) { - System.err.println("Error: unexpected byte value (got " + - byteValue + ", expected " + expectedByteValue + ")"); - System.exit(1); - } - - addr = debugger.lookup(loadObjectName, "testShort"); - if (addr == null) { - System.err.println("Error looking up symbol \"testShort\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - shortValue = addr.getJShortAt(0); - if (shortValue != expectedShortValue) { - System.err.println("Error: unexpected short value (got " + - shortValue + ", expected " + expectedShortValue + ")"); - System.exit(1); - } - - addr = debugger.lookup(loadObjectName, "testInt"); - if (addr == null) { - System.err.println("Error looking up symbol \"testInt\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - intValue = addr.getJIntAt(0); - if (intValue != expectedIntValue) { - System.err.println("Error: unexpected int value (got " + - intValue + ", expected " + expectedIntValue + ")"); - System.exit(1); - } - - addr = debugger.lookup(loadObjectName, "testLong"); - if (addr == null) { - System.err.println("Error looking up symbol \"testLong\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - longValue = addr.getJLongAt(0); - if (longValue != expectedLongValue) { - System.err.println("Error: unexpected long value (got " + - longValue + ", expected " + expectedLongValue + ")"); - System.exit(1); - } - - addr = debugger.lookup(loadObjectName, "testFloat"); - if (addr == null) { - System.err.println("Error looking up symbol \"testFloat\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - floatValue = addr.getJFloatAt(0); - if (floatValue != expectedFloatValue) { - System.err.println("Error: unexpected float value (got " + - floatValue + ", expected " + expectedFloatValue + ")"); - System.exit(1); - } - - addr = debugger.lookup(loadObjectName, "testDouble"); - if (addr == null) { - System.err.println("Error looking up symbol \"testDouble\" in context \"" + - loadObjectName + "\""); - System.exit(1); - } - doubleValue = addr.getJDoubleAt(0); - if (doubleValue != expectedDoubleValue) { - System.err.println("Error: unexpected double value (got " + - doubleValue + ", expected " + expectedDoubleValue + ")"); - System.exit(1); - } - - System.err.println("All tests passed successfully."); - - debugger.detach(); - } - catch (AddressException e) { - System.err.println("Error occurred during test:"); - e.printStackTrace(); - System.exit(1); - } - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/AbstractInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public abstract class AbstractInstruction implements Instruction { - protected final String name; - - public AbstractInstruction(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - // some type testers - public boolean isIllegal() { - return false; - } - - public boolean isArithmetic() { - return false; - } - - public boolean isLogical() { - return false; - } - - public boolean isShift() { - return false; - } - - public boolean isMove() { - return false; - } - - public boolean isBranch() { - return false; - } - - public boolean isCall() { - return false; - } - - public boolean isReturn() { - return false; - } - - public boolean isLoad() { - return false; - } - - public boolean isStore() { - return false; - } - - public boolean isFloat() { - return false; - } - - public boolean isTrap() { - return false; - } - - public boolean isNoop() { - return false; - } - - // convert the instruction as String given currentPc - // and SymbolFinder - - public String asString(long currentPc, SymbolFinder symFinder) { - return name; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/Address.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public abstract class Address extends Operand { - public boolean isAddress() { - return true; - } - - public abstract String toString(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/Arithmetic.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface Arithmetic extends Instruction, RTLOperations { - public Operand[] getArithmeticSources(); - public Operand getArithmeticDestination(); - public int getOperation(); // one of RTLOperations -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ArithmeticInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface ArithmeticInstruction extends Instruction, RTLOperations { - public Operand[] getArithmeticSources(); - public Operand getArithmeticDestination(); - public int getOperation(); // one of RTLOperations -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/BaseIndexScaleDispAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -// address is calculated as (base + (index * scale) + displacement) -// optionally index is auto incremented or decremented - -public abstract class BaseIndexScaleDispAddress extends IndirectAddress { - private final Register base, index; - private final int scale; - private final long disp; - private boolean isAutoIncr; - private boolean isAutoDecr; - - public BaseIndexScaleDispAddress(Register base, Register index, long disp, int scale) { - this.base = base; - this.index = index; - this.disp = disp; - this.scale = scale; - } - - public BaseIndexScaleDispAddress(Register base, Register index, long disp) { - this(base, index, disp, 1); - } - - public BaseIndexScaleDispAddress(Register base, Register index) { - this(base, index, 0L, 1); - } - - public BaseIndexScaleDispAddress(Register base, long disp) { - this(base, null, disp, 1); - } - - public Register getBase() { - return base; - } - - public Register getIndex() { - return index; - } - - public int getScale() { - return scale; - } - - public long getDisplacement() { - return disp; - } - - // is the index auto decremented or incremented? - public boolean isAutoIncrement() { - return isAutoIncr; - } - - public void setAutoIncrement(boolean value) { - isAutoIncr = value; - } - - public boolean isAutoDecrement() { - return isAutoDecr; - } - - public void setAutoDecrement(boolean value) { - isAutoDecr = value; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/BranchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface BranchInstruction extends Instruction { - public boolean isConditional(); - public Address getBranchDestination(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/CPUHelper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface CPUHelper { - public Disassembler createDisassembler(long startPc, byte[] code); - public Register getIntegerRegister(int num); - public Register getFloatRegister(int num); - public Register getStackPointer(); - public Register getFramePointer(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/CallInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface CallInstruction extends BranchInstruction { -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/DirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public class DirectAddress extends Address { - private long value; - public DirectAddress(long value) { - this.value = value; - } - - public long getValue() { - return value; - } - - public String toString() { - return Long.toHexString(value); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,22 +24,134 @@ package sun.jvm.hotspot.asm; -public abstract class Disassembler { - protected long startPc; - protected byte[] code; +import java.io.PrintStream; +import java.util.Observer; +import java.util.Observable; +import sun.jvm.hotspot.code.CodeBlob; +import sun.jvm.hotspot.code.NMethod; +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.runtime.VM; + +public class Disassembler { + private static String options = ""; + private static long decode_function; - public Disassembler(long startPc, byte[] code) { - this.startPc = startPc; - this.code = code; + protected long startPc; + protected byte[] code; + private CodeBlob blob; + private NMethod nmethod; + + public static void decode(InstructionVisitor visitor, CodeBlob blob) { + decode(visitor, blob, blob.codeBegin(), blob.codeEnd()); + } + + public static void decode(InstructionVisitor visitor, CodeBlob blob, Address begin, Address end) { + int codeSize = (int)end.minus(begin); + long startPc = VM.getAddressValue(begin); + byte[] code = new byte[codeSize]; + for (int i = 0; i < code.length; i++) + code[i] = begin.getJByteAt(i); + Disassembler dis = new Disassembler(startPc, code); + dis.decode(visitor); } - public long getStartPC() { - return startPc; + private Disassembler(long startPc, byte[] code) { + this.startPc = startPc; + this.code = code; + + // Lazily load hsdis + if (decode_function == 0) { + StringBuilder path = new StringBuilder(System.getProperty("java.home")); + String sep = System.getProperty("file.separator"); + String os = System.getProperty("os.name"); + String libname = "hsdis"; + String arch = System.getProperty("os.arch"); + if (os.lastIndexOf("Windows", 0) != -1) { + path.append(sep + "bin" + sep); + libname += ".dll"; + } else if (os.lastIndexOf("SunOS", 0) != -1) { + if (arch.equals("x86") || arch.equals("i386")) { + path.append(sep + "lib" + sep + "i386" + sep); + libname += "-i386" + ".so"; + } else if (arch.equals("amd64")) { + path.append(sep + "lib" + sep + "amd64" + sep); + libname += "-amd64" + ".so"; + } else { + path.append(sep + "lib" + sep + arch + sep); + libname += "-" + arch + ".so"; + } + } else if (os.lastIndexOf("Linux", 0) != -1) { + if (arch.equals("x86") || arch.equals("i386")) { + path.append(sep + "lib" + sep + "i386" + sep); + libname += "-i386.so"; + } else if (arch.equals("amd64") || arch.equals("x86_64")) { + path.append(sep + "lib" + sep + "amd64" + sep); + libname += "-amd64.so"; + } else { + path.append(sep + "lib" + sep + arch + sep); + libname += "-" + arch + ".so"; + } + } else if (os.lastIndexOf("Mac OS X", 0) != -1) { + path.append(sep + "lib" + sep); + libname += "-amd64" + ".dylib"; // x86_64 => amd64 + } else { + path.append(sep + "lib" + sep + "arch" + sep); + libname += "-" + arch + ".so"; + } + decode_function = load_library(path.toString(), libname); + } } - public byte[] getCode() { - return code; + private static native long load_library(String installed_jrepath, String hsdis_library_name); + + private native void decode(InstructionVisitor visitor, long pc, byte[] code, + String options, long decode_function); + + private void decode(InstructionVisitor visitor) { + visitor.prologue(); + decode(visitor, startPc, code, options, decode_function); + visitor.epilogue(); + } + + private boolean match(String event, String tag) { + if (!event.startsWith(tag)) + return false; + int taglen = tag.length(); + if (taglen == event.length()) return true; + char delim = event.charAt(taglen); + return delim == ' ' || delim == '/' || delim == '='; } - public abstract void decode(InstructionVisitor visitor); + // This is called from the native code to process various markers + // in the dissassembly. + private long handleEvent(InstructionVisitor visitor, String event, long arg) { + if (match(event, "insn")) { + try { + visitor.beginInstruction(arg); + } catch (Throwable e) { + e.printStackTrace(); + } + } else if (match(event, "/insn")) { + try { + visitor.endInstruction(arg); + } catch (Throwable e) { + e.printStackTrace(); + } + } else if (match(event, "addr")) { + if (arg != 0) { + visitor.printAddress(arg); + } + return arg; + } else if (match(event, "mach")) { + // output().printf("[Disassembling for mach='%s']\n", arg); + } else { + // ignore unrecognized markup + } + return 0; + } + + // This called from the native code to perform printing + private void rawPrint(InstructionVisitor visitor, String s) { + visitor.print(s); + } }
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/Immediate.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -// Immediate is a Number operand - -public class Immediate extends ImmediateOrRegister { - private final Number value; - - public Immediate(Number value) { - this.value = value; - } - - public Number getNumber() { - return value; - } - - public boolean isImmediate() { - return true; - } - - public String toString() { - return value.toString(); - } - - public int hashCode() { - return value.hashCode(); - } - - public boolean equals(Object obj) { - if (obj == null) - return false; - - if (getClass() != obj.getClass()) - return false; - - Immediate other = (Immediate) obj; - return value.equals(other.value); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/IndirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public abstract class IndirectAddress extends Address { -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/Instruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface Instruction { - public String getName(); - - // total size in bytes (operands + opcode). - // for eg. in sparc it is always 4 (= 32bits) - public int getSize(); - - // some type testers - public boolean isIllegal(); - public boolean isArithmetic(); - public boolean isLogical(); - public boolean isShift(); - public boolean isMove(); - public boolean isBranch(); - public boolean isCall(); - public boolean isReturn(); - public boolean isLoad(); - public boolean isStore(); - public boolean isFloat(); - public boolean isTrap(); - public boolean isNoop(); - - // convert the instruction as String given currentPc - // and SymbolFinder - - public String asString(long currentPc, SymbolFinder symFinder); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/InstructionVisitor.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/asm/InstructionVisitor.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,9 @@ public interface InstructionVisitor { public void prologue(); - public void visit(long currentPc, Instruction instr); + public void beginInstruction(long currentPc); + public void printAddress(long address); + public void print(String format); + public void endInstruction(long endPc); public void epilogue(); }
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/LoadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface LoadInstruction extends MemoryInstruction { - public Address getLoadSource(); - public Register[] getLoadDestinations(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/LogicInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface LogicInstruction extends Instruction, RTLOperations { - public Operand[] getLogicSources(); - public Operand getLogicDestination(); - public int getOperation(); // one of RTLOperations -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/MemoryInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface MemoryInstruction extends RTLDataTypes { - public int getDataType(); // one of the RTLDataTypes. - public boolean isConditional(); // conditional store like swap or v9 like non-faulting loads -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/MoveInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface MoveInstruction extends Instruction { - public ImmediateOrRegister getMoveSource(); - public Register getMoveDestination(); - // for condition moves - public boolean isConditional(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/PCRelativeAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -// address is specified as an offset from current PC - -public class PCRelativeAddress extends IndirectAddress { - private final long disp; - - public PCRelativeAddress(long disp) { - this.disp = disp; - } - - public String toString() { - return new Long(disp).toString(); - } - - public long getDisplacement() { - return disp; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/RTLDataTypes.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface RTLDataTypes { - - // HALF = 16 bits, WORD = 32 bits, DWORD = 64 bits and QWORD = 128 bits. - - public static final int RTLDT_SIGNED_BYTE = 0; - public static final int RTLDT_UNSIGNED_BYTE = 1; - public static final int RTLDT_SIGNED_HALF = 2; - public static final int RTLDT_UNSIGNED_HALF = 3; - public static final int RTLDT_SIGNED_WORD = 4; - public static final int RTLDT_UNSIGNED_WORD = 5; - public static final int RTLDT_SIGNED_DWORD = 6; - public static final int RTLDT_UNSIGNED_DWORD = 7; - public static final int RTLDT_SIGNED_QWORD = 8; - public static final int RTLDT_UNSIGNED_QWORD = 9; - - // float is 4 bytes, double is 8 bytes, extended double is 10 bytes - // and quad is 16 bytes. - - public static final int RTLDT_FL_SINGLE = 10; - public static final int RTLDT_FL_DOUBLE = 11; - public static final int RTLDT_FL_EXT_DOUBLE = 12; - public static final int RTLDT_FL_QUAD = 13; - - public static final int RTLDT_STRING = 14; - - public static final int RTLDT_UNKNOWN = Integer.MAX_VALUE; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/RTLOperations.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface RTLOperations { - - // arithmetic operations - public static final int RTLOP_ADD = 0; - // with carry - public static final int RTLOP_ADDC = 1; - public static final int RTLOP_SUB = 2; - // with carry - public static final int RTLOP_SUBC = 3; - public static final int RTLOP_SMUL = 4; - public static final int RTLOP_UMUL = 5; - public static final int RTLOP_SDIV = 6; - public static final int RTLOP_UDIV = 7; - - public static final int RTLOP_MAX_ARITHMETIC = RTLOP_UDIV; - - // logical operations - public static final int RTLOP_AND = 8; - public static final int RTLOP_OR = 9; - public static final int RTLOP_NOT = 10; - public static final int RTLOP_NAND = 11; - public static final int RTLOP_NOR = 12; - public static final int RTLOP_XOR = 13; - public static final int RTLOP_XNOR = 14; - - public static final int RTLOP_MAX_LOGICAL = RTLOP_XNOR; - - // shift operations - public static final int RTLOP_SRL = 15; - public static final int RTLOP_SRA = 16; - public static final int RTLOP_SLL = 17; - - public static final int RTLOP_MAX_SHIFT = RTLOP_SLL; - - public static final int RTLOP_UNKNOWN = Integer.MAX_VALUE; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ReturnInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface ReturnInstruction extends BranchInstruction { -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ShiftInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface ShiftInstruction extends Instruction, RTLOperations { - public Operand getShiftSource(); - public Operand getShiftLength(); // number of bits to shift - public Operand getShiftDestination(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/StoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm; - -public interface StoreInstruction extends MemoryInstruction { - public Register[] getStoreSources(); - public Address getStoreDestination(); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64FloatRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.amd64; - -import sun.jvm.hotspot.utilities.Assert; - -public class AMD64FloatRegisters { - - public static int getNumRegisters() { - return NUM_REGIXMMERS; - } - - public static AMD64FloatRegister getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGIXMMERS, "invalid float register number!"); - } - return registers[regNum]; - } - - public static String getRegisterName(int i) { - return "XMM(" + i + ")"; - } - - public static final AMD64FloatRegister XMM0; - public static final AMD64FloatRegister XMM1; - public static final AMD64FloatRegister XMM2; - public static final AMD64FloatRegister XMM3; - public static final AMD64FloatRegister XMM4; - public static final AMD64FloatRegister XMM5; - public static final AMD64FloatRegister XMM6; - public static final AMD64FloatRegister XMM7; - public static final AMD64FloatRegister XMM8; - public static final AMD64FloatRegister XMM9; - public static final AMD64FloatRegister XMM10; - public static final AMD64FloatRegister XMM11; - public static final AMD64FloatRegister XMM12; - public static final AMD64FloatRegister XMM13; - public static final AMD64FloatRegister XMM14; - public static final AMD64FloatRegister XMM15; - - public static final int NUM_REGIXMMERS = 16; - - private static final AMD64FloatRegister[] registers; - - static { - XMM0 = new AMD64FloatRegister(0); - XMM1 = new AMD64FloatRegister(1); - XMM2 = new AMD64FloatRegister(2); - XMM3 = new AMD64FloatRegister(3); - XMM4 = new AMD64FloatRegister(4); - XMM5 = new AMD64FloatRegister(5); - XMM6 = new AMD64FloatRegister(6); - XMM7 = new AMD64FloatRegister(7); - XMM8 = new AMD64FloatRegister(8); - XMM9 = new AMD64FloatRegister(9); - XMM10 = new AMD64FloatRegister(10); - XMM11 = new AMD64FloatRegister(11); - XMM12 = new AMD64FloatRegister(12); - XMM13 = new AMD64FloatRegister(13); - XMM14 = new AMD64FloatRegister(14); - XMM15 = new AMD64FloatRegister(15); - - registers = new AMD64FloatRegister[] { - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15 - }; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64Helper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.amd64; - -import sun.jvm.hotspot.asm.*; - - -public class AMD64Helper implements CPUHelper { - public Disassembler createDisassembler(long startPc, byte[] code) { - // FIXME: no disassembler yet - return null; - } - - public Register getIntegerRegister(int num) { - return AMD64Registers.getRegister(num); - } - - public Register getFloatRegister(int num) { - return AMD64FloatRegisters.getRegister(num); - } - - public Register getStackPointer() { - return AMD64Registers.RSP; - } - - public Register getFramePointer() { - return AMD64Registers.RBP; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64Register.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.amd64; - -import sun.jvm.hotspot.asm.*; - -public class AMD64Register extends Register { - protected String name; - public AMD64Register(int num, String name) { - super(num); - this.name = name; - } - public int getNumberOfRegisters() { - return AMD64Registers.getNumberOfRegisters(); - } - public String toString() { - return name; - } - public boolean isFramePointer() { - return number == 5; //rbp - } - public boolean isStackPointer() { - return number == 4; //rsp - } - public boolean isFloat() { - return false; - } - public boolean isSegmentPointer() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64Registers.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.amd64; - -import sun.jvm.hotspot.utilities.*; - -public class AMD64Registers { - public static final int NUM_REGISTERS = 16; - - public static final AMD64Register RAX; - public static final AMD64Register RCX; - public static final AMD64Register RDX; - public static final AMD64Register RBX; - public static final AMD64Register RSP; - public static final AMD64Register RBP; - public static final AMD64Register RSI; - public static final AMD64Register RDI; - public static final AMD64Register R8; - public static final AMD64Register R9; - public static final AMD64Register R10; - public static final AMD64Register R11; - public static final AMD64Register R12; - public static final AMD64Register R13; - public static final AMD64Register R14; - public static final AMD64Register R15; - - private static final AMD64Register[] registers; - - static { - RAX = new AMD64Register(0, "rax"); - RCX = new AMD64Register(1, "rcx"); - RDX = new AMD64Register(2, "rdx"); - RBX = new AMD64Register(3, "rbx"); - RSP = new AMD64Register(4, "rsp"); - RBP = new AMD64Register(5, "rbp"); - RSI = new AMD64Register(6, "rsi"); - RDI = new AMD64Register(7, "rdi"); - R8 = new AMD64Register(8, "r8" ); - R9 = new AMD64Register(9, "r9" ); - R10 = new AMD64Register(10,"r10"); - R11 = new AMD64Register(11,"r11"); - R12 = new AMD64Register(12,"r12"); - R13 = new AMD64Register(13,"r13"); - R14 = new AMD64Register(14,"r14"); - R15 = new AMD64Register(15,"r15"); - registers = new AMD64Register[] { - RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, - R8, R9, R10, R11, R12, R13, R14, R15 - }; - } - - public static int getNumberOfRegisters() { - return NUM_REGISTERS; - } - - public static AMD64Register getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers[regNum]; - } - - //Return the register name - public static String getRegisterName(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers[regNum].toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ia64/IA64FloatRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.ia64; - -import sun.jvm.hotspot.asm.Register; -import sun.jvm.hotspot.utilities.Assert; - -public class IA64FloatRegister extends IA64Register { - - public IA64FloatRegister(int number) { - super(number); - } - - public int getNumber() { - return number; - } - - public static final int SINGLE_PRECISION = 1; - public static final int DOUBLE_PRECISION = 2; - public static final int QUAD_PRECISION = 3; - - public int getNumber(int width) { - return number; - } - - private static final int nofRegisters = 128; - public int getNumberOfRegisters() { - return nofRegisters; - } - - public boolean isFloat() { - return true; - } - - public boolean isFramePointer() { - return false; - } - - public boolean isStackPointer() { - return false; - } - - public boolean isValid() { - return number >= 0 && number < nofRegisters; - } - - public String toString() { - return IA64FloatRegisters.getRegisterName(number); - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ia64/IA64FloatRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.ia64; - -import sun.jvm.hotspot.utilities.Assert; - -public class IA64FloatRegisters { - public static int getNumRegisters() { - return 128; - } - - public static IA64FloatRegister getRegister(int i) { - Assert.that(i >= 0 && i < 128, "float register number is invalid"); - return registers[i]; - } - - public static String getRegisterName(int i) { - return "%f" + i; - } - - public static final IA64FloatRegister F0; - public static final IA64FloatRegister F1; - public static final IA64FloatRegister F2; - public static final IA64FloatRegister F3; - public static final IA64FloatRegister F4; - public static final IA64FloatRegister F5; - public static final IA64FloatRegister F6; - public static final IA64FloatRegister F7; - public static final IA64FloatRegister F8; - public static final IA64FloatRegister F9; - public static final IA64FloatRegister F10; - public static final IA64FloatRegister F11; - public static final IA64FloatRegister F12; - public static final IA64FloatRegister F13; - public static final IA64FloatRegister F14; - public static final IA64FloatRegister F15; - public static final IA64FloatRegister F16; - public static final IA64FloatRegister F17; - public static final IA64FloatRegister F18; - public static final IA64FloatRegister F19; - public static final IA64FloatRegister F20; - public static final IA64FloatRegister F21; - public static final IA64FloatRegister F22; - public static final IA64FloatRegister F23; - public static final IA64FloatRegister F24; - public static final IA64FloatRegister F25; - public static final IA64FloatRegister F26; - public static final IA64FloatRegister F27; - public static final IA64FloatRegister F28; - public static final IA64FloatRegister F29; - public static final IA64FloatRegister F30; - public static final IA64FloatRegister F31; - public static final IA64FloatRegister F32; - public static final IA64FloatRegister F33; - public static final IA64FloatRegister F34; - public static final IA64FloatRegister F35; - public static final IA64FloatRegister F36; - public static final IA64FloatRegister F37; - public static final IA64FloatRegister F38; - public static final IA64FloatRegister F39; - public static final IA64FloatRegister F40; - public static final IA64FloatRegister F41; - public static final IA64FloatRegister F42; - public static final IA64FloatRegister F43; - public static final IA64FloatRegister F44; - public static final IA64FloatRegister F45; - public static final IA64FloatRegister F46; - public static final IA64FloatRegister F47; - public static final IA64FloatRegister F48; - public static final IA64FloatRegister F49; - public static final IA64FloatRegister F50; - public static final IA64FloatRegister F51; - public static final IA64FloatRegister F52; - public static final IA64FloatRegister F53; - public static final IA64FloatRegister F54; - public static final IA64FloatRegister F55; - public static final IA64FloatRegister F56; - public static final IA64FloatRegister F57; - public static final IA64FloatRegister F58; - public static final IA64FloatRegister F59; - public static final IA64FloatRegister F60; - public static final IA64FloatRegister F61; - public static final IA64FloatRegister F62; - public static final IA64FloatRegister F63; - public static final IA64FloatRegister F64; - public static final IA64FloatRegister F65; - public static final IA64FloatRegister F66; - public static final IA64FloatRegister F67; - public static final IA64FloatRegister F68; - public static final IA64FloatRegister F69; - public static final IA64FloatRegister F70; - public static final IA64FloatRegister F71; - public static final IA64FloatRegister F72; - public static final IA64FloatRegister F73; - public static final IA64FloatRegister F74; - public static final IA64FloatRegister F75; - public static final IA64FloatRegister F76; - public static final IA64FloatRegister F77; - public static final IA64FloatRegister F78; - public static final IA64FloatRegister F79; - public static final IA64FloatRegister F80; - public static final IA64FloatRegister F81; - public static final IA64FloatRegister F82; - public static final IA64FloatRegister F83; - public static final IA64FloatRegister F84; - public static final IA64FloatRegister F85; - public static final IA64FloatRegister F86; - public static final IA64FloatRegister F87; - public static final IA64FloatRegister F88; - public static final IA64FloatRegister F89; - public static final IA64FloatRegister F90; - public static final IA64FloatRegister F91; - public static final IA64FloatRegister F92; - public static final IA64FloatRegister F93; - public static final IA64FloatRegister F94; - public static final IA64FloatRegister F95; - public static final IA64FloatRegister F96; - public static final IA64FloatRegister F97; - public static final IA64FloatRegister F98; - public static final IA64FloatRegister F99; - public static final IA64FloatRegister F100; - public static final IA64FloatRegister F101; - public static final IA64FloatRegister F102; - public static final IA64FloatRegister F103; - public static final IA64FloatRegister F104; - public static final IA64FloatRegister F105; - public static final IA64FloatRegister F106; - public static final IA64FloatRegister F107; - public static final IA64FloatRegister F108; - public static final IA64FloatRegister F109; - public static final IA64FloatRegister F110; - public static final IA64FloatRegister F111; - public static final IA64FloatRegister F112; - public static final IA64FloatRegister F113; - public static final IA64FloatRegister F114; - public static final IA64FloatRegister F115; - public static final IA64FloatRegister F116; - public static final IA64FloatRegister F117; - public static final IA64FloatRegister F118; - public static final IA64FloatRegister F119; - public static final IA64FloatRegister F120; - public static final IA64FloatRegister F121; - public static final IA64FloatRegister F122; - public static final IA64FloatRegister F123; - public static final IA64FloatRegister F124; - public static final IA64FloatRegister F125; - public static final IA64FloatRegister F126; - public static final IA64FloatRegister F127; - public static final int NUM_REGISTERS = 128; - private static final IA64FloatRegister registers[]; - - static { - F0 = new IA64FloatRegister(0); - F1 = new IA64FloatRegister(1); - F2 = new IA64FloatRegister(2); - F3 = new IA64FloatRegister(3); - F4 = new IA64FloatRegister(4); - F5 = new IA64FloatRegister(5); - F6 = new IA64FloatRegister(6); - F7 = new IA64FloatRegister(7); - F8 = new IA64FloatRegister(8); - F9 = new IA64FloatRegister(9); - F10 = new IA64FloatRegister(10); - F11 = new IA64FloatRegister(11); - F12 = new IA64FloatRegister(12); - F13 = new IA64FloatRegister(13); - F14 = new IA64FloatRegister(14); - F15 = new IA64FloatRegister(15); - F16 = new IA64FloatRegister(16); - F17 = new IA64FloatRegister(17); - F18 = new IA64FloatRegister(18); - F19 = new IA64FloatRegister(19); - F20 = new IA64FloatRegister(20); - F21 = new IA64FloatRegister(21); - F22 = new IA64FloatRegister(22); - F23 = new IA64FloatRegister(23); - F24 = new IA64FloatRegister(24); - F25 = new IA64FloatRegister(25); - F26 = new IA64FloatRegister(26); - F27 = new IA64FloatRegister(27); - F28 = new IA64FloatRegister(28); - F29 = new IA64FloatRegister(29); - F30 = new IA64FloatRegister(30); - F31 = new IA64FloatRegister(31); - F32 = new IA64FloatRegister(32); - F33 = new IA64FloatRegister(33); - F34 = new IA64FloatRegister(34); - F35 = new IA64FloatRegister(35); - F36 = new IA64FloatRegister(36); - F37 = new IA64FloatRegister(37); - F38 = new IA64FloatRegister(38); - F39 = new IA64FloatRegister(39); - F40 = new IA64FloatRegister(40); - F41 = new IA64FloatRegister(41); - F42 = new IA64FloatRegister(42); - F43 = new IA64FloatRegister(43); - F44 = new IA64FloatRegister(44); - F45 = new IA64FloatRegister(45); - F46 = new IA64FloatRegister(46); - F47 = new IA64FloatRegister(47); - F48 = new IA64FloatRegister(48); - F49 = new IA64FloatRegister(49); - F50 = new IA64FloatRegister(50); - F51 = new IA64FloatRegister(51); - F52 = new IA64FloatRegister(52); - F53 = new IA64FloatRegister(53); - F54 = new IA64FloatRegister(54); - F55 = new IA64FloatRegister(55); - F56 = new IA64FloatRegister(56); - F57 = new IA64FloatRegister(57); - F58 = new IA64FloatRegister(58); - F59 = new IA64FloatRegister(59); - F60 = new IA64FloatRegister(60); - F61 = new IA64FloatRegister(61); - F62 = new IA64FloatRegister(62); - F63 = new IA64FloatRegister(63); - F64 = new IA64FloatRegister(64); - F65 = new IA64FloatRegister(65); - F66 = new IA64FloatRegister(66); - F67 = new IA64FloatRegister(67); - F68 = new IA64FloatRegister(68); - F69 = new IA64FloatRegister(69); - F70 = new IA64FloatRegister(70); - F71 = new IA64FloatRegister(71); - F72 = new IA64FloatRegister(72); - F73 = new IA64FloatRegister(73); - F74 = new IA64FloatRegister(74); - F75 = new IA64FloatRegister(75); - F76 = new IA64FloatRegister(76); - F77 = new IA64FloatRegister(77); - F78 = new IA64FloatRegister(78); - F79 = new IA64FloatRegister(79); - F80 = new IA64FloatRegister(80); - F81 = new IA64FloatRegister(81); - F82 = new IA64FloatRegister(82); - F83 = new IA64FloatRegister(83); - F84 = new IA64FloatRegister(84); - F85 = new IA64FloatRegister(85); - F86 = new IA64FloatRegister(86); - F87 = new IA64FloatRegister(87); - F88 = new IA64FloatRegister(88); - F89 = new IA64FloatRegister(89); - F90 = new IA64FloatRegister(90); - F91 = new IA64FloatRegister(91); - F92 = new IA64FloatRegister(92); - F93 = new IA64FloatRegister(93); - F94 = new IA64FloatRegister(94); - F95 = new IA64FloatRegister(95); - F96 = new IA64FloatRegister(96); - F97 = new IA64FloatRegister(97); - F98 = new IA64FloatRegister(98); - F99 = new IA64FloatRegister(99); - F100 = new IA64FloatRegister(100); - F101 = new IA64FloatRegister(101); - F102 = new IA64FloatRegister(102); - F103 = new IA64FloatRegister(103); - F104 = new IA64FloatRegister(104); - F105 = new IA64FloatRegister(105); - F106 = new IA64FloatRegister(106); - F107 = new IA64FloatRegister(107); - F108 = new IA64FloatRegister(108); - F109 = new IA64FloatRegister(109); - F110 = new IA64FloatRegister(110); - F111 = new IA64FloatRegister(111); - F112 = new IA64FloatRegister(112); - F113 = new IA64FloatRegister(113); - F114 = new IA64FloatRegister(114); - F115 = new IA64FloatRegister(115); - F116 = new IA64FloatRegister(116); - F117 = new IA64FloatRegister(117); - F118 = new IA64FloatRegister(118); - F119 = new IA64FloatRegister(119); - F120 = new IA64FloatRegister(120); - F121 = new IA64FloatRegister(121); - F122 = new IA64FloatRegister(122); - F123 = new IA64FloatRegister(123); - F124 = new IA64FloatRegister(124); - F125 = new IA64FloatRegister(125); - F126 = new IA64FloatRegister(126); - F127 = new IA64FloatRegister(127); - - registers = (new IA64FloatRegister[] { - F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, - F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, - F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, - F30, F31, F32, F33, F34, F35, F36, F37, F38, F39, - F40, F41, F42, F43, F44, F45, F46, F47, F48, F49, - F50, F51, F52, F53, F54, F55, F56, F57, F58, F59, - F60, F61, F62, F63, F64, F65, F66, F67, F68, F69, - F70, F71, F72, F73, F74, F75, F76, F77, F78, F79, - F80, F81, F82, F83, F84, F85, F86, F87, F88, F89, - F90, F91, F92, F93, F94, F95, F96, F97, F98, F99, - F100, F101, F102, F103, F104, F105, F106, F107, F108, F109, - F110, F111, F112, F113, F114, F115, F116, F117, F118, F119, - F120, F121, F122, F123, F124, F125, F126, F127 - }); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ia64/IA64Helper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.ia64; - -import sun.jvm.hotspot.asm.*; - -public class IA64Helper implements CPUHelper { - public Disassembler createDisassembler(long startPc, byte[] code) { - // FIXME: IA64 disassembler not implemented - return null; - } - - public Register getIntegerRegister(int num) { - // FIXME: IA64 disassembler not implemented - return null; - } - - public Register getFloatRegister(int num) { - // FIXME: IA64 disassembler not implemented - return null; - } - - public Register getStackPointer() { - // FIXME: IA64 disassembler not implemented - return null; - } - - public Register getFramePointer() { - // FIXME: IA64 disassembler not implemented - return null; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ia64/IA64Register.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.ia64; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.utilities.*; - -public class IA64Register extends Register { - - // - private static final int STACKED_BASE = 32; - private static final int STACKED_END = 127; - - // We put application registers here too rather than separate types - private static final int APPL_BASE = 128; - - private static final int nofRegisters = 129; // total number of registers - - /** Constructor for an explicitly numbered register */ - public IA64Register(int number) { - super(number); - } - - public int getNumberOfRegisters() { - return nofRegisters; - } - - public boolean isStacked() { - return (32 <= getNumber()); - } - - /** NOTE: this returns an offset in BYTES in this system! */ - public long spOffsetInSavedWindow() { - return 0; - } - - public String toString() { - return IA64Registers.getRegisterName(number); - } - - public boolean isFramePointer() { - return number == APPL_BASE; - } - - public boolean isStackPointer() { - return number == 12; - } - - public boolean isFloat() { - return false; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/ia64/IA64Registers.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,353 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.ia64; - -import sun.jvm.hotspot.utilities.*; - -public class IA64Registers { - - public static final IA64Register GR0; - public static final IA64Register GR1; - public static final IA64Register GR2; - public static final IA64Register GR3; - public static final IA64Register GR4; - public static final IA64Register GR5; - public static final IA64Register GR6; - public static final IA64Register GR7; - public static final IA64Register GR8; - public static final IA64Register GR9; - public static final IA64Register GR10; - public static final IA64Register GR11; - public static final IA64Register GR12; - public static final IA64Register GR13; - public static final IA64Register GR14; - public static final IA64Register GR15; - public static final IA64Register GR16; - public static final IA64Register GR17; - public static final IA64Register GR18; - public static final IA64Register GR19; - public static final IA64Register GR20; - public static final IA64Register GR21; - public static final IA64Register GR22; - public static final IA64Register GR23; - public static final IA64Register GR24; - public static final IA64Register GR25; - public static final IA64Register GR26; - public static final IA64Register GR27; - public static final IA64Register GR28; - public static final IA64Register GR29; - public static final IA64Register GR30; - public static final IA64Register GR31; - public static final IA64Register GR32; - public static final IA64Register GR33; - public static final IA64Register GR34; - public static final IA64Register GR35; - public static final IA64Register GR36; - public static final IA64Register GR37; - public static final IA64Register GR38; - public static final IA64Register GR39; - public static final IA64Register GR40; - public static final IA64Register GR41; - public static final IA64Register GR42; - public static final IA64Register GR43; - public static final IA64Register GR44; - public static final IA64Register GR45; - public static final IA64Register GR46; - public static final IA64Register GR47; - public static final IA64Register GR48; - public static final IA64Register GR49; - public static final IA64Register GR50; - public static final IA64Register GR51; - public static final IA64Register GR52; - public static final IA64Register GR53; - public static final IA64Register GR54; - public static final IA64Register GR55; - public static final IA64Register GR56; - public static final IA64Register GR57; - public static final IA64Register GR58; - public static final IA64Register GR59; - public static final IA64Register GR60; - public static final IA64Register GR61; - public static final IA64Register GR62; - public static final IA64Register GR63; - public static final IA64Register GR64; - public static final IA64Register GR65; - public static final IA64Register GR66; - public static final IA64Register GR67; - public static final IA64Register GR68; - public static final IA64Register GR69; - public static final IA64Register GR70; - public static final IA64Register GR71; - public static final IA64Register GR72; - public static final IA64Register GR73; - public static final IA64Register GR74; - public static final IA64Register GR75; - public static final IA64Register GR76; - public static final IA64Register GR77; - public static final IA64Register GR78; - public static final IA64Register GR79; - public static final IA64Register GR80; - public static final IA64Register GR81; - public static final IA64Register GR82; - public static final IA64Register GR83; - public static final IA64Register GR84; - public static final IA64Register GR85; - public static final IA64Register GR86; - public static final IA64Register GR87; - public static final IA64Register GR88; - public static final IA64Register GR89; - public static final IA64Register GR90; - public static final IA64Register GR91; - public static final IA64Register GR92; - public static final IA64Register GR93; - public static final IA64Register GR94; - public static final IA64Register GR95; - public static final IA64Register GR96; - public static final IA64Register GR97; - public static final IA64Register GR98; - public static final IA64Register GR99; - public static final IA64Register GR100; - public static final IA64Register GR101; - public static final IA64Register GR102; - public static final IA64Register GR103; - public static final IA64Register GR104; - public static final IA64Register GR105; - public static final IA64Register GR106; - public static final IA64Register GR107; - public static final IA64Register GR108; - public static final IA64Register GR109; - public static final IA64Register GR110; - public static final IA64Register GR111; - public static final IA64Register GR112; - public static final IA64Register GR113; - public static final IA64Register GR114; - public static final IA64Register GR115; - public static final IA64Register GR116; - public static final IA64Register GR117; - public static final IA64Register GR118; - public static final IA64Register GR119; - public static final IA64Register GR120; - public static final IA64Register GR121; - public static final IA64Register GR122; - public static final IA64Register GR123; - public static final IA64Register GR124; - public static final IA64Register GR125; - public static final IA64Register GR126; - public static final IA64Register GR127; - - public static final IA64Register AR_BSP; - - public static final int NUM_REGISTERS = 129; - private static final IA64Register registers[]; - - static { - GR0 = new IA64Register(0); - GR1 = new IA64Register(1); - GR2 = new IA64Register(2); - GR3 = new IA64Register(3); - GR4 = new IA64Register(4); - GR5 = new IA64Register(5); - GR6 = new IA64Register(6); - GR7 = new IA64Register(7); - GR8 = new IA64Register(8); - GR9 = new IA64Register(9); - GR10 = new IA64Register(10); - GR11 = new IA64Register(11); - GR12 = new IA64Register(12); - GR13 = new IA64Register(13); - GR14 = new IA64Register(14); - GR15 = new IA64Register(15); - GR16 = new IA64Register(16); - GR17 = new IA64Register(17); - GR18 = new IA64Register(18); - GR19 = new IA64Register(19); - GR20 = new IA64Register(20); - GR21 = new IA64Register(21); - GR22 = new IA64Register(22); - GR23 = new IA64Register(23); - GR24 = new IA64Register(24); - GR25 = new IA64Register(25); - GR26 = new IA64Register(26); - GR27 = new IA64Register(27); - GR28 = new IA64Register(28); - GR29 = new IA64Register(29); - GR30 = new IA64Register(30); - GR31 = new IA64Register(31); - GR32 = new IA64Register(32); - GR33 = new IA64Register(33); - GR34 = new IA64Register(34); - GR35 = new IA64Register(35); - GR36 = new IA64Register(36); - GR37 = new IA64Register(37); - GR38 = new IA64Register(38); - GR39 = new IA64Register(39); - GR40 = new IA64Register(40); - GR41 = new IA64Register(41); - GR42 = new IA64Register(42); - GR43 = new IA64Register(43); - GR44 = new IA64Register(44); - GR45 = new IA64Register(45); - GR46 = new IA64Register(46); - GR47 = new IA64Register(47); - GR48 = new IA64Register(48); - GR49 = new IA64Register(49); - GR50 = new IA64Register(50); - GR51 = new IA64Register(51); - GR52 = new IA64Register(52); - GR53 = new IA64Register(53); - GR54 = new IA64Register(54); - GR55 = new IA64Register(55); - GR56 = new IA64Register(56); - GR57 = new IA64Register(57); - GR58 = new IA64Register(58); - GR59 = new IA64Register(59); - GR60 = new IA64Register(60); - GR61 = new IA64Register(61); - GR62 = new IA64Register(62); - GR63 = new IA64Register(63); - GR64 = new IA64Register(64); - GR65 = new IA64Register(65); - GR66 = new IA64Register(66); - GR67 = new IA64Register(67); - GR68 = new IA64Register(68); - GR69 = new IA64Register(69); - GR70 = new IA64Register(70); - GR71 = new IA64Register(71); - GR72 = new IA64Register(72); - GR73 = new IA64Register(73); - GR74 = new IA64Register(74); - GR75 = new IA64Register(75); - GR76 = new IA64Register(76); - GR77 = new IA64Register(77); - GR78 = new IA64Register(78); - GR79 = new IA64Register(79); - GR80 = new IA64Register(80); - GR81 = new IA64Register(81); - GR82 = new IA64Register(82); - GR83 = new IA64Register(83); - GR84 = new IA64Register(84); - GR85 = new IA64Register(85); - GR86 = new IA64Register(86); - GR87 = new IA64Register(87); - GR88 = new IA64Register(88); - GR89 = new IA64Register(89); - GR90 = new IA64Register(90); - GR91 = new IA64Register(91); - GR92 = new IA64Register(92); - GR93 = new IA64Register(93); - GR94 = new IA64Register(94); - GR95 = new IA64Register(95); - GR96 = new IA64Register(96); - GR97 = new IA64Register(97); - GR98 = new IA64Register(98); - GR99 = new IA64Register(99); - GR100 = new IA64Register(100); - GR101 = new IA64Register(101); - GR102 = new IA64Register(102); - GR103 = new IA64Register(103); - GR104 = new IA64Register(104); - GR105 = new IA64Register(105); - GR106 = new IA64Register(106); - GR107 = new IA64Register(107); - GR108 = new IA64Register(108); - GR109 = new IA64Register(109); - GR110 = new IA64Register(110); - GR111 = new IA64Register(111); - GR112 = new IA64Register(112); - GR113 = new IA64Register(113); - GR114 = new IA64Register(114); - GR115 = new IA64Register(115); - GR116 = new IA64Register(116); - GR117 = new IA64Register(117); - GR118 = new IA64Register(118); - GR119 = new IA64Register(119); - GR120 = new IA64Register(120); - GR121 = new IA64Register(121); - GR122 = new IA64Register(122); - GR123 = new IA64Register(123); - GR124 = new IA64Register(124); - GR125 = new IA64Register(125); - GR126 = new IA64Register(126); - GR127 = new IA64Register(127); - - AR_BSP = new IA64Register(128); - - registers = (new IA64Register[] { - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, GR8, GR9, - GR10, GR11, GR12, GR13, GR14, GR15, GR16, GR17, GR18, GR19, - GR20, GR21, GR22, GR23, GR24, GR25, GR26, GR27, GR28, GR29, - GR30, GR31, GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, GR48, GR49, - GR50, GR51, GR52, GR53, GR54, GR55, GR56, GR57, GR58, GR59, - GR60, GR61, GR62, GR63, GR64, GR65, GR66, GR67, GR68, GR69, - GR70, GR71, GR72, GR73, GR74, GR75, GR76, GR77, GR78, GR79, - GR80, GR81, GR82, GR83, GR84, GR85, GR86, GR87, GR88, GR89, - GR90, GR91, GR92, GR93, GR94, GR95, GR96, GR97, GR98, GR99, - GR100, GR101, GR102, GR103, GR104, GR105, GR106, GR107, GR108, GR109, - GR110, GR111, GR112, GR113, GR114, GR115, GR116, GR117, GR118, GR119, - GR120, GR121, GR122, GR123, GR124, GR125, GR126, GR127, AR_BSP - }); - - } - - public static final IA64Register FP = AR_BSP; - public static final IA64Register SP = GR12; - - - /** Prefer to use this instead of the constant above */ - public static int getNumRegisters() { - return NUM_REGISTERS; - } - - - public static String getRegisterName(int regNum) { - if (regNum < 0 || regNum >= NUM_REGISTERS) { - return "[Illegal register " + regNum + "]"; - } - - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - - if (regNum == 128 ) { - return "BSP"; - } - - if (regNum == 12) { - return "SP"; - } - - return "R" + regNum; - - } - - public static IA64Register getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid register number!"); - } - - return registers[regNum]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/AlternateSpaceLdstubDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class AlternateSpaceLdstubDecoder extends LdstubDecoder { - AlternateSpaceLdstubDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - setAddressSpace(instruction, addr); - return factory.newLdstubInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/AlternateSpaceLoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class AlternateSpaceLoadDecoder extends LoadDecoder { - AlternateSpaceLoadDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - setAddressSpace(instruction, addr); - return factory.newLoadInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/AlternateSpaceStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class AlternateSpaceStoreDecoder extends StoreDecoder { - AlternateSpaceStoreDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - protected Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - setAddressSpace(instruction, addr); - return factory.newStoreInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/AlternateSpaceSwapDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class AlternateSpaceSwapDecoder extends SwapDecoder { - AlternateSpaceSwapDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - setAddressSpace(instruction, addr); - return factory.newSwapInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/ArithmeticDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class ArithmeticDecoder extends Format3ADecoder { - ArithmeticDecoder(int op3, String name, int rtlOperation) { - super(op3, name, rtlOperation); - } - - Instruction decodeFormat3AInstruction(int instruction, - SPARCRegister rs1, - ImmediateOrRegister operand2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newArithmeticInstruction(name, op3, rtlOperation, rs1, operand2, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/BranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class BranchDecoder extends InstructionDecoder { - - // format 2 - condition code names. - // Appendix F - Opcodes and Condition Codes - Page 231 - Table F-7. - static final String integerConditionNames[] = { - "bn", "be", "ble", "bl", "bleu", "bcs", "bneg", "bvs", - "ba", "bne", "bg", "bge", "bgu", "bcc", "bpos", "bvc" - }; - - static final String integerAnnuledConditionNames[] = { - "bn,a", "be,a", "ble,a", "bl,a", "bleu,a", "bcs,a", "bneg,a", "bvs,a", - "ba,a", "bne,a", "bg,a", "bge,a", "bgu,a", "bcc,a", "bpos,a", "bvc,a" - }; - - // format 2 - condition code names. - // Appendix F - Opcodes and Condition Codes - Page 231 - Table F-7. - static final String floatConditionNames[] = { - "fbn", "fbne", "fblg", "fbul", "fbl", "fbug", "fbg", "fbu", - "fba", "fbe", "fbue", "fbge", "fbuge", "fble", "fbule", "fbo" - }; - - static final String floatAnnuledConditionNames[] = { - "fbn,a", "fbne,a", "fblg,a", "fbul,a", "fbl,a", "fbug,a", "fbg,a", "fbu,a", - "fba,a", "fbe,a", "fbue,a", "fbge,a", "fbuge,a", "fble,a", "fbule,a", "fbo,a" - }; - - static boolean getAnnuledBit(int instruction) { - return (instruction & ANNUL_MASK) != 0; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - boolean isAnnuled = getAnnuledBit(instruction); - int conditionCode = getConditionCode(instruction); - String conditionName = getConditionName(conditionCode, isAnnuled); - int offset = extractSignedIntFromNBits(instruction, 22); - // word align the offset by right shifting 2 bits - offset <<= 2; - PCRelativeAddress addr = new PCRelativeAddress(offset); - return factory.newBranchInstruction(conditionName, addr, isAnnuled, conditionCode); - } - - abstract String getConditionName(int conditionCode, boolean isAnnuled); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/CallDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class CallDecoder extends InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - // sign extend, word align the offset - int offset = (instruction & DISP_30_MASK) << 2; - return factory.newCallInstruction(new PCRelativeAddress(offset)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/CoprocessorBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -// format 2 - condition code names. -// Appendix F - Opcodes and Condition Codes - Page 231 - Table F-7. - -class CoprocessorBranchDecoder extends BranchDecoder { - private static final String coprocessorConditionNames[] = { - "cbn", "cb123", "cb12", "cb13", "cb1", "cb23", "cb2", "cb3", - "cba", "cb0", "cb03", "cb02", "cb023", "cb01", "cb013", "cb012" - }; - - private static final String coprocessorAnnuledConditionNames[] = { - "cbn,a", "cb123,a", "cb12,a", "cb13,a", "cb1,a", "cb23,a", "cb2,a", "cb3,a", - "cba,a", "cb0,a", "cb03,a", "cb02,a", "cb023,a", "cb01,a", "cb013,a", "cb012,a" - }; - - String getConditionName(int conditionCode, boolean isAnnuled) { - return isAnnuled ? coprocessorAnnuledConditionNames[conditionCode] - : coprocessorConditionNames[conditionCode]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/CoprocessorDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class CoprocessorDecoder extends InstructionDecoder { - private int op3; - CoprocessorDecoder(int op3) { - this.op3 = op3; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - int rs1Num = getSourceRegister1(instruction); - int rs2Num = getSourceRegister2(instruction); - int rdNum = getDestinationRegister(instruction); - - return factory.newCoprocessorInstruction(instruction, op3, - (instruction & OPC_MASK) >> OPF_START_BIT, - rs1Num, rs2Num, rdNum); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FP2RegisterDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -class FP2RegisterDecoder extends FloatDecoder { - - FP2RegisterDecoder(int opf, String name, int srcType, int resultType) { - super(opf, name, srcType, resultType); - } - - Instruction decodeFloatInstruction(int instruction, - SPARCRegister rs1, SPARCRegister rs2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - if (Assert.ASSERTS_ENABLED) - Assert.that(rs2.isFloat() && rd.isFloat(), "rs2, rd have to be float registers"); - - return factory.newFP2RegisterInstruction(name, opf, (SPARCFloatRegister)rs2, (SPARCFloatRegister)rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FPArithmeticDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -class FPArithmeticDecoder extends FloatDecoder { - private final int rtlOperation; - - FPArithmeticDecoder(int opf, String name, int rtlOperation, - int src1Type, int src2Type, int resultType) { - super(opf, name, src1Type, src2Type, resultType); - this.rtlOperation = rtlOperation; - } - - Instruction decodeFloatInstruction(int instruction, - SPARCRegister rs1, SPARCRegister rs2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - if (Assert.ASSERTS_ENABLED) - Assert.that(rs1.isFloat() && rs2.isFloat() && rd.isFloat(), "rs1, rs2 and rd must be floats"); - return factory.newFPArithmeticInstruction(name, opf, rtlOperation, - (SPARCFloatRegister)rs1, - (SPARCFloatRegister)rs2, - (SPARCFloatRegister)rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FPMoveDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -class FPMoveDecoder extends FloatDecoder { - - FPMoveDecoder(int opf, String name, int srcType, int resultType) { - super(opf, name, srcType, resultType); - } - - Instruction decodeFloatInstruction(int instruction, - SPARCRegister rs1, SPARCRegister rs2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - if (Assert.ASSERTS_ENABLED) - Assert.that(rs2.isFloat() && rd.isFloat(), "rs2, rd have to be float registers"); - - return factory.newFPMoveInstruction(name, opf, (SPARCFloatRegister)rs2, (SPARCFloatRegister)rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FPopDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class FPopDecoder extends InstructionDecoder { - abstract InstructionDecoder getOpfDecoder(int opf); - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - int opf = getOpf(instruction); - InstructionDecoder decoder = getOpfDecoder(opf); - return (decoder == null) ? factory.newIllegalInstruction(instruction) - : decoder.decode(instruction, factory); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FloatBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -class FloatBranchDecoder extends BranchDecoder { - String getConditionName(int conditionCode, boolean isAnnuled) { - return isAnnuled ? floatAnnuledConditionNames[conditionCode] - : floatConditionNames[conditionCode]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FloatDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class FloatDecoder extends InstructionDecoder { - final int opf; - final String name; - final int numSources; // 1 or 2; - final int src1Type; // RTLDT_FL_SINGLE, _DOUBLE, _QUAD - final int src2Type; // RTLDT_FL_SINGLE, _DOUBLE, _QUAD - final int resultType; // RTLDT_FL_SINGLE, _DOUBLE, _QUAD - - FloatDecoder(int opf, String name, int src1Type, int src2Type, int resultType) { - this.opf = opf; - this.name = name; - numSources = 2; - this.src1Type = src1Type; - this.src2Type = src2Type; - this.resultType = resultType; - } - - FloatDecoder(int opf, String name, int src2Type, int resultType) { - this.opf = opf; - this.name = name; - numSources = 1; - this.src1Type = RTLOP_UNKNOWN; - this.src2Type = src2Type; - this.resultType = resultType; - } - - abstract Instruction decodeFloatInstruction(int instruction, - SPARCRegister rs1, SPARCRegister rs2, SPARCRegister rd, - SPARCInstructionFactory factory); - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - int rs1Num = getSourceRegister1(instruction); - int rs2Num = getSourceRegister2(instruction); - int rdNum = getDestinationRegister(instruction); - - SPARCRegister rs1 = null; - if (numSources == 2) { - rs1 = RegisterDecoder.decode(src1Type, rs1Num); - if (rs1 == null) { - return factory.newIllegalInstruction(instruction); - } - } - - SPARCRegister rd = RegisterDecoder.decode(resultType, rdNum); - SPARCRegister rs2 = RegisterDecoder.decode(src2Type, rs2Num); - if (rd == null || rs2 == null) { - return factory.newIllegalInstruction(instruction); - } - - return decodeFloatInstruction(instruction, rs1, rs2, rd, factory); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/FlushDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class FlushDecoder extends MemoryInstructionDecoder { - FlushDecoder() { - super(FLUSH, "flush", RTLDT_UNKNOWN); - } - - Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - return factory.newFlushInstruction(addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/Format3ADecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class Format3ADecoder extends InstructionDecoder - implements /* imports */ RTLOperations { - final int op3; - final String name; - final int rtlOperation; - - Format3ADecoder(int op3, String name, int rtlOperation) { - this.op3 = op3; - this.name = name; - this.rtlOperation = rtlOperation; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction)); - ImmediateOrRegister operand2 = getOperand2(instruction); - return decodeFormat3AInstruction(instruction, rs1, operand2, rd, factory); - } - - abstract Instruction decodeFormat3AInstruction(int instruction, - SPARCRegister rs1, - ImmediateOrRegister operand2, - SPARCRegister rd, - SPARCInstructionFactory factory); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/IllegalInstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class IllegalInstructionDecoder extends InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - return factory.newIllegalInstruction(instruction); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/InstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -// basic instruction decoder class -abstract class InstructionDecoder implements /* imports */ SPARCOpcodes , RTLDataTypes, RTLOperations { - // some general utility functions - for format 2, 3 & 3A instructions - - static int extractSignedIntFromNBits(int value, int num_bits) { - return (value << (32 - num_bits)) >> (32 - num_bits); - } - - // "rs1" - static int getSourceRegister1(int instruction) { - return (instruction & RS1_MASK) >>> RS1_START_BIT; - } - - // "rs2" - static int getSourceRegister2(int instruction) { - return (instruction & RS2_MASK); - } - - // "rd" - static int getDestinationRegister(int instruction) { - return (instruction & RD_MASK) >>> RD_START_BIT; - } - - static int getConditionCode(int instruction) { - return (instruction & CONDITION_CODE_MASK) >>> CONDITION_CODE_START_BIT; - } - - // "i" bit - used to indicate whether second component in an indirect - // address is immediate value or a register. (format 3 & 3A). - - static boolean isIBitSet(int instruction) { - return (instruction & I_MASK) != 0; - } - - static ImmediateOrRegister getOperand2(int instruction) { - boolean iBit = isIBitSet(instruction); - ImmediateOrRegister operand2 = null; - if (iBit) { - operand2 = new Immediate(new Short((short)extractSignedIntFromNBits(instruction, 13))); - } else { - operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - } - return operand2; - } - - // "opf" - floating point operation code. - static int getOpf(int instruction) { - return (instruction & OPF_MASK) >>> OPF_START_BIT; - } - - abstract Instruction decode(int instruction, SPARCInstructionFactory factory); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/IntegerBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -class IntegerBranchDecoder extends BranchDecoder { - String getConditionName(int conditionCode, boolean isAnnuled) { - return isAnnuled ? integerAnnuledConditionNames[conditionCode] - : integerConditionNames[conditionCode]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/JmplDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class JmplDecoder extends MemoryInstructionDecoder { - JmplDecoder() { - super(JMPL, "jmpl", RTLDT_UNSIGNED_WORD); - } - - Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - // this may be most probably indirect call or ret or retl - Instruction instr = null; - if (rd == SPARCRegisters.O7) { - instr = factory.newIndirectCallInstruction(addr, rd); - } else if (rd == SPARCRegisters.G0) { - int disp = (int) addr.getDisplacement(); - Register base = addr.getBase(); - if (base == SPARCRegisters.I7 && disp == 8) { - instr = factory.newReturnInstruction(addr, rd, false /* not leaf */); - } else if (base == SPARCRegisters.O7 && disp == 8) { - instr = factory.newReturnInstruction(addr, rd, true /* leaf */); - } else { - instr = factory.newJmplInstruction(addr, rd); - } - } else { - instr = factory.newJmplInstruction(addr, rd); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/LdstubDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class LdstubDecoder extends MemoryInstructionDecoder { - LdstubDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newLdstubInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/LoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class LoadDecoder extends MemoryInstructionDecoder { - LoadDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newLoadInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/LogicDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class LogicDecoder extends Format3ADecoder { - LogicDecoder(int op3, String name, int rtlOperation) { - super(op3, name, rtlOperation); - } - - Instruction decodeFormat3AInstruction(int instruction, - SPARCRegister rs1, - ImmediateOrRegister operand2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - Instruction instr = null; - if (op3 == OR && rs1 == SPARCRegisters.G0 && rd != SPARCRegisters.G0) { - instr = factory.newMoveInstruction(name, op3, operand2, rd); - } else { - instr = factory.newLogicInstruction(name, op3, rtlOperation, rs1, operand2, rd); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/MemoryInstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class MemoryInstructionDecoder extends InstructionDecoder { - final int op3; - final String name; - final int dataType; - - SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, SPARCRegister rs2) { - return new SPARCRegisterIndirectAddress(rs1, rs2); - } - - SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, int offset) { - return new SPARCRegisterIndirectAddress(rs1, offset); - } - - static void setAddressSpace(int instruction, SPARCRegisterIndirectAddress addr) { - int asi = (instruction & ASI_MASK) >>> ASI_START_BIT; - addr.setAddressSpace(asi); - } - - SPARCRegisterIndirectAddress getRegisterIndirectAddress(int instruction) { - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - boolean iBit = isIBitSet(instruction); - SPARCRegisterIndirectAddress addr = null; - if (iBit) { - int simm13 = extractSignedIntFromNBits(instruction, 13); - addr = newRegisterIndirectAddress(rs1,simm13); - } else { - SPARCRegister rs2 = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - addr = newRegisterIndirectAddress(rs1,rs2); - } - return addr; - } - - MemoryInstructionDecoder(int op3, String name, int dataType) { - this.op3 = op3; - this.name = name; - this.dataType = dataType; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCRegisterIndirectAddress addr = getRegisterIndirectAddress(instruction); - SPARCRegister rd = getDestination(instruction); - boolean isV9Okay = (factory instanceof SPARCV9InstructionFactory); - if ( (rd == null) || (! isV9Okay && rd.isV9Only()) ) - return factory.newIllegalInstruction(instruction); - - return decodeMemoryInstruction(instruction, addr, rd, factory); - } - - SPARCRegister getDestination(int instruction) { - int rdNum = getDestinationRegister(instruction); - SPARCRegister rd = RegisterDecoder.decode(dataType, rdNum); - return rd; - } - - abstract Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/ReadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class ReadDecoder extends ReadWriteDecoder { - ReadDecoder(int specialRegNum) { - super(specialRegNum); - } - - Instruction decodeReadWrite(int instruction, SPARCInstructionFactory factory, - int rs1Num, int rdNum) { - Instruction instr = null; - int specialReg = specialRegNum; - if (rs1Num == 0) - specialReg = SPARCSpecialRegisters.Y; - if (rs1Num == 15 && rdNum == 0) { - instr = factory.newStbarInstruction(); - } else { - instr = factory.newReadInstruction(specialReg, rs1Num, - SPARCRegisters.getRegister(rdNum)); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/ReadWriteDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class ReadWriteDecoder extends InstructionDecoder { - final int specialRegNum; - - abstract Instruction decodeReadWrite(int instruction, - SPARCInstructionFactory factory, - int rs1Num, int rdNum); - - ReadWriteDecoder(int specialRegNum) { - this.specialRegNum = specialRegNum; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - Instruction instr = null; - int rs1Num = getSourceRegister1(instruction); - int rdNum = getDestinationRegister(instruction); - return decodeReadWrite(instruction, factory, rs1Num, rdNum); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/RegisterDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.RTLDataTypes; - -class RegisterDecoder implements /* imports */ RTLDataTypes { - // refer to page 40 - section 5.1.4.1 - Floating-point Register Number Encoding - private static SPARCFloatRegister decodeDouble(int num) { - // 6 bit double precision registers are encoded in 5 bits as - // b<4> b<3> b<2> b<1> b<5>. - - boolean lsb = (0x1 & num) != 0; - if (lsb) - num |= 0x20; // 10000b - - if ((num % 2) != 0) - return null; - - return SPARCFloatRegisters.getRegister(num); - } - - private static SPARCFloatRegister decodeQuad(int num) { - // 6 bit quad precision registers are encoded in 5 bits as - // b<4> b<3> b<2> 0 b<5> - - boolean lsb = (0x1 & num) != 0; - if (lsb) - num |= 0x20; // 10000b - - if ((num % 4) != 0) - return null; - - return SPARCFloatRegisters.getRegister(num); - } - - static SPARCRegister decode(int dataType, int regNum) { - regNum &= 0x1F; // mask out all but lsb 5 bits - SPARCRegister result = null; - switch (dataType) { - case RTLDT_FL_SINGLE: - result = SPARCFloatRegisters.getRegister(regNum); - break; - - case RTLDT_FL_DOUBLE: - result = decodeDouble(regNum); - break; - - case RTLDT_FL_QUAD: - result = decodeQuad(regNum); - break; - - case RTLDT_UNKNOWN: - result = null; - break; - - default: // some integer register - result = SPARCRegisters.getRegister(regNum); - break; - } - return result; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/RestoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class RestoreDecoder extends Format3ADecoder { - RestoreDecoder() { - super(RESTORE, "restore", RTLOP_UNKNOWN); - } - - Instruction decodeFormat3AInstruction(int instruction, - SPARCRegister rs1, - ImmediateOrRegister operand2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newRestoreInstruction(rs1, operand2, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/RettDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class RettDecoder extends MemoryInstructionDecoder { - RettDecoder() { - super(RETT, "rett", RTLDT_UNKNOWN); - } - - Instruction decodeMemoryInstruction(int instruction, SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - return factory.newRettInstruction(addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCArithmeticInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCArithmeticInstruction extends SPARCFormat3AInstruction - implements ArithmeticInstruction { - final private int operation; - - public SPARCArithmeticInstruction(String name, int opcode, int operation, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd) { - super(name, opcode, rs1, operand2, rd); - this.operation = operation; - } - - protected String getDescription() { - if (rd == rs1 && operand2.isImmediate()) { - int value = ((Immediate)operand2).getNumber().intValue(); - StringBuffer buf = new StringBuffer(); - switch (opcode) { - case ADD: - buf.append("inc"); - break; - case ADDcc: - buf.append("inccc"); - break; - case SUB: - buf.append("dec"); - break; - case SUBcc: - buf.append("deccc"); - break; - default: - return super.getDescription(); - } - buf.append(spaces); - if (value != 1) { - buf.append(getOperand2String()); buf.append(comma); - } - buf.append(rd.toString()); - return buf.toString(); - } else if (rd == SPARCRegisters.G0 && opcode == SUBcc) { - StringBuffer buf = new StringBuffer(); - buf.append("cmp"); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - buf.append(getOperand2String()); - return buf.toString(); - } else if (rs1 == SPARCRegisters.G0 && opcode == SUB && operand2.isRegister()) { - StringBuffer buf = new StringBuffer(); - buf.append("neg"); - buf.append(spaces); - buf.append(operand2.toString()); - if (operand2 != rd) { - buf.append(comma); - buf.append(rd.toString()); - } - return buf.toString(); - } - - return super.getDescription(); - } - - public Operand getArithmeticDestination() { - return getDestinationRegister(); - } - - public Operand[] getArithmeticSources() { - return (new Operand[] { rs1, operand2 }); - } - - public int getOperation() { - return operation; - } - - public boolean isArithmetic() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCAtomicLoadStoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCAtomicLoadStoreInstruction extends SPARCInstruction - implements LoadInstruction, StoreInstruction { - final protected SPARCRegisterIndirectAddress addr; - final protected SPARCRegister rd; - final protected Register[] regs = new Register[1]; - final protected String description; - - public SPARCAtomicLoadStoreInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - super(name); - this.addr = addr; - this.rd = rd; - regs[0] = rd; - description = initDescription(); - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(addr.toString()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public Address getLoadSource() { - return addr; - } - - public Address getStoreDestination() { - return addr; - } - - public Register[] getLoadDestinations() { - return regs; - } - - public Register[] getStoreSources() { - return regs; - } - - public boolean isLoad() { - return true; - } - - public boolean isStore() { - return true; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCBranchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCBranchInstruction extends SPARCInstruction - implements BranchInstruction { - final protected PCRelativeAddress addr; - final protected int conditionCode; - final protected boolean isAnnuled; - - public SPARCBranchInstruction(String name, PCRelativeAddress addr, boolean isAnnuled, int conditionCode) { - super(name); - this.addr = addr; - this.conditionCode = conditionCode; - this.isAnnuled = isAnnuled; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - long address = addr.getDisplacement() + currentPc; - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(symFinder.getSymbolFor(address)); - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public int getConditionCode() { - return conditionCode; - } - - public boolean isAnnuledBranch() { - return isAnnuled; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return conditionCode != CONDITION_BN && conditionCode != CONDITION_BA; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCCallInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCCallInstruction extends SPARCInstruction - implements CallInstruction { - final private PCRelativeAddress addr; - - public SPARCCallInstruction(PCRelativeAddress addr) { - super("call"); - this.addr = addr; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - long address = addr.getDisplacement() + currentPc; - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(symFinder.getSymbolFor(address)); - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isCall() { - return true; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCDisassembler.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.io.*; -import java.util.*; - -public abstract class SPARCDisassembler extends Disassembler - implements /* imports */ SPARCOpcodes, RTLDataTypes, RTLOperations { - - // instruction cache - Map<Integer, Instruction>. - protected static Map instructionCache = new HashMap(); - protected final SPARCInstructionFactory factory; - - public SPARCDisassembler(long startPc, byte[] code, SPARCInstructionFactory factory) { - super(startPc, code); - this.factory = factory; - } - - protected static InstructionDecoder illegalDecoder = new IllegalInstructionDecoder(); - protected static InstructionDecoder callDecoder = new CallDecoder(); - - // direct call instruction - protected Instruction decodeFormat1Instruction(int instruction) { - return callDecoder.decode(instruction, factory); - } - - protected abstract InstructionDecoder getFormat2Decoder(int op2); - - protected Instruction decodeFormat2Instruction(int instruction) { - int op2 = (instruction & OP_2_MASK) >>> OP_2_START_BIT; - InstructionDecoder decoder = getFormat2Decoder(op2); - return decoder.decode(instruction, factory); - } - - // "op3" - used in format 3 & 3A instructions - 6 bits width - - protected static int getOp3(int instruction) { - return (instruction & OP_3_MASK) >>> OP_3_START_BIT; - } - - // op3 opcodes is broken up into column and row. MSB 2 bits form column. - // LSB 4 bits form row number. - - protected static int getOp3Row(int op3) { - return op3 & 0xF; - } - - protected static int getOp3Column(int op3) { - return (op3 >>> 4) & 0x3; - } - - protected abstract InstructionDecoder getFormat3Decoder(int row, int column); - - // memory instructions - protected Instruction decodeFormat3Instruction(int instruction) { - int op3 = getOp3(instruction); - int row = getOp3Row(op3); - int column = getOp3Column(op3); - return getFormat3Decoder(row, column).decode(instruction, factory); - } - - protected abstract InstructionDecoder getFormat3ADecoder(int row, int column); - - // arithmetic, logic, shift and the rest - protected Instruction decodeFormat3AInstruction(int instruction) { - int op3 = getOp3(instruction); - int row = getOp3Row(op3); - int column = getOp3Column(op3); - return getFormat3ADecoder(row, column).decode(instruction, factory); - } - - public void decode(InstructionVisitor visitor) { - visitor.prologue(); - try { - DataInputStream dis = new DataInputStream(new ByteArrayInputStream(code)); - int instruction = -1; - int format = -1; - Instruction instr = null; - int len = 0; - - while (len < code.length) { - instr = null; - instruction = dis.readInt(); - // check whether we have this in cache. - instr = (Instruction) instructionCache.get(new Integer(instruction)); - if (instr == null) { - format = (instruction & FORMAT_MASK) >>> FORMAT_START_BIT; - - switch (format) { - case FORMAT_2: // 0 - instr = decodeFormat2Instruction(instruction); - break; - - case FORMAT_1: // 1 - instr = decodeFormat1Instruction(instruction); - break; - - case FORMAT_3A: // 2 - instr = decodeFormat3AInstruction(instruction); - break; - - case FORMAT_3: // 3 - instr = decodeFormat3Instruction(instruction); - break; - } - - // add the new instruction to cache. - instructionCache.put(new Integer(instruction), instr); - } - - visitor.visit(startPc + len, instr); - len += 4; - } - } catch (IOException ioExp) { - // ignore, can't happen - } finally { - visitor.epilogue(); - } - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFP2RegisterInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCFP2RegisterInstruction extends SPARCInstruction { - final SPARCFloatRegister rs; - final SPARCFloatRegister rd; - final int opf; - - public SPARCFP2RegisterInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd) { - super(name); - this.rs = rs; - this.rd = rd; - this.opf = opf; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs.toString()); - buf.append(comma); - buf.append(rd.toString()); - - return buf.toString(); - } - - public boolean isFloat() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFPArithmeticInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCFPArithmeticInstruction extends SPARCFormat3AInstruction - implements ArithmeticInstruction { - final private SPARCRegister rs2; - final private int rtlOperation; - - public SPARCFPArithmeticInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, SPARCRegister rs2, - SPARCRegister rd) { - super(name, opcode, rs1, rs2, rd); - this.rs2 = rs2; - this.rtlOperation = rtlOperation; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - buf.append(rs2.toString()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public int getOperation() { - return rtlOperation; - } - - public Operand[] getArithmeticSources() { - return new Operand[] { rs1, rs2 }; - } - - public Operand getArithmeticDestination() { - return rd; - } - - public boolean isFloat() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFPMoveInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCFPMoveInstruction extends SPARCFP2RegisterInstruction - implements MoveInstruction { - - public SPARCFPMoveInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd) { - super(name, opf, rs, rd); - } - - public Register getMoveDestination() { - return rd; - } - - public ImmediateOrRegister getMoveSource() { - return rs; - } - - public int getMoveOpcode() { - return opf; - } - - public boolean isConditional() { - return false; - } - - public boolean isMove() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFloatRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.Register; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCFloatRegister extends SPARCRegister { - - public SPARCFloatRegister(int number) { - super(number); - } - - public int getNumber() { - return number; - } - - public static final int SINGLE_PRECISION = 1; - public static final int DOUBLE_PRECISION = 2; - public static final int QUAD_PRECISION = 3; - - public int getNumber(int width) { - switch (width) { - case SINGLE_PRECISION: - Assert.that(number < 32, "bad single-prec fp register"); - return number; - - case DOUBLE_PRECISION: - Assert.that(number < 64 && (number & 1) == 0, "bad double-prec fp register"); - return number & 0x1e | (number & 0x20) >> 5; - - case QUAD_PRECISION: - Assert.that(number < 64 && (number & 3) == 0, "bad quad-prec fp register"); - return number & 0x1c | (number & 0x20) >> 5; - } - throw new RuntimeException("Invalid floating point width supplied"); - } - - private static final int nofRegisters = 63; - public int getNumberOfRegisters() { - return nofRegisters; - } - - public boolean isFloat() { - return true; - } - - public boolean isFramePointer() { - return false; - } - - public boolean isStackPointer() { - return false; - } - - public boolean isV9Only() { - return number > 31; - } - - public boolean isValid() { - return number >= 0 && number < nofRegisters; - } - - public String toString() { - return SPARCFloatRegisters.getRegisterName(number); - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFloatRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCFloatRegisters { - public static int getNumRegisters() { - return 64; - } - - public static SPARCFloatRegister getRegister(int i) { - Assert.that(i >= 0 && i < 64, "float register number is invalid"); - return registers[i]; - } - - public static String getRegisterName(int i) { - return "%f" + i; - } - - public static final SPARCFloatRegister F0; - public static final SPARCFloatRegister F1; - public static final SPARCFloatRegister F2; - public static final SPARCFloatRegister F3; - public static final SPARCFloatRegister F4; - public static final SPARCFloatRegister F5; - public static final SPARCFloatRegister F6; - public static final SPARCFloatRegister F7; - public static final SPARCFloatRegister F8; - public static final SPARCFloatRegister F9; - public static final SPARCFloatRegister F10; - public static final SPARCFloatRegister F11; - public static final SPARCFloatRegister F12; - public static final SPARCFloatRegister F13; - public static final SPARCFloatRegister F14; - public static final SPARCFloatRegister F15; - public static final SPARCFloatRegister F16; - public static final SPARCFloatRegister F17; - public static final SPARCFloatRegister F18; - public static final SPARCFloatRegister F19; - public static final SPARCFloatRegister F20; - public static final SPARCFloatRegister F21; - public static final SPARCFloatRegister F22; - public static final SPARCFloatRegister F23; - public static final SPARCFloatRegister F24; - public static final SPARCFloatRegister F25; - public static final SPARCFloatRegister F26; - public static final SPARCFloatRegister F27; - public static final SPARCFloatRegister F28; - public static final SPARCFloatRegister F29; - public static final SPARCFloatRegister F30; - public static final SPARCFloatRegister F31; - public static final SPARCFloatRegister F32; - public static final SPARCFloatRegister F34; - public static final SPARCFloatRegister F36; - public static final SPARCFloatRegister F38; - public static final SPARCFloatRegister F40; - public static final SPARCFloatRegister F42; - public static final SPARCFloatRegister F44; - public static final SPARCFloatRegister F46; - public static final SPARCFloatRegister F48; - public static final SPARCFloatRegister F50; - public static final SPARCFloatRegister F52; - public static final SPARCFloatRegister F54; - public static final SPARCFloatRegister F56; - public static final SPARCFloatRegister F58; - public static final SPARCFloatRegister F60; - public static final SPARCFloatRegister F62; - public static final int NUM_REGISTERS = 64; - private static final SPARCFloatRegister registers[]; - - static { - F0 = new SPARCFloatRegister(0); - F1 = new SPARCFloatRegister(1); - F2 = new SPARCFloatRegister(2); - F3 = new SPARCFloatRegister(3); - F4 = new SPARCFloatRegister(4); - F5 = new SPARCFloatRegister(5); - F6 = new SPARCFloatRegister(6); - F7 = new SPARCFloatRegister(7); - F8 = new SPARCFloatRegister(8); - F9 = new SPARCFloatRegister(9); - F10 = new SPARCFloatRegister(10); - F11 = new SPARCFloatRegister(11); - F12 = new SPARCFloatRegister(12); - F13 = new SPARCFloatRegister(13); - F14 = new SPARCFloatRegister(14); - F15 = new SPARCFloatRegister(15); - F16 = new SPARCFloatRegister(16); - F17 = new SPARCFloatRegister(17); - F18 = new SPARCFloatRegister(18); - F19 = new SPARCFloatRegister(19); - F20 = new SPARCFloatRegister(20); - F21 = new SPARCFloatRegister(21); - F22 = new SPARCFloatRegister(22); - F23 = new SPARCFloatRegister(23); - F24 = new SPARCFloatRegister(24); - F25 = new SPARCFloatRegister(25); - F26 = new SPARCFloatRegister(26); - F27 = new SPARCFloatRegister(27); - F28 = new SPARCFloatRegister(28); - F29 = new SPARCFloatRegister(29); - F30 = new SPARCFloatRegister(30); - F31 = new SPARCFloatRegister(31); - F32 = new SPARCFloatRegister(32); - F34 = new SPARCFloatRegister(34); - F36 = new SPARCFloatRegister(36); - F38 = new SPARCFloatRegister(38); - F40 = new SPARCFloatRegister(40); - F42 = new SPARCFloatRegister(42); - F44 = new SPARCFloatRegister(44); - F46 = new SPARCFloatRegister(46); - F48 = new SPARCFloatRegister(48); - F50 = new SPARCFloatRegister(50); - F52 = new SPARCFloatRegister(52); - F54 = new SPARCFloatRegister(54); - F56 = new SPARCFloatRegister(56); - F58 = new SPARCFloatRegister(58); - F60 = new SPARCFloatRegister(60); - F62 = new SPARCFloatRegister(62); - registers = (new SPARCFloatRegister[] { - F0, F2, F3, F4, F5, F6, F7, F8, F9, F10, - F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, - F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, - F31, F32, null, F34, null, F36, null, F38, null, F40, - null, F42, null, F44, null, F46, null, F48, null, F50, - null, F52, null, F54, null, F56, null, F58, null, F60, - null, F62, null - }); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFlushInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCFlushInstruction extends SPARCInstruction { - final protected SPARCRegisterIndirectAddress addr; - final String description; - - public SPARCFlushInstruction(SPARCRegisterIndirectAddress addr) { - super("flush"); - this.addr = addr; - description = initDescription(); - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(addr.toString()); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCFormat3AInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCFormat3AInstruction extends SPARCInstruction { - final protected int opcode; - final protected SPARCRegister rs1; - final protected ImmediateOrRegister operand2; - final protected SPARCRegister rd; - - public SPARCFormat3AInstruction(String name, int opcode, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd) { - super(name); - this.opcode = opcode; - this.rs1 = rs1; - this.operand2 = operand2; - this.rd = rd; - } - - protected String getOperand2String() { - StringBuffer buf = new StringBuffer(); - if (operand2.isRegister()) { - buf.append(operand2.toString()); - } else { - Number number = ((Immediate)operand2).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - return buf.toString(); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - public int getOpcode() { - return opcode; - } - - public SPARCRegister getDestinationRegister() { - return rd; - } - - public ImmediateOrRegister getOperand2() { - return operand2; - } - - public SPARCRegister getSourceRegister1() { - return rs1; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCHelper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCHelper implements CPUHelper { - public Disassembler createDisassembler(long startPc, byte[] code) { - return new SPARCV9Disassembler(startPc, code); - } - - public Register getIntegerRegister(int num) { - return SPARCRegisters.getRegister(num); - } - - public Register getFloatRegister(int num) { - return SPARCFloatRegisters.getRegister(num); - } - - public Register getStackPointer() { - return SPARCRegisters.O7; - } - - public Register getFramePointer() { - return SPARCRegisters.I7; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCIllegalInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; - -public final class SPARCIllegalInstruction extends SPARCInstruction { - final private int instruction; - final private String description; - - public SPARCIllegalInstruction(int instruction) { - super("illegal"); - this.instruction = instruction; - description = "bad opcode - " + Integer.toHexString(instruction); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public int getInstruction() { - return instruction; - } - - public boolean isIllegal() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCIndirectCallInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCIndirectCallInstruction extends SPARCJmplInstruction - implements CallInstruction { - - public SPARCIndirectCallInstruction(SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - super("call", addr, rd); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - // remove '[' & ']' from jmp address - String addrStr = addr.toString(); - buf.append(addrStr.substring(1, addrStr.length() - 1)); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCInstruction - extends AbstractInstruction - implements /* imports */ SPARCOpcodes { - public SPARCInstruction(String name) { - super(name); - } - - public int getSize() { - return 4; - } - - protected static String comma = ", "; - protected static String spaces = "\t"; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCInstructionFactory.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public interface SPARCInstructionFactory { - public SPARCInstruction newCallInstruction(PCRelativeAddress addr); - - public SPARCInstruction newNoopInstruction(); - - public SPARCInstruction newSethiInstruction(int imm22, SPARCRegister rd); - - public SPARCInstruction newUnimpInstruction(int const22); - - public SPARCInstruction newBranchInstruction(String name, PCRelativeAddress addr, boolean isAnnuled, int conditionCode); - - public SPARCInstruction newSpecialLoadInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr); - - public SPARCInstruction newSpecialStoreInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr); - - public SPARCInstruction newLoadInstruction(String name, int opcode, - SPARCRegisterIndirectAddress addr, SPARCRegister rd, - int dataType); - - public SPARCInstruction newStoreInstruction(String name, int opcode, - SPARCRegisterIndirectAddress addr, SPARCRegister rd, - int dataType); - - public SPARCInstruction newStbarInstruction(); - - public SPARCInstruction newReadInstruction(int specialReg, int asrRegNum, SPARCRegister rd); - - public SPARCInstruction newWriteInstruction(int specialReg, int asrRegNum, SPARCRegister rs1, - ImmediateOrRegister operand2); - - public SPARCInstruction newIllegalInstruction(int instruction); - - public SPARCInstruction newIndirectCallInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd); - - public SPARCInstruction newReturnInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd, boolean isLeaf); - - public SPARCInstruction newJmplInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd); - - public SPARCInstruction newFP2RegisterInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd); - - public SPARCInstruction newFPMoveInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd); - - public SPARCInstruction newFPArithmeticInstruction(String name, int opf, int rtlOperation, - SPARCFloatRegister rs1, SPARCFloatRegister rs2, - SPARCFloatRegister rd); - - public SPARCInstruction newFlushInstruction(SPARCRegisterIndirectAddress addr); - - public SPARCInstruction newSaveInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd); - - public SPARCInstruction newRestoreInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd); - - public SPARCInstruction newTrapInstruction(String name, int conditionCode); - - public SPARCInstruction newRettInstruction(SPARCRegisterIndirectAddress addr); - - public SPARCInstruction newArithmeticInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd); - - public SPARCInstruction newLogicInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd); - - public SPARCInstruction newMoveInstruction(String name, int opcode, - ImmediateOrRegister operand2, - SPARCRegister rd); - - public SPARCInstruction newShiftInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd); - - public SPARCInstruction newCoprocessorInstruction(int instruction, int cpopcode, int opc, - int rs1Num, int rs2Num, int rdNum); - public SPARCInstruction newSwapInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd); - public SPARCInstruction newLdstubInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCInstructionFactoryImpl.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCInstructionFactoryImpl implements SPARCInstructionFactory { - public SPARCInstruction newCallInstruction(PCRelativeAddress addr) { - return new SPARCCallInstruction(addr); - } - - public SPARCInstruction newNoopInstruction() { - return new SPARCNoopInstruction(); - } - - public SPARCInstruction newSethiInstruction(int imm22, SPARCRegister rd) { - return new SPARCSethiInstruction(imm22, rd); - } - - public SPARCInstruction newUnimpInstruction(int const22) { - return new SPARCUnimpInstruction(const22); - } - - public SPARCInstruction newBranchInstruction(String name, PCRelativeAddress addr, boolean isAnnuled, int conditionCode) { - return new SPARCBranchInstruction(name, addr, isAnnuled, conditionCode); - } - - public SPARCInstruction newSpecialLoadInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr) { - return new SPARCSpecialLoadInstruction(name, specialReg, cregNum, addr); - } - - - public SPARCInstruction newSpecialStoreInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr) { - return new SPARCSpecialStoreInstruction(name, specialReg, cregNum, addr); - } - - public SPARCInstruction newLoadInstruction(String name, int opcode, - SPARCRegisterIndirectAddress addr, SPARCRegister rd, - int dataType) { - return new SPARCLoadInstruction(name, opcode, addr, rd, dataType); - } - - public SPARCInstruction newStoreInstruction(String name, int opcode, - SPARCRegisterIndirectAddress addr, SPARCRegister rd, - int dataType) { - return new SPARCStoreInstruction(name, opcode, addr, rd, dataType); - } - - public SPARCInstruction newStbarInstruction() { - return new SPARCStbarInstruction(); - } - - public SPARCInstruction newReadInstruction(int specialReg, int asrRegNum, SPARCRegister rd) { - return new SPARCReadInstruction(specialReg, asrRegNum, rd); - } - - public SPARCInstruction newWriteInstruction(int specialReg, int asrRegNum, SPARCRegister rs1, - ImmediateOrRegister operand2) { - return new SPARCWriteInstruction(specialReg, asrRegNum, rs1,operand2); - } - - public SPARCInstruction newIllegalInstruction(int instruction) { - return new SPARCIllegalInstruction(instruction); - } - - - public SPARCInstruction newIndirectCallInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd) { - return new SPARCIndirectCallInstruction(addr, rd); - } - - public SPARCInstruction newReturnInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd, boolean isLeaf) { - return new SPARCReturnInstruction(addr, rd, isLeaf); - } - - public SPARCInstruction newJmplInstruction(SPARCRegisterIndirectAddress addr, - SPARCRegister rd) { - return new SPARCJmplInstruction(addr, rd); - } - - public SPARCInstruction newFPArithmeticInstruction(String name, int opf, int rtlOperation, - SPARCFloatRegister rs1, SPARCFloatRegister rs2, - SPARCFloatRegister rd) { - return new SPARCFPArithmeticInstruction(name, opf, rtlOperation, rs1, rs2, rd); - } - - public SPARCInstruction newFPMoveInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd) { - return new SPARCFPMoveInstruction(name, opf, rs, rd); - } - - public SPARCInstruction newFP2RegisterInstruction(String name, int opf, SPARCFloatRegister rs, SPARCFloatRegister rd) { - return new SPARCFP2RegisterInstruction(name, opf, rs, rd); - } - - public SPARCInstruction newFlushInstruction(SPARCRegisterIndirectAddress addr) { - return new SPARCFlushInstruction(addr); - } - - public SPARCInstruction newSaveInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd) { - return new SPARCSaveInstruction(rs1, operand2, rd); - } - - public SPARCInstruction newRestoreInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd) { - return new SPARCRestoreInstruction(rs1, operand2, rd); - } - - public SPARCInstruction newTrapInstruction(String name, int conditionCode) { - return new SPARCTrapInstruction(name, conditionCode); - } - - public SPARCInstruction newRettInstruction(SPARCRegisterIndirectAddress addr) { - return new SPARCRettInstruction(addr); - } - - public SPARCInstruction newArithmeticInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd) { - return new SPARCArithmeticInstruction(name, opcode, rtlOperation, rs1, operand2, rd); - } - - public SPARCInstruction newLogicInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd) { - return new SPARCLogicInstruction(name, opcode, rtlOperation, rs1, operand2, rd); - } - - public SPARCInstruction newMoveInstruction(String name, int opcode, - ImmediateOrRegister operand2, - SPARCRegister rd) { - return new SPARCMoveInstruction(name, opcode, operand2, rd); - } - - public SPARCInstruction newShiftInstruction(String name, int opcode, int rtlOperation, - SPARCRegister rs1, ImmediateOrRegister operand2, - SPARCRegister rd) { - return new SPARCShiftInstruction(name, opcode, rtlOperation, rs1, operand2, rd); - } - - public SPARCInstruction newCoprocessorInstruction(int instruction, int cpopcode, int opcode, - int rs1Num, int rs2Num, int rd) { - return new SPARCIllegalInstruction(instruction); - } - - public SPARCInstruction newSwapInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - return new SPARCSwapInstruction(name, addr, rd); - } - - public SPARCInstruction newLdstubInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - return new SPARCLdstubInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCJmplInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCJmplInstruction extends SPARCInstruction - implements BranchInstruction { - final protected SPARCRegisterIndirectAddress addr; - final protected SPARCRegister rd; - - protected SPARCJmplInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - super(name); - this.addr = addr; - this.rd = rd; - } - - public SPARCJmplInstruction(SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - this("jmpl", addr, rd); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - String addrStr = addr.toString(); - // remove '[' & ']' from address - addrStr = addrStr.substring(1, addrStr.length() - 1); - if (rd == SPARCRegisters.G0) { - buf.append("jmp"); - buf.append(spaces); - buf.append(addrStr); - } else { - buf.append(getName()); - buf.append(spaces); - buf.append(addrStr); - buf.append(comma); - buf.append(rd.toString()); - } - - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - public Address getBranchDestination() { - return addr; - } - - public SPARCRegister getReturnAddressRegister() { - return rd; - } - - public boolean isAnnuledBranch() { - return false; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCLdstubInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCLdstubInstruction extends SPARCAtomicLoadStoreInstruction { - public SPARCLdstubInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - super(name, addr, rd); - } - - public int getDataType() { - return RTLDT_UNSIGNED_BYTE; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCLoadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCLoadInstruction extends SPARCMemoryInstruction - implements LoadInstruction { - final protected SPARCRegister register2; // used for double word load instructions - final protected Register[] loadDestinations; - - public SPARCLoadInstruction(String name, int opcode, SPARCRegisterIndirectAddress address, SPARCRegister register, int dataType) { - super(name, opcode,address, register, dataType); - if (opcode == LDD || opcode == LDDA) { - int nextRegNum = (register.getNumber() + 1) % SPARCRegisters.NUM_REGISTERS; - register2 = SPARCRegisters.getRegister(nextRegNum); - loadDestinations = new Register[2]; - loadDestinations[0] = register; - loadDestinations[1] = register2; - } else { - register2 = null; - loadDestinations = new Register[1]; - loadDestinations[0] = register; - } - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(address.toString()); - buf.append(comma); - buf.append(register.toString()); - return buf.toString(); - } - - public Register[] getLoadDestinations() { - return loadDestinations; - } - - public Address getLoadSource() { - return address; - } - - public boolean isLoad() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCLogicInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCLogicInstruction extends SPARCFormat3AInstruction - implements LogicInstruction { - final private int operation; - - public SPARCLogicInstruction(String name, int opcode, int operation, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd) { - super(name, opcode, rs1, operand2, rd); - this.operation = operation; - } - - protected String getDescription() { - SPARCRegister G0 = SPARCRegisters.G0; - if (opcode == ORcc && rd == G0 && rd == operand2) { - StringBuffer buf = new StringBuffer(); - buf.append("tst"); - buf.append(spaces); - buf.append(getOperand2String()); - return buf.toString(); - } else if (opcode == XNOR && G0 == operand2) { - StringBuffer buf = new StringBuffer(); - buf.append("not"); - buf.append(spaces); - buf.append(rs1.toString()); - if (rs1 != rd) { - buf.append(comma); - buf.append(rd.toString()); - } - return buf.toString(); - } else if (opcode == ANDcc && rd == G0) { - StringBuffer buf = new StringBuffer(); - buf.append("btst"); - buf.append(spaces); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } else if (rs1 == rd) { - StringBuffer buf = new StringBuffer(); - switch (opcode) { - case OR: - buf.append("bset"); - break; - case ANDN: - buf.append("bclr"); - break; - case XOR: - buf.append("btog"); - break; - default: - return super.getDescription(); - } - buf.append(spaces); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } else { - return super.getDescription(); - } - } - - public Operand getLogicDestination() { - return getDestinationRegister(); - } - - public Operand[] getLogicSources() { - return (new Operand[] { rs1, operand2 }); - } - - public int getOperation() { - return operation; - } - - public boolean isLogic() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCMemoryInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.MemoryInstruction; -import sun.jvm.hotspot.asm.SymbolFinder; - -public abstract class SPARCMemoryInstruction extends SPARCInstruction - implements MemoryInstruction { - final protected SPARCRegisterIndirectAddress address; - final protected SPARCRegister register; - final protected int dataType; - final protected int opcode; - - public SPARCMemoryInstruction(String name, int opcode, SPARCRegisterIndirectAddress address, SPARCRegister register, int dataType) { - super(name); - this.address = address; - this.register = register; - this.dataType = dataType; - this.opcode = opcode; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(address.toString()); - buf.append(comma); - buf.append(register.toString()); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - public int getDataType() { - return dataType; - } - - public boolean isConditional() { - return false; - } - - public int getOpcode() { - return opcode; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCMoveInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCMoveInstruction extends SPARCFormat3AInstruction - implements MoveInstruction, RTLOperations { - - public SPARCMoveInstruction(String name, int opcode, ImmediateOrRegister operand2, SPARCRegister rd) { - super(name, opcode, null, operand2, rd); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - if (operand2 == SPARCRegisters.G0) { - buf.append("clr"); - buf.append(spaces); - buf.append(rd.toString()); - } else { - buf.append("mov"); - buf.append(spaces); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - } - - return buf.toString(); - } - - public Register getMoveDestination() { - return getDestinationRegister(); - } - - public ImmediateOrRegister getMoveSource() { - return operand2; - } - - public boolean isConditional() { - return false; - } - - public boolean isMove() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCNoopInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCNoopInstruction extends SPARCInstruction { - public SPARCNoopInstruction() { - super("nop"); - } - - public boolean isNoop() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCOpcodes.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -// Please refer to "The SPARC Architecture Manual - Version 8" - -public interface SPARCOpcodes { - - // format type is coded in 2 bits - primary opcode - "op" - public static final int FORMAT_START_BIT = 30; - public static final int FORMAT_MASK = 3 << FORMAT_START_BIT; - - // sparc instruction formats - - // PC Relative CALL - public static final int FORMAT_1 = 1; - - // Bicc, FBfcc, CBccc, SETHI - public static final int FORMAT_2 = 0; - - // memory instructions - public static final int FORMAT_3 = 3; - - // arithmetic, logical, shift and remaining - public static final int FORMAT_3A = 2; - - // disp 30 - used in pc relative call - public static final int DISP_30_MASK = 0x3FFFFFFF; - - // secondary opcode "op2" used in FORMAT_2 instructions - 3 bits. - public static final int OP_2_START_BIT = 22; - public static final int OP_2_MASK = 7 << OP_2_START_BIT; - - // various "op2" masks - public static final int OP_2_UNIMP = 0; - public static final int OP_2_Bicc = 2; - public static final int OP_2_SETHI = 4; - public static final int OP_2_FBfcc = 6; - public static final int OP_2_CBccc = 7; - - // condition codes are encoded in 4 bits. - public static final int CONDITION_CODE_START_BIT = 25; - public static final int CONDITION_CODE_MASK = 0xF << CONDITION_CODE_START_BIT; - - // branch condition codes - public static final int CONDITION_BN = 0; - public static final int CONDITION_FBN = CONDITION_BN; - public static final int CONDITION_CBN = CONDITION_BN; - public static final int CONDITION_TN = CONDITION_BN; - - public static final int CONDITION_BE = 1; - public static final int CONDITION_FBNE = CONDITION_BE; - public static final int CONDITION_CB123= CONDITION_BE; - public static final int CONDITION_TE = CONDITION_BE; - - public static final int CONDITION_BLE = 2; - public static final int CONDITION_FBLG = CONDITION_BLE; - public static final int CONDITION_CB12 = CONDITION_BLE; - public static final int CONDITION_TLE = CONDITION_BLE; - - public static final int CONDITION_BL = 3; - public static final int CONDITION_FBUL = CONDITION_BL; - public static final int CONDITION_CB13 = CONDITION_BL; - public static final int CONDITION_TL = CONDITION_BL; - - public static final int CONDITION_BLEU = 4; - public static final int CONDITION_FBL = CONDITION_BLEU; - public static final int CONDITION_CB1 = CONDITION_BLEU; - public static final int CONDITION_TLEU = CONDITION_BLEU; - - public static final int CONDITION_BCS = 5; - public static final int CONDITION_FBUG = CONDITION_BCS; - public static final int CONDITION_CB23 = CONDITION_BCS; - public static final int CONDITION_TCS = CONDITION_BCS; - - public static final int CONDITION_BNEG = 6; - public static final int CONDITION_FBG = CONDITION_BNEG; - public static final int CONDITION_CB2 = CONDITION_BNEG; - public static final int CONDITION_TNEG = CONDITION_BNEG; - - public static final int CONDITION_BVS = 7; - public static final int CONDITION_FBU = CONDITION_BVS; - public static final int CONDITION_CB3 = CONDITION_BVS; - public static final int CONDITION_TVS = CONDITION_BVS; - - public static final int CONDITION_BA = 8; - public static final int CONDITION_FBA = CONDITION_BA; - public static final int CONDITION_CBA = CONDITION_BA; - public static final int CONDITION_TA = CONDITION_BA; - - public static final int CONDITION_BNE = 9; - public static final int CONDITION_FBE = CONDITION_BNE; - public static final int CONDITION_CB0 = CONDITION_BNE; - public static final int CONDITION_TNE = CONDITION_BNE; - - public static final int CONDITION_BG = 0xA; - public static final int CONDITION_FBUE = CONDITION_BG; - public static final int CONDITION_CB03 = CONDITION_BG; - public static final int CONDITION_TG = CONDITION_BG; - - public static final int CONDITION_BGE = 0xB; - public static final int CONDITION_FBGE = CONDITION_BGE; - public static final int CONDITION_CB02 = CONDITION_BGE; - public static final int CONDITION_TGE = CONDITION_BGE; - - public static final int CONDITION_BGU = 0xC; - public static final int CONDITION_FBUGE= CONDITION_BGU; - public static final int CONDITION_CB023= CONDITION_BGU; - public static final int CONDITION_TGU = CONDITION_BGU; - - public static final int CONDITION_BCC = 0xD; - public static final int CONDITION_FBLE = CONDITION_BCC; - public static final int CONDITION_CB01 = CONDITION_BCC; - public static final int CONDITION_TCC = CONDITION_BCC; - - public static final int CONDITION_BPOS = 0xE; - public static final int CONDITION_FBULE= CONDITION_BPOS; - public static final int CONDITION_CB013= CONDITION_BPOS; - public static final int CONDITION_TPOS = CONDITION_BPOS; - - public static final int CONDITION_BVC = 0xF; - public static final int CONDITION_FBO = CONDITION_BVC; - public static final int CONDITION_CB012= CONDITION_BVC; - public static final int CONDITION_TVC = CONDITION_BVC; - - // annul bit mask - public static final int ANNUL_MASK = 1 << 29; - - // 22 bit displacement or immediate value - used in FORMAT_2 instructions. - public static final int DISP_22_MASK = 0x3FFFFF; - public static final int IMM_22_MASK = DISP_22_MASK; - - // second operand mask, called "i" bit - public static final int I_START_BIT = 13; - public static final int I_MASK = 1 << I_START_BIT; - - // address space identifier - "asi" - 8 bits - public static final int ASI_START_BIT = 5; - public static final int ASI_MASK = 0xFF << ASI_START_BIT; - - // signed immediate value 13 bits - "simm13" - public static final int SIMM_13_MASK = 0x1FFF; - - // co-processor or floating point opcode field - "ocf/opf" - 9 bits - public static final int OPF_START_BIT = 5; - public static final int OPF_MASK = 0x1FF << OPF_START_BIT; - public static final int OPC_MASK = OPF_MASK; - - // opcode part 3 - used in FORMAT_3 and FORMAT_3A instructions - // "op3" - 6 bits - public static final int OP_3_START_BIT = 19; - public static final int OP_3_MASK = 0x3F << OP_3_START_BIT; - - // register masks - public static final int RD_START_BIT = 25; - public static final int RD_MASK = 0x1F << RD_START_BIT; // "rd" - public static final int RS1_START_BIT = 14; - public static final int RS1_MASK = 0x1F << RS1_START_BIT; // "rs1" - public static final int RS2_MASK = 0x1F; // "rs2" - - // load/store instructions - op3 values - used with op=3 (FORMAT_3) - public static final int LD = 0; - public static final int LDA = (1 << 4); - public static final int LDF = (2 << 4); - public static final int LDC = (3 << 4); - - public static final int LDUB = 1; - public static final int LDUBA = (1 << 4) | 1; - public static final int LDFSR = (2 << 4) | 1; - public static final int LDCSR = (3 << 4) | 1; - - public static final int LDUH = 2; - public static final int LDUHA = (1 << 4) | 2; - - public static final int LDD = 3; - public static final int LDDA = (1 << 4) | 3; - public static final int LDDF = (2 << 4) | 3; - public static final int LDDC = (3 << 4) | 3; - - public static final int ST = 4; - public static final int STA = (1 << 4) | 4; - public static final int STF = (2 << 4) | 4; - public static final int STC = (3 << 4) | 4; - - public static final int STB = 5; - public static final int STBA = (1 << 4) | 5; - public static final int STFSR = (2 << 4) | 5; - public static final int STCSR = (3 << 4) | 5; - - public static final int STH = 6; - public static final int STHA = (1 << 4) | 6; - public static final int STDFQ = (2 << 4) | 6; - public static final int STDCQ = (3 << 4) | 6; - - public static final int STD = 7; - public static final int STDA = (1 << 4) | 7; - public static final int STDF = (2 << 4) | 7; - public static final int STDC = (3 << 4) | 7; - - public static final int LDSB = 9; - public static final int LDSBA = (1 << 4) | 9; - - public static final int LDSH = 0xA; - public static final int LDSHA = (1 << 4) | 0xA; - - public static final int LDSTUB = 0xD; - public static final int LDSTUBA = (1 << 4) | 0xD; - - public static final int SWAP = 0xF; - public static final int SWAPA = (1 << 4) | 0xF; - - // arithmetic, logic remaining - op3 with op=2 (FORMAT_3A) - public static final int ADD = 0; - public static final int ADDcc = (1 << 4); - public static final int TADDcc = (2 << 4); - public static final int WRASR = (3 << 4); - public static final int WRY = WRASR; - - public static final int AND = 1; - public static final int ANDcc = (1 << 4) | 1; - public static final int TSUBcc = (2 << 4) | 1; - public static final int WRPSR = (3 << 4) | 1; - - public static final int OR = 2; - public static final int ORcc = (1 << 4) | 2; - public static final int TADDccTV = (2 << 4) | 2; - public static final int WRWIM = (3 << 4) | 2; - - public static final int XOR = 3; - public static final int XORcc = (1 << 4) | 3; - public static final int TSUBccTV = (2 << 4) | 3; - public static final int WRTBR = (3 << 4) | 3; - - public static final int SUB = 4; - public static final int SUBcc = (1 << 4) | 4; - public static final int MULScc = (2 << 4) | 4; - public static final int FPop1 = (3 << 4) | 4; - - public static final int ANDN = 5; - public static final int ANDNcc = (1 << 4) | 5; - public static final int SLL = (2 << 4) | 5; - public static final int FPop2 = (3 << 4) | 5; - - public static final int ORN = 6; - public static final int ORNcc = (1 << 4) | 6; - public static final int SRL = (2 << 4) | 6; - public static final int CPop1 = (3 << 4) | 6; - - public static final int XNOR = 7; - public static final int XNORcc = (1 << 4) | 7; - public static final int SRA = (2 << 4) | 7; - public static final int CPop2 = (3 << 4) | 7; - - public static final int ADDX = 8; - public static final int ADDXcc = (1 << 4) | 8; - public static final int RDASR = (2 << 4) | 8; - public static final int RDY = RDASR; - public static final int STBAR = RDASR; - public static final int JMPL = (3 << 4) | 8; - - public static final int RDPSR = (2 << 4) | 9; - public static final int RETT = (3 << 4) | 9; - - public static final int UMUL = 0xA; - public static final int UMULcc = (1 << 4) | 0xA; - public static final int RDWIM = (2 << 4) | 0xA; - public static final int Ticc = (3 << 4) | 0xA; - - public static final int SMUL = 0xB; - public static final int SMULcc = (1 << 4) | 0xB; - public static final int RDTBR = (2 << 4) | 0xB; - public static final int FLUSH = (3 << 4) | 0xB; - - public static final int SUBX = 0xC; - public static final int SUBXcc = (1 << 4) | 0xC; - public static final int SAVE = (3 << 4) | 0xC; - - public static final int RESTORE = (3 << 4) | 0xD; - - public static final int UDIV = 0xE; - public static final int UDIVcc = (1 << 4) | 0xE; - - public static final int SDIV = 0xF; - public static final int SDIVcc = (1 << 4) | 0xF; - - // opf - 9 bits (op=2, op3=0x34=FPop1) - floating point arithmetic - public static final int FMOVs = 0x01; - public static final int FNEGs = 0x05; - public static final int FABSs = 0x09; - public static final int FSQRTs = 0x29; - public static final int FSQRTd = 0x2A; - public static final int FSQRTq = 0x2B; - public static final int FADDs = 0x41; - public static final int FADDd = 0x42; - public static final int FADDq = 0x43; - public static final int FSUBs = 0x45; - public static final int FSUBd = 0x46; - public static final int FSUBq = 0x47; - public static final int FMULs = 0x49; - public static final int FMULd = 0x4A; - public static final int FMULq = 0x4B; - public static final int FDIVs = 0x4D; - public static final int FDIVd = 0x4E; - public static final int FDIVq = 0x4F; - public static final int FsMULd = 0x69; - public static final int FdMULq = 0x6E; - public static final int FiTOs = 0xC4; - public static final int FdTOs = 0xC6; - public static final int FqTOs = 0xC7; - public static final int FiTOd = 0xC8; - public static final int FsTOd = 0xC9; - public static final int FqTOd = 0xCB; - public static final int FiTOq = 0xCC; - public static final int FsTOq = 0xCD; - public static final int FdTOq = 0xCE; - public static final int FsTOi = 0xD1; - public static final int FdTOi = 0xD2; - public static final int FqTOi = 0xD3; - - // opf - 9 bits (op=2, op3=0x35=FPop2) - floating point comparisons - public static final int FCMPs = 0x51; - public static final int FCMPd = 0x52; - public static final int FCMPq = 0x53; - public static final int FCMPEs = 0x55; - public static final int FCMPEd = 0x56; - public static final int FCMPEq = 0x57; - - // 5 bit shift count mask - public static final int SHIFT_COUNT_5_MASK = 0x1F; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCReadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCReadInstruction extends SPARCSpecialRegisterInstruction { - final private int specialReg; - final private int asrRegNum; - final private SPARCRegister rd; - - public SPARCReadInstruction(int specialReg, int asrRegNum, SPARCRegister rd) { - super("rd"); - this.specialReg = specialReg; - this.asrRegNum = asrRegNum; - this.rd = rd; - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getAncillaryRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == ASR, "not an ancillary register"); - return asrRegNum; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - if(specialReg == ASR) - buf.append("%asr" + asrRegNum); - else - buf.append(getSpecialRegisterName(specialReg)); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCRegisterIndirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.Address; -import sun.jvm.hotspot.asm.BaseIndexScaleDispAddress; - -public class SPARCRegisterIndirectAddress extends BaseIndexScaleDispAddress { - protected int addressSpace = -1; - - public SPARCRegisterIndirectAddress(SPARCRegister register, int offset) { - super(register, offset); - } - - public SPARCRegisterIndirectAddress(SPARCRegister base, SPARCRegister index) { - super(base, index); - } - - public int getAddressSpace() { - return addressSpace; - } - - public void setAddressSpace(int addressSpace) { - this.addressSpace = addressSpace; - } - - public String getAddressWithoutAsi() { - StringBuffer buf = new StringBuffer(); - buf.append('['); - buf.append(getBase().toString()); - sun.jvm.hotspot.asm.Register register = getIndex(); - if (register != null) { - buf.append(" + "); - buf.append(register.toString()); - } else { - long disp = getDisplacement(); - if (disp < 0) { - buf.append(" - 0x"); - disp = -disp; - } else { - buf.append(" + 0x"); - } - buf.append(Long.toHexString(disp)); - } - buf.append(']'); - return buf.toString(); - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append(getAddressWithoutAsi()); - if(addressSpace != -1) - buf.append((new Integer(addressSpace)).toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCRestoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCRestoreInstruction extends SPARCFormat3AInstruction { - final private boolean trivial; - public SPARCRestoreInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd) { - super("restore", RESTORE, rs1, operand2, rd); - SPARCRegister G0 = SPARCRegisters.G0; - trivial = (rs1 == G0 && operand2 == G0 && rd == G0); - } - - public boolean isTrivial() { - return trivial; - } - - protected String getDescription() { - return (trivial) ? getName() : super.getDescription(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCRettInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCRettInstruction extends SPARCInstruction - implements BranchInstruction { - final protected SPARCRegisterIndirectAddress addr; - final protected String description; - - protected SPARCRettInstruction(String name, SPARCRegisterIndirectAddress addr) { - super(name); - this.addr = addr; - description = initDescription(); - } - - public SPARCRettInstruction(SPARCRegisterIndirectAddress addr) { - this("rett", addr); - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(addr.toString()); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isAnnuledBranch() { - return false; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCReturnInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCReturnInstruction extends SPARCJmplInstruction - implements ReturnInstruction { - - private final boolean leaf; - - public SPARCReturnInstruction(SPARCRegisterIndirectAddress addr, SPARCRegister rd, boolean leaf) { - super(leaf? "retl" : "ret", addr, rd); - this.leaf = leaf; - } - - public boolean isLeaf() { - return leaf; - } - - protected String getDescription() { - return getName(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSaveInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCSaveInstruction extends SPARCFormat3AInstruction { - final private boolean trivial; - public SPARCSaveInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, SPARCRegister rd) { - super("save", SAVE, rs1, operand2, rd); - SPARCRegister G0 = SPARCRegisters.G0; - trivial = (rs1 == G0 && operand2 == G0 && rd == G0); - } - - public boolean isTrivial() { - return trivial; - } - - protected String getOperand2String() { - StringBuffer buf = new StringBuffer(); - if (operand2.isRegister()) { - buf.append(operand2.toString()); - } else { - Number number = ((Immediate)operand2).getNumber(); - int value = number.intValue(); - if (value < 0) { - buf.append("-0x"); - value = -value; - } else { - buf.append("0x"); - } - - buf.append(Integer.toHexString(value)); - } - return buf.toString(); - } - - protected String getDescription() { - return (trivial) ? getName() : super.getDescription(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSethiInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCSethiInstruction extends SPARCInstruction - implements MoveInstruction { - final private SPARCRegister register; - final private ImmediateOrRegister value; - final private String description; - - public SPARCSethiInstruction(int value, SPARCRegister register) { - super("sethi"); - this.register = register; - value <<= 10; - this.value = new Immediate(new Integer(value)); - description = initDescription(value); - } - - private String initDescription(int val) { - if (val == 0 && register == SPARCRegisters.G0) { - return "nop"; - } else { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append("%hi(0x"); - buf.append(Integer.toHexString(val)); - buf.append(')'); - buf.append(comma); - buf.append(register.toString()); - return buf.toString(); - } - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Register getMoveDestination() { - return register; - } - - public ImmediateOrRegister getMoveSource() { - return value; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCShiftInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCShiftInstruction extends SPARCFormat3AInstruction - implements ShiftInstruction { - final private int operation; - - public SPARCShiftInstruction(String name, int opcode, int operation, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd) { - super(name, opcode, rs1, operand2, rd); - this.operation = operation; - } - - public int getOperation() { - return operation; - } - - public Operand getShiftDestination() { - return getDestinationRegister(); - } - - public Operand getShiftLength() { - return operand2; - } - - public Operand getShiftSource() { - return rs1; - } - - public boolean isShift() { - return true; - } - - protected String getOperand2String() { - return operand2.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSpecialLoadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCSpecialLoadInstruction - extends SPARCSpecialRegisterInstruction - implements /* imports */ SPARCSpecialRegisters { - final private int specialReg; - final private int cregNum; - final private SPARCRegisterIndirectAddress addr; - - public SPARCSpecialLoadInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr) { - super(name); - this.specialReg = specialReg; - this.cregNum = cregNum; - this.addr = addr; - } - - public SPARCSpecialLoadInstruction(String name, int specialReg, SPARCRegisterIndirectAddress addr) { - this(name, specialReg, -1, addr); - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getCoprocessorRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == CREG, "not a coprocesssor register"); - return cregNum; - } - - public Address getSource() { - return addr; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(addr); - buf.append(comma); - if (specialReg == CREG) { - buf.append("creg" + cregNum); - } else { - buf.append(getSpecialRegisterName(specialReg)); - } - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSpecialRegisterInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCSpecialRegisterInstruction - extends SPARCInstruction - implements /* import */ SPARCSpecialRegisters { - protected SPARCSpecialRegisterInstruction(String name) { - super(name); - } - - protected abstract String getDescription(); - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - protected static String[] specialRegNames = new String[] { - "%y", - "%psr", - "%wim", - "%tbr", - "%asr", - "%fsr", - "%csr", - "%fq", - "%cq" - }; - - protected static String getSpecialRegisterName(int index) { - return specialRegNames[index]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSpecialRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public interface SPARCSpecialRegisters { - public static final int Y = 0; - public static final int PSR = 1; - public static final int WIM = 2; - public static final int TBR = 3; - public static final int ASR = 4; - public static final int FSR = 5; - public static final int CSR = 6; - public static final int FQ = 7; - public static final int CQ = 8; - public static final int CREG = 9; // co-processor reg -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSpecialStoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCSpecialStoreInstruction - extends SPARCSpecialRegisterInstruction - implements /* imports */ SPARCSpecialRegisters { - final private int specialReg; - final private int cregNum; - final private SPARCRegisterIndirectAddress addr; - - public SPARCSpecialStoreInstruction(String name, int specialReg, int cregNum, - SPARCRegisterIndirectAddress addr) { - super(name); - this.specialReg = specialReg; - this.addr = addr; - this.cregNum = cregNum; - } - - public SPARCSpecialStoreInstruction(String name, int specialReg, - SPARCRegisterIndirectAddress addr) { - this(name, specialReg, -1, addr); - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getCoprocessorRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == CREG, "not a special register"); - return cregNum; - } - - public Address getDestination() { - return addr; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(getName()); - buf.append(spaces); - if (specialReg == CREG) { - buf.append("creg" + cregNum); - } else { - buf.append(getSpecialRegisterName(specialReg)); - } - buf.append(comma); - buf.append(addr.toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCStbarInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; - -public class SPARCStbarInstruction extends SPARCInstruction { - public SPARCStbarInstruction() { - super("stbar"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCStoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCStoreInstruction extends SPARCMemoryInstruction - implements StoreInstruction { - final protected SPARCRegister register2; // used by double word store instructions - final protected Register[] storeSources; - - public SPARCStoreInstruction(String name, int opcode, SPARCRegisterIndirectAddress address, SPARCRegister register, int dataType) { - super(name, opcode, address, register, dataType); - if (opcode == STD || opcode == STDA) { - storeSources = new Register[2]; - storeSources[0] = register; - int nextRegNum = (register.getNumber() + 1) % SPARCRegisters.NUM_REGISTERS; - register2 = SPARCRegisters.getRegister(nextRegNum); - storeSources[1] = register2; - } else { - storeSources = new Register[1]; - storeSources[0] = register; - register2 = null; - } - } - - private String defaultInitDescription(StringBuffer buf) { - buf.append(getName()); - buf.append(spaces); - buf.append(register.toString()); - buf.append(comma); - buf.append(address.toString()); - return buf.toString(); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - if (register == SPARCRegisters.G0) { - switch (opcode) { - case ST: - buf.append("clr"); - break; - case STH: - buf.append("clrh"); - break; - case STB: - buf.append("clrb"); - break; - default: - return defaultInitDescription(buf); - } - buf.append(spaces); - buf.append(address.toString()); - return buf.toString(); - } else { - return defaultInitDescription(buf); - } - } - - public int getDataType() { - return dataType; - } - - public Address getStoreDestination() { - return address; - } - - public Register[] getStoreSources() { - return storeSources; - } - - public boolean isStore() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCSwapInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCSwapInstruction extends SPARCAtomicLoadStoreInstruction { - public SPARCSwapInstruction(String name, SPARCRegisterIndirectAddress addr, SPARCRegister rd) { - super(name, addr, rd); - } - - public int getDataType() { - return RTLDT_UNSIGNED_WORD; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCTrapInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCTrapInstruction extends SPARCInstruction - implements BranchInstruction { - final protected int conditionCode; - - public SPARCTrapInstruction(String name, int conditionCode) { - super(name); - this.conditionCode = conditionCode; - } - - public Address getBranchDestination() { - return null; - } - - public int getConditionCode() { - return conditionCode; - } - - public boolean isConditional() { - return conditionCode != CONDITION_TN && conditionCode != CONDITION_TA; - } - - public boolean isTrap() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCUnimpInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCUnimpInstruction extends SPARCInstruction { - final private String description; - final private int const22; - - protected SPARCUnimpInstruction(String name, int const22) { - super(name); - this.const22 = const22; - description = initDescription(); - } - - public SPARCUnimpInstruction(int const22) { - this("unimp", const22); - } - - public int getConst22() { - return const22; - } - - public boolean isIllegal() { - return true; - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append("0x"); - buf.append(Integer.toHexString(const22)); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV8Disassembler.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.io.*; -import java.util.*; - -// Please refer to "The SPARC Architecture Manual - Version 8" - -public class SPARCV8Disassembler extends SPARCDisassembler { - - public SPARCV8Disassembler(long startPc, byte[] code, SPARCInstructionFactory factory) { - super(startPc, code, factory); - } - - public SPARCV8Disassembler(long startPc, byte[] code) { - this(startPc, code, new SPARCInstructionFactoryImpl()); - } - - // decoders for format 2 instructions - private static InstructionDecoder format2Decoders[] = { - new UnimpDecoder(), - illegalDecoder, - new IntegerBranchDecoder(), - illegalDecoder, - new SethiDecoder(), - illegalDecoder, - new FloatBranchDecoder(), - new CoprocessorBranchDecoder() - }; - - protected InstructionDecoder getFormat2Decoder(int op2) { - return format2Decoders[op2]; - } - - // op3 decoder table for op=3 (FORMAT_3) instructions - (memory instructions) - // Appendix F - Opcodes and Condition Codes - Page 229 - Table F-4 - - private static final InstructionDecoder format3Decoders[][] = { - { - new LoadDecoder(LD, "ld", RTLDT_UNSIGNED_WORD), new AlternateSpaceLoadDecoder(LDA, "lda", RTLDT_UNSIGNED_WORD), - new LoadDecoder(LDF,"ld", RTLDT_FL_SINGLE), new SpecialLoadDecoder(LDC,"ld", SPARCSpecialRegisters.CREG) - }, - { - new LoadDecoder(LDUB, "ldub", RTLDT_UNSIGNED_BYTE), new AlternateSpaceLoadDecoder(LDUBA, "lduba", RTLDT_UNSIGNED_BYTE), - new SpecialLoadDecoder(LDFSR, "ld", SPARCSpecialRegisters.FSR), new SpecialLoadDecoder(LDCSR, "ld", SPARCSpecialRegisters.CSR) - }, - { - new LoadDecoder(LDUH, "lduh", RTLDT_UNSIGNED_HALF), new AlternateSpaceLoadDecoder(LDUHA, "lduha", RTLDT_UNSIGNED_HALF), - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDD, "ldd", RTLDT_UNSIGNED_DWORD), new AlternateSpaceLoadDecoder(LDDA, "ldda", RTLDT_UNSIGNED_DWORD), - new LoadDecoder(LDDF, "ldd", RTLDT_FL_DOUBLE), new SpecialLoadDecoder(LDDC, "ldd", SPARCSpecialRegisters.CREG) - }, - { - new StoreDecoder(ST, "st", RTLDT_UNSIGNED_WORD), new AlternateSpaceStoreDecoder(STA, "sta", RTLDT_UNSIGNED_WORD), - new StoreDecoder(STF, "st", RTLDT_FL_SINGLE), new SpecialStoreDecoder(STC, "st", SPARCSpecialRegisters.CREG) - }, - { - new StoreDecoder(STB, "stb", RTLDT_UNSIGNED_BYTE), new AlternateSpaceStoreDecoder(STBA, "stba", RTLDT_UNSIGNED_BYTE), - new SpecialStoreDecoder(STFSR, "st", SPARCSpecialRegisters.FSR), new SpecialStoreDecoder(STCSR, "st", SPARCSpecialRegisters.CSR), - }, - { - new StoreDecoder(STH, "sth", RTLDT_UNSIGNED_HALF), new AlternateSpaceStoreDecoder(STHA, "stha", RTLDT_UNSIGNED_HALF), - new SpecialStoreDecoder(STDFQ, "std", SPARCSpecialRegisters.FQ), new SpecialStoreDecoder(STDCQ, "std", SPARCSpecialRegisters.CQ), - }, - { - new StoreDecoder(STD, "std", RTLDT_UNSIGNED_DWORD), new AlternateSpaceStoreDecoder(STDA, "stda", RTLDT_UNSIGNED_DWORD), - new StoreDecoder(STDF, "std", RTLDT_FL_DOUBLE), new SpecialStoreDecoder(STDC, "std", SPARCSpecialRegisters.CREG) - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDSB, "ldsb", RTLDT_SIGNED_BYTE), new AlternateSpaceLoadDecoder(LDSBA, "ldsba", RTLDT_UNSIGNED_BYTE), - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDSH, "ldsh", RTLDT_SIGNED_HALF), new AlternateSpaceLoadDecoder(LDSHA, "ldsha", RTLDT_UNSIGNED_HALF), - illegalDecoder, illegalDecoder - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, illegalDecoder - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, illegalDecoder - }, - { - new LdstubDecoder(LDSTUB, "ldstub", RTLDT_UNSIGNED_BYTE), new AlternateSpaceLdstubDecoder(LDSTUBA, "ldstuba", RTLDT_UNSIGNED_BYTE), - illegalDecoder, illegalDecoder - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, illegalDecoder - }, - { - new SwapDecoder(SWAP, "swap", RTLDT_UNSIGNED_WORD), new AlternateSpaceSwapDecoder(SWAPA, "swapa", RTLDT_UNSIGNED_WORD), - illegalDecoder, illegalDecoder - }, - }; - - protected InstructionDecoder getFormat3Decoder(int row, int column) { - return format3Decoders[row][column]; - } - - // op3 decoder table for op=2 (FORMAT_3A) instructions - // Appendix F - Opcodes and Condition Codes - Page 228 - Table F-3 - protected static final InstructionDecoder format3ADecoders[][] = { - { - new ArithmeticDecoder(ADD, "add", RTLOP_ADD), new ArithmeticDecoder(ADDcc, "addcc", RTLOP_ADD), - new ArithmeticDecoder(TADDcc, "taddcc", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.ASR) - }, - { - new LogicDecoder(AND, "and", RTLOP_AND), new LogicDecoder(ANDcc, "andcc", RTLOP_AND), - new ArithmeticDecoder(TSUBcc, "tsubcc", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.PSR) - }, - { - new LogicDecoder(OR, "or", RTLOP_OR), new LogicDecoder(ORcc, "orcc", RTLOP_OR), - new ArithmeticDecoder(TADDccTV, "taddcctv", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.WIM) - }, - { - new LogicDecoder(XOR, "xor", RTLOP_XOR), new LogicDecoder(XORcc, "xorcc", RTLOP_XOR), - new ArithmeticDecoder(TSUBccTV, "tsubcctv", RTLOP_SUB), new WriteDecoder(SPARCSpecialRegisters.TBR) - }, - { - new ArithmeticDecoder(SUB, "sub", RTLOP_SUB), new ArithmeticDecoder(SUBcc, "subcc", RTLOP_SUB), - new ArithmeticDecoder(MULScc, "mulscc", RTLOP_SMUL), new V8FPop1Decoder() - }, - { - new LogicDecoder(ANDN, "andn", RTLOP_NAND), new LogicDecoder(ANDNcc, "andncc", RTLOP_NAND), - new ShiftDecoder(SLL, "sll", RTLOP_SLL), new V8FPop2Decoder() - }, - { - new LogicDecoder(ORN, "orn", RTLOP_NOR), new LogicDecoder(ORNcc, "orncc", RTLOP_NOR), - new ShiftDecoder(SRL, "srl", RTLOP_SRL), new CoprocessorDecoder(CPop1) - }, - { - new LogicDecoder(XNOR, "xnor", RTLOP_XNOR), new LogicDecoder(XNORcc, "xnorcc", RTLOP_XNOR), - new ShiftDecoder(SRA, "sra", RTLOP_SRA), new CoprocessorDecoder(CPop2) - }, - { - new ArithmeticDecoder(ADDX, "addx", RTLOP_ADDC), new ArithmeticDecoder(ADDXcc, "addxcc", RTLOP_ADDC), - new ReadDecoder(SPARCSpecialRegisters.ASR), new JmplDecoder() - }, - { - illegalDecoder, illegalDecoder, - new ReadDecoder(SPARCSpecialRegisters.PSR), new RettDecoder() - }, - { - new ArithmeticDecoder(UMUL, "umul", RTLOP_UMUL), new ArithmeticDecoder(UMULcc, "umulcc", RTLOP_UMUL), - new ReadDecoder(SPARCSpecialRegisters.WIM), new TrapDecoder() - }, - { - new ArithmeticDecoder(SMUL, "smul", RTLOP_SMUL), new ArithmeticDecoder(SMULcc, "smulcc", RTLOP_SMUL), - new ReadDecoder(SPARCSpecialRegisters.TBR), new FlushDecoder() - }, - { - new ArithmeticDecoder(SUBX, "subx", RTLOP_SUBC), new ArithmeticDecoder(SUBXcc, "subxcc", RTLOP_SUBC), - illegalDecoder, new SaveDecoder() - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, new RestoreDecoder() - }, - { - new ArithmeticDecoder(UDIV, "udiv", RTLOP_UDIV), new ArithmeticDecoder(UDIVcc, "udivcc", RTLOP_UDIV), - illegalDecoder, illegalDecoder - }, - { - new ArithmeticDecoder(SDIV, "sdiv", RTLOP_SDIV), new ArithmeticDecoder(SDIVcc, "sdivcc", RTLOP_SDIV), - illegalDecoder, illegalDecoder - } - }; - - protected InstructionDecoder getFormat3ADecoder(int row, int column) { - return format3ADecoders[row][column]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9BranchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9BranchInstruction extends SPARCBranchInstruction - implements SPARCV9Instruction { - final private boolean predictTaken; - final private int conditionFlag; // icc, xcc or fccn - condition bits selected - - public SPARCV9BranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int conditionCode, boolean predictTaken, int conditionFlag) { - super((name += (predictTaken)? ",pt" : ",pn"), addr, isAnnuled, conditionCode); - this.predictTaken = predictTaken; - this.conditionFlag = conditionFlag; - } - - public boolean getPredictTaken() { - return predictTaken; - } - - public String getConditionFlagName() { - return SPARCV9ConditionFlags.getFlagName(conditionFlag); - } - - public int getConditionFlag() { - return conditionFlag; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - long address = addr.getDisplacement() + currentPc; - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - - // add conditionFlag bit used. - buf.append(getConditionFlagName()); - buf.append(comma); - buf.append(symFinder.getSymbolFor(address)); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9CasInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9CasInstruction extends SPARCAtomicLoadStoreInstruction - implements SPARCV9Instruction { - final private SPARCRegister rs2; - final private int dataType; - - public SPARCV9CasInstruction(String name, SPARCRegisterIndirectAddress addr, - SPARCRegister rs2, SPARCRegister rd, int dataType) { - super(name, addr, rd); - this.rs2 = rs2; - this.dataType = dataType; - } - - public int getDataType() { - return dataType; - } - - public boolean isConditional() { - return true; - } - - public SPARCRegister getComparisonRegister() { - return rs2; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9ConditionFlags.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -class SPARCV9ConditionFlags { - private static final String ccFlagNames[] = { - "%fcc0", "%fcc1", "%fcc2", "%fcc3", "%icc", null, "%xcc", null - }; - - public static String getFlagName(int index) { - return ccFlagNames[index]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9Disassembler.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -// Please refer to "The SPARC Architecture Manual - Version 9" - -public class SPARCV9Disassembler extends SPARCDisassembler - implements /* imports */ SPARCV9Opcodes { - public SPARCV9Disassembler(long startPc, byte[] code, SPARCV9InstructionFactory factory) { - super(startPc, code, factory); - } - - public SPARCV9Disassembler(long startPc, byte[] code) { - this(startPc, code, new SPARCV9InstructionFactoryImpl()); - } - - // decoders for format 2 instructions - private static InstructionDecoder format2Decoders[] = { - new UnimpDecoder(), - new V9IntegerBranchDecoder(), - new IntegerBranchDecoder(), - new V9IntRegisterBranchDecoder(), - new SethiDecoder(), - new V9FloatBranchDecoder(), - new FloatBranchDecoder(), - illegalDecoder - }; - - protected InstructionDecoder getFormat2Decoder(int op2) { - return format2Decoders[op2]; - } - - // op3 opcode table for op=3 (FORMAT_3) instructions - (memory instructions) - // E.2 Tables - Page 275 - Table 33. - private static final InstructionDecoder format3Decoders[][] = { - { - new LoadDecoder(LDUW, "ld" /* lduw */, RTLDT_UNSIGNED_WORD), new V9AlternateSpaceLoadDecoder(LDUWA, "lduwa", RTLDT_UNSIGNED_WORD), - new LoadDecoder(LDF,"ld", RTLDT_FL_SINGLE), new V9AlternateSpaceLoadDecoder(LDFA, "lda", RTLDT_FL_SINGLE) - }, - { - new LoadDecoder(LDUB, "ldub", RTLDT_UNSIGNED_BYTE), new V9AlternateSpaceLoadDecoder(LDUBA, "lduba", RTLDT_UNSIGNED_BYTE), - new V9SpecialLoadDecoder(LDFSR), illegalDecoder - }, - { - new LoadDecoder(LDUH, "lduh", RTLDT_UNSIGNED_HALF), new V9AlternateSpaceLoadDecoder(LDUHA, "lduha", RTLDT_UNSIGNED_HALF), - new LoadDecoder(LDQF, "ldq", RTLDT_FL_QUAD), new V9AlternateSpaceLoadDecoder(LDQFA, "ldqa", RTLDT_FL_QUAD) - }, - { - new LoadDecoder(LDD, "ldd", RTLDT_UNSIGNED_DWORD), new V9AlternateSpaceLoadDecoder(LDDA, "ldda", RTLDT_UNSIGNED_DWORD), - new LoadDecoder(LDDF, "ldd", RTLDT_FL_DOUBLE), new LoadDecoder(LDDFA, "ldda", RTLDT_FL_DOUBLE) - }, - { - new StoreDecoder(STW, "st" /* stw, stuw, stsw */, RTLDT_UNSIGNED_WORD), new V9AlternateSpaceStoreDecoder(STWA, "stwa", RTLDT_UNSIGNED_WORD), - new StoreDecoder(STF, "st", RTLDT_FL_SINGLE), new StoreDecoder(STFA, "st", RTLDT_FL_SINGLE), - }, - { - new StoreDecoder(STB, "stb", RTLDT_UNSIGNED_BYTE), new V9AlternateSpaceStoreDecoder(STBA, "stba", RTLDT_UNSIGNED_BYTE), - new V9SpecialStoreDecoder(STFSR), illegalDecoder - }, - { - new StoreDecoder(STH, "sth", RTLDT_UNSIGNED_HALF), new V9AlternateSpaceStoreDecoder(STHA, "stha", RTLDT_UNSIGNED_HALF), - new StoreDecoder(STQF, "stq", RTLDT_FL_QUAD), new V9AlternateSpaceStoreDecoder(STQFA, "stqa", RTLDT_FL_QUAD), - }, - { - new StoreDecoder(STD, "std", RTLDT_UNSIGNED_DWORD), new V9AlternateSpaceStoreDecoder(STDA, "stda", RTLDT_UNSIGNED_DWORD), - new StoreDecoder(STDF, "std", RTLDT_FL_DOUBLE), new V9AlternateSpaceStoreDecoder(STDFA, "stda", RTLDT_FL_DOUBLE) - }, - { - new LoadDecoder(LDSW, "ldsw", RTLDT_SIGNED_WORD), new V9AlternateSpaceLoadDecoder(LDSWA, "ldswa", RTLDT_SIGNED_WORD), - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDSB, "ldsb", RTLDT_SIGNED_BYTE), new V9AlternateSpaceLoadDecoder(LDSBA, "ldsba", RTLDT_UNSIGNED_BYTE), - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDSH, "ldsh", RTLDT_SIGNED_HALF), new V9AlternateSpaceLoadDecoder(LDSHA, "ldsha", RTLDT_UNSIGNED_HALF), - illegalDecoder, illegalDecoder - }, - { - new LoadDecoder(LDX, "ldx", RTLDT_UNSIGNED_DWORD), new V9AlternateSpaceLoadDecoder(LDXA, "ldxa", RTLDT_UNSIGNED_DWORD), - illegalDecoder, illegalDecoder - }, - { - illegalDecoder, illegalDecoder, - illegalDecoder, new V9CasDecoder(CASA, "casa", RTLDT_UNSIGNED_WORD) - }, - { - new LdstubDecoder(LDSTUB, "ldstub", RTLDT_UNSIGNED_BYTE), new V9AlternateSpaceLdstubDecoder(LDSTUBA, "ldstuba", RTLDT_UNSIGNED_BYTE), - new V9PrefetchDecoder(), new V9AlternateSpacePrefetchDecoder() - }, - { - new StoreDecoder(STX, "stx", RTLDT_UNSIGNED_DWORD), new V9AlternateSpaceStoreDecoder(STXA, "stxa", RTLDT_UNSIGNED_DWORD), - illegalDecoder, new V9CasDecoder(CASXA, "casxa", RTLDT_UNSIGNED_DWORD) - }, - { - new SwapDecoder(SWAP, "swap", RTLDT_UNSIGNED_WORD), new V9AlternateSpaceSwapDecoder(SWAPA, "swapa", RTLDT_UNSIGNED_WORD), - illegalDecoder, illegalDecoder - }, - }; - - protected InstructionDecoder getFormat3Decoder(int row, int column) { - return format3Decoders[row][column]; - } - - // op3 decoder table for op=2 (FORMAT_3A) instructions - // E Opcode Maps - Page 274 - Table 32 - - protected static final InstructionDecoder format3ADecoders[][] = { - { - new ArithmeticDecoder(ADD, "add", RTLOP_ADD), new ArithmeticDecoder(ADDcc, "addcc", RTLOP_ADD), - new ArithmeticDecoder(TADDcc, "taddcc", RTLOP_ADD), new V9WriteDecoder() - }, - { - new LogicDecoder(AND, "and", RTLOP_AND), new LogicDecoder(ANDcc, "andcc", RTLOP_AND), - new ArithmeticDecoder(TSUBcc, "tsubcc", RTLOP_ADD), new V9SavedRestoredDecoder() - }, - { - new LogicDecoder(OR, "or", RTLOP_OR), new LogicDecoder(ORcc, "orcc", RTLOP_OR), - new ArithmeticDecoder(TADDccTV, "taddcctv", RTLOP_ADD), new V9WrprDecoder() - }, - { - new LogicDecoder(XOR, "xor", RTLOP_XOR), new LogicDecoder(XORcc, "xorcc", RTLOP_XOR), - new ArithmeticDecoder(TSUBccTV, "tsubcctv", RTLOP_SUB), illegalDecoder - }, - { - new ArithmeticDecoder(SUB, "sub", RTLOP_SUB), new ArithmeticDecoder(SUBcc, "subcc", RTLOP_SUB), - new ArithmeticDecoder(MULScc, "mulscc", RTLOP_SMUL), new V9FPop1Decoder() - }, - { - new LogicDecoder(ANDN, "andn", RTLOP_NAND), new LogicDecoder(ANDNcc, "andncc", RTLOP_NAND), - new V9ShiftDecoder(SLL, "sll", RTLOP_SLL), new V9FPop2Decoder() - }, - { - new LogicDecoder(ORN, "orn", RTLOP_NOR), new LogicDecoder(ORNcc, "orncc", RTLOP_NOR), - new V9ShiftDecoder(SRL, "srl", RTLOP_SRL), new CoprocessorDecoder(IMPDEP1) - }, - { - new LogicDecoder(XNOR, "xnor", RTLOP_XNOR), new LogicDecoder(XNORcc, "xnorcc", RTLOP_XNOR), - new V9ShiftDecoder(SRA, "sra", RTLOP_SRA), new CoprocessorDecoder(IMPDEP2) - }, - { - new ArithmeticDecoder(ADDC, "addc", RTLOP_ADDC), new ArithmeticDecoder(ADDCcc, "addccc", RTLOP_ADDC), - new V9ReadDecoder(), new JmplDecoder() - }, - { - new ArithmeticDecoder(MULX, "mulx", RTLOP_UMUL), illegalDecoder, - illegalDecoder, new RettDecoder() - }, - { - new ArithmeticDecoder(UMUL, "umul", RTLOP_UMUL), new ArithmeticDecoder(UMULcc, "umulcc", RTLOP_UMUL), - new V9RdprDecoder(), new TrapDecoder() - }, - { - new ArithmeticDecoder(SMUL, "smul", RTLOP_SMUL), new ArithmeticDecoder(SMULcc, "smulcc", RTLOP_SMUL), - new V9FlushwDecoder(), new FlushDecoder() - }, - { - new ArithmeticDecoder(SUBC, "subc", RTLOP_SUBC), new ArithmeticDecoder(SUBCcc, "subccc", RTLOP_SUBC), - new V9MOVccDecoder(), new SaveDecoder() - }, - { - new ArithmeticDecoder(UDIVX, "udivx", RTLOP_UDIV), illegalDecoder, - new ArithmeticDecoder(SDIVX, "sdivx", RTLOP_SDIV), new RestoreDecoder() - }, - { - new ArithmeticDecoder(UDIV, "udiv", RTLOP_UDIV), new ArithmeticDecoder(UDIVcc, "udivcc", RTLOP_UDIV), - new V9PopcDecoder(), new V9DoneRetryDecoder() - }, - { - new ArithmeticDecoder(SDIV, "sdiv", RTLOP_SDIV), new ArithmeticDecoder(SDIVcc, "sdivcc", RTLOP_SDIV), - new V9MOVrDecoder(), illegalDecoder - } - }; - - protected InstructionDecoder getFormat3ADecoder(int row, int column) { - return format3ADecoders[row][column]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9DoneInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9DoneInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9DoneInstruction() { - super("done"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9FMOVccInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9FMOVccInstruction extends SPARCFPMoveInstruction - implements MoveInstruction { - final int conditionCode; - final int conditionFlag; - - public SPARCV9FMOVccInstruction(String name, int opf, int conditionCode, - int conditionFlag, SPARCFloatRegister rs, - SPARCFloatRegister rd) { - super(name, opf, rs, rd); - this.conditionFlag = conditionFlag; - this.conditionCode = conditionCode; - } - - public int getConditionCode() { - return conditionCode; - } - - public int getConditionFlag() { - return conditionFlag; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9FMOVrInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9FMOVrInstruction extends SPARCFPMoveInstruction - implements SPARCV9Instruction { - final private int regConditionCode; - final private SPARCRegister rs1; - - public SPARCV9FMOVrInstruction(String name, int opf, SPARCRegister rs1, - SPARCFloatRegister rs2, SPARCFloatRegister rd, - int regConditionCode) { - super(name, opf, rs2, rd); - this.regConditionCode = regConditionCode; - this.rs1 = rs1; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - buf.append(rs.toString()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public int getRegisterConditionCode() { - return regConditionCode; - } - - public boolean isConditional() { - return true; - } - - public Register getConditionRegister() { - return rs1; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9FlushwInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9FlushwInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9FlushwInstruction() { - super("flushw"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9IlltrapInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9IlltrapInstruction extends SPARCUnimpInstruction - implements SPARCV9Instruction { - public SPARCV9IlltrapInstruction(int const22) { - super("illtrap", const22); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9ImpdepInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9ImpdepInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9ImpdepInstruction(String name) { - super(name); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9Instruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public interface SPARCV9Instruction extends SPARCV9Opcodes { -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9InstructionFactory.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public interface SPARCV9InstructionFactory extends SPARCInstructionFactory { - public SPARCInstruction newV9BranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int conditionCode, boolean predictTaken, int conditionFlag); - public SPARCInstruction newV9RegisterBranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int regConditionCode, SPARCRegister conditionRegister, - boolean predictTaken); - public SPARCInstruction newV9CasInstruction(String name, SPARCRegisterIndirectAddress addr, - SPARCRegister rs2, SPARCRegister rd, int dataType); - public SPARCInstruction newV9PrefetchInstruction(String name, SPARCRegisterIndirectAddress addr, - int prefetchFcn); - public SPARCInstruction newV9FlushwInstruction(); - public SPARCInstruction newV9MOVccInstruction(String name, int conditionCode, int conditionFlag, - ImmediateOrRegister source, SPARCRegister rd); - public SPARCInstruction newV9MOVrInstruction(String name, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd, - int regConditionCode); - public SPARCInstruction newV9RdprInstruction(int regNum, SPARCRegister rd); - public SPARCInstruction newV9WrprInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, int regNum); - public SPARCInstruction newV9PopcInstruction(ImmediateOrRegister source, SPARCRegister rd); - public SPARCInstruction newV9DoneInstruction(); - public SPARCInstruction newV9RetryInstruction(); - public SPARCInstruction newV9SavedInstruction(); - public SPARCInstruction newV9RestoredInstruction(); - public SPARCInstruction newV9ReadInstruction(int specialRegNum, int asrRegNum, SPARCRegister rd); - public SPARCInstruction newV9WriteInstruction(int specialRegNum, int asrRegNum, SPARCRegister rs1, - ImmediateOrRegister operand2); - public SPARCInstruction newV9MembarInstruction(int mmask, int cmask); - public SPARCInstruction newV9SirInstruction(); - public SPARCInstruction newV9FMOVccInstruction(String name, int opf, int conditionCode, - int conditionFlag, SPARCFloatRegister rs, - SPARCFloatRegister rd); - public SPARCInstruction newV9FMOVrInstruction(String name, int opf, - SPARCRegister rs1, SPARCFloatRegister rs2, - SPARCFloatRegister rd, int regConditionCode); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9InstructionFactoryImpl.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9InstructionFactoryImpl extends SPARCInstructionFactoryImpl - implements SPARCV9InstructionFactory { - - public SPARCInstruction newUnimpInstruction(int const22) { - return new SPARCV9IlltrapInstruction(const22); - } - - public SPARCInstruction newRettInstruction(SPARCRegisterIndirectAddress addr) { - return new SPARCV9ReturnInstruction(addr); - } - - public SPARCInstruction newCoprocessorInstruction(int instruction, int cpopcode, int opc, - int rs1Num, int rs2Num, int rdNum) { - return new SPARCV9ImpdepInstruction(cpopcode == SPARCOpcodes.CPop1? "impdep1" : "impdep2"); - } - - public SPARCInstruction newV9ReadInstruction(int specialRegNum, int asrRegNum, SPARCRegister rd) { - return new SPARCV9ReadInstruction(specialRegNum, asrRegNum, rd); - } - - public SPARCInstruction newV9WriteInstruction(int specialRegNum, int asrRegNum, SPARCRegister rs1, - ImmediateOrRegister operand2) { - return new SPARCV9WriteInstruction(specialRegNum, asrRegNum, rs1, operand2); - } - - public SPARCInstruction newV9BranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int conditionCode, boolean predictTaken, int conditionFlag) { - return new SPARCV9BranchInstruction(name, addr, isAnnuled, conditionCode, - predictTaken, conditionFlag); - } - - public SPARCInstruction newV9RegisterBranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int regConditionCode, SPARCRegister conditionRegister, - boolean predictTaken) { - return new SPARCV9RegisterBranchInstruction(name, addr, isAnnuled, regConditionCode, - conditionRegister, predictTaken); - } - - public SPARCInstruction newV9CasInstruction(String name, SPARCRegisterIndirectAddress addr, - SPARCRegister rs2, SPARCRegister rd, int dataType) { - return new SPARCV9CasInstruction(name, addr, rs2, rd, dataType); - } - - public SPARCInstruction newV9PrefetchInstruction(String name, SPARCRegisterIndirectAddress addr, - int prefetchFcn) { - return new SPARCV9PrefetchInstruction(name, addr, prefetchFcn); - } - - public SPARCInstruction newV9FlushwInstruction() { - return new SPARCV9FlushwInstruction(); - } - - public SPARCInstruction newV9MOVccInstruction(String name, int conditionCode, int conditionFlag, - ImmediateOrRegister source, SPARCRegister rd) { - return new SPARCV9MOVccInstruction(name, conditionCode, conditionFlag, source, rd); - } - - public SPARCInstruction newV9MOVrInstruction(String name, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd, - int regConditionCode) { - return new SPARCV9MOVrInstruction(name, rs1, operand2, rd, regConditionCode); - } - - public SPARCInstruction newV9RdprInstruction(int regNum, SPARCRegister rd) { - return new SPARCV9RdprInstruction(regNum, rd); - } - - public SPARCInstruction newV9WrprInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, int regNum) { - return new SPARCV9WrprInstruction(rs1, operand2, regNum); - } - - public SPARCInstruction newV9PopcInstruction(ImmediateOrRegister source, SPARCRegister rd) { - return new SPARCV9PopcInstruction(source, rd); - } - - public SPARCInstruction newV9DoneInstruction() { - return new SPARCV9DoneInstruction(); - } - - public SPARCInstruction newV9RetryInstruction() { - return new SPARCV9RetryInstruction(); - } - - public SPARCInstruction newV9SavedInstruction() { - return new SPARCV9SavedInstruction(); - } - - public SPARCInstruction newV9RestoredInstruction() { - return new SPARCV9RestoredInstruction(); - } - - public SPARCInstruction newV9MembarInstruction(int mmask, int cmask) { - return new SPARCV9MembarInstruction(mmask, cmask); - } - - public SPARCInstruction newV9SirInstruction() { - return new SPARCV9SirInstruction(); - } - - public SPARCInstruction newV9FMOVccInstruction(String name, int opf, - int conditionCode, int conditionFlag, - SPARCFloatRegister rs, SPARCFloatRegister rd) { - return new SPARCV9FMOVccInstruction(name, opf, conditionCode, conditionFlag, rs, rd); - } - - public SPARCInstruction newV9FMOVrInstruction(String name, int opf, - SPARCRegister rs1, SPARCFloatRegister rs2, - SPARCFloatRegister rd, int regConditionCode) { - return new SPARCV9FMOVrInstruction(name, opf, rs1, rs2, rd, regConditionCode); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9MOVccInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9MOVccInstruction extends SPARCMoveInstruction - implements SPARCV9Instruction { - final private int conditionFlag; // condition flag used icc, xcc, fccn etc. - final private int conditionCode; - - public SPARCV9MOVccInstruction(String name, int conditionCode, int conditionFlag, - ImmediateOrRegister source, SPARCRegister rd) { - super(name, MOVcc, source, rd); - this.conditionCode = conditionCode; - this.conditionFlag = conditionFlag; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(SPARCV9ConditionFlags.getFlagName(conditionFlag)); - buf.append(comma); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public int getConditionCode() { - return conditionCode; - } - - public int getConditionFlag() { - return conditionFlag; - } - - public String getConditionFlagName() { - return SPARCV9ConditionFlags.getFlagName(conditionFlag); - } - - public boolean isConditional() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9MOVrInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9MOVrInstruction extends SPARCMoveInstruction - implements SPARCV9Instruction { - final private int regConditionCode; - final private SPARCRegister rs1; - - public SPARCV9MOVrInstruction(String name, SPARCRegister rs1, - ImmediateOrRegister operand2, SPARCRegister rd, - int regConditionCode) { - super(name, MOVr, operand2, rd); - this.regConditionCode = regConditionCode; - this.rs1 = rs1; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public int getRegisterConditionCode() { - return regConditionCode; - } - - public boolean isConditional() { - return true; - } - - public Register getConditionRegister() { - return getSourceRegister1(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9MembarInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; -import java.util.Vector; - -public class SPARCV9MembarInstruction extends SPARCInstruction - implements SPARCV9Instruction { - final private int mmask; - final private int cmask; - final private String description; - - public SPARCV9MembarInstruction(int mmask, int cmask) { - super("membar"); - this.mmask = mmask & 0xF; - this.cmask = cmask & 0x7; - description = initDescription(); - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - - Vector masks = new Vector(); - if ((mmask & 0x1) != 0) - masks.add("#LoadLoad"); - if ((mmask & 0x2) != 0) - masks.add("#StoreLoad"); - if ((mmask & 0x4) != 0) - masks.add("#LoadStore"); - if ((mmask & 0x8) != 0) - masks.add("#StoreStore"); - - if ((cmask & 0x1) != 0) - masks.add("#Lookaside"); - if ((cmask & 0x2) != 0) - masks.add("#MemIssue"); - if ((cmask & 0x4) != 0) - masks.add("#Sync"); - - // add all masks - Object[] tempMasks = masks.toArray(); - for (int i=0; i < tempMasks.length - 1; i++) { - buf.append((String)tempMasks[i]); - buf.append("| "); - } - buf.append((String)tempMasks[tempMasks.length - 1]); - - return buf.toString(); - } - - public int getMMask() { - return mmask; - } - - public int getCMask() { - return cmask; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9Opcodes.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,365 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -// Please refer to "The SPARC Architecture Manual - Version 9" - -public interface SPARCV9Opcodes extends SPARCOpcodes { - // format 2, v9 specific "op2" values. - - // branch on integer condition codes with prediction - public static final int OP_2_BPcc = 1; - - // branch on integer register contents with prediction - public static final int OP_2_BPr = 3; - - // branch on float condition codes with prediction - public static final int OP_2_FBPfcc = 5; - - // "rcond" - branch on register condition - public static final int BRANCH_RCOND_START_BIT = 25; - - // rcond is 3 bits length - public static final int BRANCH_RCOND_MASK = 7 << BRANCH_RCOND_START_BIT; - - // "rcond" - as used in conditional moves - public static final int CMOVE_RCOND_START_BIT = 10; - public static final int CMOVE_RCOND_MASK = 7 << CMOVE_RCOND_START_BIT; - - public static final int IMPDEP1 = CPop1; - public static final int IMPDEP2 = CPop2; - - // various rcond values - used in BPr, MOVr and FMOVr - - // reserved register condition - public static final int BRANCH_RCOND_RESERVED1 = 0; // 000 - - public static final int BRZ = 1; - public static final int MOVRZ = BRZ; - public static final int FMOVZ = BRZ; - - public static final int BRLEZ = 2; - public static final int MOVRLEZ = BRLEZ; - public static final int FMOVLEZ = BRLEZ; - - public static final int BRLZ = 3; - public static final int MOVRLZ = BRLZ; - public static final int FMOVLZ = BRLZ; - - // reserved register condition - public static final int BRANCH_RCOND_RESERVED2 = 4; // 100 - - public static final int BRNZ = 5; - public static final int MOVRNZ = BRNZ; - public static final int FMOVNZ = BRNZ; - - public static final int BRGZ = 6; - public static final int MOVGZ = BRGZ; - public static final int FMOVGZ = BRGZ; - - public static final int BRGEZ = 7; - public static final int MOVRGEZ = BRGEZ; - public static final int FMOVGEZ = BRGEZ; - - // "p" - prediction bit - predict branch taken or not taken - public static final int PREDICTION_START_BIT = 19; - public static final int PREDICTION_MASK = 1 << PREDICTION_START_BIT; - - // branch pc relative displacement - hi 2 bits of disp16. - public static final int DISP_16_HI_START_BIT = 20; - - // disp 16 hi is 2 bits length - public static final int DISP_16_HI_MASK = 3 << DISP_16_HI_START_BIT; - - // disp 16 low 14 bits - public static final int DISP_16_LO_START_BIT = 0; // just for completion. - public static final int DISP_16_LO_MASK = 0x3FFF; - public static final int DISP_16_LO_NUMBITS = 14; - - // disp 19 - integer branch with prediction - displacement - public static final int DISP_19_MASK = 0x7FFFF; - - /* - * condition code selected for integer branches - cc1 & cc0. - * condition code selected for float branches - cc1 & cc0. - * opf_cc field - floating conditional moves - 3 bits. - * convert 2 bit codes as 3 bit codes always and use following codes - * uniformly. - */ - - // opf_cc - 3 bits - public static final int OPF_CC_START_BIT = 11; - public static final int OPF_CC_MASK = 7 << OPF_CC_START_BIT; - - public static final int fcc0 = 0; // 000 - public static final int fcc1 = 1; // 001 - public static final int fcc2 = 2; // 010 - public static final int fcc3 = 3; // 011 - public static final int icc = 4; // 100 - public static final int CFLAG_RESERVED1 = 5; // 101 - public static final int xcc = 6; // 110 - public static final int CFLAG_RESERVED2 = 7; // 111 - - // cc0, cc1 as in integer, float predicted branches - public static final int BPcc_CC_START_BIT = 20; - public static final int BPcc_CC_MASK = 3 << BPcc_CC_START_BIT; - public static final int FBPfcc_CC_START_BIT = BPcc_CC_START_BIT; - public static final int FBPfcc_CC_MASK = BPcc_CC_MASK; - - // condition codes for integer branches with prediction - BPcc - public static final int CONDITION_BPN = CONDITION_BN; - public static final int CONDITION_BPE = CONDITION_BE; - public static final int CONDITION_BPLE = CONDITION_BLE; - public static final int CONDITION_BPL = CONDITION_BL; - public static final int CONDITION_BPLEU = CONDITION_BLEU; - public static final int CONDITION_BPCS = CONDITION_BCS; - public static final int CONDITION_BPNEG = CONDITION_BNEG; - public static final int CONDITION_BPVS = CONDITION_BVS; - public static final int CONDITION_BPA = CONDITION_BA; - public static final int CONDITION_BPNE = CONDITION_BNE; - public static final int CONDITION_BPG = CONDITION_BG; - public static final int CONDITION_BPGE = CONDITION_BGE; - public static final int CONDITION_BPGU = CONDITION_BGU; - public static final int CONDITION_BPCC = CONDITION_BCC; - public static final int CONDITION_BPPOS = CONDITION_BPOS; - public static final int CONDITION_BPVC = CONDITION_BVC; - - // condition codes for float branches with prediction - public static final int CONDITION_FBPN = CONDITION_BN; - public static final int CONDITION_FBPNE = CONDITION_BE; - public static final int CONDITION_FBPLG = CONDITION_BLE; - public static final int CONDITION_FBPUL = CONDITION_BL; - public static final int CONDITION_FBPL = CONDITION_BLEU; - public static final int CONDITION_FBPUG = CONDITION_BCS; - public static final int CONDITION_FBPG = CONDITION_BNEG; - public static final int CONDITION_FBPU = CONDITION_BVS; - public static final int CONDITION_FBPA = CONDITION_BA; - public static final int CONDITION_FBPE = CONDITION_BNE; - public static final int CONDITION_FBPUE = CONDITION_BG; - public static final int CONDITION_FBPGE = CONDITION_BGE; - public static final int CONDITION_FBPUGE= CONDITION_BGU; - public static final int CONDITION_FBPLE = CONDITION_BCC; - public static final int CONDITION_FBPULE= CONDITION_BPOS; - public static final int CONDITION_FBPO = CONDITION_BVC; - - // "cmask" - 3 bit mask used in membar for completion constraints - public static final int CMASK_START_BIT = 4; - public static final int CMASK_MASK = 7 << CMASK_START_BIT; - - // "mmask" - 4 bit mask used in member for ordering instruction classes. - public static final int MMASK_START_BIT = 0; - public static final int MMASK_MASK = 0xF; // no need to shift - - // v9 specific load/store instruction opcodes - // load/store instructions - op3 values - used with op=3 (FORMAT_3) - - public static final int LDUW = LD; - public static final int LDUWA = LDA; - - public static final int LDXFSR = LDFSR; - - public static final int LDFA = LDC; - public static final int LDQF = (2 << 4) | 2; - public static final int LDQFA = (3 << 4) | 2; - public static final int LDDFA = LDDC; - - public static final int STW = ST; - public static final int STWA = STA; - public static final int STFA = STC; - - public static final int STXFSR = STFSR; - - public static final int STQF = STDFQ; - public static final int STQFA = STDCQ; - public static final int STDFA = STDC; - - public static final int LDSW = 8; - public static final int LDSWA = (1 << 4) | 8; - - public static final int LDX = 0xB; - public static final int LDXA = (1 << 4) | 0xB; - - public static final int PREFETCH = (2 << 4) | 0xD; - public static final int PREFETCHA = (3 << 4) | 0xD; - - public static final int CASA = (3 << 4) | 0xC; - - public static final int STX = 0xE; - public static final int STXA = (1 << 4) | 0xE; - public static final int CASXA = (3 << 4) | 0xE; - - // 6 bit immediate shift count mask - public static final int SHIFT_COUNT_6_MASK = 0x3F; - - // X bit mask - used to differentiate b/w 32 bit and 64 bit shifts - public static final int X_MASK = 1 << 12; - - // E Opcode maps - Page 274 - Table 32 - op3 (op=2) table - // v9 specific items - public static final int ADDC = ADDX; - public static final int ADDCcc = ADDXcc; - - public static final int SUBC = SUBX; - public static final int SUBCcc = SUBXcc; - - public static final int MULX = 9; - public static final int UDIVX = 0xD; - - public static final int SLLX = SLL; - public static final int SRLX = SRL; - public static final int SRAX = SRA; - - // special register reads - public static final int RDCCR = RDY; - public static final int RDASI = RDY; - public static final int RDTICK = RDY; - public static final int RDPC = RDY; - public static final int RDFPRS = RDY; - public static final int MEMBAR = RDY; - public static final int STMBAR = RDY; - - public static final int RDPR = (2 << 4) | 0xA; - - public static final int FLUSHW = (2 << 4) | 0xB; - - public static final int MOVcc = (2 << 4) | 0xC; - - public static final int SDIVX = (2 << 4) | 0xD; - - public static final int POPC = (2 << 4) | 0xE; - - public static final int MOVr = (2 << 4) | 0xF; - - // special regitser writes - public static final int WRCCR = WRY; - public static final int WRASI = WRY; - public static final int WRFPRS = WRY; - public static final int SIR = WRY; - - public static final int SAVED = (3 << 4) | 0x1; - public static final int RESTORED = SAVED; - - public static final int WRPR = (3 << 4) | 0x2; - - public static final int RETURN = RETT; - - public static final int DONE = (3 << 4) | 0xE; - public static final int RETRY = DONE; - - // various integer condition code move instructions - public static final int CONDITION_MOVN = CONDITION_BN; - public static final int CONDITION_MOVE = CONDITION_BE; - public static final int CONDITION_MOVLE = CONDITION_BLE; - public static final int CONDITION_MOVL = CONDITION_BL; - public static final int CONDITION_MOVLEU = CONDITION_BLEU; - public static final int CONDITION_MOVCS = CONDITION_BCS; - public static final int CONDITION_MOVNEG = CONDITION_BNEG; - public static final int CONDITION_MOVVS = CONDITION_BVS; - public static final int CONDITION_MOVA = CONDITION_BA; - public static final int CONDITION_MOVNE = CONDITION_BNE; - public static final int CONDITION_MOVG = CONDITION_BG; - public static final int CONDITION_MOVGE = CONDITION_BGE; - public static final int CONDITION_MOVGU = CONDITION_BGU; - public static final int CONDITION_MOVCC = CONDITION_BCC; - public static final int CONDITION_MOVPOS = CONDITION_BPOS; - public static final int CONDITION_MOVVC = CONDITION_BVC; - - // cc0, cc1 & cc2 in conditional moves - public static final int CMOVE_CC_START_BIT = 11; - public static final int CMOVE_CC0_CC1_MASK = 3 << CMOVE_CC_START_BIT; - public static final int CMOVE_CC2_START_BIT = 18; - public static final int CMOVE_CC2_MASK = 1 << CMOVE_CC2_START_BIT; - - public static final int CMOVE_COND_START_BIT = 14; - // condition code is 4 bits - public static final int CMOVE_COND_MASK = 0xF << CMOVE_COND_START_BIT; - - // opf[8:0] (op=2,op3=0x34=FPop1) - Table 34 - Page 276 - E Opcode Maps - // v9 specific opcodes only - remaining are in SPARCOpcodes. - - public static final int FMOVd = 0x2; - public static final int FMOVq = 0x3; - public static final int FNEGd = 0x6; - public static final int FNEGq = 0x7; - public static final int FABSd = 0xA; - public static final int FABSq = 0xB; - public static final int FsTOx = (0x8 << 4) | 0x1; - public static final int FdTOx = (0x8 << 4) | 0x2; - public static final int FqTOx = (0x8 << 4) | 0x3; - public static final int FxTOs = (0x8 << 4) | 0x4; - public static final int FxTOd = (0x8 << 4) | 0x8; - public static final int FxTOq = (0x8 << 4) | 0xC; - - // opf[8:0] (op=2, op3=0x35= FPop2) - Table 35 - Page 277 - E.2 Tables - // v9 specific opcodes only 0 remanining are in SPARCOpcodes. - - // fp condition moves - - public static final int FMOVs_fcc0 = 1; - public static final int FMOVs_fcc1 = 1 | (0x4 << 4); - public static final int FMOVs_fcc2 = 1 | (0x8 << 4); - public static final int FMOVs_fcc3 = 1 | (0xC << 4); - public static final int FMOVs_icc = 1 | (0x10 << 4); - public static final int FMOVs_xcc = 1 | (0x18 << 4); - - public static final int FMOVd_fcc0 = 2; - public static final int FMOVd_fcc1 = 2 | (0x4 << 4); - public static final int FMOVd_fcc2 = 2 | (0x8 << 4); - public static final int FMOVd_fcc3 = 2 | (0xC << 4); - public static final int FMOVd_icc = 2 | (0x10 << 4); - public static final int FMOVd_xcc = 2 | (0x18 << 4); - - public static final int FMOVq_fcc0 = 3; - public static final int FMOVq_fcc1 = 3 | (0x4 << 4); - public static final int FMOVq_fcc2 = 3 | (0x8 << 4); - public static final int FMOVq_fcc3 = 3 | (0xC << 4); - public static final int FMOVq_icc = 3 | (0x10 << 4); - public static final int FMOVq_xcc = 3 | (0x18 << 4); - - // fp register condition moves - - public static final int FMOVRsZ = 5 | (0x2 << 4); - public static final int FMOVRsLEZ = 5 | (0x4 << 4); - public static final int FMOVRsLZ = 5 | (0x6 << 4); - public static final int FMOVRsNZ = 5 | (0xA << 4); - public static final int FMOVRsGZ = 5 | (0xC << 4); - public static final int FMOVRsGEZ = 5 | (0xE << 4); - - public static final int FMOVRdZ = 6 | (0x2 << 4); - public static final int FMOVRdLEZ = 6 | (0x4 << 4); - public static final int FMOVRdLZ = 6 | (0x6 << 4); - public static final int FMOVRdNZ = 6 | (0xA << 4); - public static final int FMOVRdGZ = 6 | (0xC << 4); - public static final int FMOVRdGEZ = 6 | (0xE << 4); - - public static final int FMOVRqZ = 7 | (0x2 << 4); - public static final int FMOVRqLEZ = 7 | (0x4 << 4); - public static final int FMOVRqLZ = 7 | (0x6 << 4); - public static final int FMOVRqNZ = 7 | (0xA << 4); - public static final int FMOVRqGZ = 7 | (0xC << 4); - public static final int FMOVRqGEZ = 7 | (0xE << 4); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9PopcInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9PopcInstruction extends SPARCFormat3AInstruction - implements SPARCV9Instruction { - public SPARCV9PopcInstruction(ImmediateOrRegister source, SPARCRegister rd) { - super("popc", POPC, null, source, rd); - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(getOperand2String()); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public ImmediateOrRegister getSource() { - return operand2; - } - - public SPARCRegister getDestination() { - return rd; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9PrefetchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9PrefetchInstruction extends SPARCInstruction - implements SPARCV9Instruction { - final private SPARCRegisterIndirectAddress addr; - final private int prefetchFcn; - final private String description; - - public static final int PREFETCH_MANY_READS = 0; - public static final int PREFETCH_ONE_READ = 1; - public static final int PREFETCH_MANY_WRITES = 2; - public static final int PREFETCH_ONE_WRITE = 3; - public static final int PREFETCH_PAGE = 4; - - public SPARCV9PrefetchInstruction(String name, SPARCRegisterIndirectAddress addr, int prefetchFcn) { - super(name); - this.addr = addr; - this.prefetchFcn = prefetchFcn; - description = initDescription(); - } - - private String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(addr.toString()); - buf.append(comma); - buf.append(prefetchFcn); - return buf.toString(); - } - - public int getPrefetchFunction() { - return prefetchFcn; - } - - public SPARCRegisterIndirectAddress getPrefetchAddress() { - return addr; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9PrivilegedRegisterInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCV9PrivilegedRegisterInstruction extends SPARCInstruction - implements SPARCV9Instruction, /* imports */ SPARCV9PrivilegedRegisters { - protected static final String regNames[] = { - "%tpc", "%tnpc", "%tstate", "%tt", "%tick", "%tba", "%pstate", "%tl", - "%pil", "%cwp", "%cansave", "%canrestore", "%cleanwin", "%otherwin", "%wstate", "%fq" - }; - - protected static String getPrivilegedRegisterName(int regNum) { - if ((regNum > 15 && regNum < 31) || regNum > 31) - return null; - return (regNum == 31)? "%ver" : regNames[regNum]; - } - - final protected int regNum; - - protected abstract String getDescription(); - - protected SPARCV9PrivilegedRegisterInstruction(String name, int regNum) { - super(name); - this.regNum = regNum; - } - - public int getPrivilegedRegisterNumber() { - return regNum; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9PrivilegedRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public interface SPARCV9PrivilegedRegisters { - public static final int TPC = 0; - public static final int TNPC = 1; - public static final int TSTATE = 2; - public static final int TT = 3; - public static final int TICK = 4; - public static final int TBA = 5; - public static final int PSTATE = 6; - public static final int TL = 7; - public static final int PIL = 8; - public static final int CWP = 9; - public static final int CANSAVE = 10; - public static final int CANRESTORE = 11; - public static final int CLEANWIN = 12; - public static final int OTHERWIN = 13; - public static final int WSTATE = 14; - public static final int FQ = 15; - public static final int VER = 31; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9RdprInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public class SPARCV9RdprInstruction extends SPARCV9PrivilegedRegisterInstruction { - final private SPARCRegister rd; - - public SPARCV9RdprInstruction(int regNum, SPARCRegister rd) { - super("rdpr", regNum); - this.rd = rd; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(getPrivilegedRegisterName(regNum)); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } - - public SPARCRegister getDestination() { - return rd; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9ReadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCV9ReadInstruction extends SPARCV9SpecialRegisterInstruction { - final private int specialReg; - final private int asrRegNum; - final private SPARCRegister rd; - - public SPARCV9ReadInstruction(int specialReg, int asrRegNum, SPARCRegister rd) { - super("rd"); - this.specialReg = specialReg; - this.asrRegNum = asrRegNum; - this.rd = rd; - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getAncillaryRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == ASR, "not an ancillary register"); - return asrRegNum; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - if(specialReg == ASR) - buf.append("%asr" + asrRegNum); - else - buf.append(getSpecialRegisterName(specialReg)); - buf.append(comma); - buf.append(rd.toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9RegisterBranchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9RegisterBranchInstruction extends SPARCInstruction - implements SPARCV9Instruction, BranchInstruction { - final protected PCRelativeAddress addr; - final protected boolean isAnnuled; - final protected int regConditionCode; - final protected SPARCRegister conditionRegister; - final protected boolean predictTaken; - - public SPARCV9RegisterBranchInstruction(String name, PCRelativeAddress addr, - boolean isAnnuled, int regConditionCode, - SPARCRegister conditionRegister, boolean predictTaken) { - super(name); - this.addr = addr; - this.isAnnuled = isAnnuled; - this.regConditionCode = regConditionCode; - this.conditionRegister = conditionRegister; - this.predictTaken = predictTaken; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - long address = addr.getDisplacement() + currentPc; - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(symFinder.getSymbolFor(address)); - return buf.toString(); - } - - public boolean isBranch() { - return true; - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isAnnuledBranch() { - return isAnnuled; - } - - public boolean isConditional() { - return true; - } - - public int getRegisterConditionCode() { - return regConditionCode; - } - - public SPARCRegister getConditionRegister() { - return conditionRegister; - } - - public boolean getPredictTaken() { - return predictTaken; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9RegisterIndirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public class SPARCV9RegisterIndirectAddress extends SPARCRegisterIndirectAddress { - protected boolean indirectAsi; - - public SPARCV9RegisterIndirectAddress(SPARCRegister register, int offset) { - super(register, offset); - } - - public SPARCV9RegisterIndirectAddress(SPARCRegister base, SPARCRegister index) { - super(base, index); - } - - public boolean getIndirectAsi() { - return indirectAsi; - } - - public void setIndirectAsi(boolean indirectAsi) { - this.indirectAsi = indirectAsi; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append(getAddressWithoutAsi()); - if (indirectAsi) { - buf.append("%asi"); - } else if (addressSpace != -1) { - buf.append(Integer.toString(addressSpace)); - } - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9RestoredInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9RestoredInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9RestoredInstruction() { - super("restored"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9RetryInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9RetryInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9RetryInstruction() { - super("retry"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9ReturnInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9ReturnInstruction extends SPARCRettInstruction - implements SPARCV9Instruction { - public SPARCV9ReturnInstruction(SPARCRegisterIndirectAddress addr) { - super("return", addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9SavedInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9SavedInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9SavedInstruction() { - super("saved"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9SirInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.SymbolFinder; - -public class SPARCV9SirInstruction extends SPARCInstruction - implements SPARCV9Instruction { - public SPARCV9SirInstruction() { - super("sir"); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9SpecialRegisterInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public abstract class SPARCV9SpecialRegisterInstruction - extends SPARCInstruction - implements /* import */ SPARCV9SpecialRegisters, SPARCV9Instruction { - protected SPARCV9SpecialRegisterInstruction(String name) { - super(name); - } - - protected abstract String getDescription(); - - public String asString(long currentPc, SymbolFinder symFinder) { - return getDescription(); - } - - protected static String[] specialRegNames = new String[] { - "%y", - null, - "%ccr", - "%asi", - "%tick", - "%pc", - "%fprs", - "%asr", - }; - - protected static String getSpecialRegisterName(int index) { - return specialRegNames[index]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9SpecialRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -public interface SPARCV9SpecialRegisters { - public static final int Y = 0; - public static final int CCR = 2; - public static final int ASI = 3; - public static final int TICK = 4; - public static final int PC = 5; - public static final int FPRS = 6; - public static final int ASR = 7; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9WriteInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCV9WriteInstruction extends SPARCV9SpecialRegisterInstruction { - final private int specialReg; - final private int asrRegNum; - final private SPARCRegister rs1; - final private ImmediateOrRegister operand2; - - public SPARCV9WriteInstruction(int specialReg, int asrRegNum, SPARCRegister rs1, ImmediateOrRegister operand2) { - super("wr"); - this.specialReg = specialReg; - this.asrRegNum = asrRegNum; - this.rs1 = rs1; - this.operand2 = operand2; - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getAncillaryRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == ASR, "not an ancillary register"); - return asrRegNum; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - if (operand2.isRegister()) { - buf.append(operand2.toString()); - } else { - Number number = ((Immediate)operand2).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - buf.append(comma); - - if(specialReg == ASR) - buf.append("%asr" + asrRegNum); - else - buf.append(getSpecialRegisterName(specialReg)); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9WrprInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -public class SPARCV9WrprInstruction extends SPARCV9PrivilegedRegisterInstruction { - final private SPARCRegister rs1; - final private ImmediateOrRegister operand2; - - public SPARCV9WrprInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, - int regNum) { - super("wrpr", regNum); - this.rs1 = rs1; - this.operand2 = operand2; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - if (operand2.isRegister()) { - buf.append(operand2.toString()); - } else { - int value = ((Immediate)operand2).getNumber().intValue(); - buf.append(Integer.toHexString(value)); - } - buf.append(comma); - buf.append(getPrivilegedRegisterName(regNum)); - return buf.toString(); - } - - public SPARCRegister getSourceRegister1() { - return rs1; - } - - public ImmediateOrRegister getOperand2() { - return operand2; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCWriteInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -public class SPARCWriteInstruction extends SPARCSpecialRegisterInstruction { - final private int specialReg; - final private int asrRegNum; - final private SPARCRegister rs1; - final private ImmediateOrRegister operand2; - - public SPARCWriteInstruction(int specialReg, int asrRegNum, SPARCRegister rs1, ImmediateOrRegister operand2) { - super("wr"); - this.specialReg = specialReg; - this.asrRegNum = asrRegNum; - this.rs1 = rs1; - this.operand2 = operand2; - } - - public int getSpecialRegister() { - return specialReg; - } - - public int getAncillaryRegister() { - if (Assert.ASSERTS_ENABLED) - Assert.that(specialReg == ASR, "not an ancillary register"); - return asrRegNum; - } - - protected String getDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getName()); - buf.append(spaces); - buf.append(rs1.toString()); - buf.append(comma); - if (operand2.isRegister()) { - buf.append(operand2.toString()); - } else { - Number number = ((Immediate)operand2).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - buf.append(comma); - - if(specialReg == ASR) - buf.append("%asr" + asrRegNum); - else - buf.append(getSpecialRegisterName(specialReg)); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SaveDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class SaveDecoder extends Format3ADecoder { - SaveDecoder() { - super(SAVE, "save", RTLOP_UNKNOWN); - } - - Instruction decodeFormat3AInstruction(int instruction, - SPARCRegister rs1, - ImmediateOrRegister operand2, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newSaveInstruction(rs1, operand2, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SethiDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class SethiDecoder extends InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - Instruction instr = null; - int rdNum = getDestinationRegister(instruction); - SPARCRegister rd = SPARCRegisters.getRegister(rdNum); - int imm22 = (instruction & DISP_22_MASK); - if (imm22 == 0 && rd == SPARCRegisters.G0) { - instr = factory.newNoopInstruction(); - } else { - instr = factory.newSethiInstruction(imm22, rd); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/ShiftDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class ShiftDecoder extends InstructionDecoder { - final int op3; - final String name; - final int rtlOperation; - - ShiftDecoder(int op3, String name, int rtlOperation) { - this.op3 = op3; - this.name = name; - this.rtlOperation = rtlOperation; - } - - private ImmediateOrRegister getShiftLength(int instruction) { - boolean iBit = isIBitSet(instruction); - ImmediateOrRegister operand2 = null; - if (iBit) { - int value = instruction & SHIFT_COUNT_5_MASK; - operand2 = new Immediate(new Short((short)value)); - } else { - operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - } - return operand2; - } - - Instruction decode(int instruction, - SPARCInstructionFactory factory) { - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction)); - ImmediateOrRegister operand2 = getShiftLength(instruction); - return factory.newShiftInstruction(name, op3, rtlOperation, rs1, operand2, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SpecialLoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class SpecialLoadDecoder extends SpecialLoadStoreDecoder { - SpecialLoadDecoder(int op3, String name, int specialRegNum) { - super(op3, name, specialRegNum); - } - - Instruction decodeSpecialLoadStoreInstruction(int cregNum, - SPARCRegisterIndirectAddress addr, - SPARCInstructionFactory factory) { - return factory.newSpecialLoadInstruction(name, specialRegNum, cregNum, addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SpecialLoadStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class SpecialLoadStoreDecoder extends MemoryInstructionDecoder { - final int specialRegNum; - - SpecialLoadStoreDecoder(int op3, String name, int specialRegNum) { - super(op3, name, RTLDT_UNKNOWN); - this.specialRegNum = specialRegNum; - } - - final Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - int cregNum = getSourceRegister1(instruction); - return decodeSpecialLoadStoreInstruction(cregNum, addr, factory); - } - - abstract Instruction decodeSpecialLoadStoreInstruction(int cregNum, - SPARCRegisterIndirectAddress addr, - SPARCInstructionFactory factory); -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SpecialStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class SpecialStoreDecoder extends SpecialLoadStoreDecoder { - SpecialStoreDecoder(int op3, String name, int specialRegNum) { - super(op3, name, specialRegNum); - } - - Instruction decodeSpecialLoadStoreInstruction(int cregNum, - SPARCRegisterIndirectAddress addr, - SPARCInstructionFactory factory) { - return factory.newSpecialStoreInstruction(name, specialRegNum, cregNum, addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/StoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class StoreDecoder extends MemoryInstructionDecoder { - StoreDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newStoreInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SwapDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class SwapDecoder extends MemoryInstructionDecoder { - SwapDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, - SPARCInstructionFactory factory) { - return factory.newSwapInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/TrapDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class TrapDecoder extends InstructionDecoder { - private static final String trapConditionNames[] = { - "tn", "te", "tle", "tl", "tleu", "tcs", "tneg", "tvs", - "ta", "tne", "tg", "tge", "tgu" , "tcc", "tpos", "tvc" - }; - - static String getTrapConditionName(int index) { - return trapConditionNames[index]; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - int conditionCode = getConditionCode(instruction); - return factory.newTrapInstruction(getTrapConditionName(conditionCode), - conditionCode); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/UnimpDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class UnimpDecoder extends InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - return factory.newUnimpInstruction(instruction & DISP_22_MASK); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V8FPop1Decoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.util.*; - -class V8FPop1Decoder extends FPopDecoder { - static Map opfDecoders = new HashMap(); // Map<Integer, InstructionDecoder> - static void addOpfDecoder(int fpOpcode, InstructionDecoder decoder) { - opfDecoders.put(new Integer(fpOpcode), decoder); - } - - // opf (op=2, op3=0x34=FPop1) - Table F -5 - Page 230. - static { - addOpfDecoder(FMOVs, new FPMoveDecoder(FMOVs, "fmovs", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FNEGs, new FP2RegisterDecoder(FNEGs, "fnegs", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FABSs, new FP2RegisterDecoder(FABSs, "fabss", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FSQRTs, new FP2RegisterDecoder(FSQRTs, "fsqrts", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FSQRTd, new FP2RegisterDecoder(FSQRTd, "fsqrtd", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FSQRTq, new FP2RegisterDecoder(FSQRTq, "fsqrtq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addOpfDecoder(FADDs, new FPArithmeticDecoder(FADDs, "fadds", RTLOP_ADD, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FADDd, new FPArithmeticDecoder(FADDd, "faddd", RTLOP_ADD, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FADDq, new FPArithmeticDecoder(FADDq, "faddq", RTLOP_ADD, RTLDT_FL_QUAD, RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addOpfDecoder(FSUBs, new FPArithmeticDecoder(FSUBs, "fsubs", RTLOP_SUB, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FSUBd, new FPArithmeticDecoder(FSUBd, "fsubd", RTLOP_SUB, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FSUBq, new FPArithmeticDecoder(FSUBq, "fsubq", RTLOP_SUB, RTLDT_FL_QUAD, RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addOpfDecoder(FMULs, new FPArithmeticDecoder(FMULs, "fmuls", RTLOP_SMUL, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FMULd, new FPArithmeticDecoder(FMULd, "fmuld", RTLOP_SMUL, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FMULq, new FPArithmeticDecoder(FMULq, "fmulq",RTLOP_SMUL, RTLDT_FL_QUAD, RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addOpfDecoder(FsMULd, new FPArithmeticDecoder(FsMULd, "fsmuld", RTLOP_SMUL, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FdMULq, new FPArithmeticDecoder(FdMULq, "fdmulq",RTLOP_SMUL, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE, RTLDT_FL_QUAD)); - addOpfDecoder(FDIVs, new FPArithmeticDecoder(FDIVs, "fdivs", RTLOP_SDIV, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FDIVd, new FPArithmeticDecoder(FDIVd, "fdivd", RTLOP_SDIV,RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FDIVq, new FPArithmeticDecoder(FDIVq, "fdivq", RTLOP_SDIV,RTLDT_FL_QUAD, RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addOpfDecoder(FiTOs, new FP2RegisterDecoder(FiTOs, "fitos", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FiTOd, new FP2RegisterDecoder(FiTOd, "fitod", RTLDT_FL_SINGLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FiTOq, new FP2RegisterDecoder(FiTOq, "fitoq", RTLDT_FL_SINGLE, RTLDT_FL_QUAD)); - addOpfDecoder(FsTOi, new FP2RegisterDecoder(FsTOi, "fstoi", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FdTOi, new FP2RegisterDecoder(FdTOi, "fdtoi", RTLDT_FL_DOUBLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FqTOi, new FP2RegisterDecoder(FqTOi, "fqtoi", RTLDT_FL_QUAD, RTLDT_FL_SINGLE)); - addOpfDecoder(FsTOd, new FP2RegisterDecoder(FsTOd, "fstod", RTLDT_FL_SINGLE, RTLDT_FL_DOUBLE)); - addOpfDecoder(FsTOq, new FP2RegisterDecoder(FsTOq, "fstoq", RTLDT_FL_SINGLE, RTLDT_FL_QUAD)); - addOpfDecoder(FdTOs, new FP2RegisterDecoder(FdTOs, "fdtos", RTLDT_FL_DOUBLE, RTLDT_FL_SINGLE)); - addOpfDecoder(FdTOq, new FP2RegisterDecoder(FdTOq, "fdtoq", RTLDT_FL_DOUBLE, RTLDT_FL_QUAD)); - addOpfDecoder(FqTOs, new FP2RegisterDecoder(FqTOs, "fqtos", RTLDT_FL_QUAD, RTLDT_FL_SINGLE)); - addOpfDecoder(FqTOd, new FP2RegisterDecoder(FqTOd, "fqtod", RTLDT_FL_QUAD, RTLDT_FL_DOUBLE)); - } - - InstructionDecoder getOpfDecoder(int opf) { - return (InstructionDecoder) opfDecoders.get(new Integer(opf)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V8FPop2Decoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.util.*; - -class V8FPop2Decoder extends FPopDecoder { - static Map fpop2Decoders = new HashMap(); // Map<Integer, InstructionDecoder> - static void addFPop2Decoder(int fpOpcode, InstructionDecoder decoder) { - fpop2Decoders.put(new Integer(fpOpcode), decoder); - } - - // opf (op=2, op3=0x35=FPop2 - Table F-6 page 231 - static { - addFPop2Decoder(FCMPs, new FP2RegisterDecoder(FCMPs, "fcmps", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addFPop2Decoder(FCMPd, new FP2RegisterDecoder(FCMPd, "fcmpd", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addFPop2Decoder(FCMPq, new FP2RegisterDecoder(FCMPq, "fcmpq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addFPop2Decoder(FCMPEs, new FP2RegisterDecoder(FCMPEs, "fcmpes", RTLDT_FL_SINGLE, RTLDT_FL_SINGLE)); - addFPop2Decoder(FCMPEd, new FP2RegisterDecoder(FCMPEd, "fcmped", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addFPop2Decoder(FCMPEq, new FP2RegisterDecoder(FCMPEq, "fcmpeq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - } - - InstructionDecoder getOpfDecoder(int opf) { - return (InstructionDecoder) fpop2Decoders.get(new Integer(opf)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpaceDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class V9AlternateSpaceDecoder extends MemoryInstructionDecoder - implements V9InstructionDecoder { - V9AlternateSpaceDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, SPARCRegister rs2) { - return new SPARCV9RegisterIndirectAddress(rs1, rs2); - } - - SPARCRegisterIndirectAddress newRegisterIndirectAddress(SPARCRegister rs1, int offset) { - return new SPARCV9RegisterIndirectAddress(rs1, offset); - } - - abstract Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory); - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - SPARCV9RegisterIndirectAddress v9addr = (SPARCV9RegisterIndirectAddress) addr; - if (isIBitSet(instruction)) { - // indirect asi - v9addr.setIndirectAsi(true); - } else { - // immediate asi - int asi = (instruction & ASI_MASK) >>> ASI_START_BIT; - v9addr.setAddressSpace(asi); - } - return decodeV9AsiLoadStore(instruction, v9addr, rd, - (SPARCV9InstructionFactory) factory); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpaceLdstubDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9AlternateSpaceLdstubDecoder extends V9AlternateSpaceDecoder { - V9AlternateSpaceLdstubDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - return factory.newLdstubInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpaceLoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9AlternateSpaceLoadDecoder extends V9AlternateSpaceDecoder { - V9AlternateSpaceLoadDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - return factory.newLoadInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpacePrefetchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9AlternateSpacePrefetchDecoder extends V9AlternateSpaceDecoder { - V9AlternateSpacePrefetchDecoder() { - // Fake the destination with an integer type so we can get fcn from rd - super(PREFETCHA, "prefetcha", RTLDT_SIGNED_WORD); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - return v9factory.newV9PrefetchInstruction(name, addr, rd.getNumber()); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpaceStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9AlternateSpaceStoreDecoder extends V9AlternateSpaceDecoder { - V9AlternateSpaceStoreDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - return factory.newStoreInstruction(name, op3, addr, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9AlternateSpaceSwapDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9AlternateSpaceSwapDecoder extends V9AlternateSpaceDecoder { - V9AlternateSpaceSwapDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - return factory.newSwapInstruction(name, addr, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9BranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class V9BranchDecoder extends BranchDecoder - implements /* imports */ V9InstructionDecoder { - static boolean getPredictTaken(int instruction) { - return (PREDICTION_MASK & instruction) != 0; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9CCBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class V9CCBranchDecoder extends V9BranchDecoder { - abstract int getConditionFlag(int instruction); - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - int conditionFlag = getConditionFlag(instruction); - boolean predictTaken = getPredictTaken(instruction); - int conditionCode = getConditionCode(instruction); - boolean annuled = getAnnuledBit(instruction); - String name = getConditionName(conditionCode, annuled); - // signed word aligned 19 bit - PCRelativeAddress addr = new PCRelativeAddress(extractSignedIntFromNBits(instruction, 19) << 2); - return v9factory.newV9BranchInstruction(name, addr, annuled, conditionCode, - predictTaken, conditionFlag); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9CMoveDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -abstract class V9CMoveDecoder extends InstructionDecoder - implements V9InstructionDecoder { - static private final String iccConditionNames[] = { - "n", "e", "le", "l", "leu", "cs", "neg", "vs", - "a", "ne", "g", "ge", "gu", "cc", "pos", "vc" - }; - - static private final String fccConditionNames[] = { - "fn", "fne", "flg", "ful", "fl", "fug", "fg", "fu", - "fa", "fe", "fue", "fge", "fuge", "fle", "fule", "fo" - }; - - static String getConditionName(int conditionCode, int conditionFlag) { - return (conditionFlag == icc || conditionFlag == xcc) ? - iccConditionNames[conditionCode] - : fccConditionNames[conditionCode]; - } - - static int getMoveConditionCode(int instruction) { - return (instruction & CMOVE_COND_MASK) >>> CMOVE_COND_START_BIT; - } - - static int getRegisterConditionCode(int instruction) { - return (instruction & CMOVE_RCOND_MASK) >>> CMOVE_RCOND_START_BIT; - } - - static ImmediateOrRegister getCMoveSource(int instruction, int numBits) { - ImmediateOrRegister source = null; - if (isIBitSet(instruction)) { - source = new Immediate(new Short((short) extractSignedIntFromNBits(instruction, numBits))); - } else { - source = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - } - return source; - } - - static String getFloatTypeCode(int dataType) { - String result = null; - switch(dataType) { - case RTLDT_FL_SINGLE: - result = "s"; - break; - - case RTLDT_FL_DOUBLE: - result = "d"; - break; - - case RTLDT_FL_QUAD: - result = "q"; - break; - - default: - if (Assert.ASSERTS_ENABLED) - Assert.that(false, "should not reach here"); - } - return result; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9CasDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9CasDecoder extends V9AlternateSpaceDecoder { - V9CasDecoder(int op3, String name, int dataType) { - super(op3, name, dataType); - } - - Instruction decodeV9AsiLoadStore(int instruction, - SPARCV9RegisterIndirectAddress addr, - SPARCRegister rd, - SPARCV9InstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - SPARCRegister rs2 = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - return v9factory.newV9CasInstruction(name, addr, rs2, rd, dataType); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9DoneRetryDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9DoneRetryDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int rdNum = getDestinationRegister(instruction); - // "rd" field is "fcn". Only values 0 and 1 are defined. - // see page 157 - A.11 Done and Retry - switch (rdNum) { - case 0: - instr = v9factory.newV9DoneInstruction(); - break; - case 1: - instr = v9factory.newV9RetryInstruction(); - break; - default: - instr = v9factory.newIllegalInstruction(instruction); - break; - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FMOVccDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.Assert; - -class V9FMOVccDecoder extends V9CMoveDecoder implements /* imports */ RTLDataTypes { - private final int opf; - private final int dataType; - - V9FMOVccDecoder(int opf, int dataType) { - this.opf = opf; - this.dataType = dataType; - } - - private static String getFMoveCCName(int conditionCode, int conditionFlag, int dataType) { - StringBuffer buf = new StringBuffer("fmov"); - buf.append(getFloatTypeCode(dataType)); - buf.append(getConditionName(conditionCode, conditionFlag)); - return buf.toString(); - } - - private static int getFMoveConditionFlag(int instruction) { - return (instruction & OPF_CC_MASK) >>> OPF_CC_START_BIT; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int conditionFlag = getFMoveConditionFlag(instruction); - if (conditionFlag == CFLAG_RESERVED1 || conditionFlag == CFLAG_RESERVED2) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - int rdNum = getDestinationRegister(instruction); - int rs1Num = getSourceRegister1(instruction); - SPARCRegister rd = RegisterDecoder.decode(dataType, rdNum); - int conditionCode = getMoveConditionCode(instruction); - SPARCRegister rs = RegisterDecoder.decode(dataType, rs1Num); - String name = getFMoveCCName(conditionCode, conditionFlag, dataType); - instr = v9factory.newV9FMOVccInstruction(name,opf, conditionCode, conditionFlag, - (SPARCFloatRegister)rs, (SPARCFloatRegister)rd); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FMOVrDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9FMOVrDecoder extends V9CMoveDecoder { - private final int opf; - private final String name; - private final int dataType; - - V9FMOVrDecoder(int opf, String name, int dataType) { - this.opf = opf; - this.name = name; - this.dataType = dataType; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - int regConditionCode = getRegisterConditionCode(instruction); - int rdNum = getDestinationRegister(instruction); - int rs1Num = getSourceRegister1(instruction); - int rs2Num = getSourceRegister2(instruction); - SPARCRegister rd = RegisterDecoder.decode(dataType, rdNum); - SPARCRegister rs2 = RegisterDecoder.decode(dataType, rs2Num); - SPARCRegister rs1 = SPARCRegisters.getRegister(rs1Num); - return v9factory.newV9FMOVrInstruction(name, opf, rs1, (SPARCFloatRegister)rs2, - (SPARCFloatRegister)rd, regConditionCode); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FPop1Decoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.util.*; - -class V9FPop1Decoder extends FPopDecoder - implements V9InstructionDecoder { - static Map v9opfDecoders = new HashMap(); // Map<Integer, InstructionDecoder> - static void addV9OpfDecoder(int fpOpcode, InstructionDecoder decoder) { - v9opfDecoders.put(new Integer(fpOpcode), decoder); - } - - static { - addV9OpfDecoder(FMOVd, new FPMoveDecoder(FMOVd, "fmovd", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addV9OpfDecoder(FMOVq, new FPMoveDecoder(FMOVq, "fmovq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addV9OpfDecoder(FNEGd, new FP2RegisterDecoder(FNEGd, "fnegd", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addV9OpfDecoder(FNEGq, new FP2RegisterDecoder(FNEGq, "fnegq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addV9OpfDecoder(FABSd, new FP2RegisterDecoder(FABSd, "fabsd", RTLDT_FL_DOUBLE, RTLDT_FL_DOUBLE)); - addV9OpfDecoder(FABSq, new FP2RegisterDecoder(FABSq, "fabsq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addV9OpfDecoder(FsTOx, new FP2RegisterDecoder(FsTOx, "fstox", RTLDT_FL_SINGLE, RTLDT_FL_QUAD)); - addV9OpfDecoder(FdTOx, new FP2RegisterDecoder(FdTOx, "fdtox", RTLDT_FL_DOUBLE, RTLDT_FL_QUAD)); - addV9OpfDecoder(FqTOx, new FP2RegisterDecoder(FqTOx, "fqtox", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - addV9OpfDecoder(FxTOs, new FP2RegisterDecoder(FxTOs, "fxtos", RTLDT_FL_QUAD, RTLDT_FL_SINGLE)); - addV9OpfDecoder(FxTOd, new FP2RegisterDecoder(FxTOd, "fxtod", RTLDT_FL_QUAD, RTLDT_FL_SINGLE)); - addV9OpfDecoder(FxTOq, new FP2RegisterDecoder(FxTOq, "fxtoq", RTLDT_FL_QUAD, RTLDT_FL_QUAD)); - } - - InstructionDecoder getOpfDecoder(int opf) { - InstructionDecoder decoder = (InstructionDecoder) V8FPop1Decoder.opfDecoders.get(new Integer(opf)); - return (decoder !=null)? decoder : (InstructionDecoder) v9opfDecoders.get(new Integer(opf)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FPop2Decoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; -import java.util.*; - -class V9FPop2Decoder extends FPopDecoder - implements V9InstructionDecoder { - static Map v9fpop2Decoders = new HashMap(); // Map<Integer, InstructionDecoder> - static void addV9FPop2Decoder(int fpOpcode, InstructionDecoder decoder) { - v9fpop2Decoders.put(new Integer(fpOpcode), decoder); - } - - static { - // flag conditional moves - - addV9FPop2Decoder(FMOVs_fcc0, new V9FMOVccDecoder(FMOVs_fcc0, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVs_fcc1, new V9FMOVccDecoder(FMOVs_fcc1, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVs_fcc2, new V9FMOVccDecoder(FMOVs_fcc2, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVs_fcc3, new V9FMOVccDecoder(FMOVs_fcc3, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVs_icc, new V9FMOVccDecoder(FMOVs_icc, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVs_xcc, new V9FMOVccDecoder(FMOVs_xcc, RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVd_fcc0, new V9FMOVccDecoder(FMOVd_fcc0, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVd_fcc1, new V9FMOVccDecoder(FMOVd_fcc1, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVd_fcc2, new V9FMOVccDecoder(FMOVd_fcc2, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVd_fcc3, new V9FMOVccDecoder(FMOVd_fcc3, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVd_icc, new V9FMOVccDecoder(FMOVd_icc, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVd_xcc, new V9FMOVccDecoder(FMOVd_xcc, RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVq_fcc0, new V9FMOVccDecoder(FMOVq_fcc0, RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVq_fcc1, new V9FMOVccDecoder(FMOVq_fcc1, RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVq_fcc2, new V9FMOVccDecoder(FMOVq_fcc2, RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVq_fcc3, new V9FMOVccDecoder(FMOVq_fcc3, RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVq_icc, new V9FMOVccDecoder(FMOVq_icc, RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVq_xcc, new V9FMOVccDecoder(FMOVq_xcc, RTLDT_FL_QUAD)); - - // register conditional moves - - addV9FPop2Decoder(FMOVRsZ, new V9FMOVrDecoder(FMOVRsZ, "fmovrsz", RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVRsLEZ, new V9FMOVrDecoder(FMOVRsLEZ, "fmovrslez", RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVRsLZ, new V9FMOVrDecoder(FMOVRsLZ, "fmovrslz", RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVRsNZ, new V9FMOVrDecoder(FMOVRsNZ, "fmovrsnz", RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVRsGZ, new V9FMOVrDecoder(FMOVRsGZ, "fmovrsgz", RTLDT_FL_SINGLE)); - addV9FPop2Decoder(FMOVRsGEZ, new V9FMOVrDecoder(FMOVRsGEZ, "fmovrsgez", RTLDT_FL_SINGLE)); - - addV9FPop2Decoder(FMOVRdZ, new V9FMOVrDecoder(FMOVRdZ, "fmovrdz", RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVRdLEZ, new V9FMOVrDecoder(FMOVRdLEZ, "fmovrdlez", RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVRdLZ, new V9FMOVrDecoder(FMOVRdLZ, "fmovrdlz", RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVRdNZ, new V9FMOVrDecoder(FMOVRdNZ, "fmovrdnz", RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVRdGZ, new V9FMOVrDecoder(FMOVRdGZ, "fmovrdgz", RTLDT_FL_DOUBLE)); - addV9FPop2Decoder(FMOVRdGEZ, new V9FMOVrDecoder(FMOVRdGEZ, "fmovrdgez", RTLDT_FL_DOUBLE)); - - addV9FPop2Decoder(FMOVRqZ, new V9FMOVrDecoder(FMOVRqZ, "fmovrqz", RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVRqLEZ, new V9FMOVrDecoder(FMOVRqLEZ, "fmovrqlez", RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVRqLZ, new V9FMOVrDecoder(FMOVRqLZ, "fmovrqlz", RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVRqNZ, new V9FMOVrDecoder(FMOVRqNZ, "fmovrqnz", RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVRqGZ, new V9FMOVrDecoder(FMOVRqGZ, "fmovrqgz", RTLDT_FL_QUAD)); - addV9FPop2Decoder(FMOVRqGEZ, new V9FMOVrDecoder(FMOVRqGEZ, "fmovrqgez", RTLDT_FL_QUAD)); - } - - InstructionDecoder getOpfDecoder(int opf) { - InstructionDecoder decoder = (InstructionDecoder) V8FPop2Decoder.fpop2Decoders.get(new Integer(opf)); - return (decoder != null) ? decoder : (InstructionDecoder) v9fpop2Decoders.get(new Integer(opf)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FloatBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -class V9FloatBranchDecoder extends V9CCBranchDecoder { - String getConditionName(int conditionCode, boolean isAnnuled) { - return isAnnuled ? floatAnnuledConditionNames[conditionCode] - : floatConditionNames[conditionCode]; - } - - int getConditionFlag(int instruction) { - return (FBPfcc_CC_MASK & instruction) >>> FBPfcc_CC_START_BIT; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9FlushwDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9FlushwDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - // "i" bit has to be zero. see page 169 - A.21 Flush Register Windows. - if (isIBitSet(instruction)) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - instr = v9factory.newV9FlushwInstruction(); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9InstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -interface V9InstructionDecoder extends /* imports */ SPARCV9Opcodes { -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9IntRegisterBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9IntRegisterBranchDecoder extends V9RegisterBranchDecoder { - static final String integerRegisterConditionNames[] = { - null, "brz", "brlez", "brlz", null, "brnz", "brgz", "brgez" - }; - - String getRegisterConditionName(int index) { - return integerRegisterConditionNames[index]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9IntegerBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -class V9IntegerBranchDecoder extends V9CCBranchDecoder { - String getConditionName(int conditionCode, boolean isAnnuled) { - return isAnnuled ? integerAnnuledConditionNames[conditionCode] - : integerConditionNames[conditionCode]; - } - - int getConditionFlag(int instruction) { - return ((BPcc_CC_MASK & instruction) >>> BPcc_CC_START_BIT) + icc; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9MOVccDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9MOVccDecoder extends V9CMoveDecoder { - private static String getMoveCCName(int conditionCode, int conditionFlag) { - return "mov" + getConditionName(conditionCode, conditionFlag); - } - - private static int getMoveConditionFlag(int instruction) { - boolean cc2Bit = (instruction & CMOVE_CC2_MASK) != 0; - int conditionFlag = (instruction & CMOVE_CC0_CC1_MASK) >>> CMOVE_CC_START_BIT; - if (cc2Bit) conditionFlag |= (0x4); // 100; - return conditionFlag; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int conditionFlag = getMoveConditionFlag(instruction); - if (conditionFlag == CFLAG_RESERVED1 || conditionFlag == CFLAG_RESERVED2) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - int rdNum = getDestinationRegister(instruction); - SPARCRegister rd = SPARCRegisters.getRegister(rdNum); - int conditionCode = getMoveConditionCode(instruction); - ImmediateOrRegister source = getCMoveSource(instruction, 11); - String name = getMoveCCName(conditionCode, conditionFlag); - instr = v9factory.newV9MOVccInstruction(name, conditionCode, conditionFlag, source, rd); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9MOVrDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9MOVrDecoder extends V9CMoveDecoder { - private static final String regConditionNames[] = { - null, "movrz", "movrlez", "movrlz", null, "movrnz", "movrgz", "movrgez" - }; - - private static String getMOVrName(int conditionCode) { - return regConditionNames[conditionCode]; - } - - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int regConditionCode = getRegisterConditionCode(instruction); - String name = getMOVrName(regConditionCode); - if (name == null) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - int rdNum = getDestinationRegister(instruction); - SPARCRegister rd = SPARCRegisters.getRegister(rdNum); - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - ImmediateOrRegister operand2 = getCMoveSource(instruction, 10); - instr = v9factory.newV9MOVrInstruction(name, rs1, operand2, rd, regConditionCode); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9PopcDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9PopcDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - int rs1Num = getSourceRegister1(instruction); - Instruction instr = null; - // in POPC, rs1 should be zero. see page 205 - A.41 Population Count - if (rs1Num != 0) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction)); - instr = v9factory.newV9PopcInstruction(getOperand2(instruction), rd); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9PrefetchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9PrefetchDecoder extends MemoryInstructionDecoder - implements V9InstructionDecoder { - V9PrefetchDecoder() { - // Fake the destination with an integer type so we can get fcn from rd - super(PREFETCH, "prefetch", RTLDT_SIGNED_WORD); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - return v9factory.newV9PrefetchInstruction(name, addr, rd.getNumber()); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9PrivilegedReadWriteDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class V9PrivilegedReadWriteDecoder extends InstructionDecoder - implements V9InstructionDecoder { - static boolean isLegalPrivilegedRegister(int reg) { - return (reg > -1 && reg < 16) || reg == 31; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9RdprDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9RdprDecoder extends V9PrivilegedReadWriteDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int prNum = getSourceRegister1(instruction); - if (isLegalPrivilegedRegister(prNum)) { - SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction)); - instr = v9factory.newV9RdprInstruction(prNum, rd); - } else { - instr = v9factory.newIllegalInstruction(instruction); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9ReadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9ReadDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int specialRegNum = getSourceRegister1(instruction); - - // rs1 values 1, 7-14 are reserved - see page 214, A.44 Read State Register. - if (specialRegNum == 1 || (specialRegNum > 6 && specialRegNum < 15)) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - int rdNum = getDestinationRegister(instruction); - if (specialRegNum == 15) { - // may be stbar, member or illegal - if (rdNum == 0) { - boolean iBit = isIBitSet(instruction); - if (iBit) { - instr = v9factory.newV9MembarInstruction((instruction & MMASK_MASK) >>> MMASK_START_BIT, - (instruction & CMASK_MASK) >>> CMASK_START_BIT); - } else { - instr = v9factory.newStbarInstruction(); - } - } else { // rd != 0 && rs1 == 15 - instr = v9factory.newIllegalInstruction(instruction); - } - } else { - int asrRegNum = -1; - if (specialRegNum > 15){ - asrRegNum = specialRegNum; - specialRegNum = SPARCV9SpecialRegisters.ASR; - } - SPARCRegister rd = SPARCRegisters.getRegister(rdNum); - instr = v9factory.newV9ReadInstruction(specialRegNum, asrRegNum, rd); - } - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9RegisterBranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -abstract class V9RegisterBranchDecoder extends V9BranchDecoder { - static int getDisp16(int instruction) { - int offset = (DISP_16_LO_MASK & instruction) | - ((DISP_16_HI_MASK & instruction) >>> (DISP_16_HI_START_BIT - DISP_16_LO_NUMBITS)); - - // sign extend and word align - offset = extractSignedIntFromNBits(offset, 16); - offset <<= 2; - - return offset; - } - - String getConditionName(int conditionCode, boolean isAnnuled) { - return null; - } - - abstract String getRegisterConditionName(int rcond); - - public Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - int rcond = (BRANCH_RCOND_MASK & instruction) >>> BRANCH_RCOND_START_BIT; - if (rcond == BRANCH_RCOND_RESERVED1 || rcond == BRANCH_RCOND_RESERVED2) - return factory.newIllegalInstruction(instruction); - - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - boolean predictTaken = getPredictTaken(instruction); - boolean annuled = getAnnuledBit(instruction); - PCRelativeAddress addr = new PCRelativeAddress(getDisp16(instruction)); - String name = getRegisterConditionName(rcond); - return v9factory.newV9RegisterBranchInstruction(name, addr, annuled, rcond, rs1, predictTaken); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9SavedRestoredDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9SavedRestoredDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int rdNum = getDestinationRegister(instruction); - // "rd" field is "fcn". Only values 0 and 1 are defined. - // see page 219 - A.47 Saved and Restored - switch (rdNum) { - case 0: - instr = v9factory.newV9SavedInstruction(); - break; - case 1: - instr = v9factory.newV9RestoredInstruction(); - break; - default: - instr = v9factory.newIllegalInstruction(instruction); - break; - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9ShiftDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9ShiftDecoder extends InstructionDecoder - implements V9InstructionDecoder { - final int op3; - final String name; - final int rtlOperation; - - V9ShiftDecoder(int op3, String name, int rtlOperation) { - this.op3 = op3; - this.name = name; - this.rtlOperation = rtlOperation; - } - - static boolean isXBitSet(int instruction) { - return (instruction & X_MASK) != 0; - } - - Instruction decode(int instruction, - SPARCInstructionFactory factory) { - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - SPARCRegister rd = SPARCRegisters.getRegister(getDestinationRegister(instruction)); - boolean xBit = isXBitSet(instruction); - ImmediateOrRegister operand2 = null; - - if (isIBitSet(instruction)) { - // look for 64 bits shift operations. - int value = instruction & ( xBit ? SHIFT_COUNT_6_MASK : SHIFT_COUNT_5_MASK); - operand2 = new Immediate(new Short((short) value)); - } else { - operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction)); - } - - return factory.newShiftInstruction(xBit? name + "x" : name, op3, rtlOperation, rs1, operand2, rd); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9SpecialLoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9SpecialLoadDecoder extends MemoryInstructionDecoder - implements V9InstructionDecoder { - V9SpecialLoadDecoder(int op3) { - super(op3, "ld[x]fsr", RTLDT_UNKNOWN); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - return factory.newSpecialLoadInstruction(rd == SPARCRegisters.G0? "ld" : "ldx", - SPARCSpecialRegisters.FSR, -1, - addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9SpecialStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9SpecialStoreDecoder extends MemoryInstructionDecoder - implements V9InstructionDecoder { - V9SpecialStoreDecoder(int op3) { - super(op3, "st[x]fsr", RTLDT_UNKNOWN); - } - - Instruction decodeMemoryInstruction(int instruction, - SPARCRegisterIndirectAddress addr, - SPARCRegister rd, SPARCInstructionFactory factory) { - return factory.newSpecialStoreInstruction(rd == SPARCRegisters.G0? "st" : "stx", - SPARCSpecialRegisters.FSR, -1, - addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9WriteDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9WriteDecoder extends InstructionDecoder - implements V9InstructionDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int specialRegNum = getDestinationRegister(instruction); - - // rd values 1, 4,5 7-14 are reserved - see page 244, A.63 Write State Register. - if (specialRegNum == 1 || specialRegNum == 4 || specialRegNum == 5 - || (specialRegNum > 6 && specialRegNum < 15)) { - instr = v9factory.newIllegalInstruction(instruction); - } else { - int rs1Num = getSourceRegister1(instruction); - if (specialRegNum == 15) { - if (isIBitSet(instruction) && rs1Num == 0) { - instr = v9factory.newV9SirInstruction(); - } else { - instr = v9factory.newIllegalInstruction(instruction); - } - } else { - int asrRegNum = -1; - if (specialRegNum > 15) { - asrRegNum = specialRegNum; - specialRegNum = SPARCV9SpecialRegisters.ASR; - } - SPARCRegister rs1 = SPARCRegisters.getRegister(rs1Num); - instr = v9factory.newV9WriteInstruction(specialRegNum, asrRegNum, rs1, getOperand2(instruction)); - } - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9WrprDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class V9WrprDecoder extends V9PrivilegedReadWriteDecoder { - Instruction decode(int instruction, SPARCInstructionFactory factory) { - SPARCV9InstructionFactory v9factory = (SPARCV9InstructionFactory) factory; - Instruction instr = null; - int prNum = getDestinationRegister(instruction); - if (isLegalPrivilegedRegister(prNum)) { - SPARCRegister rs1 = SPARCRegisters.getRegister(getSourceRegister1(instruction)); - ImmediateOrRegister operand2 = getOperand2(instruction); - instr = v9factory.newV9WrprInstruction(rs1, operand2, prNum); - } else { - instr = v9factory.newIllegalInstruction(instruction); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/WriteDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.sparc; - -import sun.jvm.hotspot.asm.*; - -class WriteDecoder extends ReadWriteDecoder { - WriteDecoder(int specialRegNum) { - super(specialRegNum); - } - - Instruction decodeReadWrite(int instruction, SPARCInstructionFactory factory, - int rs1Num, int rdNum) { - Instruction instr = null; - int specialReg = specialRegNum; - if (rdNum == 0) - specialReg = SPARCSpecialRegisters.Y; - return factory.newWriteInstruction(specialReg, rdNum, - SPARCRegisters.getRegister(rs1Num), - getOperand2(instruction)); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/ArithmeticDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; -import sun.jvm.hotspot.asm.*; - -public class ArithmeticDecoder extends InstructionDecoder { - private int rtlOperation; - - public ArithmeticDecoder(String name, int addrMode1, int operandType1, int rtlOperation) { - super(name, addrMode1, operandType1); - this.rtlOperation = rtlOperation; - } - public ArithmeticDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - public ArithmeticDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int addrMode3, int operandType3, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2, addrMode3, operandType3); - this.rtlOperation = rtlOperation; - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - Operand op3 = getOperand3(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newArithmeticInstruction(name, rtlOperation, op1, op2, op3, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/BranchDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.*; - -public class BranchDecoder extends InstructionDecoder { - - public BranchDecoder(String name) { - super(name); - } - public BranchDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand addr = getOperand1(bytesArray, operandSize, addrSize); - if (Assert.ASSERTS_ENABLED) { - Assert.that(addr == null || addr instanceof X86PCRelativeAddress, "Address should be PC Relative!"); - } - int size = byteIndex - instrStartIndex; - return factory.newBranchInstruction(name, (X86PCRelativeAddress)addr, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/CallDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class CallDecoder extends InstructionDecoder { - public CallDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand operand = getOperand1(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - Address address; - if (operand instanceof X86Register) { - address = new X86RegisterDirectAddress((X86Register)operand); - } else { - address = (Address) operand; - } - return factory.newCallInstruction(name, address, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/ConditionalJmpDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.utilities.*; - -public class ConditionalJmpDecoder extends InstructionDecoder { - - public ConditionalJmpDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand addr = getOperand1(bytesArray, operandSize, addrSize); - if (Assert.ASSERTS_ENABLED) { - Assert.that(addr instanceof X86PCRelativeAddress, "Address should be PC Relative!"); - } - return factory.newCondJmpInstruction(name, (X86PCRelativeAddress)addr, byteIndex-instrStartIndex, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FPArithmeticDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class FPArithmeticDecoder extends FPInstructionDecoder { - private int rtlOperation; - - public FPArithmeticDecoder(String name, int addrMode1, int operandType1, int rtlOperation) { - super(name, addrMode1, operandType1); - this.rtlOperation = rtlOperation; - } - public FPArithmeticDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newFPArithmeticInstruction(name, rtlOperation, op1, op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FPInstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -// basic float instruction decoder class -public class FPInstructionDecoder extends InstructionDecoder { - - public FPInstructionDecoder(String name) { - super(name); - } - public FPInstructionDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - public FPInstructionDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return new X86FPInstruction(name, op1, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FPLoadDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -class FPLoadDecoder extends FPInstructionDecoder { - FPLoadDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op = getOperand1(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newFPLoadInstruction(name, op, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FPStoreDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -class FPStoreDecoder extends FPInstructionDecoder { - FPStoreDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op = getOperand1(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newFPStoreInstruction(name, op, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FloatDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class FloatDecoder extends FPInstructionDecoder { - - public FloatDecoder() { - super(null); - } - - //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 - //APPENDIX A - Escape opcodes - - /*When ModR/M byte is within 00h to BFh*/ - private static final FPInstructionDecoder floatMapOne[][] = { - /* d8 */ - { - new FPArithmeticDecoder("fadds", ADDR_E, v_mode, RTLOP_ADD), - new FPArithmeticDecoder("fmuls", ADDR_E, v_mode, RTLOP_SMUL), - new FPInstructionDecoder("fcoms", ADDR_E, v_mode), - new FPInstructionDecoder("fcomps", ADDR_E, v_mode), - new FPArithmeticDecoder("fsubs", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fsubrs", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fdivs", ADDR_E, v_mode, RTLOP_SDIV), - new FPArithmeticDecoder("fdivrs", ADDR_E, v_mode, RTLOP_SDIV) - }, - /* d9 */ - { - new FPLoadDecoder("flds", ADDR_E, v_mode), - null, - new FPStoreDecoder("fsts", ADDR_E, v_mode), - new FPStoreDecoder("fstps", ADDR_E, v_mode), - new FPStoreDecoder("fldenv", ADDR_E, v_mode), - new FPStoreDecoder("fldcw", ADDR_E, v_mode), - new FPStoreDecoder("fNstenv", ADDR_E, v_mode), - new FPStoreDecoder("fNstcw", ADDR_E, v_mode) - }, - /* da */ - { - new FPArithmeticDecoder("fiaddl", ADDR_E, v_mode, RTLOP_ADD), - new FPArithmeticDecoder("fimull", ADDR_E, v_mode, RTLOP_SMUL), - new FPInstructionDecoder("ficoml", ADDR_E, v_mode), - new FPInstructionDecoder("ficompl", ADDR_E, v_mode), - new FPArithmeticDecoder("fisubl", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fisubrl", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fidivl", ADDR_E, v_mode, RTLOP_SDIV), - new FPArithmeticDecoder("fidivrl", ADDR_E, v_mode, RTLOP_SDIV) - }, - /* db */ - { - new FPLoadDecoder("fildl", ADDR_E, v_mode), - null, - new FPStoreDecoder("fistl", ADDR_E, v_mode), - new FPStoreDecoder("fistpl", ADDR_E, v_mode), - null, - new FPLoadDecoder("fldt", ADDR_E, v_mode), - null, - new FPStoreDecoder("fstpt", ADDR_E, v_mode) - }, - /* dc */ - { - new FPArithmeticDecoder("faddl", ADDR_E, v_mode, RTLOP_ADD), - new FPArithmeticDecoder("fmull", ADDR_E, v_mode, RTLOP_SMUL), - new FPInstructionDecoder("fcoml", ADDR_E, v_mode), - new FPInstructionDecoder("fcompl", ADDR_E, v_mode), - new FPArithmeticDecoder("fsubl", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fsubrl", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fdivl", ADDR_E, v_mode, RTLOP_SDIV), - new FPArithmeticDecoder("fdivrl", ADDR_E, v_mode, RTLOP_SDIV) - }, - /* dd */ - { - new FPLoadDecoder("fldl", ADDR_E, v_mode), - null, - new FPStoreDecoder("fstl", ADDR_E, v_mode), - new FPStoreDecoder("fstpl", ADDR_E, v_mode), - new FPStoreDecoder("frstor", ADDR_E, v_mode), - null, - new FPStoreDecoder("fNsave", ADDR_E, v_mode), - new FPStoreDecoder("fNstsw", ADDR_E, v_mode) - }, - /* de */ - { - new FPArithmeticDecoder("fiadd", ADDR_E, v_mode, RTLOP_ADD), - new FPArithmeticDecoder("fimul", ADDR_E, v_mode, RTLOP_SMUL), - new FPInstructionDecoder("ficom", ADDR_E, v_mode), - new FPInstructionDecoder("ficomp", ADDR_E, v_mode), - new FPArithmeticDecoder("fisub", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fisubr", ADDR_E, v_mode, RTLOP_SUB), - new FPArithmeticDecoder("fidiv", ADDR_E, v_mode, RTLOP_SDIV), - new FPArithmeticDecoder("fidivr", ADDR_E, v_mode, RTLOP_SDIV) - }, - /* df */ - { - new FPLoadDecoder("fild", ADDR_E, v_mode), - null, - new FPStoreDecoder("fist", ADDR_E, v_mode), - new FPStoreDecoder("fistp", ADDR_E, v_mode), - new FPLoadDecoder("fbld", ADDR_E, v_mode), - new FPLoadDecoder("fildll", ADDR_E, v_mode), - new FPStoreDecoder("fbstp", ADDR_E, v_mode), - new FPStoreDecoder("fistpll", ADDR_E, v_mode) - } - }; - - /*When ModR/M byte is outside 00h to BFh*/ - private static final FPInstructionDecoder floatMapTwo[][] = { - - /* d8 */ - /*parameter for ADDR_FPREG, 0 means ST(0), 1 means ST at rm value. */ - { - new FPArithmeticDecoder("fadd", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_ADD), - new FPArithmeticDecoder("fmul", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SMUL), - new FPInstructionDecoder("fcom", ADDR_FPREG, 1), - new FPInstructionDecoder("fcomp", ADDR_FPREG, 1), - new FPArithmeticDecoder("fsub", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SUB), - new FPArithmeticDecoder("fsubr", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SUB), - new FPArithmeticDecoder("fdiv", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SDIV), - new FPArithmeticDecoder("fdivr", ADDR_FPREG, 0, ADDR_FPREG, 1, RTLOP_SDIV) - }, - /* d9 */ - { - new FPLoadDecoder("fld", ADDR_FPREG, 1), - new FPInstructionDecoder("fxch", ADDR_FPREG, 1), - new FloatGRPDecoder(null, 0), - null, - new FloatGRPDecoder(null, 1), - new FloatGRPDecoder(null, 2), - new FloatGRPDecoder(null, 3), - new FloatGRPDecoder(null, 4) - }, - /* da */ - { - null, - null, - null, - null, - null, - new FloatGRPDecoder(null, 5), - null, - null - }, - /* db */ - { - null, - null, - null, - null, - new FloatGRPDecoder(null, 6), - null, - null, - null - }, - /* dc */ - { - new FPArithmeticDecoder("fadd", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_ADD), - new FPArithmeticDecoder("fmul", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SMUL), - null, - null, - new FPArithmeticDecoder("fsub", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB), - new FPArithmeticDecoder("fsubr",ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB), - new FPArithmeticDecoder("fdiv", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV), - new FPArithmeticDecoder("fdivr", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV) - }, - /* dd */ - { - new FPInstructionDecoder("ffree", ADDR_FPREG, 1), - null, - new FPStoreDecoder("fst", ADDR_FPREG, 1), - new FPStoreDecoder("fstp", ADDR_FPREG, 1), - new FPInstructionDecoder("fucom", ADDR_FPREG, 1), - new FPInstructionDecoder("fucomp", ADDR_FPREG, 1), - null, - null - }, - /* de */ - { - new FPArithmeticDecoder("faddp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_ADD), - new FPArithmeticDecoder("fmulp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SMUL), - null, - new FloatGRPDecoder(null, 7), - new FPArithmeticDecoder("fsubrp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB), - new FPArithmeticDecoder("fsubp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SUB), - new FPArithmeticDecoder("fdivrp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV), - new FPArithmeticDecoder("fdivp", ADDR_FPREG, 1, ADDR_FPREG, 0, RTLOP_SDIV) - }, - /* df */ - { - null, - null, - null, - null, - new FloatGRPDecoder(null, 7), - null, - null, - null - } - }; - - public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) { - this.byteIndex = index; - this.instrStartIndex = instrStartIndex; - this.prefixes = prefixes; - - int ModRM = readByte(bytesArray, byteIndex); - int reg = (ModRM >> 3) & 7; - int regOrOpcode = (ModRM >> 3) & 7; - int rm = ModRM & 7; - - int floatOpcode = InstructionDecoder.readByte(bytesArray, instrStartIndex); - FPInstructionDecoder instrDecoder = null; - - if(ModRM < 0xbf) { - instrDecoder = floatMapOne[floatOpcode - 0xd8][reg]; - } - else { - instrDecoder = floatMapTwo[floatOpcode - 0xd8][reg]; - } - - Instruction instr = null; - if(instrDecoder != null) { - instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory); - byteIndex = instrDecoder.getCurrentIndex(); - } else { - instr = factory.newIllegalInstruction(); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/FloatGRPDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class FloatGRPDecoder extends FPInstructionDecoder { - - final private int number; - - //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 - //APPENDIX A - Escape opcodes - - private static final FPInstructionDecoder floatGRPMap[][] = { - /* d9_2 */ - { - new FPInstructionDecoder("fnop"), - null, - null, - null, - null, - null, - null, - null - }, - /* d9_4 */ - { - new FPInstructionDecoder("fchs"), - new FPInstructionDecoder("fabs"), - null, - null, - new FPInstructionDecoder("ftst"), - new FPInstructionDecoder("fxam"), - null, - null - }, - /* d9_5 */ - { - new FPInstructionDecoder("fld1"), - new FPInstructionDecoder("fldl2t"), - new FPInstructionDecoder("fldl2e"), - new FPInstructionDecoder("fldpi"), - new FPInstructionDecoder("fldlg2"), - new FPInstructionDecoder("fldln2"), - new FPInstructionDecoder("fldz"), - null - }, - /* d9_6 */ - { - new FPInstructionDecoder("f2xm1"), - new FPInstructionDecoder("fyl2x"), - new FPInstructionDecoder("fptan"), - new FPInstructionDecoder("fpatan"), - new FPInstructionDecoder("fxtract"), - new FPInstructionDecoder("fprem1"), - new FPInstructionDecoder("fdecstp"), - new FPInstructionDecoder("fincstp") - }, - /* d9_7 */ - { - new FPInstructionDecoder("fprem"), - new FPInstructionDecoder("fyl2xp1"), - new FPInstructionDecoder("fsqrt"), - new FPInstructionDecoder("fsincos"), - new FPInstructionDecoder("frndint"), - new FPInstructionDecoder("fscale"), - new FPInstructionDecoder("fsin"), - new FPInstructionDecoder("fcos") - }, - /* da_5 */ - { - null, - new FPInstructionDecoder("fucompp"), - null, - null, - null, - null, - null, - null - }, - /* db_4 */ - { - new FPInstructionDecoder("feni(287 only)"), - new FPInstructionDecoder("fdisi(287 only)"), - new FPInstructionDecoder("fNclex"), - new FPInstructionDecoder("fNinit"), - new FPInstructionDecoder("fNsetpm(287 only)"), - null, - null, - null - }, - /* de_3 */ - { - null, - new FPInstructionDecoder("fcompp"), - null, - null, - null, - null, - null, - null - }, - /* df_4 */ - { - new FPInstructionDecoder("fNstsw"), - null, - null, - null, - null, - null, - null, - null - } - }; - - public FloatGRPDecoder(String name, int number) { - super(name); - this.number = number; - } - - public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) { - this.byteIndex = index; - this.instrStartIndex = instrStartIndex; - this.prefixes = prefixes; - - int ModRM = readByte(bytesArray, byteIndex); - int rm = ModRM & 7; - - FPInstructionDecoder instrDecoder = null; - instrDecoder = floatGRPMap[number][rm]; - - Instruction instr = null; - if(instrDecoder != null) { - instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory); - byteIndex = instrDecoder.getCurrentIndex(); - } else { - instr = factory.newIllegalInstruction(); - } - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/GRPDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class GRPDecoder extends InstructionDecoder { - - final private int number; - //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 - //APPENDIX A - Table A-4. Opcode Extensions for One and Two-byte Opcodes by Group Number. - private static final InstructionDecoder grpTable[][] = { - { - new ArithmeticDecoder("addb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_ADD), - new LogicalDecoder("orb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_OR), - new ArithmeticDecoder("adcb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_ADDC), - new ArithmeticDecoder("sbbb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_SUBC), - new LogicalDecoder("andb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_AND), - new ArithmeticDecoder("subb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_SUB), - new LogicalDecoder("xorb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_XOR), - new InstructionDecoder("cmpb", ADDR_E, b_mode, ADDR_I, b_mode) - }, - { - new ArithmeticDecoder("addS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_ADD), - new LogicalDecoder("orS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_OR), - new ArithmeticDecoder("adcS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_ADDC), - new ArithmeticDecoder("sbbS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_SUBC), - new LogicalDecoder("andS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_AND), - new ArithmeticDecoder("subS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_SUB), - new LogicalDecoder("xorS", ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_XOR), - new InstructionDecoder("cmpS", ADDR_E, v_mode, ADDR_I, v_mode) - }, - { - new ArithmeticDecoder("addS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_ADD), /*note: sIb here*/ - new LogicalDecoder("orS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_OR), - new ArithmeticDecoder("adcS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_ADDC), - new ArithmeticDecoder("sbbS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SUBC), - new LogicalDecoder("andS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_AND), - new ArithmeticDecoder("subS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SUB), - new LogicalDecoder("xorS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_XOR), - new InstructionDecoder("cmpS", ADDR_E, v_mode, ADDR_I, b_mode) - }, - { - new RotateDecoder("rolb", ADDR_E, b_mode, ADDR_I, b_mode), - new RotateDecoder("rorb", ADDR_E, b_mode, ADDR_I, b_mode), - new RotateDecoder("rclb", ADDR_E, b_mode, ADDR_I, b_mode), - new RotateDecoder("rcrb", ADDR_E, b_mode, ADDR_I, b_mode), - new ShiftDecoder("shlb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_SLL), - new ShiftDecoder("shrb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new ShiftDecoder("sarb", ADDR_E, b_mode, ADDR_I, b_mode, RTLOP_SRA), - }, - { - new RotateDecoder("rolS", ADDR_E, v_mode, ADDR_I, b_mode), - new RotateDecoder("rorS", ADDR_E, v_mode, ADDR_I, b_mode), - new RotateDecoder("rclS", ADDR_E, v_mode, ADDR_I, b_mode), - new RotateDecoder("rcrS", ADDR_E, v_mode, ADDR_I, b_mode), - new ShiftDecoder("shlS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SLL), - new ShiftDecoder("shrS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new ShiftDecoder("sarS", ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SRA) - }, - { - new RotateDecoder("rolb", ADDR_E, b_mode), - new RotateDecoder("rorb", ADDR_E, b_mode), - new RotateDecoder("rclb", ADDR_E, b_mode), - new RotateDecoder("rcrb", ADDR_E, b_mode), - new ShiftDecoder("shlb", ADDR_E, b_mode, RTLOP_SLL), - new ShiftDecoder("shrb", ADDR_E, b_mode, RTLOP_SRL), - null, - new ShiftDecoder("sarb", ADDR_E, b_mode, RTLOP_SRA) - }, - { - new RotateDecoder("rolS", ADDR_E, v_mode), - new RotateDecoder("rorS", ADDR_E, v_mode), - new RotateDecoder("rclS", ADDR_E, v_mode), - new RotateDecoder("rcrS", ADDR_E, v_mode), - new ShiftDecoder("shlS", ADDR_E, v_mode, RTLOP_SLL), - new ShiftDecoder("shrS", ADDR_E, v_mode, RTLOP_SRL), - null, - new ShiftDecoder("sarS", ADDR_E, v_mode, RTLOP_SRA) - }, - { - new RotateDecoder("rolb", ADDR_E, b_mode, ADDR_REG, CL), - new RotateDecoder("rorb", ADDR_E, b_mode, ADDR_REG, CL), - new RotateDecoder("rclb", ADDR_E, b_mode, ADDR_REG, CL), - new RotateDecoder("rcrb", ADDR_E, b_mode, ADDR_REG, CL), - new ShiftDecoder( "shlb", ADDR_E, b_mode, ADDR_REG, CL, RTLOP_SLL), - new ShiftDecoder("shrb", ADDR_E, b_mode, ADDR_REG, CL, RTLOP_SRL), - null, - new ShiftDecoder("sarb", ADDR_E, b_mode, ADDR_REG, CL, RTLOP_SRA) - }, - { - new RotateDecoder("rolS", ADDR_E, v_mode, ADDR_REG, CL), - new RotateDecoder("rorS", ADDR_E, v_mode, ADDR_REG, CL), - new RotateDecoder("rclS", ADDR_E, v_mode, ADDR_REG, CL), - new RotateDecoder("rcrS", ADDR_E, v_mode, ADDR_REG, CL), - new ShiftDecoder("shlS", ADDR_E, v_mode, ADDR_REG, CL, RTLOP_SLL), - new ShiftDecoder("shrS", ADDR_E, v_mode, ADDR_REG, CL, RTLOP_SRL), - null, - new ShiftDecoder("sarS", ADDR_E, v_mode, ADDR_REG, CL, RTLOP_SRA) - }, - { - new InstructionDecoder("testb", ADDR_E, b_mode, ADDR_I, b_mode), - null, /*new InstructionDecoder("(bad)", ADDR_E, b_mode)*/ - new LogicalDecoder("notb", ADDR_E, b_mode, RTLOP_NOT), - new InstructionDecoder("negb", ADDR_E, b_mode), - new ArithmeticDecoder("mulb", ADDR_REG, AL, ADDR_E, b_mode, RTLOP_UMUL), - new ArithmeticDecoder("imulb", ADDR_REG, AL, ADDR_E, b_mode, RTLOP_SMUL), - new ArithmeticDecoder("divb", ADDR_REG, AL, ADDR_E, b_mode, RTLOP_UDIV), - new ArithmeticDecoder("idivb", ADDR_REG, AL, ADDR_E, b_mode, RTLOP_SDIV) - }, - { - new InstructionDecoder("testS", ADDR_E, v_mode, ADDR_I, v_mode), - null, - new LogicalDecoder("notS", ADDR_E, v_mode, RTLOP_NOT), - new InstructionDecoder("negS", ADDR_E, v_mode), - new ArithmeticDecoder("mulS", ADDR_REG, EAX, ADDR_E, v_mode, RTLOP_UMUL), - new ArithmeticDecoder("imulS", ADDR_REG, EAX, ADDR_E, v_mode, RTLOP_SMUL), - new ArithmeticDecoder("divS", ADDR_REG, EAX, ADDR_E, v_mode, RTLOP_SDIV), - new ArithmeticDecoder("idivS", ADDR_REG, EAX, ADDR_E, v_mode, RTLOP_SDIV) - }, - { - new ArithmeticDecoder("incb", ADDR_E, b_mode, RTLOP_ADD), - new ArithmeticDecoder("decb", ADDR_E, b_mode, RTLOP_SUB), - null, - null, - null, - null, - null, - null - }, - { - new ArithmeticDecoder("incS", ADDR_E, v_mode, RTLOP_ADD), - new ArithmeticDecoder("decS", ADDR_E, v_mode, RTLOP_SUB), - new CallDecoder("call", ADDR_E, v_mode), - new CallDecoder("lcall", ADDR_E, p_mode), - new JmpDecoder("jmp", ADDR_E, v_mode), - new JmpDecoder("ljmp", ADDR_E, p_mode), - new InstructionDecoder("pushS", ADDR_E, v_mode), - null - }, - { - new InstructionDecoder("sldt", ADDR_E, w_mode), - new InstructionDecoder("str", ADDR_E, w_mode), - new InstructionDecoder("lldt", ADDR_E, w_mode), - new InstructionDecoder("ltr", ADDR_E, w_mode), - new InstructionDecoder("verr", ADDR_E, w_mode), - new InstructionDecoder("verw", ADDR_E, w_mode), - null, - null - }, - { - new InstructionDecoder("sgdt", ADDR_E, w_mode), - new InstructionDecoder("sidt", ADDR_E, w_mode), - new InstructionDecoder("lgdt", ADDR_E, w_mode), - new InstructionDecoder("lidt", ADDR_E, w_mode), - new InstructionDecoder("smsw", ADDR_E, w_mode), - null, - new InstructionDecoder("lmsw", ADDR_E, w_mode), - new InstructionDecoder("invlpg", ADDR_E, w_mode) - }, - { - null, - null, - null, - null, - new InstructionDecoder("btS", ADDR_E, v_mode, ADDR_I, b_mode), - new InstructionDecoder("btsS", ADDR_E, v_mode, ADDR_I, b_mode), - new InstructionDecoder("btrS", ADDR_E, v_mode, ADDR_I, b_mode), - new InstructionDecoder("btcS", ADDR_E, v_mode, ADDR_I, b_mode) - }, - /*16*/ - { - null, - new SSEInstructionDecoder("cmpxch8b", ADDR_W, q_mode), - null, - null, - null, - null, - null, - null - }, - /*17*/ - { - null, - null, - new SSEShiftDecoder("psrlw", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new SSEShiftDecoder("psraw", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SRA), - null, - new SSEShiftDecoder("psllw", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SLL), - null - }, - /*18*/ - { - null, - null, - new SSEShiftDecoder("psrld", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new SSEShiftDecoder("psrad", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SRA), - null, - new SSEShiftDecoder("pslld", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SLL), - null - }, - /*19*/ - { - null, - null, - new SSEShiftDecoder("psrlq", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - null, - null, - new SSEShiftDecoder("psllq", ADDR_P, q_mode, ADDR_I, b_mode, RTLOP_SLL), - null - }, - /*20 - Grp15*/ - { - new SSEInstructionDecoder("fxsave"), - new SSEInstructionDecoder("fxrstor"), - new SSEInstructionDecoder("ldmxcsr"), - new SSEInstructionDecoder("stmxcsr"), - null, - null, - null, - new SSEInstructionDecoder("clflush") - }, - /*21 - Grp16*/ - { - new SSEInstructionDecoder("prefetchnta"), - new SSEInstructionDecoder("prefetcht0"), - new SSEInstructionDecoder("prefetcht1"), - new SSEInstructionDecoder("prefetcht2"), - null, - null, - null, - null - }, - /*22 - Grp12:66*/ - { - null, - null, - new SSEShiftDecoder("psrlw", ADDR_P, dq_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new SSEShiftDecoder("psraw", ADDR_P, dq_mode, ADDR_I, b_mode, RTLOP_SRA), - null, - new SSEShiftDecoder("psllw", ADDR_P, dq_mode, ADDR_I, b_mode, RTLOP_SLL), - null - }, - /*23 - Grp13:66*/ - { - null, - null, - new SSEShiftDecoder("psrld", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - new SSEShiftDecoder("psrad", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SRA), - null, - new SSEShiftDecoder("pslld", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SLL), - null - }, - /*24 - - Grp14:66*/ - { - null, - null, - new SSEShiftDecoder("psrlq", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SRL), - new SSEShiftDecoder("psrldq", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SRL), - null, - null, - new SSEShiftDecoder("psllq", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SLL), - new SSEShiftDecoder("psllq", ADDR_W, dq_mode, ADDR_I, b_mode, RTLOP_SLL) - } -}; - - public GRPDecoder(String name, int number) { - super(name); - this.number = number; - } - - public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) { - this.byteIndex = index; - this.instrStartIndex = instrStartIndex; - this.prefixes = prefixes; - - int ModRM = readByte(bytesArray, byteIndex); - int reg = (ModRM >> 3) & 7; - - InstructionDecoder instrDecoder = grpTable[number][reg]; - Instruction instr = null; - if(instrDecoder != null) { - instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory); - byteIndex = instrDecoder.getCurrentIndex(); - } else { - instr = factory.newIllegalInstruction(); - } - - return instr; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/InstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,554 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -// basic instruction decoder class -public class InstructionDecoder implements /* imports */ X86Opcodes , RTLDataTypes, RTLOperations { - - protected String name; - protected int addrMode1; - protected int operandType1; - protected int addrMode2; - protected int operandType2; - protected int addrMode3; - protected int operandType3; - - private int mod; - private int regOrOpcode; - private int rm; - protected int prefixes; - - protected int byteIndex; - protected int instrStartIndex; - - public InstructionDecoder(String name) { - this.name = name; - this.operandType1 = INVALID_OPERANDTYPE; - this.operandType2 = INVALID_OPERANDTYPE; - this.operandType3 = INVALID_OPERANDTYPE; - this.addrMode1 = INVALID_ADDRMODE; - this.addrMode2 = INVALID_ADDRMODE; - this.addrMode3 = INVALID_ADDRMODE; - } - public InstructionDecoder(String name, int addrMode1, int operandType1) { - this(name); - this.addrMode1 = addrMode1; - this.operandType1 = operandType1; - } - public InstructionDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - this(name, addrMode1, operandType1); - this.addrMode2 = addrMode2; - this.operandType2 = operandType2; - } - public InstructionDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, - int addrMode3, int operandType3) { - this(name, addrMode1, operandType1, addrMode2, operandType2); - this.addrMode3 = addrMode3; - this.operandType3 = operandType3; - } - // "operand1" - protected Operand getOperand1(byte[] bytesArray, boolean operandSize, boolean addrSize) { - if( (addrMode1 != INVALID_ADDRMODE) && (operandType1 != INVALID_OPERANDTYPE) ) - return getOperand(bytesArray, addrMode1, operandType1, operandSize, addrSize); - else - return null; - } - - // "operand2" - protected Operand getOperand2(byte[] bytesArray, boolean operandSize, boolean addrSize) { - if( (addrMode2 != INVALID_ADDRMODE) && (operandType2 != INVALID_OPERANDTYPE) ) - return getOperand(bytesArray, addrMode2, operandType2, operandSize, addrSize); - else - return null; - } - - // "operand3" - protected Operand getOperand3(byte[] bytesArray, boolean operandSize, boolean addrSize) { - if( (addrMode3 != INVALID_ADDRMODE) && (operandType3 != INVALID_OPERANDTYPE) ) - return getOperand(bytesArray, addrMode3, operandType3, operandSize, addrSize); - else - return null; - } - - static int readInt32(byte[] bytesArray, int index) { - int ret = 0; - ret = readByte(bytesArray, index); - ret |= readByte(bytesArray, index+1) << 8; - ret |= readByte(bytesArray, index+2) << 16; - ret |= readByte(bytesArray, index+3) << 24; - return ret; - } - static int readInt16(byte[] bytesArray, int index) { - int ret = 0; - ret = readByte(bytesArray, index); - ret |= readByte(bytesArray, index+1) << 8; - return ret; - } - static int readByte(byte[] bytesArray, int index) { - int ret = 0; - if (index < bytesArray.length) { - ret = (int)bytesArray[index]; - ret = ret & 0xff; - } - return ret; - } - private boolean isModRMPresent(int addrMode) { - if( (addrMode == ADDR_E) || (addrMode == ADDR_G) || (addrMode == ADDR_FPREG) || (addrMode == ADDR_Q) || (addrMode == ADDR_W) ) - return true; - else - return false; - } - public int getCurrentIndex() { - return byteIndex; - } - - public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) { - this.byteIndex = index; - this.instrStartIndex = instrStartIndex; - this.prefixes = prefixes; - boolean operandSize; //operand-size prefix - boolean addrSize; //address-size prefix - if ( ( (prefixes & PREFIX_DATA) ^ segmentOverride ) == 1) - operandSize = true; - else - operandSize = false; - if ( ((prefixes & PREFIX_ADR) ^ segmentOverride) == 1) - addrSize = true; - else - addrSize = false; - this.name = getCorrectOpcodeName(name, prefixes, operandSize, addrSize); - - //Fetch the mod/reg/rm byte only if it is present. - if( isModRMPresent(addrMode1) || isModRMPresent(addrMode2) || isModRMPresent(addrMode3) ) { - - int ModRM = readByte(bytesArray, byteIndex); - byteIndex++; - mod = (ModRM >> 6) & 3; - regOrOpcode = (ModRM >> 3) & 7; - rm = ModRM & 7; - } - return decodeInstruction(bytesArray, operandSize, addrSize, factory); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - Operand op3 = getOperand3(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newGeneralInstruction(name, op1, op2, op3, size, prefixes); - } - - // capital letters in template are macros - private String getCorrectOpcodeName(String oldName, int prefixes, boolean operandSize, boolean addrSize) { - StringBuffer newName = new StringBuffer(oldName); - int index = 0; - for(index=0; index<oldName.length(); index++) { - switch (oldName.charAt(index)) { - case 'C': /* For jcxz/jecxz */ - if (addrSize) - newName.setCharAt(index, 'e'); - index++; - break; - case 'N': - if ((prefixes & PREFIX_FWAIT) == 0) - newName.setCharAt(index, 'n'); - index++; - break; - case 'S': - /* operand size flag */ - if (operandSize == true) - newName.setCharAt(index, 'l'); - else - newName.setCharAt(index, 'w'); - index++; - break; - default: - break; - } - } - return newName.toString(); - } - - //IA-32 Intel Architecture Software Developer's Manual Volume 2 - //Refer to Chapter 2 - Instruction Format - - //Get the Operand object from the address type and the operand type - private Operand getOperand(byte[] bytesArray, int addrMode, int operandType, boolean operandSize, boolean addrSize) { - Operand op = null; - switch(addrMode) { - case ADDR_E: - case ADDR_W: //SSE: ModR/M byte specifies either 128 bit XMM register or memory - case ADDR_Q: //SSE: ModR/M byte specifies either 128 bit MMX register or memory - X86SegmentRegister segReg = getSegmentRegisterFromPrefix(prefixes); - - if (mod == 3) { //Register operand, no SIB follows - if (addrMode == ADDR_E) { - switch (operandType) { - case b_mode: - op = X86Registers.getRegister8(rm); - break; - case w_mode: - op = X86Registers.getRegister16(rm); - break; - case v_mode: - if (operandSize == true) //Operand size prefix is present - op = X86Registers.getRegister32(rm); - else - op = X86Registers.getRegister16(rm); - break; - case p_mode: - X86Register reg; - if (operandSize == true) //Operand size prefix is present - reg = X86Registers.getRegister32(rm); - else - reg = X86Registers.getRegister16(rm); - - op = new X86RegisterIndirectAddress(segReg, reg, null, 0); - break; - default: - break; - } - } else if (addrMode == ADDR_W) { - op = X86XMMRegisters.getRegister(rm); - } else if (addrMode == ADDR_Q) { - op = X86MMXRegisters.getRegister(rm); - } - - } else { //mod != 3 - //SIB follows for (rm==4), SIB gives scale, index and base in this case - //disp32 is present for (mod==0 && rm==5) || (mod==2) - //disp8 is present for (mod==1) - //for (rm!=4) base is register at rm. - int scale = 0; - int index = 0; - int base = 0; - long disp = 0; - if(rm == 4) { - int sib = readByte(bytesArray, byteIndex); - byteIndex++; - scale = (sib >> 6) & 3; - index = (sib >> 3) & 7; - base = sib & 7; - } - - switch (mod) { - case 0: - switch(rm) { - case 4: - if(base == 5) { - disp = readInt32(bytesArray, byteIndex); - byteIndex += 4; - if (index != 4) { - op = new X86RegisterIndirectAddress(segReg, null, X86Registers.getRegister32(index), disp, scale); - } else { - op = new X86RegisterIndirectAddress(segReg, null, null, disp, scale); - } - } - else { - if (index != 4) { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), X86Registers.getRegister32(index), 0, scale); - } else { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, 0, scale); - } - } - break; - case 5: - disp = readInt32(bytesArray, byteIndex); - byteIndex += 4; - //Create an Address object only with displacement - op = new X86RegisterIndirectAddress(segReg, null, null, disp); - break; - default: - base = rm; - //Create an Address object only with base - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, 0); - break; - } - break; - case 1: - disp = (byte)readByte(bytesArray, byteIndex); - byteIndex++; - if (rm !=4) { - base = rm; - //Address with base and disp only - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, disp); - } else { - if (index != 4) { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), X86Registers.getRegister32(index), disp, scale); - } else { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, disp, scale); - } - } - break; - case 2: - disp = readInt32(bytesArray, byteIndex); - byteIndex += 4; - if (rm !=4) { - base = rm; - //Address with base and disp - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, disp); - } else if (index != 4) { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), X86Registers.getRegister32(index), disp, scale); - } else { - op = new X86RegisterIndirectAddress(segReg, X86Registers.getRegister32(base), null, disp, scale); - } - break; - } - } - break; - - case ADDR_I: - switch (operandType) { - case b_mode: - op = new Immediate(new Integer(readByte(bytesArray, byteIndex))); - byteIndex++; - break; - case w_mode: - op = new Immediate(new Integer(readInt16(bytesArray, byteIndex))); - byteIndex += 2; - break; - case v_mode: - if (operandSize == true) { //Operand size prefix is present - op = new Immediate(new Integer(readInt32(bytesArray, byteIndex))); - byteIndex += 4; - } else { - op = new Immediate(new Integer(readInt16(bytesArray, byteIndex))); - byteIndex += 2; - } - break; - default: - break; - } - break; - case ADDR_REG: //registers - switch(operandType) { - case EAX: - case ECX: - case EDX: - case EBX: - case ESP: - case EBP: - case ESI: - case EDI: - if(operandSize == true) { - op = X86Registers.getRegister32(operandType - EAX); - } - else { - op = X86Registers.getRegister16(operandType - EAX); - } - break; - case AX: - case CX: - case DX: - case BX: - case SP: - case BP: - case SI: - case DI: - op = X86Registers.getRegister16(operandType - AX); - break; - case AL: - case CL: - case DL: - case BL: - case AH: - case CH: - case DH: - case BH: - op = X86Registers.getRegister8(operandType - AL); - break; - case ES: //ES, CS, SS, DS, FS, GS - case CS: - case SS: - case DS: - case FS: - case GS: - op = X86SegmentRegisters.getSegmentRegister(operandType - ES); - break; - } - break; - case ADDR_DIR: //segment and offset - long segment = 0; - long offset = 0; - switch (operandType) { - case p_mode: - if (addrSize == true) { - offset = readInt32(bytesArray, byteIndex); - byteIndex += 4; - segment = readInt16(bytesArray, byteIndex); - byteIndex += 2; - } else { - offset = readInt16(bytesArray, byteIndex); - byteIndex += 2; - segment = readInt16(bytesArray, byteIndex); - byteIndex += 2; - } - op = new X86DirectAddress(segment, offset); //with offset - break; - case v_mode: - if (addrSize == true) { - offset = readInt32(bytesArray, byteIndex); - byteIndex += 4; - } else { - offset = readInt16(bytesArray, byteIndex); - byteIndex += 2; - } - op = new X86DirectAddress(offset); //with offset - break; - default: - break; - } - break; - case ADDR_G: - switch (operandType) { - case b_mode: - op = X86Registers.getRegister8(regOrOpcode); - break; - case w_mode: - op = X86Registers.getRegister16(regOrOpcode); - break; - case d_mode: - op = X86Registers.getRegister32(regOrOpcode); - break; - case v_mode: - if (operandSize == true) - op = X86Registers.getRegister32(regOrOpcode); - else - op = X86Registers.getRegister16(regOrOpcode); - break; - default: - break; - } - break; - case ADDR_SEG: - op = X86SegmentRegisters.getSegmentRegister(regOrOpcode); - break; - case ADDR_OFF: - int off = 0; - if (addrSize == true) { - off = readInt32(bytesArray, byteIndex); - byteIndex += 4; - } - else { - off = readInt16(bytesArray, byteIndex); - byteIndex += 2; - } - op = new X86DirectAddress((long)off); - break; - case ADDR_J: - long disp = 0; - //The effective address is Instruction pointer + relative offset - switch(operandType) { - case b_mode: - disp = (byte)readByte(bytesArray, byteIndex); - byteIndex++; - break; - case v_mode: - if (operandSize == true) { - disp = readInt32(bytesArray, byteIndex); - byteIndex += 4; - } - else { - disp = readInt16(bytesArray, byteIndex); - byteIndex += 2; - } - //disp = disp + (byteIndex-instrStartIndex); - break; - } - op = new X86PCRelativeAddress(disp); - break; - case ADDR_ESDI: - op = new X86SegmentRegisterAddress(X86SegmentRegisters.ES, X86Registers.DI); - break; - case ADDR_DSSI: - op = new X86SegmentRegisterAddress(X86SegmentRegisters.DS, X86Registers.SI); - break; - case ADDR_R: - switch (operandType) { - case b_mode: - op = X86Registers.getRegister8(mod); - break; - case w_mode: - op = X86Registers.getRegister16(mod); - break; - case d_mode: - op = X86Registers.getRegister32(mod); - break; - case v_mode: - if (operandSize == true) - op = X86Registers.getRegister32(mod); - else - op = X86Registers.getRegister16(mod); - break; - default: - break; - } - break; - case ADDR_FPREG: - switch (operandType) { - case 0: - op = X86FloatRegisters.getRegister(0); - break; - case 1: - op = X86FloatRegisters.getRegister(rm); - break; - } - break; - - //SSE: reg field of ModR/M byte selects a 128-bit XMM register - case ADDR_V: - op = X86XMMRegisters.getRegister(regOrOpcode); - break; - - //SSE: reg field of ModR/M byte selects a 64-bit MMX register - case ADDR_P: - op = X86MMXRegisters.getRegister(regOrOpcode); - break; - } - return op; - } - - private X86SegmentRegister getSegmentRegisterFromPrefix(int prefixes) { - X86SegmentRegister segRegister = null; - - if ( (prefixes & PREFIX_CS) != 0) - segRegister = X86SegmentRegisters.CS; - if ( (prefixes & PREFIX_DS) != 0) - segRegister = X86SegmentRegisters.DS; - if ( (prefixes & PREFIX_ES) != 0) - segRegister = X86SegmentRegisters.ES; - if ( (prefixes & PREFIX_FS) != 0) - segRegister = X86SegmentRegisters.FS; - if ( (prefixes & PREFIX_SS) != 0) - segRegister = X86SegmentRegisters.SS; - if ( (prefixes & PREFIX_GS) != 0) - segRegister = X86SegmentRegisters.GS; - - return segRegister; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/JmpDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class JmpDecoder extends InstructionDecoder { - public JmpDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand operand = getOperand1(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - Address address; - if (operand instanceof X86Register) { - address = new X86RegisterDirectAddress((X86Register)operand); - } else { - address = (Address) operand; - } - return factory.newJmpInstruction(name, address, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/LogicalDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class LogicalDecoder extends InstructionDecoder { - private int rtlOperation; - - public LogicalDecoder(String name, int addrMode1, int operandType1, int rtlOperation) { - super(name, addrMode1, operandType1); - this.rtlOperation = rtlOperation; - } - public LogicalDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newLogicInstruction(name, rtlOperation, op1, op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/MoveDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class MoveDecoder extends InstructionDecoder { - public MoveDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - - if( (op1 instanceof X86Register) && (op2 instanceof ImmediateOrRegister) ) { - return factory.newMoveInstruction(name, (X86Register)op1, (ImmediateOrRegister)op2, size, prefixes); - } - else if( (op1 instanceof Address) && (op2 instanceof Immediate) ) { - return factory.newGeneralInstruction(name, op1, op2, size, prefixes); - } - else if( (op1 instanceof Address) && (op2 instanceof X86Register) ) { - return factory.newMoveStoreInstruction(name, (Address)op1, (X86Register)op2, 0, size, prefixes); - } - else if( (op1 instanceof X86Register) && (op2 instanceof Address) ) { - return factory.newMoveLoadInstruction(name, (X86Register)op1, (Address)op2, 0, size, prefixes); - } - - return null; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/RotateDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class RotateDecoder extends InstructionDecoder { - - public RotateDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - public RotateDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newRotateInstruction(name, op1, (ImmediateOrRegister)op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/SSEArithmeticDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class SSEArithmeticDecoder extends SSEInstructionDecoder { - private int rtlOperation; - - public SSEArithmeticDecoder(String name, int addrMode1, int operandType1, int rtlOperation) { - super(name, addrMode1, operandType1); - this.rtlOperation = rtlOperation; - } - - public SSEArithmeticDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newArithmeticInstruction(name, rtlOperation, op1, op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/SSEInstructionDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -// SSE instructions decoder class -public class SSEInstructionDecoder extends InstructionDecoder { - - public SSEInstructionDecoder(String name) { - super(name); - } - public SSEInstructionDecoder(String name, int addrMode1, int operandType1) { - super(name, addrMode1, operandType1); - } - public SSEInstructionDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - } - - public SSEInstructionDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int addrMode3, int operandType3) { - super(name, addrMode1, operandType1, addrMode2, operandType2, addrMode3, operandType3); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - Operand op3 = getOperand3(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newGeneralInstruction(name, op1, op2, op3, size, 0); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/SSELogicalDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class SSELogicalDecoder extends SSEInstructionDecoder { - private int rtlOperation; - - public SSELogicalDecoder(String name, int addrMode1, int operandType1, int addrMode2, - int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, - boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newLogicInstruction(name, rtlOperation, op1, op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/SSEMoveDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class SSEMoveDecoder extends SSEInstructionDecoder { - - public SSEMoveDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - - if( (op1 instanceof X86Register) && (op2 instanceof ImmediateOrRegister) ) { - return factory.newMoveInstruction(name, (X86Register)op1, (ImmediateOrRegister)op2, size, 0); - } - else if( (op1 instanceof Address) && (op2 instanceof Immediate) ) { - return factory.newGeneralInstruction(name, op1, op2, size, 0); - } - else if( (op1 instanceof Address) && (op2 instanceof X86Register) ) { - return factory.newMoveStoreInstruction(name, (Address)op1, (X86Register)op2, 0, size, 0); - } - else if( (op1 instanceof X86Register) && (op2 instanceof Address) ) { - return factory.newMoveLoadInstruction(name, (X86Register)op1, (Address)op2, 0, size, 0); - } - - return null; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/SSEShiftDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class SSEShiftDecoder extends SSEInstructionDecoder { - private int rtlOperation; - - public SSEShiftDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newShiftInstruction(name, rtlOperation, op1, (ImmediateOrRegister)op2, size, 0); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/ShiftDecoder.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class ShiftDecoder extends InstructionDecoder { - private int rtlOperation; - - public ShiftDecoder(String name, int addrMode1, int operandType1, int rtlOperation) { - super(name, addrMode1, operandType1); - this.rtlOperation = rtlOperation; - } - public ShiftDecoder(String name, int addrMode1, int operandType1, int addrMode2, int operandType2, int rtlOperation) { - super(name, addrMode1, operandType1, addrMode2, operandType2); - this.rtlOperation = rtlOperation; - } - protected Instruction decodeInstruction(byte[] bytesArray, boolean operandSize, boolean addrSize, X86InstructionFactory factory) { - Operand op1 = getOperand1(bytesArray, operandSize, addrSize); - Operand op2 = getOperand2(bytesArray, operandSize, addrSize); - int size = byteIndex - instrStartIndex; - return factory.newShiftInstruction(name, rtlOperation, op1, (ImmediateOrRegister)op2, size, prefixes); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86ArithmeticInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86ArithmeticInstruction extends X86Instruction - implements ArithmeticInstruction { - final private int operation; //RTL operation - final private Operand operand1; - final private Operand operand2; - final private Operand operand3; - final private String description; - - public X86ArithmeticInstruction(String name, int operation, Operand op1, Operand op2, int size, int prefixes) { - super(name, size, prefixes); - this.operation = operation; - this.operand1 = op1; - this.operand2 = op2; - this.operand3 = null; - description = initDescription(); - } - - public X86ArithmeticInstruction(String name, int operation, Operand op1, Operand op2, Operand op3, int size, int prefixes) { - super(name, size, prefixes); - this.operation = operation; - this.operand1 = op1; - this.operand2 = op2; - this.operand3 = op3; - description = initDescription(); - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - if (operand1 != null) { - buf.append(getOperandAsString(operand1)); - } - if (operand2 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand2)); - } - if(operand3 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand3)); - } - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Operand getArithmeticDestination() { - return operand1; - } - - public Operand getOperand1() { - return operand1; - } - - public Operand getOperand2() { - return operand2; - } - - public Operand getOperand3() { - return operand3; - } - - public Operand[] getArithmeticSources() { - return (new Operand[] { operand1, operand2, operand3 }); - } - - public int getOperation() { - return operation; - } - - public boolean isArithmetic() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86BranchInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86BranchInstruction extends X86Instruction - implements BranchInstruction { - final private X86PCRelativeAddress addr; - - public X86BranchInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes) { - super(name, size, prefixes); - this.addr = addr; - if(addr instanceof X86PCRelativeAddress) { - addr.setInstructionSize(getSize()); - } - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - if(addr != null) { - buf.append(spaces); - if(addr instanceof X86PCRelativeAddress) { - long disp = ((X86PCRelativeAddress)addr).getDisplacement(); - long address = disp + currentPc; - buf.append(symFinder.getSymbolFor(address)); - } - } - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return false; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86CallInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86CallInstruction extends X86Instruction - implements CallInstruction { - final private Address addr; - - public X86CallInstruction(String name, Address addr, int size, int prefixes) { - super(name, size, prefixes); - this.addr = addr; - if(addr instanceof X86PCRelativeAddress) { - ((X86PCRelativeAddress)addr).setInstructionSize(getSize()); - } - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - long address; - if(addr instanceof X86PCRelativeAddress) { - long disp = ((X86PCRelativeAddress)addr).getDisplacement(); - address = disp + currentPc; - buf.append(symFinder.getSymbolFor(address)); - } - else { - buf.append(addr.toString()); - } - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isCall() { - return true; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86CondJmpInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86CondJmpInstruction extends X86Instruction - implements BranchInstruction { - final private X86PCRelativeAddress addr; - - public X86CondJmpInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes) { - super(name, size, prefixes); - this.addr = addr; - if(addr instanceof X86PCRelativeAddress) { - addr.setInstructionSize(getSize()); - } - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - - if(addr instanceof X86PCRelativeAddress) { - long disp = ((X86PCRelativeAddress)addr).getDisplacement(); - long address = disp + currentPc; - buf.append(symFinder.getSymbolFor(address)); - } - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86DirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.Address; -import sun.jvm.hotspot.asm.DirectAddress; -import sun.jvm.hotspot.asm.Register; - -public class X86DirectAddress extends DirectAddress { - private long segment; - public X86DirectAddress(long segment, long disp) { - super(disp); - this.segment = segment; - } - public X86DirectAddress(long disp) { - super(disp); - this.segment = 0; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - if (getSegment() != 0) { - buf.append("0x"); - buf.append(Long.toHexString(getSegment())); - buf.append(":"); - } - buf.append("["); - buf.append("0x"); - buf.append(Long.toHexString(getValue())); - buf.append("]"); - - return buf.toString(); - } - - long getSegment() { - return segment; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Disassembler.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1617 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; -import java.io.*; - -public class X86Disassembler extends Disassembler - implements X86Opcodes { - private int byteIndex; - protected final X86InstructionFactory factory; - - public X86Disassembler(long startPc, byte[] code, X86InstructionFactory factory) { - super(startPc, code); - this.factory = factory; - } - - public X86Disassembler(long startPc, byte[] code) { - this(startPc, code, new X86InstructionFactoryImpl()); - } - - //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 - //APPENDIX A - Table A-2. One-byte Opcode Map - private static final InstructionDecoder oneByteTable[] = { - /* 00 */ - new ArithmeticDecoder("addb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADD), - new ArithmeticDecoder("addS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADD), - new ArithmeticDecoder("addb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_ADD), - new ArithmeticDecoder("addS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_ADD), - new ArithmeticDecoder("addb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_ADD), - new ArithmeticDecoder("addS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_ADD), - new InstructionDecoder("pushl", ADDR_REG, ES), - new InstructionDecoder("popl", ADDR_REG, ES), - /* 08 */ - new LogicalDecoder("orb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_OR), - new LogicalDecoder("orS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_OR), - new LogicalDecoder("orb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_OR), - new LogicalDecoder("orS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_OR), - new LogicalDecoder("orb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_OR), - new LogicalDecoder("orS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_OR), - new InstructionDecoder("pushl", ADDR_REG, CS), - null, /* 0x0f extended opcode escape */ - /* 10 */ - new ArithmeticDecoder("adcb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADDC), - new ArithmeticDecoder("adcS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADDC), - new ArithmeticDecoder("adcb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_ADDC), - new ArithmeticDecoder("adcS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_ADDC), - new ArithmeticDecoder("adcb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_ADDC), - new ArithmeticDecoder("adcS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_ADDC), - new InstructionDecoder("pushl", ADDR_REG, SS), - new InstructionDecoder("popl", ADDR_REG, SS), - /* 18 */ - new ArithmeticDecoder("sbbb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_SUBC), - new ArithmeticDecoder("sbbS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_SUBC), - new ArithmeticDecoder("sbbb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_SUBC), - new ArithmeticDecoder("sbbS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SUBC), - new ArithmeticDecoder("sbbb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_SUBC), - new ArithmeticDecoder("sbbS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_SUBC), - new InstructionDecoder("pushl", ADDR_REG, DS), - new InstructionDecoder("popl", ADDR_REG, DS), - /* 20 */ - new LogicalDecoder("andb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_AND), - new LogicalDecoder("andS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_AND), - new LogicalDecoder("andb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_AND), - new LogicalDecoder("andS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_AND), - new LogicalDecoder("andb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_AND), - new LogicalDecoder("andS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_AND), - null, /* SEG es prefix */ - new InstructionDecoder("daa"), - /* 28 */ - new ArithmeticDecoder("subb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_SUB), - new ArithmeticDecoder("subS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_SUB), - new ArithmeticDecoder("subb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_SUB), - new ArithmeticDecoder("subS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SUB), - new ArithmeticDecoder("subb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_SUB), - new ArithmeticDecoder("subS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_SUB), - null, /* SEG CS prefix */ - new InstructionDecoder("das"), - /* 30 */ - new LogicalDecoder("xorb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_XOR), - new LogicalDecoder("xorS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_XOR), - new LogicalDecoder("xorb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_XOR), - new LogicalDecoder("xorS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_XOR), - new LogicalDecoder("xorb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_XOR), - new LogicalDecoder("xorS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_XOR), - null, /* SEG SS prefix */ - new InstructionDecoder("aaa"), - /* 38 */ - new InstructionDecoder("cmpb", ADDR_E, b_mode, ADDR_G, b_mode), - new InstructionDecoder("cmpS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("cmpb", ADDR_G, b_mode, ADDR_E, b_mode), - new InstructionDecoder("cmpS", ADDR_G, v_mode, ADDR_E, v_mode), - new InstructionDecoder("cmpb", ADDR_REG, AL, ADDR_I, b_mode), - new InstructionDecoder("cmpS", ADDR_REG, EAX, ADDR_I, v_mode), - null, /* SEG DS prefix */ - new InstructionDecoder("aas"), - /* 40 */ - new ArithmeticDecoder("incS", ADDR_REG, EAX, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, ECX, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, EDX, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, EBX, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, ESP, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, EBP, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, ESI, RTLOP_ADD), - new ArithmeticDecoder("incS", ADDR_REG, EDI, RTLOP_ADD), - /* 48 */ - new ArithmeticDecoder("decS", ADDR_REG, EAX, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, ECX, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, EDX, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, EBX, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, ESP, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, EBP, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, ESI, RTLOP_SUB), - new ArithmeticDecoder("decS", ADDR_REG, EDI, RTLOP_SUB), - /* 50 */ - new InstructionDecoder("pushS", ADDR_REG, EAX), - new InstructionDecoder("pushS", ADDR_REG, ECX), - new InstructionDecoder("pushS", ADDR_REG, EDX), - new InstructionDecoder("pushS", ADDR_REG, EBX), - new InstructionDecoder("pushS", ADDR_REG, ESP), - new InstructionDecoder("pushS", ADDR_REG, EBP), - new InstructionDecoder("pushS", ADDR_REG, ESI), - new InstructionDecoder("pushS", ADDR_REG, EDI), - /* 58 */ - new InstructionDecoder("popS", ADDR_REG, EAX), - new InstructionDecoder("popS", ADDR_REG, ECX), - new InstructionDecoder("popS", ADDR_REG, EDX), - new InstructionDecoder("popS", ADDR_REG, EBX), - new InstructionDecoder("popS", ADDR_REG, ESP), - new InstructionDecoder("popS", ADDR_REG, EBP), - new InstructionDecoder("popS", ADDR_REG, ESI), - new InstructionDecoder("popS", ADDR_REG, EDI), - /* 60 */ - new InstructionDecoder("pusha"), - new InstructionDecoder("popa"), - new InstructionDecoder("boundS", ADDR_G, v_mode, ADDR_E, v_mode), - new InstructionDecoder("arpl", ADDR_E, w_mode, ADDR_G, w_mode), - null, /* seg fs */ - null, /* seg gs */ - null, /* op size prefix */ - null, /* adr size prefix */ - /* 68 */ - new InstructionDecoder("pushS", ADDR_I, v_mode), /* 386 book wrong */ - new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_SMUL), - new InstructionDecoder("pushl", ADDR_I, b_mode), /* push of byte really pushes 4 bytes */ - new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SMUL), - new InstructionDecoder("insb", ADDR_ESDI, b_mode, INDIR_REG, DX), - new InstructionDecoder("insS", ADDR_ESDI, v_mode, INDIR_REG, DX), - new InstructionDecoder("outsb", INDIR_REG, DX, ADDR_DSSI, b_mode), - new InstructionDecoder("outsS", INDIR_REG, DX, ADDR_DSSI, v_mode), - /* 70 */ - new ConditionalJmpDecoder("jo", ADDR_J, b_mode), - new ConditionalJmpDecoder("jno", ADDR_J, b_mode), - new ConditionalJmpDecoder("jb", ADDR_J, b_mode), - new ConditionalJmpDecoder("jae", ADDR_J, b_mode), - new ConditionalJmpDecoder("je", ADDR_J, b_mode), - new ConditionalJmpDecoder("jne", ADDR_J, b_mode), - new ConditionalJmpDecoder("jbe", ADDR_J, b_mode), - new ConditionalJmpDecoder("ja", ADDR_J, b_mode), - /* 78 */ - new ConditionalJmpDecoder("js", ADDR_J, b_mode), - new ConditionalJmpDecoder("jns", ADDR_J, b_mode), - new ConditionalJmpDecoder("jp", ADDR_J, b_mode), - new ConditionalJmpDecoder("jnp", ADDR_J, b_mode), - new ConditionalJmpDecoder("jl", ADDR_J, b_mode), - new ConditionalJmpDecoder("jnl", ADDR_J, b_mode), - new ConditionalJmpDecoder("jle", ADDR_J, b_mode), - new ConditionalJmpDecoder("jg", ADDR_J, b_mode), - /* 80 */ - new GRPDecoder(null, 0), - new GRPDecoder(null, 1), - null, - new GRPDecoder(null, 2), - new InstructionDecoder("testb", ADDR_E, b_mode, ADDR_G, b_mode), - new InstructionDecoder("testS", ADDR_E, v_mode, ADDR_G, v_mode), - new MoveDecoder("xchgb", ADDR_E, b_mode, ADDR_G, b_mode), - new MoveDecoder("xchgS", ADDR_E, v_mode, ADDR_G, v_mode), - /* 88 */ - new MoveDecoder("movb", ADDR_E, b_mode, ADDR_G, b_mode), - new MoveDecoder("movS", ADDR_E, v_mode, ADDR_G, v_mode), - new MoveDecoder("movb", ADDR_G, b_mode, ADDR_E, b_mode), - new MoveDecoder("movS", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("movw", ADDR_E, w_mode, ADDR_SEG, w_mode), - new InstructionDecoder("leaS", ADDR_G, v_mode, ADDR_E, 0), - new MoveDecoder("movw", ADDR_SEG, w_mode, ADDR_E, w_mode), - new InstructionDecoder("popS", ADDR_E, v_mode), - /* 90 */ - new InstructionDecoder("nop"), - new MoveDecoder("xchgS", ADDR_REG, ECX, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, EDX, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, EBX, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, ESP, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, EBP, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, ESI, ADDR_REG, EAX), - new MoveDecoder("xchgS", ADDR_REG, EDI, ADDR_REG, EAX), - /* 98 */ - new InstructionDecoder("cwtl"), - new InstructionDecoder("cltd"), - new CallDecoder("lcall", ADDR_DIR, p_mode), - null, /* fwait */ - new InstructionDecoder("pushf"), - new InstructionDecoder("popf"), - new InstructionDecoder("sahf"), - new InstructionDecoder("lahf"), - /* a0 */ - new MoveDecoder("movb", ADDR_REG, AL, ADDR_OFF, b_mode), - new MoveDecoder("movS", ADDR_REG, EAX, ADDR_OFF, v_mode), - new MoveDecoder("movb", ADDR_OFF, b_mode, ADDR_REG, AL), - new MoveDecoder("movS", ADDR_OFF, v_mode, ADDR_REG, EAX), - new MoveDecoder("movsb", ADDR_ESDI, b_mode, ADDR_DSSI, b_mode), - new MoveDecoder("movsS", ADDR_ESDI, v_mode, ADDR_DSSI, v_mode), - new InstructionDecoder("cmpsb", ADDR_ESDI, b_mode, ADDR_DSSI, b_mode), - new InstructionDecoder("cmpsS", ADDR_ESDI, v_mode, ADDR_DSSI, v_mode), - /* a8 */ - new InstructionDecoder("testb", ADDR_REG, AL, ADDR_I, b_mode), - new InstructionDecoder("testS", ADDR_REG, EAX, ADDR_I, v_mode), - new InstructionDecoder("stosb", ADDR_ESDI, b_mode, ADDR_REG, AL), - new InstructionDecoder("stosS", ADDR_ESDI, v_mode, ADDR_REG, EAX), - new InstructionDecoder("lodsb", ADDR_REG, AL, ADDR_DSSI, b_mode), - new InstructionDecoder("lodsS", ADDR_REG, EAX, ADDR_DSSI, v_mode), - new InstructionDecoder("scasb", ADDR_REG, AL, ADDR_ESDI, b_mode), - new InstructionDecoder("scasS", ADDR_REG, EAX, ADDR_ESDI, v_mode), - /* b0 */ - new MoveDecoder("movb", ADDR_REG, AL, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, CL, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, DL, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, BL, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, AH, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, CH, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, DH, ADDR_I, b_mode), - new MoveDecoder("movb", ADDR_REG, BH, ADDR_I, b_mode), - /* b8 */ - new MoveDecoder("movS", ADDR_REG, EAX, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, ECX, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, EDX, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, EBX, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, ESP, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, EBP, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, ESI, ADDR_I, v_mode), - new MoveDecoder("movS", ADDR_REG, EDI, ADDR_I, v_mode), - /* c0 */ - new GRPDecoder(null, 3), - new GRPDecoder(null, 4), - new BranchDecoder("ret", ADDR_I, w_mode), - new BranchDecoder("ret"), - new InstructionDecoder("lesS", ADDR_G, v_mode, ADDR_E, 0), - new InstructionDecoder("ldsS", ADDR_G, v_mode, ADDR_E, 0), - new MoveDecoder("movb", ADDR_E, b_mode, ADDR_I, b_mode), - new MoveDecoder("movS", ADDR_E, v_mode, ADDR_I, v_mode), - /* c8 */ - new InstructionDecoder("enter", ADDR_I, w_mode, ADDR_I, b_mode), - new InstructionDecoder("leave"), - new InstructionDecoder("lret", ADDR_I, w_mode), - new InstructionDecoder("lret"), - new InstructionDecoder("int3"), - new InstructionDecoder("int", ADDR_I, b_mode), - new InstructionDecoder("into"), - new InstructionDecoder("iret"), - /* d0 */ - new GRPDecoder(null, 5), - new GRPDecoder(null, 6), - new GRPDecoder(null, 7), - new GRPDecoder(null, 8), - new InstructionDecoder("aam", ADDR_I, b_mode), - new InstructionDecoder("aad", ADDR_I, b_mode), - null, - new InstructionDecoder("xlat"), - /* d8 */ - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - new FloatDecoder(), - /* e0 */ - new BranchDecoder("loopne", ADDR_J, b_mode), - new BranchDecoder("loope", ADDR_J, b_mode), - new BranchDecoder("loop", ADDR_J, b_mode), - new ConditionalJmpDecoder("jCcxz", ADDR_J, b_mode), - new InstructionDecoder("inb", ADDR_REG, AL, ADDR_I, b_mode), - new InstructionDecoder("inS", ADDR_REG, EAX, ADDR_I, b_mode), - new InstructionDecoder("outb", ADDR_I, b_mode, ADDR_REG, AL), - new InstructionDecoder("outS", ADDR_I, b_mode, ADDR_REG, EAX), - /* e8 */ - new CallDecoder("call", ADDR_J, v_mode), - new JmpDecoder("jmp", ADDR_J, v_mode), - new JmpDecoder("ljmp", ADDR_DIR, p_mode), - new JmpDecoder("jmp", ADDR_J, b_mode), - new InstructionDecoder("inb", ADDR_REG, AL, INDIR_REG, DX), - new InstructionDecoder("inS", ADDR_REG, EAX, INDIR_REG, DX), - new InstructionDecoder("outb", INDIR_REG, DX, ADDR_REG,AL), - new InstructionDecoder("outS", INDIR_REG, DX, ADDR_REG, EAX), - /* f0 */ - new InstructionDecoder("lock"), /* lock prefix */ - null, - new InstructionDecoder("repne"), /* repne */ - new InstructionDecoder("rep"), /* repz */ - new InstructionDecoder("hlt"), - new InstructionDecoder("cmc"), - new GRPDecoder(null, 9), - new GRPDecoder(null, 10), - /* f8 */ - new InstructionDecoder("clc"), - new InstructionDecoder("stc"), - new InstructionDecoder("cli"), - new InstructionDecoder("sti"), - new InstructionDecoder("cld"), - new InstructionDecoder("std"), - new GRPDecoder(null, 11), - new GRPDecoder(null, 12) - }; - - //APPENDIX A - Table A-3. Two-byte Opcode Map - private static final InstructionDecoder twoByteTable[] = { - /* 00 */ - new GRPDecoder(null, 13), - new GRPDecoder(null, 14), - new InstructionDecoder("larS", ADDR_G, v_mode, ADDR_E, w_mode), - new InstructionDecoder("lslS", ADDR_G, v_mode, ADDR_E, w_mode), - null, - null, - new InstructionDecoder("clts"), - null, - /* 08 */ - new InstructionDecoder("invd"), - new InstructionDecoder("wbinvd"), - null, - null, - null, - null, - null, - null, - /* 10 */ //SSE - new SSEMoveDecoder("movups", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSEMoveDecoder("movups", ADDR_W, ps_mode, ADDR_V, ps_mode), - new SSEMoveDecoder("movlps", ADDR_W, q_mode, ADDR_V, q_mode), - new SSEMoveDecoder("movlps", ADDR_V, q_mode, ADDR_W, q_mode), - new SSEInstructionDecoder("unpcklps", ADDR_V, ps_mode, ADDR_W, q_mode), - new SSEInstructionDecoder("unpckhps", ADDR_V, ps_mode, ADDR_W, q_mode), - new SSEMoveDecoder("movhps", ADDR_V, q_mode, ADDR_W, q_mode), - new SSEMoveDecoder("movhps", ADDR_W, q_mode, ADDR_V, q_mode), - /* 18 */ - new GRPDecoder(null, 21), - null, - null, - null, - null, - null, - null, - null, - /* 20 */ - /* these are all backward in appendix A of the intel book */ - new MoveDecoder("movl", ADDR_R, d_mode, ADDR_C, d_mode), - new MoveDecoder("movl", ADDR_R, d_mode, ADDR_D, d_mode), - new MoveDecoder("movl", ADDR_C, d_mode, ADDR_R, d_mode), - new MoveDecoder("movl", ADDR_D, d_mode, ADDR_R, d_mode), - new MoveDecoder("movl", ADDR_R, d_mode, ADDR_T, d_mode), - null, - new MoveDecoder("movl", ADDR_T, d_mode, ADDR_R, d_mode), - null, - /* 28 */ - new SSEMoveDecoder("movaps", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSEMoveDecoder("movaps", ADDR_W, ps_mode, ADDR_V, ps_mode), - new SSEInstructionDecoder("cvtpi2ps", ADDR_V, ps_mode, ADDR_Q, q_mode), - new SSEMoveDecoder("movntps", ADDR_W, ps_mode, ADDR_V, ps_mode), - new SSEInstructionDecoder("cvttps2pi", ADDR_Q, q_mode, ADDR_W, ps_mode), - new SSEInstructionDecoder("cvtps2pi", ADDR_Q, q_mode, ADDR_W, ps_mode), - new SSEInstructionDecoder("ucomiss", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEInstructionDecoder("comiss", ADDR_V, ps_mode, ADDR_W, ps_mode), - /* 30 */ - new SSEInstructionDecoder("wrmsr"), - new SSEInstructionDecoder("rtdsc"), - new SSEInstructionDecoder("rdmsr"), - new SSEInstructionDecoder("rdpmc"), - new SSEInstructionDecoder("sysenter"), - new SSEInstructionDecoder("sysexit"), - null, - null, - /* 38 */ - null, - null, - null, - null, - new SSEMoveDecoder("movnti", ADDR_G, v_mode, ADDR_E, v_mode), - null, - null, - null, - /* 40 */ - new MoveDecoder("cmovo", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovno", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovb", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovae", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmove", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovne", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovbe", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmova", ADDR_G, v_mode, ADDR_E, v_mode), - /* 48 */ - new MoveDecoder("cmovs", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovns", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovp", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovnp", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovl", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovge", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovle", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("cmovg", ADDR_G, v_mode, ADDR_E, v_mode), - /* 50 */ - new SSEMoveDecoder("movmskps", ADDR_E, d_mode, ADDR_V, ps_mode), - new SSEInstructionDecoder("sqrtps", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSEInstructionDecoder("rsqrtps", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSEInstructionDecoder("rcpps", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSELogicalDecoder("andps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_AND), - new SSELogicalDecoder("andnps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_AND), - new SSELogicalDecoder("orps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_OR), - new SSELogicalDecoder("xorps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_XOR), - /* 58 */ - new SSEArithmeticDecoder("addps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_ADD), - new SSEArithmeticDecoder("mulps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SMUL), - new SSEInstructionDecoder("cvtps2pd", ADDR_V, pd_mode, ADDR_W, ps_mode), - new SSEInstructionDecoder("cvtdq2ps", ADDR_V, ps_mode, ADDR_W, dq_mode), - new SSEArithmeticDecoder("subps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SUB), - new SSEInstructionDecoder("minps", ADDR_V, ps_mode, ADDR_W, ps_mode), - new SSEArithmeticDecoder("divps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SDIV), - new SSEInstructionDecoder("maxps", ADDR_V, ps_mode, ADDR_W, ps_mode), - /* 60 */ - new SSEInstructionDecoder("punpcklbw", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("punpcklwd", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("punpckldq", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("packsswb", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pcmpgtb", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pcmpgtw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pcmpgtd", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("packuswb", ADDR_P, q_mode, ADDR_Q, q_mode), - /* 68 */ - new SSEInstructionDecoder("punpckhbw", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("punpckhwd", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("punpckhdq", ADDR_P, q_mode, ADDR_Q, d_mode), - new SSEInstructionDecoder("packssdw", ADDR_P, q_mode, ADDR_Q, d_mode), - null, - null, - new SSEMoveDecoder("movd", ADDR_P, d_mode, ADDR_E, d_mode), - new SSEMoveDecoder("movq", ADDR_P, q_mode, ADDR_E, q_mode), - /* 70 */ - new SSEInstructionDecoder("pshufw", ADDR_P, q_mode, ADDR_Q, q_mode, ADDR_I, b_mode), - new GRPDecoder(null, 17), - new GRPDecoder(null, 18), - new GRPDecoder(null, 19), - new SSEInstructionDecoder("pcmpeqb", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pcmpeqw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pcmpeqd", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("emms"), - /* 78 */ - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movd", ADDR_E, d_mode, ADDR_P, d_mode), - new SSEMoveDecoder("movq", ADDR_Q, q_mode, ADDR_P, q_mode), - /* 80 */ - new ConditionalJmpDecoder("jo", ADDR_J, v_mode), - new ConditionalJmpDecoder("jno", ADDR_J, v_mode), - new ConditionalJmpDecoder("jb", ADDR_J, v_mode), - new ConditionalJmpDecoder("jae", ADDR_J, v_mode), - new ConditionalJmpDecoder("je", ADDR_J, v_mode), - new ConditionalJmpDecoder("jne", ADDR_J, v_mode), - new ConditionalJmpDecoder("jbe", ADDR_J, v_mode), - new ConditionalJmpDecoder("ja", ADDR_J, v_mode), - /* 88 */ - new ConditionalJmpDecoder("js", ADDR_J, v_mode), - new ConditionalJmpDecoder("jns", ADDR_J, v_mode), - new ConditionalJmpDecoder("jp", ADDR_J, v_mode), - new ConditionalJmpDecoder("jnp", ADDR_J, v_mode), - new ConditionalJmpDecoder("jl", ADDR_J, v_mode), - new ConditionalJmpDecoder("jge", ADDR_J, v_mode), - new ConditionalJmpDecoder("jle", ADDR_J, v_mode), - new ConditionalJmpDecoder("jg", ADDR_J, v_mode), - /* 90 */ - new InstructionDecoder("seto", ADDR_E, b_mode), - new InstructionDecoder("setno", ADDR_E, b_mode), - new InstructionDecoder("setb", ADDR_E, b_mode), - new InstructionDecoder("setae", ADDR_E, b_mode), - new InstructionDecoder("sete", ADDR_E, b_mode), - new InstructionDecoder("setne", ADDR_E, b_mode), - new InstructionDecoder("setbe", ADDR_E, b_mode), - new InstructionDecoder("seta", ADDR_E, b_mode), - /* 98 */ - new InstructionDecoder("sets", ADDR_E, b_mode), - new InstructionDecoder("setns", ADDR_E, b_mode), - new InstructionDecoder("setp", ADDR_E, b_mode), - new InstructionDecoder("setnp", ADDR_E, b_mode), - new InstructionDecoder("setl", ADDR_E, b_mode), - new InstructionDecoder("setge", ADDR_E, b_mode), - new InstructionDecoder("setle", ADDR_E, b_mode), - new InstructionDecoder("setg", ADDR_E, b_mode), - /* a0 */ - new InstructionDecoder("pushl", ADDR_REG, FS), - new InstructionDecoder("popl", ADDR_REG, FS), - null, - new InstructionDecoder("btS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("shldS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_I, b_mode), - new InstructionDecoder("shldS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_REG, CL), - null, - null, - /* a8 */ - new InstructionDecoder("pushl", ADDR_REG, GS), - new InstructionDecoder("popl", ADDR_REG, GS), - new SSEInstructionDecoder("rsm"), - new InstructionDecoder("btsS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("shrdS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_I, b_mode), - new InstructionDecoder("shrdS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_REG, CL), - new GRPDecoder(null, 20), - new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SMUL), - /* b0 */ - new InstructionDecoder("cmpxchgb", ADDR_E, b_mode, ADDR_G, b_mode), - new InstructionDecoder("cmpxchgS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("lssS", ADDR_G, v_mode, ADDR_M, p_mode), - new InstructionDecoder("btrS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("lfsS", ADDR_G, v_mode, ADDR_M, p_mode), - new InstructionDecoder("lgsS", ADDR_G, v_mode, ADDR_M, p_mode), - new MoveDecoder("movzbS", ADDR_G, v_mode, ADDR_E, b_mode), - new MoveDecoder("movzwS", ADDR_G, v_mode, ADDR_E, w_mode), - /* b8 */ - null, - null, - new GRPDecoder(null, 15), - new InstructionDecoder("btcS", ADDR_E, v_mode, ADDR_G, v_mode), - new InstructionDecoder("bsfS", ADDR_G, v_mode, ADDR_E, v_mode), - new InstructionDecoder("bsrS", ADDR_G, v_mode, ADDR_E, v_mode), - new MoveDecoder("movsbS", ADDR_G, v_mode, ADDR_E, b_mode), - new MoveDecoder("movswS", ADDR_G, v_mode, ADDR_E, w_mode), - /* c0 */ - new ArithmeticDecoder("xaddb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADD), - new ArithmeticDecoder("xaddS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADD), - new SSEInstructionDecoder("cmpps", ADDR_V, ps_mode, ADDR_W, ps_mode, ADDR_I, b_mode), - new SSEMoveDecoder("movnti", ADDR_E, d_mode, ADDR_G, d_mode), - new SSEInstructionDecoder("pinsrw", ADDR_P, q_mode, ADDR_E, d_mode, ADDR_I, b_mode), - new SSEInstructionDecoder("pextrw", ADDR_G, d_mode, ADDR_P, q_mode, ADDR_I, b_mode), - new SSEInstructionDecoder("shufps", ADDR_V, ps_mode, ADDR_W, ps_mode, ADDR_I, b_mode), - new GRPDecoder(null, 16), - /* c8 */ - new InstructionDecoder("bswap", ADDR_REG, EAX), - new InstructionDecoder("bswap", ADDR_REG, ECX), - new InstructionDecoder("bswap", ADDR_REG, EDX), - new InstructionDecoder("bswap", ADDR_REG, EBX), - new InstructionDecoder("bswap", ADDR_REG, ESP), - new InstructionDecoder("bswap", ADDR_REG, EBP), - new InstructionDecoder("bswap", ADDR_REG, ESI), - new InstructionDecoder("bswap", ADDR_REG, EDI), - /* d0 */ - null, - new SSEShiftDecoder("psrlw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), - new SSEShiftDecoder("psrld", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), - new SSEShiftDecoder("psrlq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), - new SSEArithmeticDecoder("paddq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("pmullw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SMUL), - null, - new SSEMoveDecoder("pmovmskb", ADDR_G, d_mode, ADDR_P, q_mode), - /* d8 */ - new SSEArithmeticDecoder("psubusb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubusw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEInstructionDecoder("pminub", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSELogicalDecoder("pand", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_AND), - new SSEArithmeticDecoder("paddusb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddusw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEInstructionDecoder("pmaxub", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSELogicalDecoder("pandn", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_AND), - /* e0 */ - new SSEInstructionDecoder("pavgb", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("psraw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("psrad", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEInstructionDecoder("pavgw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSEArithmeticDecoder("pmulhuw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_UMUL), - new SSEArithmeticDecoder("pmulhw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SMUL), - null, - new SSEMoveDecoder("movntq", ADDR_W, q_mode, ADDR_V, q_mode), - /* e8 */ - new SSEArithmeticDecoder("psubsb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubsw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEInstructionDecoder("pminsw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSELogicalDecoder("por", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_OR), - new SSEArithmeticDecoder("paddsb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddsw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEInstructionDecoder("pmaxsw", ADDR_P, q_mode, ADDR_Q, q_mode), - new SSELogicalDecoder("pxor", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_XOR), - /* f0 */ - null, - new SSEShiftDecoder("psllw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), - new SSEShiftDecoder("pslld", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), - new SSEShiftDecoder("psllq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), - new SSEArithmeticDecoder("pmuludq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_UMUL), - new SSEArithmeticDecoder("pmaddwd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("psadbw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEMoveDecoder("maskmoveq", ADDR_P, pi_mode, ADDR_Q, pi_mode), - /* f8 */ - new SSEArithmeticDecoder("psubb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), - new SSEArithmeticDecoder("paddb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), - null - }; - - private static final InstructionDecoder twoBytePrefixF2Table[] = { - /* 00 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 08 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 10 */ - new SSEMoveDecoder("movsd", ADDR_V, sd_mode, ADDR_W, sd_mode), - new SSEMoveDecoder("movsd", ADDR_V, sd_mode, ADDR_W, sd_mode), - null, - null, - null, - null, - null, - null, - /* 18 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 20 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 28 */ - null, - null, - new SSEInstructionDecoder("cvtsi2sd", ADDR_V, sd_mode, ADDR_E, d_mode), - null, - new SSEInstructionDecoder("cvttsd2si", ADDR_G, d_mode, ADDR_W, sd_mode), - new SSEInstructionDecoder("cvtsd2si", ADDR_G, d_mode, ADDR_W, sd_mode), - null, - null, - /* 30 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 38 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 40 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 48 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 50 */ - null, - new SSEInstructionDecoder("sqrtsd", ADDR_V, sd_mode, ADDR_W, sd_mode), - null, - null, - null, - null, - null, - null, - /* 58 */ - new SSEArithmeticDecoder("addsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_ADD), - new SSEArithmeticDecoder("mulsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SMUL), - new SSEInstructionDecoder("cvtsd2ss", ADDR_V, sd_mode, ADDR_W, sd_mode), - null, - new SSEArithmeticDecoder("subsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SUB), - new SSEInstructionDecoder("minsd", ADDR_V, sd_mode, ADDR_W, sd_mode), - new SSEArithmeticDecoder("divsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SDIV), - new SSEInstructionDecoder("maxsd", ADDR_V, sd_mode, ADDR_W, sd_mode), - /* 60 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 68 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 70 */ - new SSEInstructionDecoder("pshuflw", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), - null, - null, - null, - null, - null, - null, - null, - /* 78 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 80 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 88 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 90 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 98 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* c0 */ - null, - null, - new SSEInstructionDecoder("cmpsd", ADDR_V, sd_mode, ADDR_W, sd_mode, ADDR_I, b_mode), - null, - null, - null, - null, - null, - /* c8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* d0 */ - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movdq2q", ADDR_P, q_mode, ADDR_W, q_mode), - null, - /* d8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* e0 */ - null, - null, - null, - null, - null, - null, - new SSEInstructionDecoder("cvtpd2dq", ADDR_V, dq_mode, ADDR_W, pd_mode), - null, - /* e8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* f0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* f8 */ - null, - null, - null, - null, - null, - null, - null, - null - }; - - private static final InstructionDecoder twoBytePrefixF3Table[] = { - /* 00 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 08 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 10 */ - new SSEMoveDecoder("movss", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEMoveDecoder("movss", ADDR_W, ss_mode, ADDR_V, ss_mode), - null, - null, - null, - null, - null, - null, - /* 18 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 20 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 28 */ - null, - null, - new SSEInstructionDecoder("cvtsi2ss", ADDR_V, ss_mode, ADDR_E, d_mode), - null, - new SSEInstructionDecoder("cvttss2si", ADDR_G, d_mode, ADDR_W, ss_mode), - new SSEInstructionDecoder("cvtss2si", ADDR_G, d_mode, ADDR_W, ss_mode), - null, - null, - /* 30 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 38 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 40 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 48 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 50 */ - null, - new SSEInstructionDecoder("sqrtss", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEInstructionDecoder("rsqrtss", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEInstructionDecoder("rcpss", ADDR_V, ss_mode, ADDR_W, ss_mode), - null, - null, - null, - null, - /* 58 */ - new SSEArithmeticDecoder("addss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_ADD), - new SSEArithmeticDecoder("mulss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SMUL), - new SSEInstructionDecoder("cvtss2sd", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEInstructionDecoder("cvttps2dq", ADDR_V, dq_mode, ADDR_W, ps_mode), - new SSEArithmeticDecoder("subss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SUB), - new SSEInstructionDecoder("minss", ADDR_V, ss_mode, ADDR_W, ss_mode), - new SSEArithmeticDecoder("divss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SDIV), - new SSEInstructionDecoder("maxss", ADDR_V, ss_mode, ADDR_W, ss_mode), - /* 60 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 68 */ - null, - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movdqu", ADDR_V, dq_mode, ADDR_W, dq_mode), - /* 70 */ - new SSEInstructionDecoder("pshufhw", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), - null, - null, - null, - null, - null, - null, - null, - /* 78 */ - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movq", ADDR_V, q_mode, ADDR_W, q_mode), - new SSEMoveDecoder("movdqu", ADDR_W, dq_mode, ADDR_V, dq_mode), - /* 80 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 88 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 90 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 98 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* c0 */ - null, - null, - new SSEInstructionDecoder("cmpss", ADDR_V, ss_mode, ADDR_W, ss_mode, ADDR_I, b_mode), - null, - null, - null, - null, - null, - /* c8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* d0 */ - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movq2dq", ADDR_V, dq_mode, ADDR_Q, q_mode), - null, - /* d8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* e0 */ - null, - null, - null, - null, - null, - null, - new SSEInstructionDecoder("cvtdq2pd", ADDR_V, pd_mode, ADDR_W, dq_mode), - null, - /* e8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* f0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* f8 */ - null, - null, - null, - null, - null, - null, - null, - null - }; - - private static final InstructionDecoder twoBytePrefix66Table[] = { - /* 00 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 08 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 10 */ - new SSEMoveDecoder("movupd", ADDR_V, pd_mode, ADDR_W, pd_mode), - new SSEMoveDecoder("movupd", ADDR_W, pd_mode, ADDR_V, pd_mode), - new SSEMoveDecoder("movlpd", ADDR_V, q_mode, ADDR_W, s_mode), - new SSEMoveDecoder("movlpd", ADDR_V, q_mode, ADDR_W, q_mode), - new SSEInstructionDecoder("unpcklpd", ADDR_V, pd_mode, ADDR_W, q_mode), - new SSEInstructionDecoder("unpckhpd", ADDR_V, pd_mode, ADDR_W, q_mode), - new SSEMoveDecoder("movhpd", ADDR_V, q_mode, ADDR_W, q_mode), - new SSEMoveDecoder("movhpd", ADDR_W, q_mode, ADDR_V, q_mode), - /* 18 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 20 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 28 */ - new SSEMoveDecoder("movapd", ADDR_V, pd_mode, ADDR_W, pd_mode), - new SSEMoveDecoder("movapd", ADDR_W, pd_mode, ADDR_V, pd_mode), - new SSEInstructionDecoder("cvtpi2pd", ADDR_V, pd_mode, ADDR_Q, dq_mode), - new SSEMoveDecoder("movntpd", ADDR_W, pd_mode, ADDR_V, pd_mode), - new SSEInstructionDecoder("cvttpd2pi", ADDR_Q, dq_mode, ADDR_W, pd_mode), - new SSEInstructionDecoder("cvtpd2pi", ADDR_Q, dq_mode, ADDR_W, pd_mode), - new SSEInstructionDecoder("ucomisd", ADDR_V, sd_mode, ADDR_W, sd_mode), - new SSEInstructionDecoder("comisd", ADDR_V, sd_mode, ADDR_W, sd_mode), - /* 30 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 38 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 40 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 48 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 50 */ - new SSEMoveDecoder("movmskpd", ADDR_E, d_mode, ADDR_V, pd_mode), - new SSEInstructionDecoder("sqrtpd", ADDR_V, pd_mode, ADDR_W, pd_mode), - null, - null, - new SSELogicalDecoder("andpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_AND), - new SSELogicalDecoder("andnpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_AND), - new SSELogicalDecoder("orpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_OR), - new SSELogicalDecoder("xorpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_XOR), - /* 58 */ - new SSEArithmeticDecoder("addpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_ADD), - new SSEArithmeticDecoder("mulpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SMUL), - new SSEInstructionDecoder("cvtpd2ps", ADDR_V, ps_mode, ADDR_W, pd_mode), - new SSEInstructionDecoder("cvtps2dq", ADDR_V, dq_mode, ADDR_W, ps_mode), - new SSEArithmeticDecoder("subpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SUB), - new SSEInstructionDecoder("minpd", ADDR_V, pd_mode, ADDR_W, pd_mode), - new SSEArithmeticDecoder("divpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SDIV), - new SSEInstructionDecoder("maxpd", ADDR_V, pd_mode, ADDR_W, pd_mode), - /* 60 */ - new SSEInstructionDecoder("punpcklbw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("punpcklwd", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("punpckldq", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("packsswb", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pcmpgtb", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pcmpgtw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pcmpgtd", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("packuswb", ADDR_V, dq_mode, ADDR_W, dq_mode), - /* 68 */ - new SSEInstructionDecoder("punpckhbw", ADDR_P, dq_mode, ADDR_Q, dq_mode), - new SSEInstructionDecoder("punpckhwd", ADDR_P, dq_mode, ADDR_Q, dq_mode), - new SSEInstructionDecoder("punpckhdq", ADDR_P, dq_mode, ADDR_Q, dq_mode), - new SSEInstructionDecoder("packssdw", ADDR_P, dq_mode, ADDR_Q, dq_mode), - new SSEInstructionDecoder("punpcklqdq", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("punpckhqdq", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEMoveDecoder("movd", ADDR_V, dq_mode, ADDR_E, d_mode), - new SSEMoveDecoder("movdqa", ADDR_V, dq_mode, ADDR_W, dq_mode), - /* 70 */ - new SSEInstructionDecoder("pshufd", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), - new GRPDecoder(null, 22), - new GRPDecoder(null, 23), - new GRPDecoder(null, 24), - new SSEInstructionDecoder("pcmpeqb", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pcmpeqw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pcmpeqd", ADDR_V, dq_mode, ADDR_W, dq_mode), - null, - /* 78 */ - null, - null, - null, - null, - null, - null, - new SSEMoveDecoder("movd", ADDR_E, d_mode, ADDR_V, dq_mode), - new SSEMoveDecoder("movdqa", ADDR_W, dq_mode, ADDR_V, dq_mode), - /* 80 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 88 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 90 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* 98 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* a8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b0 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* b8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* c0 */ - null, - null, - new SSEInstructionDecoder("cmppd", ADDR_V, pd_mode, ADDR_W, pd_mode, ADDR_I, b_mode), - null, - new SSEInstructionDecoder("pinsrw", ADDR_V, dq_mode, ADDR_E, d_mode, ADDR_I, b_mode), - new SSEInstructionDecoder("pextrw", ADDR_G, d_mode, ADDR_V, dq_mode, ADDR_I, b_mode), - new SSEInstructionDecoder("shufpd", ADDR_V, pd_mode, ADDR_W, pd_mode, ADDR_I, b_mode), - null, - /* c8 */ - null, - null, - null, - null, - null, - null, - null, - null, - /* d0 */ - null, - new SSEShiftDecoder("psrlw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), - new SSEShiftDecoder("psrld", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), - new SSEShiftDecoder("psrlq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), - new SSEArithmeticDecoder("paddq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("pmullw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SMUL), - new SSEMoveDecoder("movq", ADDR_W, q_mode, ADDR_V, q_mode), - new SSEMoveDecoder("pmovmskb", ADDR_G, d_mode, ADDR_V, dq_mode), - /* d8 */ - new SSEArithmeticDecoder("psubusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEInstructionDecoder("pminub", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSELogicalDecoder("pand", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_AND), - new SSEArithmeticDecoder("paddusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEInstructionDecoder("pmaxub", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSELogicalDecoder("pandn", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_AND), - /* e0 */ - new SSEInstructionDecoder("pavgb", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("psraw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("psrad", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEInstructionDecoder("pavgw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSEArithmeticDecoder("pmulhuw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_UMUL), - new SSEArithmeticDecoder("pmulhw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SMUL), - new SSEInstructionDecoder("cvttpd2dq", ADDR_V, dq_mode, ADDR_W, pd_mode), - new SSEMoveDecoder("movntdq", ADDR_W, dq_mode, ADDR_V, dq_mode), - /* e8 */ - new SSEArithmeticDecoder("psubusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEInstructionDecoder("pminsw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSELogicalDecoder("por", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_OR), - new SSEArithmeticDecoder("paddsb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddsw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEInstructionDecoder("pmaxsw", ADDR_V, dq_mode, ADDR_W, dq_mode), - new SSELogicalDecoder("pxor", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_XOR), - /* f0 */ - null, - new SSEShiftDecoder("psllw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), - new SSEShiftDecoder("pslld", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), - new SSEShiftDecoder("psllq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), - new SSEArithmeticDecoder("pmuludq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_UMUL), - new SSEArithmeticDecoder("pmaddwd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("psadbw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEMoveDecoder("maskmovdqu", ADDR_V, dq_mode, ADDR_W, dq_mode), - /* f8 */ - new SSEArithmeticDecoder("psubb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("psubq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), - new SSEArithmeticDecoder("paddb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - new SSEArithmeticDecoder("paddd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), - null - }; - - public void decode(InstructionVisitor visitor) { - int enter_instruction = 0; - Instruction instr = null; - visitor.prologue(); - InstructionDecoder instrDecoder = null; - try { - byteIndex = 0; - int len = 0; - int instrStartIndex = 0; - - while(len < code.length) { - int prefixes = 0; - instrStartIndex = byteIndex; - - //check if there is any prefix - prefixes = getPrefixes(); - int segmentOverride = 1; //get segment override prefix - - if (code[byteIndex] == 0xc8) - enter_instruction = 1; - else - enter_instruction = 0; - - //Read opcode - int opcode = InstructionDecoder.readByte(code, byteIndex); - byteIndex++; - - if (opcode == 0x0f) { - opcode = InstructionDecoder.readByte(code, byteIndex); - byteIndex++; - - //SSE: SSE instructions have reserved use of 0xF2, 0xF3, 0x66 prefixes - if ((prefixes & PREFIX_REPNZ) != 0) { - instrDecoder = twoBytePrefixF2Table[opcode]; - } else if ((prefixes & PREFIX_REPZ) != 0) { - instrDecoder = twoBytePrefixF3Table[opcode]; - } else if ((prefixes & PREFIX_DATA) != 0) { - instrDecoder = twoBytePrefix66Table[opcode]; - } else { - instrDecoder = twoByteTable[opcode]; - } - - } else { - instrDecoder = oneByteTable[opcode]; - } - if (instrDecoder != null) { - instr = instrDecoder.decode(code, byteIndex, instrStartIndex, segmentOverride, prefixes, factory); - visitor.visit(startPc + len, instr); - len = instrDecoder.getCurrentIndex(); - } - else { - len += 1; - } - byteIndex = len; - } - } catch (Exception exp) { - visitor.epilogue(); - } - } - - private int getPrefixes() { - int prefixByte = 0; - int prefixes = 0; - boolean isPrefix = true; - while (isPrefix) { - prefixByte = InstructionDecoder.readByte(code, byteIndex); - - switch (prefixByte) { - case 0xf3: - prefixes |= PREFIX_REPZ; - break; - case 0xf2: - prefixes |= PREFIX_REPNZ; - break; - case 0xf0: - prefixes |= PREFIX_LOCK; - break; - case 0x2e: - prefixes |= PREFIX_CS; - break; - case 0x36: - prefixes |= PREFIX_SS; - break; - case 0x3e: - prefixes |= PREFIX_DS; - break; - case 0x26: - prefixes |= PREFIX_ES; - break; - case 0x64: - prefixes |= PREFIX_FS; - break; - case 0x65: - prefixes |= PREFIX_GS; - break; - case 0x66: - prefixes |= PREFIX_DATA; - break; - case 0x67: - prefixes |= PREFIX_ADR; - break; - case 0x9b: - prefixes |= PREFIX_FWAIT; - break; - default: - isPrefix = false; - break; - } - if(isPrefix) - byteIndex++; - } - return prefixes; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FPArithmeticInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86FPArithmeticInstruction extends X86FPInstruction - implements ArithmeticInstruction { - final private int operation; //RTL operation - final private Operand operand1; - final private Operand operand2; - final private String description; - - public X86FPArithmeticInstruction(String name, int operation, Operand op1, Operand op2, int size, int prefixes) { - super(name, size, prefixes); - this.operation = operation; - this.operand1 = op1; - this.operand2 = op2; - description = initDescription(); - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - if (operand1 != null) { - buf.append(getOperandAsString(operand1)); - } - if (operand2 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand2)); - } - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Operand getArithmeticDestination() { - return operand1; - } - public Operand getOperand1() { - return operand1; - } - - public Operand getOperand2() { - return operand2; - } - - public Operand[] getArithmeticSources() { - return (new Operand[] { operand1, operand2}); - } - - public int getOperation() { - return operation; - } - - public boolean isArithmetic() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FPInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86FPInstruction extends X86Instruction { - - final private Operand operand1; - final private String description; - - public X86FPInstruction(String name, int size, int prefixes) { - super(name, size, prefixes); - this.operand1 = null; - description = initDescription(); - } - - public X86FPInstruction(String name, Operand op1, int size, int prefixes) { - super(name, size, prefixes); - this.operand1 = op1; - description = initDescription(); - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - if (operand1 != null) { - buf.append(getOperandAsString(operand1)); - } - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Operand getOperand1() { - return operand1; - } - - public boolean isFloat() { - return true; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FPLoadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86FPLoadInstruction extends X86FPInstruction { - - final private Operand source; - - public X86FPLoadInstruction(String name, Operand operand, int size, int prefixes) { - super(name, size, prefixes); - this.source = operand; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(source.toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FPStoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86FPStoreInstruction extends X86FPInstruction { - - final private Operand dest; - - public X86FPStoreInstruction(String name, Operand op, int size, int prefixes) { - super(name, size, prefixes); - this.dest = op; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(dest.toString()); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FloatRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.Register; -import sun.jvm.hotspot.utilities.Assert; - -public class X86FloatRegister extends Register { - - public X86FloatRegister(int number) { - super(number); - } - - public int getNumber() { - return number; - } - - public int getNumberOfRegisters() { - return X86FloatRegisters.getNumRegisters(); - } - - public boolean isFloat() { - return true; - } - - public boolean isFramePointer() { - return false; - } - - public boolean isStackPointer() { - return false; - } - - public boolean isValid() { - return number >= 0 && number < X86FloatRegisters.getNumRegisters(); - } - - public String toString() { - return X86FloatRegisters.getRegisterName(number); - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86FloatRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.utilities.Assert; - -public class X86FloatRegisters { - - public static int getNumRegisters() { - return NUM_REGISTERS; - } - - public static X86FloatRegister getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid float register number!"); - } - return registers[regNum]; - } - - public static String getRegisterName(int i) { - return "ST(" + i + ")"; - } - - public static final X86FloatRegister ST0; - public static final X86FloatRegister ST1; - public static final X86FloatRegister ST2; - public static final X86FloatRegister ST3; - public static final X86FloatRegister ST4; - public static final X86FloatRegister ST5; - public static final X86FloatRegister ST6; - public static final X86FloatRegister ST7; - - public static final int NUM_REGISTERS = 8; - - private static final X86FloatRegister registers[]; - - static { - ST0 = new X86FloatRegister(0); - ST1 = new X86FloatRegister(1); - ST2 = new X86FloatRegister(2); - ST3 = new X86FloatRegister(3); - ST4 = new X86FloatRegister(4); - ST5 = new X86FloatRegister(5); - ST6 = new X86FloatRegister(6); - ST7 = new X86FloatRegister(7); - registers = (new X86FloatRegister[] { - ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7 - }); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86GeneralInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86GeneralInstruction extends X86Instruction { - final private Operand operand1; - final private Operand operand2; - final private Operand operand3; - final private String description; - - public X86GeneralInstruction(String name, Operand op1, Operand op2, Operand op3, int size, int prefixes) { - super(name, size, prefixes); - this.operand1 = op1; - this.operand2 = op2; - this.operand3 = op3; - description = initDescription(); - } - public X86GeneralInstruction(String name, Operand op1, Operand op2, int size, int prefixes) { - this(name, op1, op2, null, size, prefixes); - } - - public X86GeneralInstruction(String name, Operand op1, int size, int prefixes) { - this(name, op1, null, null, size, prefixes); - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - if (operand1 != null) { - buf.append(getOperandAsString(operand1)); - } - if (operand2 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand2)); - } - if(operand3 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand3)); - } - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public Operand getOperand1() { - return operand1; - } - - public Operand getOperand2() { - return operand2; - } - - public Operand getOperand3() { - return operand3; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Helper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - - -public class X86Helper implements CPUHelper { - public Disassembler createDisassembler(long startPc, byte[] code) { - return new X86Disassembler(startPc, code); - } - - public Register getIntegerRegister(int num) { - return X86Registers.getRegister32(num); - } - - public Register getFloatRegister(int num) { - return X86FloatRegisters.getRegister(num); - } - - public Register getStackPointer() { - return X86Registers.ESP; - } - - public Register getFramePointer() { - return X86Registers.EBP; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86IllegalInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.SymbolFinder; - -public final class X86IllegalInstruction extends X86Instruction { - final private String description; - - public X86IllegalInstruction() { - super("illegal", 1, 0); - description = "bad opcode"; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public boolean isIllegal() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Instruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public abstract class X86Instruction implements Instruction, X86Opcodes { - final private String name; - final private int size; - final private int prefixes; - - public X86Instruction(String name, int size, int prefixes) { - this.name = name; - this.size = size; - this.prefixes = prefixes; - } - - public abstract String asString(long currentPc, SymbolFinder symFinder); - - public String getName() { - return name; - } - - public String getPrefixString() { - StringBuffer buf = new StringBuffer(); - if ((prefixes & PREFIX_REPZ) != 0) - buf.append("repz "); - if ((prefixes & PREFIX_REPNZ) != 0) - buf.append("repnz "); - if ((prefixes & PREFIX_LOCK) != 0) - buf.append("lock "); - - return buf.toString(); - } - - protected String getOperandAsString(Operand op) { - StringBuffer buf = new StringBuffer(); - if ((op instanceof Register) || (op instanceof Address)) { - buf.append(op.toString()); - } else { - Number number = ((Immediate)op).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - return buf.toString(); - } - - public int getSize() { - return size; - } - - public boolean isArithmetic() { - return false; - } - - public boolean isBranch() { - return false; - } - - public boolean isCall() { - return false; - } - - public boolean isFloat() { - return false; - } - - public boolean isIllegal() { - return false; - } - - public boolean isLoad() { - return false; - } - - public boolean isLogical() { - return false; - } - - public boolean isMove() { - return false; - } - - public boolean isReturn() { - return false; - } - - public boolean isShift() { - return false; - } - - public boolean isStore() { - return false; - } - - public boolean isTrap() { - return false; - } - - public boolean isNoop() { - return false; - } - - protected static String comma = ", "; - protected static String spaces = "\t"; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86InstructionFactory.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public interface X86InstructionFactory { - public X86Instruction newCallInstruction(String name, Address addr, int size, int prefixes); - - public X86Instruction newJmpInstruction(String name, Address addr, int size, int prefixes); - - public X86Instruction newCondJmpInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes); - - public X86Instruction newMoveInstruction(String name, X86Register rd, ImmediateOrRegister oSrc, int size, int prefixes); - - public X86Instruction newMoveLoadInstruction(String name, X86Register op1, Address op2, int dataType, int size, int prefixes); - - public X86Instruction newMoveStoreInstruction(String name, Address op1, X86Register op2, int dataType, int size, int prefixes); - - public X86Instruction newArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, Operand op3, int size, int prefixes); - - public X86Instruction newArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes); - - public X86Instruction newLogicInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes); - - public X86Instruction newBranchInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes); - - public X86Instruction newShiftInstruction(String name, int rtlOperation, Operand op1, ImmediateOrRegister op2, int size, int prefixes); - - public X86Instruction newRotateInstruction(String name, Operand op1, ImmediateOrRegister op2, int size, int prefixes); - - public X86Instruction newFPLoadInstruction(String name, Operand op, int size, int prefixes); - - public X86Instruction newFPStoreInstruction(String name, Operand op, int size, int prefixes); - - public X86Instruction newFPArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes); - - public X86Instruction newGeneralInstruction(String name, Operand op1, Operand op2, Operand op3, int size, int prefixes); - - public X86Instruction newGeneralInstruction(String name, Operand op1, Operand op2, int size, int prefixes); - - public X86Instruction newGeneralInstruction(String name, Operand op1, int size, int prefixes); - - public X86Instruction newIllegalInstruction(); - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86InstructionFactoryImpl.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86InstructionFactoryImpl implements X86InstructionFactory { - - public X86Instruction newCallInstruction(String name, Address addr, int size, int prefixes) { - return new X86CallInstruction(name, addr, size, prefixes); - } - - public X86Instruction newJmpInstruction(String name, Address addr, int size, int prefixes) { - return new X86JmpInstruction(name, addr, size, prefixes); - } - - public X86Instruction newCondJmpInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes) { - return new X86CondJmpInstruction(name, addr, size, prefixes); - } - - public X86Instruction newMoveInstruction(String name, X86Register rd, ImmediateOrRegister oSrc, int size, int prefixes) { - return new X86MoveInstruction(name, rd, oSrc, size, prefixes); - } - - public X86Instruction newMoveLoadInstruction(String name, X86Register op1, Address op2, int dataType, int size, int prefixes) { - return new X86MoveLoadInstruction(name, op1, op2, dataType, size, prefixes); - } - - public X86Instruction newMoveStoreInstruction(String name, Address op1, X86Register op2, int dataType, int size, int prefixes) { - return new X86MoveStoreInstruction(name, op1, op2, dataType, size, prefixes); - } - - public X86Instruction newArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, Operand op3, int size, int prefixes) { - return new X86ArithmeticInstruction(name, rtlOperation, op1, op2, op3, size, prefixes); - } - - public X86Instruction newArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes) { - return new X86ArithmeticInstruction(name, rtlOperation, op1, op2, size, prefixes); - } - - - public X86Instruction newLogicInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes) { - return new X86LogicInstruction(name, rtlOperation, op1, op2, size, prefixes); - } - - public X86Instruction newBranchInstruction(String name, X86PCRelativeAddress addr, int size, int prefixes) { - return new X86BranchInstruction(name, addr, size, prefixes); - } - - public X86Instruction newShiftInstruction(String name, int rtlOperation, Operand op1, ImmediateOrRegister op2, int size, int prefixes) { - return new X86ShiftInstruction(name, rtlOperation, op1, op2, size, prefixes); - } - - public X86Instruction newRotateInstruction(String name, Operand op1, ImmediateOrRegister op2, int size, int prefixes) { - return new X86RotateInstruction(name, op1, op2, size, prefixes); - } - - public X86Instruction newFPLoadInstruction(String name, Operand op, int size, int prefixes) { - return new X86FPLoadInstruction(name, op, size, prefixes); - } - - public X86Instruction newFPStoreInstruction(String name, Operand op, int size, int prefixes) { - return new X86FPStoreInstruction(name, op, size, prefixes); - } - - public X86Instruction newFPArithmeticInstruction(String name, int rtlOperation, Operand op1, Operand op2, int size, int prefixes) { - return new X86FPArithmeticInstruction(name, rtlOperation, op1, op2, size, prefixes); - } - - public X86Instruction newGeneralInstruction(String name, Operand op1, Operand op2, Operand op3, int size, int prefixes) { - return new X86GeneralInstruction(name, op1, op2, op3, size, prefixes); - } - - public X86Instruction newGeneralInstruction(String name, Operand op1, Operand op2, int size, int prefixes) { - return new X86GeneralInstruction(name, op1, op2, size, prefixes); - } - - public X86Instruction newGeneralInstruction(String name, Operand op1, int size, int prefixes) { - return new X86GeneralInstruction(name, op1, size, prefixes); - } - - public X86Instruction newIllegalInstruction() { - return new X86IllegalInstruction(); - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86JmpInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86JmpInstruction extends X86Instruction - implements BranchInstruction { - final private Address addr; - - public X86JmpInstruction(String name, Address addr, int size, int prefixes) { - super(name, size, prefixes); - this.addr = addr; - if(addr instanceof X86PCRelativeAddress) { - ((X86PCRelativeAddress)addr).setInstructionSize(getSize()); - } - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - long address; - if(addr instanceof X86PCRelativeAddress) { - long disp = ((X86PCRelativeAddress)addr).getDisplacement(); - address = disp + currentPc; - buf.append(symFinder.getSymbolFor(address)); - } - else { - buf.append(addr.toString()); - } - return buf.toString(); - } - - public Address getBranchDestination() { - return addr; - } - - public boolean isBranch() { - return true; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86LogicInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86LogicInstruction extends X86Instruction - implements LogicInstruction { - final private Operand operand1; - final private Operand operand2; - final private int operation; - - public X86LogicInstruction(String name, int operation, Operand op1, Operand op2, int size, int prefixes) { - super(name, size, prefixes); - this.operation = operation; - this.operand1 = op1; - this.operand2 = op2; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(getOperandAsString(operand1)); - if(operand2 != null) { - buf.append(comma); - buf.append(getOperandAsString(operand2)); - } - return buf.toString(); - } - - public Operand getLogicDestination() { - return operand1; - } - - public Operand[] getLogicSources() { - return (new Operand[] { operand2 }); - } - - public int getOperation() { - return operation; - } - - public boolean isLogic() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MMXRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86MMXRegister extends X86Register { - - public X86MMXRegister(int num, String name) { - super(num, name); - } - public int getNumberOfRegisters() { - return X86MMXRegisters.getNumberOfRegisters(); - } - public String toString() { - return name; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MMXRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.utilities.*; - -/* 8 64-bit registers called MMX registers*/ - -public class X86MMXRegisters { - - public static final int NUM_MMX_REGISTERS = 8; - - public static final X86MMXRegister MM0; - public static final X86MMXRegister MM1; - public static final X86MMXRegister MM2; - public static final X86MMXRegister MM3; - public static final X86MMXRegister MM4; - public static final X86MMXRegister MM5; - public static final X86MMXRegister MM6; - public static final X86MMXRegister MM7; - - private static X86MMXRegister mmxRegisters[]; - - static { - //MMX registers - MM0 = new X86MMXRegister(0, "%mm0"); - MM1 = new X86MMXRegister(1, "%mm1"); - MM2 = new X86MMXRegister(2, "%mm2"); - MM3 = new X86MMXRegister(3, "%mm3"); - MM4 = new X86MMXRegister(4, "%mm4"); - MM5 = new X86MMXRegister(5, "%mm5"); - MM6 = new X86MMXRegister(6, "%mm6"); - MM7 = new X86MMXRegister(7, "%mm7"); - - mmxRegisters = (new X86MMXRegister[] { - MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7 - }); - } - - public static int getNumberOfRegisters() { - return NUM_MMX_REGISTERS; - } - - //Return the register name - public static String getRegisterName(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_MMX_REGISTERS, "invalid MMX register number!"); - } - return mmxRegisters[regNum].toString(); - } - - public static X86MMXRegister getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_MMX_REGISTERS, "invalid MMX register number!"); - } - return mmxRegisters[regNum]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MemoryIndirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.asm.x86.*; - -public class X86MemoryIndirectAddress extends IndirectAddress { - - private long value; - - public X86MemoryIndirectAddress(long value) { - this.value = value; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("*"); - buf.append("["); - buf.append(Long.toHexString(value)); - buf.append(']'); - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MemoryInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public abstract class X86MemoryInstruction extends X86Instruction - implements MemoryInstruction { - final protected Address address; - final protected X86Register register; - final protected int dataType; - final protected String description; - - public X86MemoryInstruction(String name, Address address, X86Register register, int dataType, int size, int prefixes) { - super(name, size, prefixes); - this.address = address; - this.register = register; - this.dataType = dataType; - description = initDescription(); - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(register.toString()); - buf.append(comma); - buf.append(address.toString()); - return buf.toString(); - } - - public String asString(long currentPc, SymbolFinder symFinder) { - return description; - } - - public int getDataType() { - return dataType; - } - - public boolean isConditional() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MoveInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86MoveInstruction extends X86Instruction - implements MoveInstruction, RTLOperations { - private ImmediateOrRegister source; - private X86Register destination; - - public X86MoveInstruction(String name, X86Register rd, ImmediateOrRegister oSrc, int size, int prefixes) { - super(name, size, prefixes); - this.source = oSrc; - this.destination = rd; - } - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(destination.toString()); - buf.append(comma); - buf.append(getSourceString()); - return buf.toString(); - } - - protected String getSourceString() { - StringBuffer buf = new StringBuffer(); - if ((source instanceof Register)) { - buf.append(source.toString()); - } else { - Number number = ((Immediate)source).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - return buf.toString(); - } - - public ImmediateOrRegister getMoveSource() { - return source; - } - - public Register getMoveDestination() { - return destination; - } - - // for condition moves - public boolean isConditional() { - return false; - } - - public boolean isMove() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MoveLoadInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86MoveLoadInstruction extends X86MemoryInstruction - implements LoadInstruction { - public X86MoveLoadInstruction(String name, X86Register register, Address address, int dataType, int size, int prefixes) { - super(name, address, register, dataType, size, prefixes); - } - - public boolean isLoad() { - return true; - } - - public Register[] getLoadDestinations() { - Register[] destinations = new Register[1]; - destinations[0] = register; - return destinations; - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(register.toString()); - buf.append(comma); - buf.append(address.toString()); - return buf.toString(); - } - - public Address getLoadSource() { - return address; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86MoveStoreInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86MoveStoreInstruction extends X86MemoryInstruction - implements StoreInstruction { - final protected Register[] storeSources; - - public X86MoveStoreInstruction(String name, Address address, X86Register register, int dataType, int size, int prefixes) { - super(name, address, register, dataType, size, prefixes); - storeSources = new Register[1]; - storeSources[0] = register; - } - - protected String initDescription() { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(address.toString()); - buf.append(comma); - buf.append(register.toString()); - return buf.toString(); - } - - public int getDataType() { - return dataType; - } - - public Address getStoreDestination() { - return address; - } - - public Register[] getStoreSources() { - return storeSources; - } - - public boolean isStore() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Opcodes.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -//Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 -//APPENDIX A - A.1. - -public interface X86Opcodes - extends RTLDataTypes, RTLOperations { - public static final int b_mode = 1; - public static final int v_mode = 2; - public static final int w_mode = 3; - public static final int d_mode = 4; - public static final int p_mode = 5; - - public static final int dq_mode = 6; //SSE: double-quadword - public static final int pi_mode = 7; //SSE: quadword MMX register - public static final int ps_mode = 8; //SSE: 128bit single precision floating point data - public static final int pd_mode = 9; //SSE: 128bit double precision floating point data - public static final int sd_mode = 10; //SSE: 128bit scalar double precision floating point data - public static final int q_mode = 11; //SSE: quadword - public static final int ss_mode = 12; //SSE: scalar element of 128bit floating data - public static final int si_mode = 13; //SSE: doubleword integer register (e.g. eax) - public static final int s_mode = 14; //SSE: 6 byte pseudo descriptor - - public static final int INVALID_OPERANDTYPE = -1; - - public static final int EAX = 0; - public static final int ECX = 1; - public static final int EDX = 2; - public static final int EBX = 3; - public static final int ESP = 4; - public static final int EBP = 5; - public static final int ESI = 6; - public static final int EDI = 7; - - public static final int AX = 8; - public static final int CX = 9; - public static final int DX = 10; - public static final int BX = 11; - public static final int SP = 12; - public static final int BP = 13; - public static final int SI = 14; - public static final int DI = 15; - - public static final int AL = 16; - public static final int CL = 17; - public static final int DL = 18; - public static final int BL = 19; - public static final int AH = 20; - public static final int CH = 21; - public static final int DH = 22; - public static final int BH = 23; - - public static final int ES = 24; - public static final int CS = 25; - public static final int SS = 26; - public static final int DS = 27; - public static final int FS = 28; - public static final int GS = 29; - - //Addressing modes - public static final int ADDR_E = 1; - public static final int ADDR_I = 2; - public static final int ADDR_DIR = 3; - public static final int ADDR_J = 4; - public static final int ADDR_G = 5; - public static final int ADDR_REG = 6; - public static final int ADDR_ESDI = 7; - public static final int ADDR_DSSI = 8; - public static final int ADDR_SEG = 9; - public static final int ADDR_OFF = 10; - public static final int INDIR_REG = 11; - public static final int ADDR_INDIR_E = 12; - public static final int ADDR_R = 13; //mod field selects a register - public static final int ADDR_C = 14; //reg field selects a control register - public static final int ADDR_D = 15; //reg field selects debug register - public static final int ADDR_T = 16; //reg field selects test register - public static final int ADDR_M = 17; //modR/M refer only to memory - public static final int ADDR_FPREG = 18; - //SSE - public static final int ADDR_W = 19; //modR/M: either a 128 bit XMM register or memory - public static final int ADDR_Q = 20; //modR/M: either a 128 bit MMX register or memory - public static final int ADDR_V = 21; //reg field of modR/M selects a 128-bit XMM register - public static final int ADDR_P = 22; //reg field of modR/M selects a 64-bit MMX register - - public static final int INVALID_ADDRMODE = -1; - - //Refer to chapter 2 - Instruction Format - //Prefix codes - public static final int PREFIX_REPZ = 1; - public static final int PREFIX_REPNZ = 2; - public static final int PREFIX_LOCK = 4; - public static final int PREFIX_CS = 8; - public static final int PREFIX_SS = 0x10; - public static final int PREFIX_DS = 0x20; - public static final int PREFIX_ES = 0x40; - public static final int PREFIX_FS = 0x80; - public static final int PREFIX_GS = 0x100; - public static final int PREFIX_DATA = 0x200; - public static final int PREFIX_ADR = 0x400; - public static final int PREFIX_FWAIT = 0x800; -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86PCRelativeAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -// address is specified as an offset from current PC - -public class X86PCRelativeAddress extends PCRelativeAddress { - private int instrSize; - - public X86PCRelativeAddress(long disp) { - super(disp); - } - - - public void setInstructionSize(int size) { - instrSize = size; - } - - public String toString() { - long displacement = this.getDisplacement(); - return new Long(displacement).toString(); - } - - //In intel assembly the displacement is from start of next instruction. - //So we add the size of current instruction to get the correct disp. - public long getDisplacement() { - long displacement = super.getDisplacement() + (long)instrSize; - return displacement; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Register.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86Register extends Register { - protected String name; - public X86Register(int num, String name) { - super(num); - this.name = name; - } - public int getNumberOfRegisters() { - return X86Registers.getNumberOfRegisters(); - } - public String toString() { - return name; - } - public boolean isFramePointer() { - return number == 5; //ebp - } - public boolean isStackPointer() { - return number == 4; //esp - } - public boolean isFloat() { - return false; - } - public boolean isSegmentPointer() { - return false; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86RegisterDirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.Address; -import sun.jvm.hotspot.asm.BaseIndexScaleDispAddress; - -public class X86RegisterDirectAddress extends Address { - final private X86Register base; - - public X86RegisterDirectAddress(X86Register base) { - this.base = base; - } - - public String toString() { - return base.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86RegisterIndirectAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.Address; -import sun.jvm.hotspot.asm.BaseIndexScaleDispAddress; - -public class X86RegisterIndirectAddress extends BaseIndexScaleDispAddress { - - final private X86SegmentRegister segReg; - - public X86RegisterIndirectAddress(X86SegmentRegister segReg, X86Register base, X86Register index, long disp, int scale) { - super(base, index, disp, scale); - this.segReg = segReg; - } - - public X86RegisterIndirectAddress(X86SegmentRegister segReg, X86Register base, X86Register index, long disp) { - super(base, index, disp, -1); - this.segReg = segReg; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - if(segReg != null) { - buf.append(segReg.toString()); - buf.append(":"); - } - - long disp = getDisplacement(); - if(disp != 0) - buf.append(disp); - - sun.jvm.hotspot.asm.Register base = getBase(); - sun.jvm.hotspot.asm.Register index = getIndex(); - int scaleVal = getScale(); - scaleVal = 1 << scaleVal; - - if( (base != null) || (index != null) || (scaleVal > 1) ) - buf.append('['); - - if(base != null) { - buf.append(base.toString()); - if(index != null) { - buf.append("+"); - buf.append(index.toString()); - } - } - else { - if(index != null) { - buf.append(index.toString()); - } - } - - if (scaleVal > 1) { - buf.append(" * "); - buf.append(Integer.toString(scaleVal)); - } - - if( (base != null) || (index != null) || (scaleVal > 1) ) - buf.append(']'); - - return buf.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86RegisterPart.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86RegisterPart extends X86Register { - private int startBit; - private int length; - public X86RegisterPart(int num, String name, int startBit, int length) { - super(num, name); - this.startBit = startBit; - this.length = length; - } - public boolean is32BitRegister() { - return ( length == 32); - } - public boolean is16BitRegister() { - return ( length == 16); - } - public boolean is8BitRegister() { - return ( length == 8); - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Registers.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.utilities.*; - -public class X86Registers { - public static final int NUM_REGISTERS = 8; - - public static final X86Register EAX; - public static final X86Register ECX; - public static final X86Register EDX; - public static final X86Register EBX; - public static final X86Register ESP; - public static final X86Register EBP; - public static final X86Register ESI; - public static final X86Register EDI; - - public static final X86Register AX; - public static final X86Register CX; - public static final X86Register DX; - public static final X86Register BX; - public static final X86Register SP; - public static final X86Register BP; - public static final X86Register SI; - public static final X86Register DI; - - public static final X86Register AL; - public static final X86Register CL; - public static final X86Register DL; - public static final X86Register BL; - public static final X86Register AH; - public static final X86Register CH; - public static final X86Register DH; - public static final X86Register BH; - - private static X86Register registers8[]; - private static X86Register registers16[]; - private static X86Register registers32[]; - - static { - EAX = new X86RegisterPart(0, "%eax", 0, 32); - ECX = new X86RegisterPart(1, "%ecx", 0, 32); - EDX = new X86RegisterPart(2, "%edx", 0, 32); - EBX = new X86RegisterPart(3, "%ebx", 0, 32); - ESP = new X86RegisterPart(4, "%esp", 0, 32); - EBP = new X86RegisterPart(5, "%ebp", 0, 32); - ESI = new X86RegisterPart(6, "%esi", 0, 32); - EDI = new X86RegisterPart(7, "%edi", 0, 32); - - AX = new X86RegisterPart(0, "%ax", 0, 16); - CX = new X86RegisterPart(1, "%cx", 0, 16); - DX = new X86RegisterPart(2, "%dx", 0, 16); - BX = new X86RegisterPart(3, "%bx", 0, 16); - SP = new X86RegisterPart(4, "%sp", 0, 16); - BP = new X86RegisterPart(5, "%bp", 0, 16); - SI = new X86RegisterPart(6, "%si", 0, 16); - DI = new X86RegisterPart(7, "%di", 0, 16); - - AL = new X86RegisterPart(0, "%al", 0, 8); - CL = new X86RegisterPart(1, "%cl", 0, 8); - DL = new X86RegisterPart(2, "%dl", 0, 8); - BL = new X86RegisterPart(3, "%bl", 0, 8); - AH = new X86RegisterPart(0, "%ah", 8, 8); - CH = new X86RegisterPart(1, "%ch", 8, 8); - DH = new X86RegisterPart(2, "%dh", 8, 8); - BH = new X86RegisterPart(3, "%bh", 8, 8); - - registers32 = (new X86Register[] { - EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI - }); - registers16 = (new X86Register[] { - AX, CX, DX, BX, SP, BP, SI, DI - }); - registers8 = (new X86Register[] { - AL, CL, DL, BL, AH, CH, DH, BH - }); - } - - public static int getNumberOfRegisters() { - return NUM_REGISTERS; - } - - public static X86Register getRegister8(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers8[regNum]; - } - - public static X86Register getRegister16(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers16[regNum]; - } - - public static X86Register getRegister32(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers32[regNum]; - } - - //Return the 32bit register name - public static String getRegisterName(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!"); - } - return registers32[regNum].toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86RotateInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86RotateInstruction extends X86Instruction { - final private Operand operand1; - final private ImmediateOrRegister operand2; - - public X86RotateInstruction(String name, Operand operand1, ImmediateOrRegister operand2, int size, int prefixes) { - super(name, size, prefixes); - this.operand1 = operand1; - this.operand2 = operand2; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - if(operand2 != null) { - if ((operand2 instanceof Register)) { - buf.append(operand2.toString()); - } - else { - Number number = ((Immediate)operand2).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - buf.append(comma); - } - buf.append(getOperandAsString(operand1)); - return buf.toString(); - } - - public Operand getRotateDestination() { - return operand1; - } - - public Operand getRotateSource() { - return operand1; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86SegmentRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86SegmentRegister extends X86Register { - - public X86SegmentRegister(int num, String name) { - super(num, name); - } - public int getNumberOfRegisters() { - return X86SegmentRegisters.getNumberOfRegisters(); - } - public String toString() { - return name; - } - public boolean isSegmentPointer() { - return true; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86SegmentRegisterAddress.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86SegmentRegisterAddress extends IndirectAddress { - private final X86SegmentRegister segment; - private final X86Register offset; - - public X86SegmentRegisterAddress(X86SegmentRegister segment, X86Register offset) { - this.segment = segment; - this.offset = offset; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append(getSegment().toString()); - buf.append(":"); - buf.append(getOffset().toString()); - return buf.toString(); - } - - public X86SegmentRegister getSegment() { - return segment; - } - - public X86Register getOffset() { - return offset; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86SegmentRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.utilities.*; - -public class X86SegmentRegisters { - - public static final int NUM_SEGMENT_REGISTERS = 6; - - public static final X86SegmentRegister ES; - public static final X86SegmentRegister CS; - public static final X86SegmentRegister SS; - public static final X86SegmentRegister DS; - public static final X86SegmentRegister FS; - public static final X86SegmentRegister GS; - - private static X86SegmentRegister segmentRegisters[]; - - static { - //Segment registers - ES = new X86SegmentRegister(0, "%es"); - CS = new X86SegmentRegister(1, "%cs"); - SS = new X86SegmentRegister(2, "%ss"); - DS = new X86SegmentRegister(3, "%ds"); - FS = new X86SegmentRegister(4, "%fs"); - GS = new X86SegmentRegister(5, "%gs"); - - segmentRegisters = (new X86SegmentRegister[] { - ES, CS, SS, DS, FS, GS - }); - } - - public static int getNumberOfRegisters() { - return NUM_SEGMENT_REGISTERS; - } - - public static X86SegmentRegister getSegmentRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_SEGMENT_REGISTERS, "invalid segment register number!"); - } - return segmentRegisters[regNum]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86ShiftInstruction.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86ShiftInstruction extends X86Instruction implements ShiftInstruction { - final private int operation; - final private Operand operand1; - final private ImmediateOrRegister operand2; - - public X86ShiftInstruction(String name, int operation, Operand operand1, ImmediateOrRegister operand2, int size, int prefixes) { - super(name, size, prefixes); - this.operand1 = operand1; - this.operand2 = operand2; - this.operation = operation; - } - - public String asString(long currentPc, SymbolFinder symFinder) { - StringBuffer buf = new StringBuffer(); - buf.append(getPrefixString()); - buf.append(getName()); - buf.append(spaces); - buf.append(getOperandAsString(operand1)); - - if(operand2 != null) { - buf.append(comma); - - if ((operand2 instanceof Register)) { - buf.append(operand2.toString()); - } - else { - Number number = ((Immediate)operand2).getNumber(); - buf.append("0x"); - buf.append(Integer.toHexString(number.intValue())); - } - } - return buf.toString(); - } - - public int getOperation() { - return operation; - } - - public Operand getShiftDestination() { - return operand1; - } - - public Operand getShiftLength() { - return operand2; - } - - public Operand getShiftSource() { - return operand1; - } - - public boolean isShift() { - return true; - } - - protected String getOperand2String() { - return operand2.toString(); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86XMMRegister.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.asm.*; - -public class X86XMMRegister extends X86Register { - - public X86XMMRegister(int num, String name) { - super(num, name); - } - public int getNumberOfRegisters() { - return X86XMMRegisters.getNumberOfRegisters(); - } - public String toString() { - return name; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86XMMRegisters.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.asm.x86; - -import sun.jvm.hotspot.utilities.*; - -/* There are 8 128-bit XMM registers*/ - -public class X86XMMRegisters { - - public static final int NUM_XMM_REGISTERS = 8; - - public static final X86XMMRegister XMM0; - public static final X86XMMRegister XMM1; - public static final X86XMMRegister XMM2; - public static final X86XMMRegister XMM3; - public static final X86XMMRegister XMM4; - public static final X86XMMRegister XMM5; - public static final X86XMMRegister XMM6; - public static final X86XMMRegister XMM7; - - private static X86XMMRegister xmmRegisters[]; - - static { - //XMM registers - XMM0 = new X86XMMRegister(0, "%xmm0"); - XMM1 = new X86XMMRegister(1, "%xmm1"); - XMM2 = new X86XMMRegister(2, "%xmm2"); - XMM3 = new X86XMMRegister(3, "%xmm3"); - XMM4 = new X86XMMRegister(4, "%xmm4"); - XMM5 = new X86XMMRegister(5, "%xmm5"); - XMM6 = new X86XMMRegister(6, "%xmm6"); - XMM7 = new X86XMMRegister(7, "%xmm7"); - - xmmRegisters = (new X86XMMRegister[] { - XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 - }); - } - - public static int getNumberOfRegisters() { - return NUM_XMM_REGISTERS; - } - - //Return the register name - public static String getRegisterName(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_XMM_REGISTERS, "invalid XMM register number!"); - } - return xmmRegisters[regNum].toString(); - } - - public static X86XMMRegister getRegister(int regNum) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(regNum > -1 && regNum < NUM_XMM_REGISTERS, "invalid XMM register number!"); - } - return xmmRegisters[regNum]; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Fri Sep 28 10:16:29 2012 -0700 @@ -58,10 +58,6 @@ * <P> The BugSpot debugger requires that the underlying Debugger * support C/C++ debugging via the CDebugger interface. </P> * - * <P> FIXME: need to add a way to configure the paths to dbx and the - * DSO from the outside. However, this should work for now for - * internal use. </P> - * * <P> FIXME: especially with the addition of remote debugging, this * has turned into a mess; needs rethinking. </P> */
--- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ import java.io.*; import java.util.*; -import sun.jvm.hotspot.asm.x86.*; import sun.jvm.hotspot.compiler.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*;
--- a/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Fri Sep 28 10:16:29 2012 -0700 @@ -351,6 +351,82 @@ return bestGuessPCDesc; } + PCDesc find_pc_desc(long pc, boolean approximate) { + return find_pc_desc_internal(pc, approximate); + } + + // Finds a PcDesc with real-pc equal to "pc" + PCDesc find_pc_desc_internal(long pc, boolean approximate) { + long base_address = VM.getAddressValue(codeBegin()); + int pc_offset = (int) (pc - base_address); + + // Fallback algorithm: quasi-linear search for the PcDesc + // Find the last pc_offset less than the given offset. + // The successor must be the required match, if there is a match at all. + // (Use a fixed radix to avoid expensive affine pointer arithmetic.) + Address lower = scopesPCsBegin(); + Address upper = scopesPCsEnd(); + upper = upper.addOffsetTo(-pcDescSize); // exclude final sentinel + if (lower.greaterThan(upper)) return null; // native method; no PcDescs at all + + // Take giant steps at first (4096, then 256, then 16, then 1) + int LOG2_RADIX = 4; + int RADIX = (1 << LOG2_RADIX); + Address mid; + for (int step = (1 << (LOG2_RADIX*3)); step > 1; step >>= LOG2_RADIX) { + while ((mid = lower.addOffsetTo(step * pcDescSize)).lessThan(upper)) { + PCDesc m = new PCDesc(mid); + if (m.getPCOffset() < pc_offset) { + lower = mid; + } else { + upper = mid; + break; + } + } + } + // Sneak up on the value with a linear search of length ~16. + while (true) { + mid = lower.addOffsetTo(pcDescSize); + PCDesc m = new PCDesc(mid); + if (m.getPCOffset() < pc_offset) { + lower = mid; + } else { + upper = mid; + break; + } + } + + PCDesc u = new PCDesc(upper); + if (match_desc(u, pc_offset, approximate)) { + return u; + } else { + return null; + } + } + + // ScopeDesc retrieval operation + PCDesc pc_desc_at(long pc) { return find_pc_desc(pc, false); } + // pc_desc_near returns the first PCDesc at or after the givne pc. + PCDesc pc_desc_near(long pc) { return find_pc_desc(pc, true); } + + // Return a the last scope in (begin..end] + public ScopeDesc scope_desc_in(long begin, long end) { + PCDesc p = pc_desc_near(begin+1); + if (p != null && VM.getAddressValue(p.getRealPC(this)) <= end) { + return new ScopeDesc(this, p.getScopeDecodeOffset(), p.getObjDecodeOffset(), p.getReexecute()); + } + return null; + } + + static boolean match_desc(PCDesc pc, int pc_offset, boolean approximate) { + if (!approximate) { + return pc.getPCOffset() == pc_offset; + } else { + PCDesc prev = new PCDesc(pc.getAddress().addOffsetTo(-pcDescSize)); + return prev.getPCOffset() < pc_offset && pc_offset <= pc.getPCOffset(); + } + } + /** This is only for use by the debugging system, and is only intended for use in the topmost frame, where we are not guaranteed to be at a PC for which we have a PCDesc. It finds
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/ThreadContext.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/ThreadContext.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/ia64/IA64ThreadContext.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/ia64/IA64ThreadContext.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/sparc/SPARCThreadContext.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/sparc/SPARCThreadContext.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/x86/X86ThreadContext.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/x86/X86ThreadContext.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
--- a/agent/src/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/SADebugServer.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,13 @@ usage(); } + // By default SA agent classes prefer Windows process debugger + // to windbg debugger. SA expects special properties to be set + // to choose other debuggers. We will set those here before + // attaching to SA agent. + + System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); + // delegate to the actual SA debug server. sun.jvm.hotspot.DebugServer.main(args); }
--- a/agent/src/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java Fri Sep 28 10:16:29 2012 -0700 @@ -263,6 +263,13 @@ this.hashCode() + "]"); ((com.sun.tools.jdi.VirtualMachineManagerImpl)mgr).addVirtualMachine(this); + + // By default SA agent classes prefer Windows process debugger + // to windbg debugger. SA expects special properties to be set + // to choose other debuggers. We will set those here before + // attaching to SA agent. + + System.setProperty("sun.jvm.hotspot.debugger.useWindbgDebugger", "true"); } // we reflectively use newly spec'ed class because our ALT_BOOTDIR
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java Fri Sep 28 10:16:29 2012 -0700 @@ -25,14 +25,29 @@ package sun.jvm.hotspot.runtime; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.utilities.PlatformInfo; /** Encapsulates some byte-swapping operations defined in the VM */ public class Bytes { + // swap if client platform is different from server's. private boolean swap; public Bytes(MachineDescription machDesc) { - swap = !machDesc.isBigEndian(); + String cpu = PlatformInfo.getCPU(); + if (cpu.equals("sparc")) { + if (machDesc.isBigEndian()) { + swap = false; + } else { + swap = true; + } + } else { // intel + if (machDesc.isBigEndian()) { + swap = true; + } else { + swap = false; + } + } } /** Should only swap if the hardware's underlying byte order is
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Fri Sep 28 10:16:29 2012 -0700 @@ -32,9 +32,7 @@ import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess; -import sun.jvm.hotspot.runtime.win32_ia64.Win32IA64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess; -import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; @@ -79,14 +77,10 @@ access = new Win32X86JavaThreadPDAccess(); } else if (cpu.equals("amd64")) { access = new Win32AMD64JavaThreadPDAccess(); - } else if (cpu.equals("ia64")) { - access = new Win32IA64JavaThreadPDAccess(); } } else if (os.equals("linux")) { if (cpu.equals("x86")) { access = new LinuxX86JavaThreadPDAccess(); - } else if (cpu.equals("ia64")) { - access = new LinuxIA64JavaThreadPDAccess(); } else if (cpu.equals("amd64")) { access = new LinuxAMD64JavaThreadPDAccess(); } else if (cpu.equals("sparc")) {
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Fri Sep 28 10:16:29 2012 -0700 @@ -477,6 +477,11 @@ return db.lookupIntConstant(name); } + // Convenience function for conversions + static public long getAddressValue(Address addr) { + return VM.getVM().getDebugger().getAddressValue(addr); + } + public long getAddressSize() { return db.getAddressSize(); }
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/IA64CurrentFrameGuess.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.ia64; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.ia64.*; -import sun.jvm.hotspot.code.*; -import sun.jvm.hotspot.interpreter.*; -import sun.jvm.hotspot.runtime.*; - -/** <P> Should be able to be used on all ia64 platforms we support - (Win32, Linux) to implement JavaThread's - "currentFrameGuess()" functionality. Input is an IA64ThreadContext; - output is SP, FP, and PC for an IA64Frame. Instantiation of the - IA64Frame is left to the caller, since we may need to subclass - IA64Frame to support signal handler frames on Unix platforms. </P> - - <P> This is pretty much impossible on ia64. - </P> */ - -public class IA64CurrentFrameGuess { - private IA64ThreadContext context; - private JavaThread thread; - private Address spFound; - private Address fpFound; - private Address pcFound; - - private static final boolean DEBUG = false; - - public IA64CurrentFrameGuess(IA64ThreadContext context, - JavaThread thread) { - this.context = context; - this.thread = thread; - } - - /** Returns false if not able to find a frame within a reasonable range. */ - public boolean run(long regionInBytesToSearch) { - /* - Without using the stack walking library this is not possible on ia64. - There is also the issue of walking dynamic code where there is no - stack walking info generated. - */ - return false; - } - - public Address getSP() { return null; } - public Address getFP() { return null; } - /** May be null if getting values from thread-local storage; take - care to call the correct IA64Frame constructor to recover this if - necessary */ - public Address getPC() { return null; } - - private void setValues(Address sp, Address fp, Address pc) { - spFound = sp; - fpFound = fp; - pcFound = pc; - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/IA64Frame.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,481 +0,0 @@ -/* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.ia64; - -import java.util.*; -// import sun.jvm.hotspot.asm.ia64.*; -import sun.jvm.hotspot.code.*; -import sun.jvm.hotspot.compiler.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; - -/** Specialization of and implementation of abstract methods of the - Frame class for the ia64 family of CPUs. */ - -public class IA64Frame extends Frame { - private static final boolean DEBUG = false; - - // All frames - - // Interpreter frames - - // Entry frames - - // Native frames - - // an additional field beyond sp and pc: - // Address raw_fp; // frame pointer only 1.4.2 - - Address iframe; - - private IA64Frame() { - } - - public IA64Frame(Address raw_sp, Address iframe, Address pc) { - this.raw_sp = raw_sp; - this.iframe = iframe; - this.pc = pc; - if (DEBUG) { - System.err.println("IA64Frame(sp, iframe, pc): " + this); - dumpStack(); - } - } - - public Object clone() { - IA64Frame frame = new IA64Frame(); - frame.raw_sp = raw_sp; - frame.iframe = iframe; - frame.pc = pc; - return frame; - } - - public boolean equals(Object arg) { - if (arg == null) { - return false; - } - - if (!(arg instanceof IA64Frame)) { - return false; - } - - IA64Frame other = (IA64Frame) arg; - - return (AddressOps.equal(getSP(), other.getSP()) && - AddressOps.equal(getIFRAME(), other.getIFRAME()) && - AddressOps.equal(getPC(), other.getPC())); - } - - public int hashCode() { - if (iframe == null) { - return 0; - } - - return iframe.hashCode(); - } - - public String toString() { - return "sp: " + (getSP() == null? "null" : getSP().toString()) + - ", iframe: " + (getIFRAME() == null? "null" : getIFRAME().toString()) + - ", pc: " + (pc == null? "null" : pc.toString()); - } - - // accessors for the instance variables - public Address getFP() { return null; } - public Address getIFRAME() { return iframe; } - public Address getSP() { return raw_sp; } - public Address getID() { return getFP(); } - - // FIXME: not implemented yet - public boolean isSignalHandlerFrameDbg() { return false; } - public int getSignalNumberDbg() { return 0; } - public String getSignalNameDbg() { return null; } - - // FIXME: do sanity checks - public boolean isInterpretedFrameValid() { - return true; - } - - public boolean isInterpretedFrame() { return iframe != null; } - - - // FIXME: not applicable in current system - // void patch_pc(Thread* thread, address pc); - - public Frame sender(RegisterMap regMap, CodeBlob cb) { - - if (iframe == null) { - return null; - } - - cInterpreter fr = new cInterpreter(iframe); - - if (fr.prev() == null) { - Address wrapper = fr.wrapper(); - if ( wrapper == null) { - return null; - } - IA64JavaCallWrapper jcw = new IA64JavaCallWrapper(wrapper); - Address iprev = jcw.getPrevIFrame(); - if (iprev == null) { - return null; - } - return new IA64Frame(null, iprev, null); - } else { - return new IA64Frame(null, fr.prev(), null); - } - - /* - IA64RegisterMap map = (IA64RegisterMap) regMap; - - if (Assert.ASSERTS_ENABLED) { - Assert.that(map != null, "map must be set"); - } - - // Default is we done have to follow them. The sender_for_xxx will - // update it accordingly - map.setIncludeArgumentOops(false); - - if (isEntryFrame()) return senderForEntryFrame(map); - if (isInterpretedFrame()) return senderForInterpreterFrame(map); - - if (!VM.getVM().isCore()) { - if(cb == null) { - cb = VM.getVM().getCodeCache().findBlob(getPC()); - } else { - if (Assert.ASSERTS_ENABLED) { - Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same"); - } - } - - if (cb != null) { - return senderForCompiledFrame(map, cb); - } - } - - // Must be native-compiled frame, i.e. the marshaling code for native - // methods that exists in the core system. - return new IA64Frame(getSenderSP(), getLink(), getSenderPC()); - - */ - } - - private Frame senderForEntryFrame(IA64RegisterMap map) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(map != null, "map must be set"); - } - /* - // Java frame called from C; skip all C frames and return top C - // frame of that chunk as the sender - IA64JavaCallWrapper jcw = (IA64JavaCallWrapper) getEntryFrameCallWrapper(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); - Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); - } - IA64Frame fr = new IA64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), null); - map.clear(); - if (Assert.ASSERTS_ENABLED) { - Assert.that(map.getIncludeArgumentOops(), "should be set by clear"); - } - return fr; - */ - throw new RuntimeException("senderForEntryFrame NYI"); - } - - private Frame senderForInterpreterFrame(IA64RegisterMap map) { - /* - Address sp = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0); - // We do not need to update the callee-save register mapping because above - // us is either another interpreter frame or a converter-frame, but never - // directly a compiled frame. - return new IA64Frame(sp, getLink(), getSenderPC()); - */ - throw new RuntimeException("senderForInterpreterFrame NYI"); - } - - private Frame senderForDeoptimizedFrame(IA64RegisterMap map, CodeBlob cb) { - // FIXME - throw new RuntimeException("Deoptimized frames not handled yet"); - } - - private Frame senderForCompiledFrame(IA64RegisterMap map, CodeBlob cb) { - // - // NOTE: some of this code is (unfortunately) duplicated in IA64CurrentFrameGuess - // - - if (Assert.ASSERTS_ENABLED) { - Assert.that(map != null, "map must be set"); - } - - throw new RuntimeException("senderForCompiledFrame NYI"); - - /* - - // frame owned by optimizing compiler - Address sender_sp = null; - - if (VM.getVM().isClientCompiler()) { - sender_sp = addressOfStackSlot(SENDER_SP_OFFSET); - } else { - if (Assert.ASSERTS_ENABLED) { - Assert.that(cb.getFrameSize() >= 0, "Compiled by Compiler1: do not use"); - } - sender_sp = getSP().addOffsetTo(cb.getFrameSize()); - } - - // On Intel the return_address is always the word on the stack - Address sender_pc = sender_sp.getAddressAt(-1 * VM.getVM().getAddressSize()); - - if (map.getUpdateMap() && cb.getOopMaps() != null) { - OopMapSet.updateRegisterMap(this, cb, map, true); - } - - Address saved_fp = null; - if (VM.getVM().isClientCompiler()) { - saved_fp = getFP().getAddressAt(0); - } else { - int llink_offset = cb.getLinkOffset(); - if (llink_offset >= 0) { - // Restore base-pointer, since next frame might be an interpreter frame. - Address fp_addr = getSP().addOffsetTo(VM.getVM().getAddressSize() * llink_offset); - saved_fp = fp_addr.getAddressAt(0); - } - } - - sender_sp = null ; // sp_addr.getAddressAt(0); - - return new IA64Frame(sender_sp, saved_fp, sender_pc); - - */ - } - - protected boolean hasSenderPD() { - // FIXME - return true; - } - - public long frameSize() { - throw new RuntimeException("frameSize NYI"); - /* - return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize()); - */ - } - - public Address getLink() { - throw new RuntimeException("getLink NYI"); - /* - return addressOfStackSlot(LINK_OFFSET).getAddressAt(0); - */ - } - - // FIXME: not implementable yet - //inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; } - - public Address getUnextendedSP() { return getSP(); } - - // Return address: - /* - public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); } - */ - - public Address getSenderPC() { return null; } - - /* - // return address of param, zero origin index. - public Address getNativeParamAddr(int idx) { - return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx); - } - */ - - public Address getSenderSP() { return null; } - - /* - public Address compiledArgumentToLocationPD(VMReg reg, RegisterMap regMap, int argSize) { - if (VM.getVM().isCore() || VM.getVM().isClientCompiler()) { - throw new RuntimeException("Should not reach here"); - } - - return oopMapRegToLocation(reg, regMap); - } - - */ - - public Address addressOfInterpreterFrameLocals() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return fr.locals(); - } - - private Address addressOfInterpreterFrameBCX() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return fr.bcpAddr(); - } - - public int getInterpreterFrameBCI() { - // 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. - Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0); - Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0); - Method method = (Method)Metadata.instantiateWrapperFor(methodHandle); - return bcpToBci(bcp, method); - } - - public Address addressOfInterpreterFrameMDX() { - return null; - } - - // FIXME - //inline int frame::interpreter_frame_monitor_size() { - // return BasicObjectLock::size(); - //} - - // expression stack - // (the max_stack arguments are used by the GC; see class FrameClosure) - - public Address addressOfInterpreterFrameExpressionStack() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return fr.stackBase(); - } - - public int getInterpreterFrameExpressionStackDirection() { return -1; } - - // top of expression stack - public Address addressOfInterpreterFrameTOS() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - // tos always points to first free element in c++ interpreter not tos - return fr.stackBase().addOffsetTo(VM.getVM().getAddressSize()); - } - - /** Expression stack from top down */ - public Address addressOfInterpreterFrameTOSAt(int slot) { - return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize()); - } - - public Address getInterpreterFrameSenderSP() { - if (Assert.ASSERTS_ENABLED) { - Assert.that(isInterpretedFrame(), "interpreted frame expected"); - } - throw new RuntimeException("getInterpreterFrameSenderSP NYI"); - } - - // Monitors - public BasicObjectLock interpreterFrameMonitorBegin() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return new BasicObjectLock(fr.monitorBase()); - } - - public BasicObjectLock interpreterFrameMonitorEnd() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - // Monitors end is just above stack base (2 slots per monitor) - Address result = fr.stackBase().addOffsetTo(2 * VM.getVM().getAddressSize()); - /* - if (Assert.ASSERTS_ENABLED) { - // make sure the pointer points inside the frame - Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); - Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer"); - } - */ - return new BasicObjectLock(result); - } - - public int interpreterFrameMonitorSize() { - return BasicObjectLock.size(); - } - - // Method - public Address addressOfInterpreterFrameMethod() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return fr.methodAddr(); - } - - // Constant pool cache - public Address addressOfInterpreterFrameCPCache() { - if (iframe == null) { - throw new RuntimeException("Not an Interpreter frame"); - } - cInterpreter fr = new cInterpreter(iframe); - return fr.constantsAddr(); - } - - // Entry frames - public JavaCallWrapper getEntryFrameCallWrapper() { - throw new RuntimeException("getEntryFrameCallWrapper NYI"); - } - - protected Address addressOfSavedOopResult() { - throw new RuntimeException("public boolean isInterpretedFrame() NYI"); - /* - // offset is 2 for compiler2 and 3 for compiler1 - return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) * - VM.getVM().getAddressSize()); - */ - } - - protected Address addressOfSavedReceiver() { - throw new RuntimeException("getEntryFrameCallWrapper NYI"); - // return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize()); - } - - private void dumpStack() { - /* - if (getFP() != null) { - for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize()); - AddressOps.lte(addr, getFP().addOffsetTo(5 * VM.getVM().getAddressSize())); - addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { - System.out.println(addr + ": " + addr.getAddressAt(0)); - } - } else { - for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize()); - AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize())); - addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { - System.out.println(addr + ": " + addr.getAddressAt(0)); - } - } - */ - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/IA64JavaCallWrapper.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.ia64; - -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.runtime.*; - -public class IA64JavaCallWrapper extends JavaCallWrapper { - private static AddressField lastJavaIFrameField; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("JavaCallWrapper"); - - lastJavaIFrameField = type.getAddressField("_last_Java_iframe"); - } - - public IA64JavaCallWrapper(Address addr) { - super(addr); - } - - public Address getPrevIFrame() { - return lastJavaIFrameField.getValue(addr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/IA64RegisterMap.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.ia64; - -import sun.jvm.hotspot.asm.ia64.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.runtime.*; - -public class IA64RegisterMap extends RegisterMap { - - /** This is the only public constructor */ - public IA64RegisterMap(JavaThread thread, boolean updateMap) { - super(thread, updateMap); - } - - protected IA64RegisterMap(RegisterMap map) { - super(map); - } - - public Object clone() { - IA64RegisterMap retval = new IA64RegisterMap(this); - return retval; - } - - // no PD state to clear or copy: - protected void clearPD() {} - protected void initializePD() {} - protected void initializeFromPD(RegisterMap map) {} - protected Address getLocationPD(VMReg reg) { return null; } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ia64/cInterpreter.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.ia64; - -import java.util.*; -// import sun.jvm.hotspot.asm.ia64.*; -import sun.jvm.hotspot.code.*; -import sun.jvm.hotspot.compiler.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; - -/** Specialization of and implementation of abstract methods of the - Frame class for the ia64 family of CPUs. */ - -public class cInterpreter extends VMObject { - private static final boolean DEBUG = true; - - private static AddressField bcpField; - private static AddressField localsField; - private static AddressField constantsField; - private static AddressField methodField; - private static AddressField stackField; // i.e. tos - private static AddressField stackBaseField; // ultimate bottom of stack - private static AddressField stackLimitField; // ultimate top of stack - private static AddressField monitorBaseField; - private static CIntegerField messageField; - private static AddressField prevFieldField; - private static AddressField wrapperField; - private static AddressField prevField; - - private static int NO_REQUEST; - private static int INITIALIZE; - private static int METHOD_ENTRY; - private static int METHOD_RESUME; - private static int GOT_MONITORS; - private static int RETHROW_EXCEPTION; - private static int CALL_METHOD; - private static int RETURN_FROM_METHOD; - private static int RETRY_METHOD; - private static int MORE_MONITORS; - private static int THROWING_EXCEPTION; - private static int POPPING_FRAME; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - - Type cInterpreterType = db.lookupType("cInterpreter"); - bcpField = cInterpreterType.getAddressField("_bcp"); - localsField = cInterpreterType.getAddressField("_locals"); - constantsField = cInterpreterType.getAddressField("_constants"); - methodField = cInterpreterType.getAddressField("_method"); - stackField = cInterpreterType.getAddressField("_stack"); - stackBaseField = cInterpreterType.getAddressField("_stack_base"); - stackLimitField = cInterpreterType.getAddressField("_stack_limit"); - monitorBaseField = cInterpreterType.getAddressField("_monitor_base"); - // messageField = cInterpreterType.getCIntegerField("_msg"); - messageField = null; - wrapperField = cInterpreterType.getAddressField("_wrapper"); - prevField = cInterpreterType.getAddressField("_prev_link"); - - /* - NO_REQUEST = db.lookupIntConstant("no_request").intValue(); - INITIALIZE = db.lookupIntConstant("initialize").intValue(); - METHOD_ENTRY = db.lookupIntConstant("method_entry").intValue(); - METHOD_RESUME = db.lookupIntConstant("method_resume").intValue(); - GOT_MONITORS = db.lookupIntConstant("got_monitors").intValue(); - RETHROW_EXCEPTION = db.lookupIntConstant("rethrow_exception").intValue(); - CALL_METHOD = db.lookupIntConstant("call_method").intValue(); - RETURN_FROM_METHOD = db.lookupIntConstant("return_from_method").intValue(); - RETRY_METHOD = db.lookupIntConstant("retry_method").intValue(); - MORE_MONITORS = db.lookupIntConstant("more_monitors").intValue(); - THROWING_EXCEPTION = db.lookupIntConstant("throwing_exception").intValue(); - POPPING_FRAME = db.lookupIntConstant("popping_frame").intValue(); - */ - } - - - public cInterpreter(Address addr) { - super(addr); - } - - public Address prev() { - return prevField.getValue(addr); - } - - public Address locals() { - - Address val = localsField.getValue(addr); - return val; - } - - public Address localsAddr() { - - Address localsAddr = localsField.getValue(addr); - return localsAddr; - } - - public Address bcp() { - - Address val = bcpField.getValue(addr); - return val; - } - - public Address bcpAddr() { - - Address bcpAddr = addr.addOffsetTo(bcpField.getOffset()); - return bcpAddr; - } - - public Address constants() { - - Address val = constantsField.getValue(addr); - return val; - } - - public Address constantsAddr() { - - Address constantsAddr = constantsField.getValue(addr); - return constantsAddr; - } - - public Address method() { - - Address val = methodField.getValue(addr); - return val; - } - public Address methodAddr() { - - Address methodAddr = addr.addOffsetTo(methodField.getOffset()); - return methodAddr; - } - - public Address stack() { - - Address val = stackField.getValue(addr); - return val; - } - - public Address stackBase() { - - Address val = stackBaseField.getValue(addr); - return val; - } - - public Address stackLimit() { - - Address val = stackLimitField.getValue(addr); - return val; - } - - public Address monitorBase() { - - Address val = monitorBaseField.getValue(addr); - return val; - } - - public Address wrapper() { - - return wrapperField.getValue(addr); - } - - public int message() { - int val = (int) messageField.getValue(addr); - return val; - } - -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/linux_ia64/LinuxIA64JavaThreadPDAccess.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.linux_ia64; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.ia64.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.runtime.ia64.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; - -public class LinuxIA64JavaThreadPDAccess implements JavaThreadPDAccess { - // private static AddressField lastJavaPCField; - // private static AddressField lastJavaFPField; - private static AddressField lastJavaIFrameField; - private static AddressField osThreadField; - - // Field from OSThread - private static CIntegerField osThreadPThreadIDField; - - // This is currently unneeded but is being kept in case we change - // the currentFrameGuess algorithm - private static final long GUESS_SCAN_RANGE = 128 * 1024; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("JavaThread"); - - lastJavaIFrameField = type.getAddressField("_last_Java_iframe"); - osThreadField = type.getAddressField("_osthread"); - - type = db.lookupType("OSThread"); - osThreadPThreadIDField = type.getCIntegerField("_pthread_id"); - } - - public Address getLastJavaIFrame(Address addr) { - return lastJavaIFrameField.getValue(addr); - } - - - public Address getBaseOfStackPointer(Address addr) { - return null; - } - - public Address getLastJavaFP(Address addr) { - return null; // Not in 1.4.1 - } - - public Address getLastJavaPC(Address addr) { - return null; // Not in 1.4.1 - } - - public boolean isInterpretedFrame() { - - // In 1.4.1 there are only interpreted frames - // and there is no pc - return true; - } - - public Frame getLastFramePD(JavaThread thread, Address addr) { - // The thread is the JavaThread that contains "this" - // so we don't need any new accessor at the JavaThread level - Address iframe = getLastJavaIFrame(addr); - Address pc = thread.getLastJavaPC(); - if (iframe == null) { - return null; // no information - } - return new IA64Frame(thread.getLastJavaSP(), iframe, pc); - } - - public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { - return new IA64RegisterMap(thread, updateMap); - } - - public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { - return getLastFramePD(thread, addr); - } - - public void printThreadIDOn(Address addr, PrintStream tty) { - tty.print(getThreadProxy(addr)); - } - - public void printInfoOn(Address threadAddr, PrintStream tty) { - tty.print("Thread id: "); - printThreadIDOn(threadAddr, tty); - tty.println("\nLastJavaIFrame: " + getLastJavaIFrame(threadAddr)); - } - - public Address getLastSP(Address addr) { - ThreadProxy t = getThreadProxy(addr); - IA64ThreadContext context = (IA64ThreadContext) t.getContext(); - return context.getRegisterAsAddress(IA64ThreadContext.SP); - } - - public ThreadProxy getThreadProxy(Address addr) { - // Addr is the address of the JavaThread. - // Fetch the OSThread (for now and for simplicity, not making a - // separate "OSThread" class in this package) - Address osThreadAddr = osThreadField.getValue(addr); - // Get the address of the _pthread_id from the OSThread - Address pthreadIdAddr = osThreadAddr.addOffsetTo(osThreadPThreadIDField.getOffset()); - - JVMDebugger debugger = VM.getVM().getDebugger(); - return debugger.getThreadForIdentifierAddress(pthreadIdAddr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/win32_ia64/Win32IA64JavaThreadPDAccess.java Thu Sep 27 15:49:48 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime.win32_ia64; - -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.debugger.ia64.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.runtime.ia64.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; - -public class Win32IA64JavaThreadPDAccess implements JavaThreadPDAccess { - // private static AddressField lastJavaPCField; - // private static AddressField lastJavaFPField; - private static AddressField lastJavaIFrameField; - private static AddressField osThreadField; - - // Field from OSThread - private static CIntegerField osThreadPThreadIDField; - - // This is currently unneeded but is being kept in case we change - // the currentFrameGuess algorithm - private static final long GUESS_SCAN_RANGE = 128 * 1024; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - Type type = db.lookupType("JavaThread"); - - lastJavaIFrameField = type.getAddressField("_last_Java_iframe"); - osThreadField = type.getAddressField("_osthread"); - - type = db.lookupType("OSThread"); - osThreadPThreadIDField = type.getCIntegerField("_pthread_id"); - } - - public Address getLastJavaIFrame(Address addr) { - return lastJavaIFrameField.getValue(addr); - } - - - public Address getBaseOfStackPointer(Address addr) { - return null; - } - - public Address getLastJavaFP(Address addr) { - return null; // Not in 1.4.1 - } - - public Address getLastJavaPC(Address addr) { - return null; // Not in 1.4.1 - } - - public boolean isInterpretedFrame() { - - // In 1.4.1 there are only interpreted frames - // and there is no pc - return true; - } - - public Frame getLastFramePD(JavaThread thread, Address addr) { - // The thread is the JavaThread that contains "this" - // so we don't need any new accessor at the JavaThread level - Address iframe = getLastJavaIFrame(addr); - Address pc = thread.getLastJavaPC(); - if (iframe == null) { - return null; // no information - } - return new IA64Frame(thread.getLastJavaSP(), iframe, pc); - } - - public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { - return new IA64RegisterMap(thread, updateMap); - } - - public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { - return getLastFramePD(thread, addr); - } - - public void printThreadIDOn(Address addr, PrintStream tty) { - tty.print(getThreadProxy(addr)); - } - - public void printInfoOn(Address threadAddr, PrintStream tty) { - tty.print("Thread id: "); - printThreadIDOn(threadAddr, tty); - tty.println("\nLastJavaIFrame: " + getLastJavaIFrame(threadAddr)); - } - - public Address getLastSP(Address addr) { - ThreadProxy t = getThreadProxy(addr); - IA64ThreadContext context = (IA64ThreadContext) t.getContext(); - return context.getRegisterAsAddress(IA64ThreadContext.SP); - } - - public ThreadProxy getThreadProxy(Address addr) { - // Addr is the address of the JavaThread. - // Fetch the OSThread (for now and for simplicity, not making a - // separate "OSThread" class in this package) - Address osThreadAddr = osThreadField.getValue(addr); - // Get the address of the _pthread_id from the OSThread - Address pthreadIdAddr = osThreadAddr.addOffsetTo(osThreadPThreadIDField.getOffset()); - - JVMDebugger debugger = VM.getVM().getDebugger(); - return debugger.getThreadForIdentifierAddress(pthreadIdAddr); - } -}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RegisterMap.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/x86/X86RegisterMap.java Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ package sun.jvm.hotspot.runtime.x86; -import sun.jvm.hotspot.asm.x86.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*;
--- a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java Fri Sep 28 10:16:29 2012 -0700 @@ -27,10 +27,6 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.asm.*; -import sun.jvm.hotspot.asm.sparc.*; -import sun.jvm.hotspot.asm.x86.*; -import sun.jvm.hotspot.asm.ia64.*; -import sun.jvm.hotspot.asm.amd64.*; import sun.jvm.hotspot.code.*; import sun.jvm.hotspot.compiler.*; import sun.jvm.hotspot.debugger.*; @@ -182,40 +178,6 @@ spaces = " "; tab = " "; } - } - - private static CPUHelper cpuHelper; - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(); - } - }); - } - - private static synchronized void initialize() { - String cpu = VM.getVM().getCPU(); - if (cpu.equals("sparc")) { - cpuHelper = new SPARCHelper(); - } else if (cpu.equals("x86")) { - cpuHelper = new X86Helper(); - } else if (cpu.equals("amd64") || cpu.equals("x86_64")) { - cpuHelper = new AMD64Helper(); - } else if (cpu.equals("ia64")) { - cpuHelper = new IA64Helper(); - } else { - try { - cpuHelper = (CPUHelper)Class.forName("sun.jvm.hotspot.asm." + - cpu.toLowerCase() + "." + cpu.toUpperCase() + - "Helper").newInstance(); - } catch (Exception e) { - throw new RuntimeException("cpu '" + cpu + "' is not yet supported!"); - } - } - } - - protected static synchronized CPUHelper getCPUHelper() { - return cpuHelper; } protected String escapeHTMLSpecialChars(String value) { @@ -827,10 +789,6 @@ } } - protected Disassembler createDisassembler(long startPc, byte[] code) { - return getCPUHelper().createDisassembler(startPc, code); - } - protected SymbolFinder createSymbolFinder() { return new DummySymbolFinder(); } @@ -892,17 +850,9 @@ return genHTMLForRawDisassembly(pc, null); } - protected byte[] readBuffer(sun.jvm.hotspot.debugger.Address addr, int size) { - byte[] buf = new byte[size]; - for (int b = 0; b < size; b++) { - buf[b] = (byte) addr.getJByteAt(b); - } - return buf; - } - - public String genHTMLForRawDisassembly(sun.jvm.hotspot.debugger.Address startPc, int size) { + public String genHTMLForRawDisassembly(sun.jvm.hotspot.debugger.Address startPc, int size) { try { - return genHTMLForRawDisassembly(startPc, null, readBuffer(startPc, size)); + return genHTMLForRawDisassembly(startPc, size, null); } catch (Exception exp) { return genHTMLErrorMessage(exp); } @@ -911,7 +861,7 @@ protected String genHTMLForRawDisassembly(sun.jvm.hotspot.debugger.Address startPc, String prevPCs) { try { - return genHTMLForRawDisassembly(startPc, prevPCs, readBuffer(startPc, NATIVE_CODE_SIZE)); + return genHTMLForRawDisassembly(startPc, NATIVE_CODE_SIZE, prevPCs); } catch (Exception exp) { return genHTMLErrorMessage(exp); } @@ -928,25 +878,28 @@ return buf.toString(); } - protected String genPCHref(long currentPc, sun.jvm.hotspot.asm.Address addr) { - String href = null; - if (addr instanceof PCRelativeAddress) { - PCRelativeAddress pcRelAddr = (PCRelativeAddress) addr; - href = genPCHref(currentPc + pcRelAddr.getDisplacement()); - } else if(addr instanceof DirectAddress) { - href = genPCHref(((DirectAddress) addr).getValue()); - } - - return href; + protected String genPCHref(Address addr) { + return genPCHref(addressToLong(addr)); } - class RawCodeVisitor implements InstructionVisitor { + class HTMLDisassembler implements InstructionVisitor { private int instrSize = 0; private Formatter buf; private SymbolFinder symFinder = createSymbolFinder(); + private long pc; + private OopMapSet oms; + private CodeBlob blob; + private NMethod nmethod; - RawCodeVisitor(Formatter buf) { + HTMLDisassembler(Formatter buf, CodeBlob blob) { this.buf = buf; + this.blob = blob; + if (blob != null) { + if (blob instanceof NMethod) { + nmethod = (NMethod)blob; + } + oms = blob.getOopMaps(); + } } public int getInstructionSize() { @@ -956,26 +909,68 @@ public void prologue() { } - public void visit(long currentPc, Instruction instr) { - String href = null; - if (instr.isCall()) { - CallInstruction call = (CallInstruction) instr; - sun.jvm.hotspot.asm.Address addr = call.getBranchDestination(); - href = genPCHref(currentPc, addr); - } + public void beginInstruction(long currentPc) { + pc = currentPc; + + sun.jvm.hotspot.debugger.Address adr = longToAddress(pc); + if (nmethod != null) { + if (adr.equals(nmethod.getEntryPoint())) print("[Entry Point]\n"); + if (adr.equals(nmethod.getVerifiedEntryPoint())) print("[Verified Entry Point]\n"); + if (adr.equals(nmethod.exceptionBegin())) print("[Exception Handler]\n"); + if (adr.equals(nmethod.stubBegin()) && + !nmethod.stubBegin().equals(nmethod.stubEnd())) print("[Stub Code]\n"); + // if (adr.equals(nmethod.constsBegin())) print("[Constants]\n"); + } + + buf.append(adr.toString()); + buf.append(':'); + buf.append(tab); + } + + public void printAddress(long address) { + sun.jvm.hotspot.debugger.Address addr = longToAddress(address); + if (VM.getVM().getCodeCache().contains(addr)) { + buf.link(genPCHref(address), addr.toString()); + } else { + buf.append(addr.toString()); + } + } + + public void print(String s) { + buf.append(s); + } - instrSize += instr.getSize(); - buf.append("0x"); - buf.append(Long.toHexString(currentPc)); - buf.append(':'); - buf.append(tab); + public void endInstruction(long endPc) { + instrSize += endPc - pc; + if (genHTML) buf.br(); + + if (nmethod != null) { + ScopeDesc sd = nmethod.scope_desc_in(pc, endPc); + if (sd != null) { + buf.br(); + buf.append(genSafepointInfo(nmethod, sd)); + } + } - if (href != null) { - buf.link(href, instr.asString(currentPc, symFinder)); - } else { - buf.append(instr.asString(currentPc, symFinder)); - } - buf.br(); + if (oms != null) { + long base = addressToLong(blob.codeBegin()); + for (int i = 0, imax = (int)oms.getSize(); i < imax; i++) { + OopMap om = oms.getMapAt(i); + long omspc = base + om.getOffset(); + if (omspc > pc) { + if (omspc <= endPc) { + buf.br(); + buf.append(genOopMapInfo(om)); + // st.move_to(column); + // visitor.print("; "); + // om.print_on(st); + } + break; + } + } + } + // follow each complete insn by a nice newline + buf.br(); } public void epilogue() { @@ -983,13 +978,11 @@ }; protected String genHTMLForRawDisassembly(sun.jvm.hotspot.debugger.Address addr, - String prevPCs, - byte[] code) { + int size, + String prevPCs) { try { - long startPc = addressToLong(addr); - Disassembler disasm = createDisassembler(startPc, code); final Formatter buf = new Formatter(genHTML); - buf.genHTMLPrologue("Disassembly @0x" + Long.toHexString(startPc)); + buf.genHTMLPrologue("Disassembly @ " + addr); if (prevPCs != null && genHTML) { buf.beginTag("p"); @@ -999,11 +992,12 @@ buf.h3("Code"); - RawCodeVisitor visitor = new RawCodeVisitor(buf); - disasm.decode(visitor); + HTMLDisassembler visitor = new HTMLDisassembler(buf, null); + Disassembler.decode(visitor, null, addr, addr.addOffsetTo(size)); if (genHTML) buf.beginTag("p"); Formatter tmpBuf = new Formatter(genHTML); + long startPc = addressToLong(addr); tmpBuf.append("0x"); tmpBuf.append(Long.toHexString(startPc + visitor.getInstructionSize()).toString()); tmpBuf.append(",0x"); @@ -1024,8 +1018,7 @@ } } - protected String genSafepointInfo(NMethod nm, PCDesc pcDesc) { - ScopeDesc sd = nm.getScopeDescAt(pcDesc.getRealPC(nm)); + protected String genSafepointInfo(NMethod nm, ScopeDesc sd) { Formatter buf = new Formatter(genHTML); Formatter tabs = new Formatter(genHTML); tabs.append(tab + tab + tab); // Initial indent for debug info @@ -1040,8 +1033,6 @@ genScObjInfo(buf, tabs, sd); buf.endTag("pre"); - buf.append(genOopMapInfo(nm, pcDesc)); - return buf.toString(); } @@ -1229,7 +1220,7 @@ buf.append(omvIterator.iterate(oms, "Oops:", false)); oms = new OopMapStream(map, OopMapValue.OopTypes.NARROWOOP_VALUE); - buf.append(omvIterator.iterate(oms, "narrowOops:", false)); + buf.append(omvIterator.iterate(oms, "NarrowOops:", false)); oms = new OopMapStream(map, OopMapValue.OopTypes.VALUE_VALUE); buf.append(omvIterator.iterate(oms, "Values:", false)); @@ -1433,76 +1424,7 @@ buf.append(genMethodAndKlassLink(nmethod.getMethod())); buf.h3("Compiled Code"); - sun.jvm.hotspot.debugger.Address instsBegin = nmethod.instsBegin(); - sun.jvm.hotspot.debugger.Address instsEnd = nmethod.instsEnd(); - final int instsSize = nmethod.instsSize(); - final long startPc = addressToLong(instsBegin); - final byte[] code = new byte[instsSize]; - for (int i=0; i < code.length; i++) - code[i] = instsBegin.getJByteAt(i); - - final long verifiedEntryPoint = addressToLong(nmethod.getVerifiedEntryPoint()); - final long entryPoint = addressToLong(nmethod.getEntryPoint()); - final Map safepoints = nmethod.getSafepoints(); - - final SymbolFinder symFinder = createSymbolFinder(); - final Disassembler disasm = createDisassembler(startPc, code); - class NMethodVisitor implements InstructionVisitor { - public void prologue() { - } - - public void visit(long currentPc, Instruction instr) { - String href = null; - if (instr.isCall()) { - CallInstruction call = (CallInstruction) instr; - sun.jvm.hotspot.asm.Address addr = call.getBranchDestination(); - href = genPCHref(currentPc, addr); - } - - if (currentPc == verifiedEntryPoint) { - buf.bold("Verified Entry Point"); buf.br(); - } - if (currentPc == entryPoint) { - buf.bold(">Entry Point"); buf.br(); - } - - PCDesc pcDesc = (PCDesc) safepoints.get(longToAddress(currentPc)); - - if (pcDesc != null) { - buf.append(genSafepointInfo(nmethod, pcDesc)); - } - - buf.append("0x"); - buf.append(Long.toHexString(currentPc)); - buf.append(':'); - buf.append(tab); - - if (href != null) { - buf.link(href, instr.asString(currentPc, symFinder)); - } else { - buf.append(instr.asString(currentPc, symFinder)); - } - - buf.br(); - } - - public void epilogue() { - } - }; - - disasm.decode(new NMethodVisitor()); - - sun.jvm.hotspot.debugger.Address stubBegin = nmethod.stubBegin(); - if (stubBegin != null) { - sun.jvm.hotspot.debugger.Address stubEnd = nmethod.stubEnd(); - buf.h3("Stub"); - long stubStartPc = addressToLong(stubBegin); - long stubEndPc = addressToLong(stubEnd); - int range = (int) (stubEndPc - stubStartPc); - byte[] stubCode = readBuffer(stubBegin, range); - Disassembler disasm2 = createDisassembler(stubStartPc, stubCode); - disasm2.decode(new NMethodVisitor()); - } + Disassembler.decode(new HTMLDisassembler(buf, nmethod), nmethod); buf.genHTMLEpilogue(); return buf.toString(); } catch (Exception exp) { @@ -1517,72 +1439,7 @@ buf.h3("CodeBlob"); buf.h3("Compiled Code"); - final sun.jvm.hotspot.debugger.Address codeBegin = blob.codeBegin(); - final int codeSize = blob.getCodeSize(); - final long startPc = addressToLong(codeBegin); - final byte[] code = new byte[codeSize]; - for (int i=0; i < code.length; i++) - code[i] = codeBegin.getJByteAt(i); - - final SymbolFinder symFinder = createSymbolFinder(); - final Disassembler disasm = createDisassembler(startPc, code); - class CodeBlobVisitor implements InstructionVisitor { - OopMapSet maps; - OopMap curMap; - int curMapIndex; - long curMapOffset; - public void prologue() { - maps = blob.getOopMaps(); - if (maps != null && (maps.getSize() > 0)) { - curMap = maps.getMapAt(0); - if (curMap != null) { - curMapOffset = curMap.getOffset(); - } - } - } - - public void visit(long currentPc, Instruction instr) { - String href = null; - if (instr.isCall()) { - CallInstruction call = (CallInstruction) instr; - sun.jvm.hotspot.asm.Address addr = call.getBranchDestination(); - href = genPCHref(currentPc, addr); - } - - buf.append("0x"); - buf.append(Long.toHexString(currentPc)); - buf.append(':'); - buf.append(tab); - - if (href != null) { - buf.link(href, instr.asString(currentPc, symFinder)); - } else { - buf.append(instr.asString(currentPc, symFinder)); - } - buf.br(); - - // See whether we have an oop map at this PC - if (curMap != null) { - long curOffset = currentPc - startPc; - if (curOffset == curMapOffset) { - buf.append(genOopMapInfo(curMap)); - if (++curMapIndex >= maps.getSize()) { - curMap = null; - } else { - curMap = maps.getMapAt(curMapIndex); - if (curMap != null) { - curMapOffset = curMap.getOffset(); - } - } - } - } - } - - public void epilogue() { - } - }; - - disasm.decode(new CodeBlobVisitor()); + Disassembler.decode(new HTMLDisassembler(buf, blob), blob); buf.genHTMLEpilogue(); return buf.toString(); @@ -1653,13 +1510,8 @@ } buf.h3("Code"); - long stubStartPc = addressToLong(codelet.codeBegin()); - long stubEndPc = addressToLong(codelet.codeEnd()); - int range = (int) (stubEndPc - stubStartPc); - byte[] stubCode = readBuffer(codelet.codeBegin(), range); - Disassembler disasm = createDisassembler(stubStartPc, stubCode); - disasm.decode(new RawCodeVisitor(buf)); - + Disassembler.decode(new HTMLDisassembler(buf, null), null, + codelet.codeBegin(), codelet.codeEnd()); Stub next = stubq.getNext(codelet); if (next != null) {
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Fri Sep 28 10:16:29 2012 -0700 @@ -221,15 +221,6 @@ // if "registerCommand" function is defined // then register few global functions as "commands". if (typeof(registerCommand) == 'function') { - this.printDis = function(addr, len) { - if (!addr) { - writeln("Usage: dis address [ length ]"); - } else { - dis(addr, len); - } - } - registerCommand("dis", "dis address [ length ]", "printDis"); - this.jclass = function(name) { if (typeof(name) == "string") { var clazz = sapkg.utilities.SystemDictionaryHelper.findInstanceKlass(name); @@ -251,15 +242,6 @@ } registerCommand("classes", "classes", "jclasses"); - this.printJDis = function(addr) { - if (!addr) { - writeln("Usage: jdis address"); - } else { - jdis(addr); - } - } - registerCommand("jdis", "jdis address", "printJDis"); - this.dclass = function(clazz, dir) { if (!clazz) { writeln("Usage: dumpclass { address | name } [ directory ]"); @@ -395,18 +377,6 @@ } } -// read 'num' bytes at 'addr' and return an array as result. -// returns Java byte[] type result and not a JavaScript array. -function readBytesAt(addr, num) { - addr = any2addr(addr); - var res = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, num); - var i; - for (i = 0; i < num; i++) { - res[i] = addr.getJByteAt(i); - } - return res; -} - // read 'num' words at 'addr' and return an array as result. // returns Java long[] type result and not a JavaScript array. function readWordsAt(addr, num) { @@ -506,54 +476,6 @@ writeln(); } -// return the disassemble class for current CPU -function disassemblerClass() { - var DisAsmClass; - if (CPU == 'x86') { - DisAsmClass = sapkg.asm.x86.X86Disassembler; - } else if (CPU == 'sparc') { - DisAsmClass = sapkg.asm.sparc.SPARCV9Disassembler; - } - return DisAsmClass; -} - -// print native code disassembly of 'num' bytes at 'addr' -function dis(addr, num) { - addr = any2addr(addr); - var nmethod = findNMethod(addr); - if (nmethod != null) { - // disassemble it as nmethod - nmethoddis(nmethod); - } else { - // raw disassembly - if (num == undefined) { - // size of one SPARC instruction and - // unknown number of Intel instructions. - num = 4; - } - DisAsmClass = disassemblerClass(); - if (DisAsmClass == undefined) { - // unsupported CPU - writeln(CPU + " is not yet supported!"); - return; - } - - var bytes = readBytesAt(addr, num); - var disAsm = new DisAsmClass(addr2num(addr), bytes); - disAsm.decode(new sapkg.asm.InstructionVisitor() { - visit: function (pc, instr) { - write(addr2sym(num2addr(pc)) + ':', '\t'); - writeln(instr.asString(pc, - new sapkg.asm.SymbolFinder() { - getSymbolFor: function(addr) { - return addr2sym(num2addr(addr)); - } - })); - } - }); - } -} - // System dictionary functions // find InstanceKlass by name @@ -586,31 +508,6 @@ sa.sysDict.primArrayClassesDo(new VisitorClass() { visit: callback }); } -// (hotspot) symbol table functions - -// String-to-Symbol -function str2sym(str) { - return sa.symTbl.probe(str); -} - -// Symbol-to-String -function sym2str(sym) { - return sym.asString(); -} - -// oop functions - -// Address-to-Oop -function addr2oop(addr) { - addr = any2addr(addr); - return sa.objHeap.newOop(addr.addOffsetToAsOopHandle(0)); -} - -// Oop-to-Address -function oop2addr(oop) { - return oop.handle; -} - // 'oop' to higher-level java object wrapper in which for(i in o) // works by iterating java level fields and javaobject.javafield // syntax works. @@ -646,202 +543,6 @@ klass, includeSubtypes); } -// code cache functions - -// iterates CodeCache for each 'CodeBlob' -function forEachCodeBlob(callback) { - var VisitorClass = sapkg.code.CodeCacheVisitor; - sa.codeCache.iterate(new VisitorClass() { visit: callback }); -} - -// find the ClodBlob (if any) that contains given address -function findCodeBlob(addr) { - addr = any2addr(addr); - return sa.codeCache.findBlobUnsafe(addr); -} - -// find the NMethod (if any) that contains given address -function findNMethod(addr) { - var codeBlob = findCodeBlob(addr); - return (codeBlob != null && codeBlob.isNMethod())? codeBlob : null; -} - -// returns PcDesc at given address or null -function pcDescAt(addr) { - addr = any2addr(addr); - var nmethod = findNMethod(addr); - return (nmethod != null)? nmethod.safepoints.get(addr) : null; -} - -// helpers for nmethod disassembler -function printScope(scopeDesc) { - if (scopeDesc == null) { - return; - } - printScope(scopeDesc.sender()); - var method = scopeDesc.method; - var bci = scopeDesc.BCI; - var line = -1; - if (method.hasLineNumberTable()) { - line = method.getLineNumberFromBCI(bci); - } - - write('\t', method.externalNameAndSignature(), '@', method.handle, 'bci=' + bci); - if (line != -1) { - write('line=' + line); - } - writeln(); -} - -function printSafepointInfo(nmethod, pcDesc) { - var scopeDesc = nmethod.getScopeDescAt( - pcDesc.getRealPC(nmethod), - pcDesc.isAtCall()); - printScope(scopeDesc); -} - -// print disassembly for a given nmethod -function nmethoddis(nmethod) { - var DisAsmClass = disassemblerClass(); - if (DisAsmClass == undefined) { - writeln(CPU + " is not yet supported!"); - return; - } - - var method = nmethod.method; - writeln('NMethod:', method.externalNameAndSignature(), '@', method.handle); - - var codeBegin = nmethod.codeBegin(); - var codeEnd = nmethod.codeEnd(); - var size = codeEnd.minus(codeBegin); - var code = readBytesAt(codeBegin, size); - var startPc = addr2num(codeBegin); - var verifiedEntryPoint = addr2num(nmethod.verifiedEntryPoint); - var entryPoint = addr2num(nmethod.entryPoint); - var interpreterEntryPoint = addr2num(nmethod.interpreterEntryPointOrNull); - var safepoints = nmethod.safepoints; - var disAsm = new DisAsmClass(startPc, code); - disAsm.decode(new sapkg.asm.InstructionVisitor() { - visit: function(curPc, instr) { - if (curPc == verifiedEntryPoint) { - writeln(); - writeln("Verified Entry Point:"); - } - if (curPc == entryPoint) { - writeln(); - writeln("Entry Point:"); - } - if (curPc == interpreterEntryPoint) { - writeln(""); - writeln("Interpreter Entry Point:"); - } - - var pcDesc = safepoints.get(num2addr(curPc)); - var isSafepoint = (pcDesc != null); - if (isSafepoint && pcDesc.isAtCall()) { - printSafepointInfo(nmethod, pcDesc); - } - - write(num2addr(curPc) + ':', '\t'); - writeln(instr.asString(curPc, - new sapkg.asm.SymbolFinder() { - getSymbolFor: function(addr) { - return addr2sym(num2addr(addr)); - } - })); - - if (isSafepoint && !pcDesc.isAtCall()) { - printSafepointInfo(nmethod, pcDesc); - } - } - }); -} - -// bytecode interpreter functions - -// iterates interpreter codelets for each interpreter codelet -function forEachInterpCodelet(callback) { - var stubQueue = sa.interpreter.code; - var stub = stubQueue.first; - while (stub != null) { - if (callback(stub) == false) return; - stub = stubQueue.getNext(stub); - } -} - -// helper for bytecode disassembler -function printExceptionTable(method) { - var expTbl = method.getExceptionTable(); - var len = expTbl.getLength(); - if (len != 0) { - var i; - var cpool = method.constants; - writeln("start", '\t', "end", '\t', "handler", '\t', "exception"); - writeln(""); - for (i = 0; i < len; i += 4) { - write(expTbl.getIntAt(i), '\t', - expTbl.getIntAt(i + 1), '\t', - expTbl.getIntAt(i + 2), '\t'); - var cpIndex = expTbl.getIntAt(i + 3); - var oop = (cpIndex == 0)? null : cpool.getObjAt(cpIndex); - if (oop == null) { - writeln("<any>"); - } else if (oop.isSymbol()) { - writeln(oop.asString().replace('/', '.')); - } else if (oop.isKlass()) { - writeln(oop.name.asString().replace('/', '.')); - } else { - writeln(cpIndex); - } - } - } -} - -// print Java bytecode disassembly -function jdis(method) { - if (method.getByteCode == undefined) { - // method oop may be specified by address - method = addr2oop(any2addr(method)); - } - writeln(method, '-', method.externalNameAndSignature()); - if (method.isNative()) { - writeln("native method"); - return; - } - if (method.isAbstract()) { - writeln("abstract method"); - return; - } - - writeln(); - var BytecodeDisAsmClass = sapkg.interpreter.BytecodeDisassembler; - var disAsm = new BytecodeDisAsmClass(method); - var bci = 0; - var hasLines = method.hasLineNumberTable(); - if (hasLines) { - writeln("bci", '\t', "line", '\t', "instruction"); - } else { - writeln("bci", '\t', "instruction"); - } - writeln(""); - disAsm.decode(new sapkg.interpreter.BytecodeVisitor() { - prologue: function(method) { }, - epilogue: function() { }, - visit: function(bytecode) { - if (hasLines) { - var line = method.getLineNumberFromBCI(bci); - writeln(bci, '\t', line, '\t', bytecode); - } else { - writeln(bci, '\t', bytecode); - } - bci++; - } - }); - - writeln(); - printExceptionTable(method); -} - // Java thread // iterates each Thread
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/src/share/native/sadis.c Fri Sep 28 10:16:29 2012 -0700 @@ -0,0 +1,289 @@ +/* + * Copyright 2012, Oracle and/or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "sun_jvm_hotspot_asm_Disassembler.h" + +/* + * This file implements a binding between Java and the hsdis + * dissasembler. It should compile on Linux/Solaris and Windows. + * The only platform dependent pieces of the code for doing + * dlopen/dlsym to find the entry point in hsdis. All the rest is + * standard JNI code. + */ + +#ifdef _WINDOWS + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +#include <windows.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef _DEBUG +#include <crtdbg.h> +#endif + +#else + +#include <strings.h> +#include <dlfcn.h> +#include <link.h> + +#endif + +#include <limits.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <errno.h> + +#ifdef _WINDOWS +static int getLastErrorString(char *buf, size_t len) +{ + long errval; + + if ((errval = GetLastError()) != 0) + { + /* DOS error */ + size_t n = (size_t)FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + errval, + 0, + buf, + (DWORD)len, + NULL); + if (n > 3) { + /* Drop final '.', CR, LF */ + if (buf[n - 1] == '\n') n--; + if (buf[n - 1] == '\r') n--; + if (buf[n - 1] == '.') n--; + buf[n] = '\0'; + } + return (int)n; + } + + if (errno != 0) + { + /* C runtime error that has no corresponding DOS error code */ + const char *s = strerror(errno); + size_t n = strlen(s); + if (n >= len) n = len - 1; + strncpy(buf, s, n); + buf[n] = '\0'; + return (int)n; + } + return 0; +} +#endif /* _WINDOWS */ + +/* + * Class: sun_jvm_hotspot_asm_Disassembler + * Method: load_library + * Signature: (Ljava/lang/String;)L + */ +JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_asm_Disassembler_load_1library(JNIEnv * env, + jclass disclass, + jstring jrepath_s, + jstring libname_s) { + uintptr_t func = 0; + const char* error_message = NULL; + const char* java_home; + jboolean isCopy; + uintptr_t *handle = NULL; + + const char * jrepath = (*env)->GetStringUTFChars(env, jrepath_s, &isCopy); // like $JAVA_HOME/jre/lib/sparc/ + const char * libname = (*env)->GetStringUTFChars(env, libname_s, &isCopy); + char buffer[128]; + + /* Load the hsdis library */ +#ifdef _WINDOWS + HINSTANCE hsdis_handle; + hsdis_handle = LoadLibrary(libname); + if (hsdis_handle == NULL) { + snprintf(buffer, sizeof(buffer), "%s%s", jrepath, libname); + hsdis_handle = LoadLibrary(buffer); + } + if (hsdis_handle != NULL) { + func = (uintptr_t)GetProcAddress(hsdis_handle, "decode_instructions_virtual"); + } + if (func == 0) { + getLastErrorString(buffer, sizeof(buffer)); + error_message = buffer; + } +#else + void* hsdis_handle; + hsdis_handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL); + if (hsdis_handle == NULL) { + snprintf(buffer, sizeof(buffer), "%s%s", jrepath, libname); + hsdis_handle = dlopen(buffer, RTLD_LAZY | RTLD_GLOBAL); + } + if (hsdis_handle != NULL) { + func = (uintptr_t)dlsym(hsdis_handle, "decode_instructions_virtual"); + } + if (func == 0) { + error_message = dlerror(); + } +#endif + + (*env)->ReleaseStringUTFChars(env, libname_s, libname); + (*env)->ReleaseStringUTFChars(env, jrepath_s, jrepath); + + if (func == 0) { + /* Couldn't find entry point. error_message should contain some + * platform dependent error message. + */ + jclass eclass = (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"); + (*env)->ThrowNew(env, eclass, error_message); + } + return (jlong)func; +} + +/* signature of decode_instructions_virtual from hsdis.h */ +typedef void* (*decode_func)(uintptr_t start_va, uintptr_t end_va, + unsigned char* start, uintptr_t length, + void* (*event_callback)(void*, const char*, void*), + void* event_stream, + int (*printf_callback)(void*, const char*, ...), + void* printf_stream, + const char* options); + +/* container for call back state when decoding instructions */ +typedef struct { + JNIEnv* env; + jobject dis; + jobject visitor; + jmethodID handle_event; + jmethodID raw_print; + char buffer[4096]; +} decode_env; + + +/* event callback binding to Disassembler.handleEvent */ +static void* event_to_env(void* env_pv, const char* event, void* arg) { + decode_env* denv = (decode_env*)env_pv; + JNIEnv* env = denv->env; + jstring event_string = (*env)->NewStringUTF(env, event); + jlong result = (*env)->CallLongMethod(env, denv->dis, denv->handle_event, denv->visitor, + event_string, (jlong) (uintptr_t)arg); + if ((*env)->ExceptionOccurred(env) != NULL) { + /* ignore exceptions for now */ + (*env)->ExceptionClear(env); + result = 0; + } + return (void*)(uintptr_t)result; +} + +/* printing callback binding to Disassembler.rawPrint */ +static int printf_to_env(void* env_pv, const char* format, ...) { + jstring output; + va_list ap; + int cnt; + decode_env* denv = (decode_env*)env_pv; + JNIEnv* env = denv->env; + size_t flen = strlen(format); + const char* raw = NULL; + + if (flen == 0) return 0; + if (flen < 2 || + strchr(format, '%') == NULL) { + raw = format; + } else if (format[0] == '%' && format[1] == '%' && + strchr(format+2, '%') == NULL) { + // happens a lot on machines with names like %foo + flen--; + raw = format+1; + } + if (raw != NULL) { + jstring output = (*env)->NewStringUTF(env, raw); + (*env)->CallVoidMethod(env, denv->dis, denv->raw_print, denv->visitor, output); + if ((*env)->ExceptionOccurred(env) != NULL) { + /* ignore exceptions for now */ + (*env)->ExceptionClear(env); + } + return (int) flen; + } + va_start(ap, format); + cnt = vsnprintf(denv->buffer, sizeof(denv->buffer), format, ap); + va_end(ap); + + output = (*env)->NewStringUTF(env, denv->buffer); + (*env)->CallVoidMethod(env, denv->dis, denv->raw_print, denv->visitor, output); + if ((*env)->ExceptionOccurred(env) != NULL) { + /* ignore exceptions for now */ + (*env)->ExceptionClear(env); + } + return cnt; +} + +/* + * Class: sun_jvm_hotspot_asm_Disassembler + * Method: decode + * Signature: (Lsun/jvm/hotspot/asm/InstructionVisitor;J[BLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_asm_Disassembler_decode(JNIEnv * env, + jobject dis, + jobject visitor, + jlong startPc, + jbyteArray code, + jstring options_s, + jlong decode_instructions_virtual) { + jboolean isCopy; + jbyte* start = (*env)->GetByteArrayElements(env, code, &isCopy); + jbyte* end = start + (*env)->GetArrayLength(env, code); + const char * options = (*env)->GetStringUTFChars(env, options_s, &isCopy); + jclass disclass = (*env)->GetObjectClass(env, dis); + + decode_env denv; + denv.env = env; + denv.dis = dis; + denv.visitor = visitor; + + /* find Disassembler.handleEvent callback */ + denv.handle_event = (*env)->GetMethodID(env, disclass, "handleEvent", + "(Lsun/jvm/hotspot/asm/InstructionVisitor;Ljava/lang/String;J)J"); + if ((*env)->ExceptionOccurred(env)) { + return; + } + + /* find Disassembler.rawPrint callback */ + denv.raw_print = (*env)->GetMethodID(env, disclass, "rawPrint", + "(Lsun/jvm/hotspot/asm/InstructionVisitor;Ljava/lang/String;)V"); + if ((*env)->ExceptionOccurred(env)) { + return; + } + + /* decode the buffer */ + (*(decode_func)(uintptr_t)decode_instructions_virtual)(startPc, + startPc + end - start, + (unsigned char*)start, + end - start, + &event_to_env, (void*) &denv, + &printf_to_env, (void*) &denv, + options); + + /* cleanup */ + (*env)->ReleaseByteArrayElements(env, code, start, JNI_ABORT); + (*env)->ReleaseStringUTFChars(env, options_s, options); +}
--- a/agent/test/jdi/jstack.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/jdi/jstack.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,10 +23,4 @@ # # -OS=`uname` - -if [ "$OS" != "Linux" ]; then - OPTIONS="-Dsun.jvm.hotspot.debugger.useProcDebugger" -fi - $JAVA_HOME/bin/java -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $*
--- a/agent/test/jdi/jstack64.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/jdi/jstack64.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,4 @@ # # -OPTIONS="-Dsun.jvm.hotspot.debugger.useProcDebugger" - $JAVA_HOME/bin/java -d64 -showversion ${OPTIONS} -classpath $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.tools.StackTrace $*
--- a/agent/test/jdi/runsa.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/jdi/runsa.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/ksh # -# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -112,7 +112,6 @@ fi set -x -#setenv USE_LIBPROC_DEBUGGER "-Dsun.jvm.hotspot.debugger.useProcDebugger -Djava.library.path=$saprocdir" # If jjh makes this, then the classes are in .../build/agent. # if someone else does, they are in .
--- a/agent/test/jdi/sasanity.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/jdi/sasanity.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,6 +1,6 @@ #!/bin/ksh # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -46,10 +46,6 @@ shift OS=`uname` -if [ "$OS" != "Linux" ]; then - OPTIONS="-Dsun.jvm.hotspot.debugger.useProcDebugger" -fi - javacp=$jdk/lib/sa-jdi.jar:./workdir mkdir -p workdir
--- a/agent/test/libproc/libproctest.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/libproc/libproctest.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,7 +1,7 @@ #!/bin/ksh # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ kill -9 $pid -OPTIONS="-Djava.library.path=$STARTDIR/../src/os/solaris/proc/`uname -p`:$STARTDIR/../solaris/`uname -p` -Dsun.jvm.hotspot.debugger.useProcDebugger" +OPTIONS="-Djava.library.path=$STARTDIR/../src/os/solaris/proc/`uname -p`:$STARTDIR/../solaris/`uname -p`" # run libproc client $SA_JAVA -showversion ${OPTIONS} -cp $STARTDIR/../../build/classes::$STARTDIR/../sa.jar:$STARTDIR LibprocClient x core.$pid
--- a/agent/test/libproc/libproctest64.sh Thu Sep 27 15:49:48 2012 -0700 +++ b/agent/test/libproc/libproctest64.sh Fri Sep 28 10:16:29 2012 -0700 @@ -1,7 +1,7 @@ #!/bin/ksh # -# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ gcore $pid kill -9 $pid -OPTIONS="-Djava.library.path=$STARTDIR/../src/os/solaris/proc/sparcv9:$STARTDIR/../solaris/sparcv9 -Dsun.jvm.hotspot.debugger.useProcDebugger" +OPTIONS="-Djava.library.path=$STARTDIR/../src/os/solaris/proc/sparcv9:$STARTDIR/../solaris/sparcv9" # run libproc client $SA_JAVA -d64 -showversion ${OPTIONS} -cp $STARTDIR/../../build/classes::$STARTDIR/../sa.jar:$STARTDIR LibprocClient x core.$pid
--- a/make/bsd/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/make/bsd/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -288,42 +288,54 @@ $(TARGETS_C2): $(SUBDIRS_C2) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install endif $(TARGETS_TIERED): $(SUBDIRS_TIERED) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_C1): $(SUBDIRS_C1) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_CORE): $(SUBDIRS_CORE) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_ZERO): $(SUBDIRS_ZERO) cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_SHARK): $(SUBDIRS_SHARK) cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install endif
--- a/make/bsd/makefiles/launcher.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/bsd/makefiles/launcher.make Fri Sep 28 10:16:29 2012 -0700 @@ -19,7 +19,7 @@ # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA # or visit www.oracle.com if you need additional information or have any # questions. -# +# # # Rules to build gamma launcher, used by vm.make @@ -41,6 +41,8 @@ -DLAUNCHER_TYPE=\"gamma\" \ -DLINK_INTO_$(LINK_INTO) \ $(TARGET_DEFINES) +# Give the launcher task_for_pid() privileges so that it can be used to run JStack, JInfo, et al. +LFLAGS_LAUNCHER += -sectcreate __TEXT __info_plist $(GAMMADIR)/src/os/bsd/launcher/Info-privileged.plist ifeq ($(LINK_INTO),AOUT) LAUNCHER.o = launcher.o $(JVM_OBJ_FILES) @@ -50,22 +52,22 @@ LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS) else LAUNCHER.o = launcher.o - LFLAGS_LAUNCHER += -L`pwd` + LFLAGS_LAUNCHER += -L`pwd` # The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a - # freshly built JVM at ./libjvm.{so|dylib}. This is accomplished by setting - # the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM + # freshly built JVM at ./libjvm.{so|dylib}. This is accomplished by setting + # the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM # first. Gamma dlopen()s libjava from $JAVA_HOME/jre/lib{/$arch}, which is # statically linked with CoreFoundation framework libs. Unfortunately, gamma's - # unique searchpath results in some unresolved symbols in the framework + # unique searchpath results in some unresolved symbols in the framework # libraries, because JDK libraries are inadvertently discovered first on the # searchpath, e.g. libjpeg. On Mac OS X, filenames are case *insensitive*. # So, the actual filename collision is libjpeg.dylib and libJPEG.dylib. - # To resolve this, gamma needs to also statically link with the CoreFoundation + # To resolve this, gamma needs to also statically link with the CoreFoundation # framework libraries. ifeq ($(OS_VENDOR),Darwin) - LFLAGS_LAUNCHER += -framework CoreFoundation + LFLAGS_LAUNCHER += -framework CoreFoundation endif LIBS_LAUNCHER += -l$(JVM) $(LIBS) @@ -99,8 +101,11 @@ $(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE) $(QUIETLY) echo Linking launcher... $(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK) - $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER) + $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER) $(QUIETLY) $(LINK_LAUNCHER/POST_HOOK) + # Sign the launcher with the development certificate (if present) so that it can be used + # to run JStack, JInfo, et al. + $(QUIETLY) -codesign -s openjdk_codesign $@ $(LAUNCHER): $(LAUNCHER_SCRIPT)
--- a/make/bsd/makefiles/sa.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/bsd/makefiles/sa.make Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -120,9 +120,9 @@ $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext - $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext + $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler clean: rm -rf $(SA_CLASSDIR)
--- a/make/bsd/makefiles/saproc.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/bsd/makefiles/saproc.make Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -40,12 +40,13 @@ SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family) -NON_STUB_SASRCFILES = $(SASRCDIR)/salibelf.c \ - $(SASRCDIR)/symtab.c \ - $(SASRCDIR)/libproc_impl.c \ - $(SASRCDIR)/ps_proc.c \ - $(SASRCDIR)/ps_core.c \ - $(SASRCDIR)/BsdDebuggerLocal.c +NON_STUB_SASRCFILES = $(SASRCDIR)/salibelf.c \ + $(SASRCDIR)/symtab.c \ + $(SASRCDIR)/libproc_impl.c \ + $(SASRCDIR)/ps_proc.c \ + $(SASRCDIR)/ps_core.c \ + $(SASRCDIR)/BsdDebuggerLocal.c \ + $(AGENT_DIR)/src/share/native/sadis.c ifeq ($(OS_VENDOR), FreeBSD) SASRCFILES = $(NON_STUB_SASRCFILES)
--- a/make/bsd/makefiles/vm.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/bsd/makefiles/vm.make Fri Sep 28 10:16:29 2012 -0700 @@ -311,7 +311,7 @@ echo Linking vm...; \ $(LINK_LIB.CXX/PRE_HOOK) \ $(LINK_VM) $(LD_SCRIPT_FLAG) \ - $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ + $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ $(LINK_LIB.CXX/POST_HOOK) \ rm -f $@.1; ln -s $@ $@.1; \ [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
--- a/make/defs.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/defs.make Fri Sep 28 10:16:29 2012 -0700 @@ -332,6 +332,9 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h +# By default, run Queens test after building +TEST_IN_BUILD ?= true + ifndef JAVASE_EMBEDDED EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h endif
--- a/make/linux/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -288,42 +288,54 @@ $(TARGETS_C2): $(SUBDIRS_C2) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install endif $(TARGETS_TIERED): $(SUBDIRS_TIERED) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_C1): $(SUBDIRS_C1) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_CORE): $(SUBDIRS_CORE) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_ZERO): $(SUBDIRS_ZERO) cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_SHARK): $(SUBDIRS_SHARK) cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install endif
--- a/make/linux/makefiles/adlc.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/adlc.make Fri Sep 28 10:16:29 2012 -0700 @@ -109,7 +109,7 @@ $(EXEC) : $(OBJECTS) @echo Making adlc - $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) + $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) -o $(EXEC) $(OBJECTS) # Random dependencies: $(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp @@ -213,14 +213,14 @@ $(OUTDIR)/%.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) + $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) + $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) # #########################################################################
--- a/make/linux/makefiles/defs.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/defs.make Fri Sep 28 10:16:29 2012 -0700 @@ -29,8 +29,14 @@ SLASH_JAVA ?= /java # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name -ARCH:=$(shell uname -m) -PATH_SEP = : + +# ARCH can be set explicitly in spec.gmk +ifndef ARCH + ARCH := $(shell uname -m) +endif + +PATH_SEP ?= : + ifeq ($(LP64), 1) ARCH_DATA_MODEL ?= 64 else @@ -72,8 +78,8 @@ HS_ARCH = sparc endif -# x86_64 -ifeq ($(ARCH), x86_64) +# amd64/x86_64 +ifneq (,$(findstring $(ARCH), amd64 x86_64)) ifeq ($(ARCH_DATA_MODEL), 64) ARCH_DATA_MODEL = 64 MAKE_ARGS += LP64=1 @@ -90,8 +96,8 @@ endif endif -# i686 -ifeq ($(ARCH), i686) +# i686/i586 ie 32-bit x86 +ifneq (,$(findstring $(ARCH), i686 i586)) ARCH_DATA_MODEL = 32 PLATFORM = linux-i586 VM_PLATFORM = linux_i486
--- a/make/linux/makefiles/launcher.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/launcher.make Fri Sep 28 10:16:29 2012 -0700 @@ -82,7 +82,7 @@ $(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE) $(QUIETLY) echo Linking launcher... $(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK) - $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER) + $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER) $(QUIETLY) $(LINK_LAUNCHER/POST_HOOK) $(LAUNCHER): $(LAUNCHER_SCRIPT)
--- a/make/linux/makefiles/sa.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/sa.make Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -107,9 +107,9 @@ $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext - $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext + $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler clean: rm -rf $(SA_CLASSDIR)
--- a/make/linux/makefiles/saproc.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/saproc.make Fri Sep 28 10:16:29 2012 -0700 @@ -48,7 +48,8 @@ $(SASRCDIR)/libproc_impl.c \ $(SASRCDIR)/ps_proc.c \ $(SASRCDIR)/ps_core.c \ - $(SASRCDIR)/LinuxDebuggerLocal.c + $(SASRCDIR)/LinuxDebuggerLocal.c \ + $(AGENT_DIR)/src/share/native/sadis.c -include $(HS_ALT_MAKE)/linux/makefiles/saproc.make
--- a/make/linux/makefiles/vm.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/linux/makefiles/vm.make Fri Sep 28 10:16:29 2012 -0700 @@ -320,7 +320,7 @@ echo Linking vm...; \ $(LINK_LIB.CXX/PRE_HOOK) \ $(LINK_VM) $(LD_SCRIPT_FLAG) \ - $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ + $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ $(LINK_LIB.CXX/POST_HOOK) \ rm -f $@.1; ln -s $@ $@.1; \ [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
--- a/make/sa.files Thu Sep 27 15:49:48 2012 -0700 +++ b/make/sa.files Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -39,10 +39,7 @@ AGENT_FILES = \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/amd64/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/sparc/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/bugspot/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/bugspot/tree/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/c1/*.java \ @@ -59,10 +56,8 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/sparc/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/posix/*.java \ @@ -79,7 +74,6 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/win32/coff/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/amd64/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/g1/*.java \ @@ -98,10 +92,8 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_amd64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \ -$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_sparc/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/posix/*.java \
--- a/make/solaris/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/make/solaris/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -237,35 +237,45 @@ $(TARGETS_C2): $(SUBDIRS_C2) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install endif $(TARGETS_TIERED): $(SUBDIRS_TIERED) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_C1): $(SUBDIRS_C1) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_CORE): $(SUBDIRS_CORE) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install endif $(TARGETS_KERNEL): $(SUBDIRS_KERNEL) cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS) +ifeq ($(TEST_IN_BUILD),true) cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && ./test_gamma +endif ifdef INSTALL cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS) install endif
--- a/make/solaris/makefiles/launcher.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/solaris/makefiles/launcher.make Fri Sep 28 10:16:29 2012 -0700 @@ -96,7 +96,7 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) $(QUIETLY) echo Linking launcher... $(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK) - $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER) + $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER) $(QUIETLY) $(LINK_LAUNCHER/POST_HOOK) endif # filter -sbfast -xsbfast
--- a/make/solaris/makefiles/sa.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/solaris/makefiles/sa.make Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -94,6 +94,7 @@ $(QUIETLY) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . $(QUIETLY) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(QUIETLY) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal + $(QUIETLY) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler clean: rm -rf $(SA_CLASSDIR)
--- a/make/solaris/makefiles/saproc.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/solaris/makefiles/saproc.make Fri Sep 28 10:16:29 2012 -0700 @@ -27,7 +27,9 @@ # libsaproc[_g].so: serviceability agent SAPROC = saproc +SADIS = sadis LIBSAPROC = lib$(SAPROC).so +SADISOBJ = $(SADIS).o SAPROC_G = $(SAPROC)$(G_SUFFIX) LIBSAPROC_G = lib$(SAPROC_G).so @@ -43,6 +45,8 @@ SASRCFILES = $(SASRCDIR)/saproc.cpp +SADISSRCFILES = $(AGENT_DIR)/src/share/native/sadis.c + SAMAPFILE = $(SASRCDIR)/mapfile DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) @@ -90,13 +94,14 @@ # when actually building on Nevada-B158 or earlier: #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER -$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SAMAPFILE) + +$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE) $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi @echo Making SA debugger back-end... - $(QUIETLY) $(CXX) \ + $(QUIETLY) $(CXX) \ $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ -I$(SASRCDIR) \ -I$(GENERATED) \ @@ -104,10 +109,23 @@ -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ $(SOLARIS_11_B159_OR_LATER) \ $(SASRCFILES) \ + $(SADISOBJ) \ $(SA_LFLAGS) \ -o $@ \ -ldl -ldemangle -lthread -lc [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } + +$(SADISOBJ): $(SADISSRCFILES) + $(QUIETLY) $(CC) \ + $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ + -I$(SASRCDIR) \ + -I$(GENERATED) \ + -I$(BOOT_JAVA_HOME)/include \ + -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ + $(SOLARIS_11_B159_OR_LATER) \ + $(SADISSRCFILES) \ + -c -o $(SADISOBJ) + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. # Clear the SHF_ALLOC flag (if set) from empty section headers.
--- a/make/solaris/makefiles/vm.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/solaris/makefiles/vm.make Fri Sep 28 10:16:29 2012 -0700 @@ -288,7 +288,7 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) @echo Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) - $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM) + $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM) $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1 $(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
--- a/make/windows/makefiles/sa.make Thu Sep 27 15:49:48 2012 -0700 +++ b/make/windows/makefiles/sa.make Fri Sep 28 10:16:29 2012 -0700 @@ -69,8 +69,8 @@ $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext - $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.asm.Disassembler
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/os/bsd/launcher/Info-privileged.plist Fri Sep 28 10:16:29 2012 -0700 @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>net.java.openjdk.cmd</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>OpenJDK Command</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>SecTaskAccess</key> + <string>allowed</string> +</dict> +</plist>
--- a/src/os/solaris/vm/os_solaris.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -1488,11 +1488,11 @@ // First crack at OS-specific initialization, from inside the new thread. -void os::initialize_thread() { +void os::initialize_thread(Thread* thr) { int r = thr_main() ; guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ; if (r) { - JavaThread* jt = (JavaThread *)Thread::current(); + JavaThread* jt = (JavaThread *)thr; assert(jt != NULL,"Sanity check"); size_t stack_size; address base = jt->stack_base();
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -297,7 +297,7 @@ return (char*) -1; } -void os::initialize_thread() { +void os::initialize_thread(Thread* thr) { // Nothing to do. }
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -103,7 +103,7 @@ #endif // SPARC } -void os::initialize_thread() { +void os::initialize_thread(Thread* thr) { // Nothing to do. }
--- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -225,7 +225,7 @@ return (char*) 0; } -void os::initialize_thread() {} +void os::initialize_thread(Thread* thr) {} void os::print_context(outputStream *st, void *context) { if (context == NULL) return;
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -114,7 +114,7 @@ return (char*) -1; } -void os::initialize_thread() { +void os::initialize_thread(Thread* thr) { // Nothing to do. }
--- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -98,7 +98,7 @@ #endif // SPARC } -void os::initialize_thread() { +void os::initialize_thread(Thread * thr){ // Nothing to do. }
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -219,7 +219,7 @@ return true; } -void os::initialize_thread() { +void os::initialize_thread(Thread* thr) { // Nothing to do. }
--- a/src/share/tools/hsdis/Makefile Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/tools/hsdis/Makefile Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -66,14 +66,18 @@ endif CC = $(MINGW)-gcc CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW) -else +else #linux CPU = $(shell uname -m) ARCH1=$(CPU:x86_64=amd64) ARCH=$(ARCH1:i686=i386) +ifdef LP64 +CFLAGS/sparcv9 += -m64 +CFLAGS/amd64 += -m64 +else +ARCH=$(ARCH1:amd64=i386) CFLAGS/i386 += -m32 CFLAGS/sparc += -m32 -CFLAGS/sparcv9 += -m64 -CFLAGS/amd64 += -m64 +endif CFLAGS += $(CFLAGS/$(ARCH)) CFLAGS += -fPIC OS = linux @@ -85,16 +89,41 @@ LDFLAGS += -ldl OUTFLAGS += -o $@ ## OS = Windows ## -else # !SunOS, !Linux => Windows +else # !SunOS, !Linux => Darwin or Windows +ifeq ($(OS),Darwin) +CPU = $(shell uname -m) +ARCH1=$(CPU:x86_64=amd64) +ARCH=$(ARCH1:i686=i386) +ifdef LP64 +CFLAGS/sparcv9 += -m64 +CFLAGS/amd64 += -m64 +else +ARCH=$(ARCH1:amd64=i386) +CFLAGS/i386 += -m32 +CFLAGS/sparc += -m32 +endif # LP64 +CFLAGS += $(CFLAGS/$(ARCH)) +CFLAGS += -fPIC +OS = macosx +LIB_EXT = .dylib +CC = gcc +CFLAGS += -O +# CFLAGS += -DZ_PREFIX +DLDFLAGS += -shared +DLDFLAGS += -lz +LDFLAGS += -ldl +OUTFLAGS += -o $@ +else #Windows OS = windows CC = gcc #CPPFLAGS += /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG" CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi- -CFLAGS += LIBARCH=\"$(LIBARCH)\"" +CFLAGS += LIBARCH=\"$(LIBARCH)\" DLDFLAGS += /dll /subsystem:windows /incremental:no \ /export:decode_instruction OUTFLAGS += /link /out:$@ LIB_EXT = .dll +endif # Darwin endif # Linux endif # SunOS @@ -118,7 +147,7 @@ BINUTILSDIR = $(shell cd $(BINUTILS);pwd) endif -CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd +CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\" TARGET_DIR = build/$(OS)-$(JDKARCH)
--- a/src/share/tools/hsdis/README Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/tools/hsdis/README Fri Sep 28 10:16:29 2012 -0700 @@ -1,4 +1,4 @@ -Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,14 @@ one of it's mirrors. Builds targetting windows should use at least 2.19 and currently requires the use of a cross compiler. +Binutils should be configured with the '--disable-nls' flag to disable +Native Language Support, otherwise you might get an "undefined +reference to `libintl_gettext'" if you try to load hsdis.so on systems +which don't have NLS by default. It also avoids build problems on +other configurations that don't include the full NLS support. + The makefile looks for the sources in build/binutils or you can -specify it's location to the makefile using BINTUILS=path. It will +specify it's location to the makefile using BINUTILS=path. It will configure binutils and build it first and then build and link the disasembly adapter. Make all will build the default target for your platform. If you platform support both 32 and 64 simultaneously then
--- a/src/share/tools/hsdis/hsdis-demo.c Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/tools/hsdis/hsdis-demo.c Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,16 @@ This demonstrates the protocol required by the HotSpot PrintAssembly option. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <inttypes.h> + #include "hsdis.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" void greet(const char*); -void disassemble(void*, void*); +void disassemble(uintptr_t, uintptr_t); void end_of_file(); const char* options = NULL; @@ -62,7 +64,14 @@ if (!greeted) greet("world"); printf("...And now for something completely different:\n"); - disassemble((void*) &main, (void*) &end_of_file); + void *start = (void*) &main; + void *end = (void*) &end_of_file; +#if defined(__ia64) || defined(__powerpc__) + /* On IA64 and PPC function pointers are pointers to function descriptors */ + start = *((void**)start); + end = *((void**)end); +#endif + disassemble(start, (end > start) ? end : start + 64); printf("Cheers!\n"); } @@ -76,7 +85,7 @@ #include "dlfcn.h" -#define DECODE_INSTRUCTIONS_NAME "decode_instructions" +#define DECODE_INSTRUCTIONS_NAME "decode_instructions_virtual" #define HSDIS_NAME "hsdis" static void* decode_instructions_pv = 0; static const char* hsdis_path[] = { @@ -108,8 +117,14 @@ static const char* lookup(void* addr) { +#if defined(__ia64) || defined(__powerpc__) + /* On IA64 and PPC function pointers are pointers to function descriptors */ +#define CHECK_NAME(fn) \ + if (addr == *((void**) &fn)) return #fn; +#else #define CHECK_NAME(fn) \ if (addr == (void*) &fn) return #fn; +#endif CHECK_NAME(main); CHECK_NAME(greet); @@ -123,6 +138,14 @@ static const char event_cookie[] = "event_cookie"; /* demo placeholder */ +static void* simple_handle_event(void* cookie, const char* event, void* arg) { + if (MATCH(event, "/insn")) { + // follow each complete insn by a nice newline + printf("\n"); + } + return NULL; +} + static void* handle_event(void* cookie, const char* event, void* arg) { #define NS_DEMO "demo:" if (cookie != event_cookie) @@ -162,10 +185,8 @@ printf(" %p\t", arg); } else if (MATCH(event, "/insn")) { - /* basic action for </insn>: - (none, plugin puts the newline for us - */ - + // follow each complete insn by a nice newline + printf("\n"); } else if (MATCH(event, "mach")) { printf("Decoding for CPU '%s'\n", (char*) arg); @@ -186,7 +207,7 @@ #define fprintf_callback \ (decode_instructions_printf_callback_ftype)&fprintf -void disassemble(void* from, void* to) { +void disassemble(uintptr_t from, uintptr_t to) { const char* err = load_decode_instructions(); if (err != NULL) { printf("%s: %s\n", err, dlerror()); @@ -197,15 +218,15 @@ = (decode_instructions_ftype) decode_instructions_pv; void* res; if (raw && xml) { - res = (*decode_instructions)(from, to, NULL, stdout, NULL, stdout, options); + res = (*decode_instructions)(from, to, (unsigned char*)from, to - from, simple_handle_event, stdout, NULL, stdout, options); } else if (raw) { - res = (*decode_instructions)(from, to, NULL, NULL, NULL, stdout, options); + res = (*decode_instructions)(from, to, (unsigned char*)from, to - from, simple_handle_event, stdout, NULL, stdout, options); } else { - res = (*decode_instructions)(from, to, + res = (*decode_instructions)(from, to, (unsigned char*)from, to - from, handle_event, (void*) event_cookie, fprintf_callback, stdout, options); } - if (res != to) + if (res != (void*)to) printf("*** Result was %p!\n", res); }
--- a/src/share/tools/hsdis/hsdis.c Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/tools/hsdis/hsdis.c Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,13 +27,13 @@ HotSpot PrintAssembly option. */ -#include "hsdis.h" - -#include <sysdep.h> #include <libiberty.h> #include <bfd.h> #include <dis-asm.h> #include <inttypes.h> +#include <string.h> +#include <errno.h> +#include "hsdis.h" #ifndef bool #define bool int @@ -47,11 +47,15 @@ /* disassemble_info.application_data object */ struct hsdis_app_data { - /* the arguments to decode_instructions */ - uintptr_t start; uintptr_t end; + /* virtual address of data */ + uintptr_t start_va, end_va; + /* the instructions to be decoded */ + unsigned char* buffer; + uintptr_t length; event_callback_t event_callback; void* event_stream; printf_callback_t printf_callback; void* printf_stream; bool losing; + bool do_newline; /* the architecture being disassembled */ const char* arch_name; @@ -65,6 +69,8 @@ char insn_options[256]; }; +static void* decode(struct hsdis_app_data* app_data, const char* options); + #define DECL_APP_DATA(dinfo) \ struct hsdis_app_data* app_data = (struct hsdis_app_data*) (dinfo)->application_data @@ -89,59 +95,91 @@ #ifdef DLL_ENTRY DLL_ENTRY #endif +decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, + unsigned char* buffer, uintptr_t length, + event_callback_t event_callback_arg, void* event_stream_arg, + printf_callback_t printf_callback_arg, void* printf_stream_arg, + const char* options) { + struct hsdis_app_data app_data; + memset(&app_data, 0, sizeof(app_data)); + app_data.start_va = start_va; + app_data.end_va = end_va; + app_data.buffer = buffer; + app_data.length = length; + app_data.event_callback = event_callback_arg; + app_data.event_stream = event_stream_arg; + app_data.printf_callback = printf_callback_arg; + app_data.printf_stream = printf_stream_arg; + app_data.do_newline = false; + + return decode(&app_data, options); +} + +/* This is the compatability interface for older version of hotspot */ +void* +#ifdef DLL_ENTRY + DLL_ENTRY +#endif decode_instructions(void* start_pv, void* end_pv, event_callback_t event_callback_arg, void* event_stream_arg, printf_callback_t printf_callback_arg, void* printf_stream_arg, const char* options) { - struct hsdis_app_data app_data; - memset(&app_data, 0, sizeof(app_data)); - app_data.start = (uintptr_t) start_pv; - app_data.end = (uintptr_t) end_pv; - app_data.event_callback = event_callback_arg; - app_data.event_stream = event_stream_arg; - app_data.printf_callback = printf_callback_arg; - app_data.printf_stream = printf_stream_arg; + decode_instructions_virtual((uintptr_t)start_pv, + (uintptr_t)end_pv, + (unsigned char*)start_pv, + (uintptr_t)end_pv - (uintptr_t)start_pv, + event_callback_arg, + event_stream_arg, + printf_callback_arg, + printf_stream_arg, + options); +} - setup_app_data(&app_data, options); +static void* decode(struct hsdis_app_data* app_data, const char* options) { + setup_app_data(app_data, options); char buf[128]; { /* now reload everything from app_data: */ - DECL_EVENT_CALLBACK(&app_data); - DECL_PRINTF_CALLBACK(&app_data); - uintptr_t start = app_data.start; - uintptr_t end = app_data.end; + DECL_EVENT_CALLBACK(app_data); + DECL_PRINTF_CALLBACK(app_data); + uintptr_t start = app_data->start_va; + uintptr_t end = app_data->end_va; uintptr_t p = start; (*event_callback)(event_stream, "insns", (void*)start); (*event_callback)(event_stream, "mach name='%s'", - (void*) app_data.arch_info->printable_name); - if (app_data.dinfo.bytes_per_line != 0) { + (void*) app_data->arch_info->printable_name); + if (app_data->dinfo.bytes_per_line != 0) { (*event_callback)(event_stream, "format bytes-per-line='%p'/", - (void*)(intptr_t) app_data.dinfo.bytes_per_line); + (void*)(intptr_t) app_data->dinfo.bytes_per_line); } - while (p < end && !app_data.losing) { + while (p < end && !app_data->losing) { (*event_callback)(event_stream, "insn", (void*) p); /* reset certain state, so we can read it with confidence */ - app_data.dinfo.insn_info_valid = 0; - app_data.dinfo.branch_delay_insns = 0; - app_data.dinfo.data_size = 0; - app_data.dinfo.insn_type = 0; + app_data->dinfo.insn_info_valid = 0; + app_data->dinfo.branch_delay_insns = 0; + app_data->dinfo.data_size = 0; + app_data->dinfo.insn_type = 0; - int size = (*app_data.dfn)((bfd_vma) p, &app_data.dinfo); + int size = (*app_data->dfn)((bfd_vma) p, &app_data->dinfo); if (size > 0) p += size; - else app_data.losing = true; + else app_data->losing = true; - const char* insn_close = format_insn_close("/insn", &app_data.dinfo, - buf, sizeof(buf)); - (*event_callback)(event_stream, insn_close, (void*) p); + if (!app_data->losing) { + const char* insn_close = format_insn_close("/insn", &app_data->dinfo, + buf, sizeof(buf)); + (*event_callback)(event_stream, insn_close, (void*) p) != NULL; - /* follow each complete insn by a nice newline */ - (*printf_callback)(printf_stream, "\n"); + if (app_data->do_newline) { + /* follow each complete insn by a nice newline */ + (*printf_callback)(printf_stream, "\n"); + } + } } (*event_callback)(event_stream, "/insns", (void*) p); @@ -150,7 +188,7 @@ } /* take the address of the function, for luck, and also test the typedef: */ -const decode_instructions_ftype decode_instructions_address = &decode_instructions; +const decode_instructions_ftype decode_instructions_address = &decode_instructions_virtual; static const char* format_insn_close(const char* close, disassemble_info* dinfo, @@ -189,13 +227,14 @@ bfd_byte* myaddr, unsigned int length, struct disassemble_info* dinfo) { - uintptr_t memaddr_p = (uintptr_t) memaddr; DECL_APP_DATA(dinfo); - if (memaddr_p + length > app_data->end) { + /* convert the virtual address memaddr into an address within memory buffer */ + uintptr_t offset = ((uintptr_t) memaddr) - app_data->start_va; + if (offset + length > app_data->length) { /* read is out of bounds */ return EIO; } else { - memcpy(myaddr, (bfd_byte*) memaddr_p, length); + memcpy(myaddr, (bfd_byte*) (app_data->buffer + offset), length); return 0; } } @@ -407,16 +446,16 @@ static const char* native_arch_name() { const char* res = NULL; #ifdef LIBARCH_i386 - res = "i386"; + res = "i386"; #endif #ifdef LIBARCH_amd64 - res = "i386:x86-64"; + res = "i386:x86-64"; #endif #ifdef LIBARCH_sparc - res = "sparc:v8plusb"; + res = "sparc:v8plusb"; #endif #ifdef LIBARCH_sparcv9 - res = "sparc:v9b"; + res = "sparc:v9b"; #endif if (res == NULL) res = "architecture not set in Makefile!"; @@ -468,7 +507,7 @@ dinfo->fprintf_func = &print_to_dev_null; (*dfn)(0, dinfo); - // put it back: + /* put it back */ dinfo->read_memory_func = read_memory_func; dinfo->fprintf_func = fprintf_func; }
--- a/src/share/tools/hsdis/hsdis.h Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/tools/hsdis/hsdis.h Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,10 @@ /* decode_instructions -- dump a range of addresses as native instructions This implements the protocol required by the HotSpot PrintAssembly option. - The starting and ending addresses are within the current process's address space. + The start_va, end_va is the virtual address the region of memory to + disasemble and buffer contains the instructions to decode, + Disassembling instructions in the current address space is done by + having start_va == buffer. The option string, if not empty, is interpreted by the disassembler implementation. @@ -48,18 +51,20 @@ #ifdef DLL_EXPORT DLL_EXPORT #endif -void* decode_instructions(void* start, void* end, - void* (*event_callback)(void*, const char*, void*), - void* event_stream, - int (*printf_callback)(void*, const char*, ...), - void* printf_stream, - const char* options); +void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, + unsigned char* buffer, uintptr_t length, + void* (*event_callback)(void*, const char*, void*), + void* event_stream, + int (*printf_callback)(void*, const char*, ...), + void* printf_stream, + const char* options); /* convenience typedefs */ typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*); typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...); -typedef void* (*decode_instructions_ftype) (void* start, void* end, +typedef void* (*decode_instructions_ftype) (uintptr_t start_va, uintptr_t end_va, + unsigned char* buffer, uintptr_t length, decode_instructions_event_callback_ftype event_callback, void* event_stream, decode_instructions_printf_callback_ftype printf_callback,
--- a/src/share/vm/code/codeCache.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/code/codeCache.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -309,12 +309,10 @@ // Mark nmethods for unloading if they contain otherwise unreachable // oops. -void CodeCache::do_unloading(BoolObjectClosure* is_alive, - OopClosure* keep_alive, - bool unloading_occurred) { +void CodeCache::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) { assert_locked_or_safepoint(CodeCache_lock); FOR_ALL_ALIVE_NMETHODS(nm) { - nm->do_unloading(is_alive, keep_alive, unloading_occurred); + nm->do_unloading(is_alive, unloading_occurred); } }
--- a/src/share/vm/code/codeCache.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/code/codeCache.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -130,9 +130,7 @@ // If "unloading_occurred" is true, then unloads (i.e., breaks root links // to) any unmarked codeBlobs in the cache. Sets "marked_for_unloading" // to "true" iff some code got unloaded. - static void do_unloading(BoolObjectClosure* is_alive, - OopClosure* keep_alive, - bool unloading_occurred); + static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); static void oops_do(OopClosure* f) { CodeBlobToOopClosure oopc(f, /*do_marking=*/ false); blobs_do(&oopc);
--- a/src/share/vm/code/nmethod.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/code/nmethod.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -1475,9 +1475,7 @@ // If this oop is not live, the nmethod can be unloaded. -bool nmethod::can_unload(BoolObjectClosure* is_alive, - OopClosure* keep_alive, - oop* root, bool unloading_occurred) { +bool nmethod::can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred) { assert(root != NULL, "just checking"); oop obj = *root; if (obj == NULL || is_alive->do_object_b(obj)) { @@ -1586,8 +1584,7 @@ // GC to unload an nmethod if it contains otherwise unreachable // oops. -void nmethod::do_unloading(BoolObjectClosure* is_alive, - OopClosure* keep_alive, bool unloading_occurred) { +void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) { // Make sure the oop's ready to receive visitors assert(!is_zombie() && !is_unloaded(), "should not call follow on zombie or unloaded nmethod"); @@ -1675,7 +1672,7 @@ (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), "oop must be found in exactly one place"); if (r->oop_is_immediate() && r->oop_value() != NULL) { - if (can_unload(is_alive, keep_alive, r->oop_addr(), unloading_occurred)) { + if (can_unload(is_alive, r->oop_addr(), unloading_occurred)) { return; } } @@ -1687,7 +1684,7 @@ // Scopes for (oop* p = oops_begin(); p < oops_end(); p++) { if (*p == Universe::non_oop_word()) continue; // skip non-oops - if (can_unload(is_alive, keep_alive, p, unloading_occurred)) { + if (can_unload(is_alive, p, unloading_occurred)) { return; } }
--- a/src/share/vm/code/nmethod.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/code/nmethod.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -560,10 +560,8 @@ void set_method(Method* method) { _method = method; } // GC support - void do_unloading(BoolObjectClosure* is_alive, OopClosure* keep_alive, - bool unloading_occurred); - bool can_unload(BoolObjectClosure* is_alive, OopClosure* keep_alive, - oop* root, bool unloading_occurred); + void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); + bool can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred); void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f);
--- a/src/share/vm/compiler/disassembler.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/compiler/disassembler.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ Disassembler::decode_func Disassembler::_decode_instructions = NULL; static const char hsdis_library_name[] = "hsdis-"HOTSPOT_LIB_ARCH; -static const char decode_instructions_name[] = "decode_instructions"; +static const char decode_instructions_name[] = "decode_instructions_virtual"; #define COMMENT_COLUMN 40 LP64_ONLY(+8) /*could be an option*/ #define BYTES_COMMENT ";..." /* funky byte display comment */ @@ -219,6 +219,8 @@ } } } + // follow each complete insn by a nice newline + st->cr(); } address handle_event(const char* event, address arg); @@ -449,14 +451,16 @@ FILE* out = stdout; FILE* xmlout = (_print_raw > 1 ? out : NULL); return (address) - (*Disassembler::_decode_instructions)(start, end, + (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, + start, end - start, NULL, (void*) xmlout, NULL, (void*) out, options()); } return (address) - (*Disassembler::_decode_instructions)(start, end, + (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, + start, end - start, &event_to_env, (void*) this, &printf_to_env, (void*) this, options());
--- a/src/share/vm/compiler/disassembler.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/compiler/disassembler.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,8 @@ friend class decode_env; private: // this is the type of the dll entry point: - typedef void* (*decode_func)(void* start, void* end, + typedef void* (*decode_func)(uintptr_t start_va, uintptr_t end_va, + unsigned char* buffer, uintptr_t length, void* (*event_callback)(void*, const char*, void*), void* event_stream, int (*printf_callback)(void*, const char*, ...),
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -5954,9 +5954,7 @@ bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure); // Follow CodeCache roots and unload any methods marked for unloading - CodeCache::do_unloading(&_is_alive_closure, - &cmsKeepAliveClosure, - purged_class); + CodeCache::do_unloading(&_is_alive_closure, purged_class); cmsDrainMarkingStackClosure.do_void(); verify_work_stacks_empty();
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -230,6 +230,7 @@ void ConcurrentMarkSweepThread::print_all_on(outputStream* st) { if (_cmst != NULL) { _cmst->print_on(st); + st->cr(); } if (_collector != NULL) { AbstractWorkGang* gang = _collector->conc_workers();
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -3412,7 +3412,6 @@ st->cr(); _cm->print_worker_threads_on(st); _cg1r->print_worker_threads_on(st); - st->cr(); } void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const {
--- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -129,7 +129,7 @@ buf.append_and_print_cr("]"); } -#ifdef ASSERT +#ifndef PRODUCT template <class T> void WorkerDataArray<T>::reset() {
--- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -151,9 +151,7 @@ // Follow code cache roots (has to be done after system dictionary, // assumes all live klasses are marked) - CodeCache::do_unloading(&GenMarkSweep::is_alive, - &GenMarkSweep::keep_alive, - purged_class); + CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); GenMarkSweep::follow_stack(); // Update subklass/sibling/implementor links of live klasses
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -521,8 +521,7 @@ bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); // Follow code cache roots - CodeCache::do_unloading(is_alive_closure(), mark_and_push_closure(), - purged_class); + CodeCache::do_unloading(is_alive_closure(), purged_class); follow_stack(); // Flush marking stack // Update subklass/sibling/implementor links of live klasses
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -2375,8 +2375,7 @@ bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); // Follow code cache roots. - CodeCache::do_unloading(is_alive_closure(), &mark_and_push_closure, - purged_class); + CodeCache::do_unloading(is_alive_closure(), purged_class); cm->follow_marking_stacks(); // Flush marking stack. // Update subklass/sibling/implementor links of live klasses
--- a/src/share/vm/memory/genMarkSweep.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/memory/genMarkSweep.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -291,7 +291,7 @@ bool purged_class = SystemDictionary::do_unloading(&is_alive); // Follow code cache roots - CodeCache::do_unloading(&is_alive, &keep_alive, purged_class); + CodeCache::do_unloading(&is_alive, purged_class); follow_stack(); // Flush marking stack // Update subklass/sibling/implementor links of live klasses
--- a/src/share/vm/memory/metaspace.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/memory/metaspace.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -2518,7 +2518,7 @@ " waste " SIZE_FORMAT, curr_total, used, free, capacity, waste); } -#ifndef PRODUCT +#ifdef ASSERT void SpaceManager::mangle_freed_chunks() { for (ChunkIndex index = SmallIndex; index < NumberOfFreeLists; @@ -2536,7 +2536,7 @@ } } } -#endif // PRODUCT +#endif // ASSERT // MetaspaceAux
--- a/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -43,7 +43,7 @@ #ifdef TARGET_ARCH_ppc # include "bytes_ppc.hpp" #endif -// FIXME: add Deprecated, LVTT attributes +// FIXME: add Deprecated attribute // FIXME: fix Synthetic attribute // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes() @@ -135,6 +135,7 @@ u2 line_num_cnt = 0; int stackmap_len = 0; int local_variable_table_length = 0; + int local_variable_type_table_length = 0; // compute number and length of attributes int attr_count = 0; @@ -171,8 +172,8 @@ } if (method->has_localvariable_table()) { local_variable_table_length = method->localvariable_table_length(); - ++attr_count; if (local_variable_table_length != 0) { + ++attr_count; // Compute the size of the local variable table attribute (VM stores raw): // LocalVariableTable_attribute { // u2 attribute_name_index; @@ -186,6 +187,31 @@ // u2 index; // } attr_size += 2 + 4 + 2 + local_variable_table_length * (2 + 2 + 2 + 2 + 2); + + // Local variables with generic signatures must have LVTT entries + LocalVariableTableElement *elem = method->localvariable_table_start(); + for (int idx = 0; idx < local_variable_table_length; idx++) { + if (elem[idx].signature_cp_index != 0) { + local_variable_type_table_length++; + } + } + + if (local_variable_type_table_length != 0) { + ++attr_count; + // Compute the size of the local variable type table attribute (VM stores raw): + // LocalVariableTypeTable_attribute { + // u2 attribute_name_index; + // u4 attribute_length; + // u2 local_variable_type_table_length; + // { + // u2 start_pc; + // u2 length; + // u2 name_index; + // u2 signature_index; + // u2 index; + // } + attr_size += 2 + 4 + 2 + local_variable_type_table_length * (2 + 2 + 2 + 2 + 2); + } } } @@ -223,6 +249,9 @@ if (local_variable_table_length != 0) { write_local_variable_table_attribute(method, local_variable_table_length); } + if (local_variable_type_table_length != 0) { + write_local_variable_type_table_attribute(method, local_variable_type_table_length); + } } // Write Exceptions attribute @@ -387,7 +416,7 @@ } } -// Write LineNumberTable attribute +// Write LocalVariableTable attribute // JVMSpec| LocalVariableTable_attribute { // JVMSpec| u2 attribute_name_index; // JVMSpec| u4 attribute_length; @@ -417,6 +446,39 @@ } } +// Write LocalVariableTypeTable attribute +// JVMSpec| LocalVariableTypeTable_attribute { +// JVMSpec| u2 attribute_name_index; +// JVMSpec| u4 attribute_length; +// JVMSpec| u2 local_variable_type_table_length; +// JVMSpec| { u2 start_pc; +// JVMSpec| u2 length; +// JVMSpec| u2 name_index; +// JVMSpec| u2 signature_index; +// JVMSpec| u2 index; +// JVMSpec| } local_variable_type_table[local_variable_type_table_length]; +// JVMSpec| } +void JvmtiClassFileReconstituter::write_local_variable_type_table_attribute(methodHandle method, u2 num_entries) { + write_attribute_name_index("LocalVariableTypeTable"); + write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2)); + write_u2(num_entries); + + LocalVariableTableElement *elem = method->localvariable_table_start(); + for (int j=0; j<method->localvariable_table_length(); j++) { + if (elem->signature_cp_index > 0) { + // Local variable has a generic signature - write LVTT attribute entry + write_u2(elem->start_bci); + write_u2(elem->length); + write_u2(elem->name_cp_index); + write_u2(elem->signature_cp_index); + write_u2(elem->slot); + num_entries--; + } + elem++; + } + assert(num_entries == 0, "just checking"); +} + // Write stack map table attribute // JSR-202| StackMapTable_attribute { // JSR-202| u2 attribute_name_index;
--- a/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -120,6 +120,7 @@ u2 line_number_table_entries(methodHandle method); void write_line_number_table_attribute(methodHandle method, u2 num_entries); void write_local_variable_table_attribute(methodHandle method, u2 num_entries); + void write_local_variable_type_table_attribute(methodHandle method, u2 num_entries); void write_stackmap_table_attribute(methodHandle method, int stackmap_table_len); u2 inner_classes_attribute_length(); void write_inner_classes_attribute(int length);
--- a/src/share/vm/runtime/arguments.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/arguments.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -1991,6 +1991,11 @@ } #endif // SPARC + if (PrintNMTStatistics && MemTracker::tracking_level() == MemTracker::NMT_off) { + warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); + PrintNMTStatistics = false; + } + return status; }
--- a/src/share/vm/runtime/globals.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/globals.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -863,6 +863,9 @@ product(ccstr, NativeMemoryTracking, "off", \ "Native memory tracking options") \ \ + diagnostic(bool, PrintNMTStatistics, false, \ + "Print native memory tracking summary data if it is on") \ + \ diagnostic(bool, LogCompilation, false, \ "Log compilation activity in detail to hotspot.log or LogFile") \ \
--- a/src/share/vm/runtime/java.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/java.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -56,6 +56,8 @@ #include "runtime/task.hpp" #include "runtime/timer.hpp" #include "runtime/vm_operations.hpp" +#include "services/memReporter.hpp" +#include "services/memTracker.hpp" #include "trace/tracing.hpp" #include "trace/traceEventTypes.hpp" #include "utilities/dtrace.hpp" @@ -359,6 +361,15 @@ } #endif // COMPILER2 #endif // ENABLE_ZAP_DEAD_LOCALS + // Native memory tracking data + if (PrintNMTStatistics) { + if (MemTracker::is_on()) { + BaselineTTYOutputer outputer(tty); + MemTracker::print_memory_usage(outputer, K, false); + } else { + tty->print_cr(MemTracker::reason()); + } + } } #else // PRODUCT MODE STATISTICS @@ -376,6 +387,16 @@ if (PrintBiasedLockingStatistics) { BiasedLocking::print_counters(); } + + // Native memory tracking data + if (PrintNMTStatistics) { + if (MemTracker::is_on()) { + BaselineTTYOutputer outputer(tty); + MemTracker::print_memory_usage(outputer, K, false); + } else { + tty->print_cr(MemTracker::reason()); + } + } } #endif
--- a/src/share/vm/runtime/os.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/os.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -201,14 +201,21 @@ } } - +// The mapping from OS priority back to Java priority may be inexact because +// Java priorities can map M:1 with native priorities. If you want the definite +// Java priority then use JavaThread::java_priority() OSReturn os::get_priority(const Thread* const thread, ThreadPriority& priority) { int p; int os_prio; OSReturn ret = get_native_priority(thread, &os_prio); if (ret != OS_OK) return ret; - for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ; + if (java_to_os_priority[MaxPriority] > java_to_os_priority[MinPriority]) { + for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ; + } else { + // niceness values are in reverse order + for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] < os_prio; p--) ; + } priority = (ThreadPriority)p; return OS_OK; }
--- a/src/share/vm/runtime/os.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/os.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -387,7 +387,7 @@ static void pd_start_thread(Thread* thread); static void start_thread(Thread* thread); - static void initialize_thread(); + static void initialize_thread(Thread* thr); static void free_thread(OSThread* osthread); // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit
--- a/src/share/vm/runtime/thread.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/runtime/thread.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -308,19 +308,25 @@ // initialize structure dependent on thread local storage ThreadLocalStorage::set_thread(this); - - // set up any platform-specific state. - os::initialize_thread(); } void Thread::record_stack_base_and_size() { set_stack_base(os::current_stack_base()); set_stack_size(os::current_stack_size()); - - // record thread's native stack, stack grows downward - address low_stack_addr = stack_base() - stack_size(); - MemTracker::record_thread_stack(low_stack_addr, stack_size(), this, - CURRENT_PC); + // CR 7190089: on Solaris, primordial thread's stack is adjusted + // in initialize_thread(). Without the adjustment, stack size is + // incorrect if stack is set to unlimited (ulimit -s unlimited). + // So far, only Solaris has real implementation of initialize_thread(). + // + // set up any platform-specific state. + os::initialize_thread(this); + + // record thread's native stack, stack grows downward + if (MemTracker::is_on()) { + address stack_low_addr = stack_base() - stack_size(); + MemTracker::record_thread_stack(stack_low_addr, stack_size(), this, + CURRENT_PC); + } } @@ -836,7 +842,11 @@ void Thread::print_on(outputStream* st) const { // get_priority assumes osthread initialized if (osthread() != NULL) { - st->print("prio=%d tid=" INTPTR_FORMAT " ", get_priority(this), this); + int os_prio; + if (os::get_native_priority(this, &os_prio) == OS_OK) { + st->print("os_prio=%d ", os_prio); + } + st->print("tid=" INTPTR_FORMAT " ", this); osthread()->print_on(st); } debug_only(if (WizardMode) print_owned_locks_on(st);) @@ -2743,7 +2753,11 @@ void JavaThread::print_on(outputStream *st) const { st->print("\"%s\" ", get_thread_name()); oop thread_oop = threadObj(); - if (thread_oop != NULL && java_lang_Thread::is_daemon(thread_oop)) st->print("daemon "); + if (thread_oop != NULL) { + st->print("#" INT64_FORMAT " ", java_lang_Thread::thread_id(thread_oop)); + if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon "); + st->print("prio=%d ", java_lang_Thread::priority(thread_oop)); + } Thread::print_on(st); // print guess for valid stack memory region (assume 4K pages); helps lock debugging st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12)); @@ -4270,8 +4284,10 @@ st->cr(); Universe::heap()->print_gc_threads_on(st); WatcherThread* wt = WatcherThread::watcher_thread(); - if (wt != NULL) wt->print_on(st); - st->cr(); + if (wt != NULL) { + wt->print_on(st); + st->cr(); + } CompileBroker::print_compiler_threads_on(st); st->flush(); }
--- a/src/share/vm/services/management.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/services/management.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -1804,31 +1804,37 @@ class ThreadTimesClosure: public ThreadClosure { private: - objArrayOop _names; + objArrayHandle _names_strings; + char **_names_chars; typeArrayOop _times; int _names_len; int _times_len; int _count; public: - ThreadTimesClosure(objArrayOop names, typeArrayOop times); + ThreadTimesClosure(objArrayHandle names, typeArrayOop times); + ~ThreadTimesClosure(); virtual void do_thread(Thread* thread); + void do_unlocked(); int count() { return _count; } }; -ThreadTimesClosure::ThreadTimesClosure(objArrayOop names, +ThreadTimesClosure::ThreadTimesClosure(objArrayHandle names, typeArrayOop times) { - assert(names != NULL, "names was NULL"); + assert(names() != NULL, "names was NULL"); assert(times != NULL, "times was NULL"); - _names = names; + _names_strings = names; _names_len = names->length(); + _names_chars = NEW_C_HEAP_ARRAY(char*, _names_len, mtInternal); _times = times; _times_len = times->length(); _count = 0; } +// +// Called with Threads_lock held +// void ThreadTimesClosure::do_thread(Thread* thread) { - Handle s; assert(thread != NULL, "thread was NULL"); // exclude externally visible JavaThreads @@ -1842,16 +1848,32 @@ } EXCEPTION_MARK; + ResourceMark rm(THREAD); // thread->name() uses ResourceArea assert(thread->name() != NULL, "All threads should have a name"); - s = java_lang_String::create_from_str(thread->name(), CHECK); - _names->obj_at_put(_count, s()); - + _names_chars[_count] = strdup(thread->name()); _times->long_at_put(_count, os::is_thread_cpu_time_supported() ? os::thread_cpu_time(thread) : -1); _count++; } +// Called without Threads_lock, we can allocate String objects. +void ThreadTimesClosure::do_unlocked() { + + EXCEPTION_MARK; + for (int i = 0; i < _count; i++) { + Handle s = java_lang_String::create_from_str(_names_chars[i], CHECK); + _names_strings->obj_at_put(i, s()); + } +} + +ThreadTimesClosure::~ThreadTimesClosure() { + for (int i = 0; i < _count; i++) { + free(_names_chars[i]); + } + FREE_C_HEAP_ARRAY(char *, _names_chars, mtInternal); +} + // Fills names with VM internal thread names and times with the corresponding // CPU times. If names or times is NULL, a NullPointerException is thrown. // If the element type of names is not String, an IllegalArgumentException is @@ -1878,12 +1900,12 @@ typeArrayOop ta = typeArrayOop(JNIHandles::resolve_non_null(times)); typeArrayHandle times_ah(THREAD, ta); - ThreadTimesClosure ttc(names_ah(), times_ah()); + ThreadTimesClosure ttc(names_ah, times_ah()); { MutexLockerEx ml(Threads_lock); Threads::threads_do(&ttc); } - + ttc.do_unlocked(); return ttc.count(); JVM_END
--- a/src/share/vm/services/memTracker.cpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/services/memTracker.cpp Fri Sep 28 10:16:29 2012 -0700 @@ -71,8 +71,13 @@ _tracking_level = NMT_off; if (strncmp(option_line, "=summary", 8) == 0) { _tracking_level = NMT_summary; - } else if (strncmp(option_line, "=detail", 8) == 0) { + } else if (strncmp(option_line, "=detail", 7) == 0) { _tracking_level = NMT_detail; + } else { + char msg[255]; + //+1 to remove the '=' character + jio_snprintf(msg, 255, "Unknown option given to XX:NativeMemoryTracking: %s", option_line+1); + vm_exit_during_initialization(msg, NULL); } } @@ -341,6 +346,7 @@ */ void MemTracker::create_memory_record(address addr, MEMFLAGS flags, size_t size, address pc, Thread* thread) { + assert(addr != NULL, "Sanity check"); if (!shutdown_in_progress()) { // single thread, we just write records direct to global recorder,' // with any lock
--- a/src/share/vm/services/memTracker.hpp Thu Sep 27 15:49:48 2012 -0700 +++ b/src/share/vm/services/memTracker.hpp Fri Sep 28 10:16:29 2012 -0700 @@ -85,7 +85,7 @@ NMT_shutdown // shutdown }; - + public: // native memory tracking level enum NMTLevel { NMT_off, // native memory tracking is off @@ -93,7 +93,6 @@ NMT_detail // track callsite also }; - public: enum ShutdownReason { NMT_shutdown_none, // no shutdown requested NMT_shutdown_user, // user requested shutdown @@ -117,6 +116,10 @@ _state >= NMT_bootstrapping_single_thread); } + static inline enum NMTLevel tracking_level() { + return _tracking_level; + } + // user readable reason for shutting down NMT static const char* reason() { switch(_reason) { @@ -185,6 +188,7 @@ static inline void record_malloc(address addr, size_t size, MEMFLAGS flags, address pc = 0, Thread* thread = NULL) { if (NMT_CAN_TRACK(flags)) { + assert(size > 0, "Sanity check"); create_memory_record(addr, (flags|MemPointerRecord::malloc_tag()), size, pc, thread); } } @@ -198,6 +202,7 @@ static inline void record_realloc(address old_addr, address new_addr, size_t size, MEMFLAGS flags, address pc = 0, Thread* thread = NULL) { if (is_on()) { + assert(size > 0, "Sanity check"); record_free(old_addr, flags, thread); record_malloc(new_addr, size, flags, pc, thread); } @@ -208,6 +213,7 @@ // we add a positive offset to arena address, so we can have arena size record // sorted after arena record if (is_on() && !UseMallocOnly) { + assert(addr != NULL, "Sanity check"); create_memory_record((addr + sizeof(void*)), MemPointerRecord::arena_size_tag(), size, 0, NULL); } @@ -217,7 +223,7 @@ static inline void record_virtual_memory_reserve(address addr, size_t size, address pc = 0, Thread* thread = NULL) { if (is_on()) { - assert(size > 0, "reserve szero size"); + assert(size > 0, "Sanity check"); create_memory_record(addr, MemPointerRecord::virtual_memory_reserve_tag(), size, pc, thread); } @@ -248,6 +254,7 @@ static inline void record_virtual_memory_commit(address addr, size_t size, address pc = 0, Thread* thread = NULL) { if (is_on()) { + assert(size > 0, "Sanity check"); create_memory_record(addr, MemPointerRecord::virtual_memory_commit_tag(), size, DEBUG_CALLER_PC, thread); } @@ -257,6 +264,7 @@ static inline void record_virtual_memory_uncommit(address addr, size_t size, Thread* thread = NULL) { if (is_on()) { + assert(size > 0, "Sanity check"); create_memory_record(addr, MemPointerRecord::virtual_memory_uncommit_tag(), size, DEBUG_CALLER_PC, thread); } @@ -266,6 +274,7 @@ static inline void record_virtual_memory_release(address addr, size_t size, Thread* thread = NULL) { if (is_on()) { + assert(size > 0, "Sanity check"); create_memory_record(addr, MemPointerRecord::virtual_memory_release_tag(), size, DEBUG_CALLER_PC, thread); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/7194254/Test7194254.java Fri Sep 28 10:16:29 2012 -0700 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7194254 + * @summary Creates several threads with different java priorities and checks + * whether jstack reports correct priorities for them. + * + * @run main T7194254 + */ + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CyclicBarrier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Test7194254 { + + public static void main(String[] args) throws Exception { + final int NUMBER_OF_JAVA_PRIORITIES = + Thread.MAX_PRIORITY - Thread.MIN_PRIORITY + 1; + final CyclicBarrier barrier = + new CyclicBarrier(NUMBER_OF_JAVA_PRIORITIES + 1); + + for (int p = Thread.MIN_PRIORITY; p <= Thread.MAX_PRIORITY; ++p) { + final int priority = p; + new Thread("Priority=" + p) { + { + setPriority(priority); + } + public void run() { + try { + barrier.await(); // 1st + barrier.await(); // 2nd + } catch (Exception exc) { + // ignore + } + } + }.start(); + } + barrier.await(); // 1st + + int matches = 0; + List<String> failed = new ArrayList<>(); + try { + String pid = getPid(); + String jstack = System.getProperty("java.home") + "/../bin/jstack"; + Process process = new ProcessBuilder(jstack, pid) + .redirectErrorStream(true).start(); + Pattern pattern = Pattern.compile( + "\\\"Priority=(\\d+)\\\".* prio=(\\d+).*"); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(process.getInputStream()))) { + String line; + while((line = reader.readLine()) != null) { + Matcher matcher = pattern.matcher(line); + if (matcher.matches()) { + matches += 1; + String expected = matcher.group(1); + String actual = matcher.group(2); + if (!expected.equals(actual)) { + failed.add(line); + } + } + } + } + barrier.await(); // 2nd + } finally { + barrier.reset(); + } + + if (matches != NUMBER_OF_JAVA_PRIORITIES) { + throw new AssertionError("matches: expected " + + NUMBER_OF_JAVA_PRIORITIES + ", but was " + matches); + } + if (!failed.isEmpty()) { + throw new AssertionError(failed.size() + ":" + failed); + } + System.out.println("Test passes."); + } + + static String getPid() { + RuntimeMXBean runtimebean = ManagementFactory.getRuntimeMXBean(); + String vmname = runtimebean.getName(); + int i = vmname.indexOf('@'); + if (i != -1) { + vmname = vmname.substring(0, i); + } + return vmname; + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/7196045/Test7196045.java Fri Sep 28 10:16:29 2012 -0700 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * @test + * @bug 7196045 + * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API. + * @run main/othervm + */ + +import java.lang.management.ManagementFactory; +import javax.management.JMException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + +public class Test7196045 { + + public static long duration = 1000 * 60 * 2; + private static final String HOTSPOT_INTERNAL = "sun.management:type=HotspotInternal"; + + public static void main(String[] args) { + + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + ObjectName objName= null; + try { + ObjectName hotspotInternal = new ObjectName(HOTSPOT_INTERNAL); + try { + server.registerMBean(new sun.management.HotspotInternal(), hotspotInternal); + } catch (JMException e) { + throw new RuntimeException("HotSpotWatcher: Failed to register the HotspotInternal MBean" + e); + } + objName= new ObjectName("sun.management:type=HotspotThreading"); + + } catch (MalformedObjectNameException e1) { + throw new RuntimeException("Bad object name" + e1); + } + + long endTime = System.currentTimeMillis() + duration; + long i = 0; + while (true) { + try { + server.getAttribute(objName, "InternalThreadCpuTimes"); + } catch (Exception ex) { + System.err.println("Exception while getting attribute: " + ex); + } + i++; + if (i % 10000 == 0) { + System.out.println("Successful iterations: " + i); + } + if (System.currentTimeMillis() > endTime) { + break; + } + } + System.out.println("PASSED."); + } +}