This commit is contained in:
J. Duke 2017-07-05 18:24:25 +02:00
commit 9817a2f423
495 changed files with 7120 additions and 25226 deletions

View File

@ -179,3 +179,4 @@ c1a277c6022affbc6855bdfb039511e73fbe2395 jdk8-b54
b85b44cced2406792cfb9baab1377ff03e7001d8 jdk8-b55
76844579fa4b30929731115b237e477181a82394 jdk8-b56
522dfac8ca4d07c0b74025d4ac3b6e5feefbb829 jdk8-b57
9367024804874faf8e958adeb333682bab1c0c47 jdk8-b58

View File

@ -179,3 +179,4 @@ d20d9eb9f093adbf392918c703960ad24c93a331 jdk8-b50
e8a0e84383d6fbd303ce44bd355fb25972b13286 jdk8-b55
bf1bb47414e178beff67dc255fc3b97bf401f679 jdk8-b56
f3ab4163ae012965fc8acdfc25ce0fece8d6906d jdk8-b57
18462a19f7bd66d38015f61ea549a5e0c0c889a3 jdk8-b58

View File

@ -279,3 +279,5 @@ af0c8a0808516317333dcf9af15567cdd52761ce jdk8-b55
9b076bc3ab67d42d1d02144ef8dcd6006a7fc0d6 hs25-b01
d70102c4cb73158902acaa6016f47c7bc14e0d67 jdk8-b57
5f54277c67f755a377999bff904ab48aa63ddaf9 hs25-b02
6bb378c50828e9d76fb2653d1712c66ea8fc47db jdk8-b58
f2e12eb74117c917c0bb264694c02de4a6a15a10 hs25-b03

View File

@ -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");
}
}
}

View File

@ -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 @@ endif
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 @@ com.sun.java.swing.ui
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 \

View File

@ -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

View File

@ -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

View File

@ -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 @@ static task_t getTask(JNIEnv *env, jobject this_obj) {
#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_ENTER(env);
}
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);
}

View File

@ -36,25 +36,33 @@ SOURCES = salibelf.c \
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 @@ ifneq ($(_HAS_HASH_STYLE_GNU),)
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 @@ test: test.o
$(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS)
clean:
rm -rf $(LIBSA)
rm -rf $(OBJS)
rmdir $(ARCH)
rm -fr $(ARCH)

View File

@ -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 @@ SUNWprivate_1.1 {
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;

View File

@ -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 @@ RM := /usr/bin/rm
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 @@ else
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 @@ javahomecheck::
exit 1 ; \
fi
i386:: javahomecheck
i386 amd64 sparc sparcv9:: 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
$(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

View File

@ -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 @@ SUNWprivate_1.1 {
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:
*;
};

View File

@ -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_LIB32=$(WINDBG_HOME)/sdk/lib/i386
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 @@ ia64: ia64/$(SAWINDBGDLL)
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

View File

@ -42,6 +42,7 @@ import sun.jvm.hotspot.memory.*;
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 @@ public class CommandProcessor {
}
}
},
// 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();

View File

@ -43,10 +43,6 @@ import sun.jvm.hotspot.utilities.*;
* 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 @@ public class HotSpotAgent {
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() {

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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 {
}

View File

@ -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);
}
}

View File

@ -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 Disassembler(long startPc, byte[] code) {
public class Disassembler {
private static String options = "";
private static long decode_function;
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);
}
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 long getStartPC() {
return startPc;
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();
}
public byte[] getCode() {
return code;
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);
}
}

View File

@ -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);
}
}

View File

@ -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 {
}

View File

@ -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);
}

View File

@ -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 @@ package sun.jvm.hotspot.asm;
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();
}

View File

@ -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();
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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
};
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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
});
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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];
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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];
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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];
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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];
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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
});
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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";
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

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