提交 dc9281d1 编写于 作者: O ohair

Merge

......@@ -8,3 +8,4 @@ b6d6877c1155621a175dccd12dc14c54f938fb8b jdk7-b30
b7474b739d13bacd9972f88ac91f6350b7b0be12 jdk7-b31
c51121419e30eac5f0fbbce45ff1711c4ce0de28 jdk7-b32
fa4c0a6cdd25d97d4e6f5d7aa180bcbb0e0d56af jdk7-b33
434055a0716ee44bca712ebca02fc04b20e6e288 jdk7-b34
......@@ -451,7 +451,7 @@ vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
# namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
# relatives.
#
VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/include$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/javavm/include
VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
vpath %.h $(VPATH.h)
#
......
......@@ -57,7 +57,7 @@ SUNWprivate_1.1 {
Java_java_net_Inet6AddressImpl_isReachable0;
Java_java_net_NetworkInterface_init;
Java_java_net_NetworkInterface_getByName0;
Java_java_net_NetworkInterface_getByIndex;
Java_java_net_NetworkInterface_getByIndex0;
Java_java_net_NetworkInterface_getByInetAddress0;
Java_java_net_NetworkInterface_getAll;
Java_java_net_NetworkInterface_isUp0;
......
#
# Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -52,12 +52,6 @@ FILES_c = \
check_code.c \
check_format.c
#
# libverify.so needs these 2 header files (opcodes.h opcodes.length)
# from the VM.
#
CPPFLAGS += -I$(SHARE_SRC)/javavm/include
#
# Targets.
#
......
......@@ -145,7 +145,6 @@ Notes on using CND (C/C++ pack) with this project and NetBeans.
(a somewhat complete list of awt and 2d native directories on windows):
../../src/share/javavm/export;
../../src/share/javavm/include;
../../src/share/native/common;
../../src/share/native/sun/awt/debug;
../../src/share/native/sun/awt/image/cvutils;
......
/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -37,7 +37,6 @@
#include "bool.h"
#include "utf.h"
#include "tree.h"
#include "sys_api.h"
extern bool_t verify_class_codes(ClassClass *cb);
......
/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -41,7 +41,6 @@
#include "ArrayReferenceImpl.h"
#include "EventRequestImpl.h"
#include "StackFrameImpl.h"
#include "typedefs.h"
static void **l1Array;
......
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -48,7 +48,6 @@
#include "util.h"
#include "proc_md.h"
#include "typedefs.h"
/* Maximim length of a message */
#define MAX_MESSAGE_LEN MAXPATHLEN*2+512
......
/*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -30,7 +30,6 @@
#include "bag.h"
#include "commonRef.h"
#include "FrameID.h"
#include "typedefs.h"
#define INITIAL_REF_ALLOC 50
#define SMALLEST(a, b) ((a) < (b)) ? (a) : (b)
......
/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,8 +26,6 @@
#ifndef JDWP_OUTSTREAM_H
#define JDWP_OUTSTREAM_H
#include "typedefs.h"
#include "transport.h"
#include "FrameID.h"
......
......@@ -203,11 +203,17 @@ public final class NetworkInterface {
}
/**
* Get the index of this network interface.
* Returns the index of this network interface. The index is an integer greater
* or equal to zero, or {@code -1} for unknown. This is a system specific value
* and interfaces with the same name can have different indexes on different
* machines.
*
* @return the index of this network interface
* @return the index of this network interface or {@code -1} if the index is
* unknown
* @see #getByIndex(int)
* @since 1.7
*/
int getIndex() {
public int getIndex() {
return index;
}
......@@ -249,11 +255,18 @@ public final class NetworkInterface {
* Get a network interface given its index.
*
* @param index an integer, the index of the interface
* @return the NetworkInterface obtained from its index
* @exception SocketException if an I/O error occurs.
* @return the NetworkInterface obtained from its index, or {@code null} if
* there is no interface with such an index on the system
* @throws SocketException if an I/O error occurs.
* @throws IllegalArgumentException if index has a negative value
* @see #getIndex()
* @since 1.7
*/
native static NetworkInterface getByIndex(int index)
throws SocketException;
public static NetworkInterface getByIndex(int index) throws SocketException {
if (index < 0)
throw new IllegalArgumentException("Interface index can't be negative");
return getByIndex0(index);
}
/**
* Convenience method to search for a network interface that
......@@ -325,6 +338,9 @@ public final class NetworkInterface {
private native static NetworkInterface getByName0(String name)
throws SocketException;
private native static NetworkInterface getByIndex0(int index)
throws SocketException;
private native static NetworkInterface getByInetAddress0(InetAddress addr)
throws SocketException;
......
......@@ -142,14 +142,18 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
*
* <P>The <code>backlog</code> argument must be a positive
* value greater than 0. If the value passed is equal or less
* than 0, then the default value will be assumed.
* The <code>backlog</code> argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
*
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* @param backlog the maximum length of the queue.
* @param backlog requested maximum length of the queue of incoming
* connections.
*
* @exception IOException if an I/O error occurs when opening the socket.
* @exception SecurityException
......@@ -187,13 +191,17 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
*
* <P>The <code>backlog</code> argument must be a positive
* value greater than 0. If the value passed is equal or less
* than 0, then the default value will be assumed.
* The <code>backlog</code> argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* @param backlog the listen backlog
* @param backlog requested maximum length of the queue of incoming
* connections.
* @param bindAddr the local InetAddress the server will bind to
*
* @throws SecurityException if a security manager exists and
......@@ -321,11 +329,15 @@ class ServerSocket implements java.io.Closeable {
* If the address is <code>null</code>, then the system will pick up
* an ephemeral port and a valid local address to bind the socket.
* <P>
* The <code>backlog</code> argument must be a positive
* value greater than 0. If the value passed is equal or less
* than 0, then the default value will be assumed.
* The <code>backlog</code> argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* @param endpoint The IP address & port number to bind to.
* @param backlog The listen backlog length.
* @param backlog requested maximum length of the queue of
* incoming connections.
* @throws IOException if the bind operation fails, or if the socket
* is already bound.
* @throws SecurityException if a <code>SecurityManager</code> is present and
......
......@@ -432,4 +432,11 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
Object writeReplace() {
return new SerializationProxy<E>(this);
}
// readObject method for the serialization proxy pattern
// See Effective Java, Second Ed., Item 78.
private void readObject(java.io.ObjectInputStream stream)
throws java.io.InvalidObjectException {
throw new java.io.InvalidObjectException("Proxy required");
}
}
......@@ -108,9 +108,12 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* The <code>backlog</code> argument must be a positive
* value greater than 0. If the value passed if equal or less
* than 0, then the default value will be assumed.
* The <code>backlog</code> argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* If there is a security manager, its <code>checkListen</code>
* method is called with the <code>port</code> argument as its
......@@ -118,8 +121,8 @@ public abstract class SSLServerSocket extends ServerSocket
* in a SecurityException.
*
* @param port the port on which to listen
* @param backlog how many connections may be pending before
* the system should start rejecting new requests
* @param backlog requested maximum length of the queue of incoming
* connections.
* @throws IOException if an I/O error occurs when creating the socket
* @throws SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation.
......@@ -150,16 +153,19 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* <P>The <code>backlog</code> argument must be a positive
* value greater than 0. If the value passed if equal or less
* than 0, then the default value will be assumed.
* The <code>backlog</code> argument is the requested maximum number of
* pending connections on the socket. Its exact semantics are implementation
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* If <i>address</i> is null, it will default accepting connections
* on any/all local addresses.
*
* @param port the port on which to listen
* @param backlog how many connections may be pending before
* the system should start rejecting new requests
* @param backlog requested maximum length of the queue of incoming
* connections.
* @param address the address of the network interface through
* which connections will be accepted
* @throws IOException if an I/O error occurs when creating the socket
......
/*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -50,6 +50,7 @@ class DerIndefLenConverter {
private byte[] data, newData;
private int newDataPos, dataPos, dataSize, index;
private int unresolved = 0;
private ArrayList<Object> ndefsList = new ArrayList<Object>();
......@@ -113,6 +114,7 @@ class DerIndefLenConverter {
numOfEncapsulatedLenBytes;
byte[] sectionLenBytes = getLengthBytes(sectionLen);
ndefsList.set(index, sectionLenBytes);
unresolved--;
// Add the number of bytes required to represent this section
// to the total number of length bytes,
......@@ -149,6 +151,7 @@ class DerIndefLenConverter {
int lenByte = data[dataPos++] & 0xff;
if (isIndefinite(lenByte)) {
ndefsList.add(new Integer(dataPos));
unresolved++;
return curLen;
}
if (isLongForm(lenByte)) {
......@@ -308,15 +311,21 @@ class DerIndefLenConverter {
dataPos=0; index=0;
dataSize = data.length;
int len=0;
int unused = 0;
// parse and set up the vectors of all the indefinite-lengths
while (dataPos < dataSize) {
parseTag();
len = parseLength();
parseValue(len);
if (unresolved == 0) {
unused = dataSize - dataPos;
dataSize = dataPos;
break;
}
}
newData = new byte[dataSize + numOfTotalLenBytes];
newData = new byte[dataSize + numOfTotalLenBytes + unused];
dataPos=0; newDataPos=0; index=0;
// write out the new byte array replacing all the indefinite-lengths
......@@ -325,6 +334,8 @@ class DerIndefLenConverter {
writeTag();
writeLengthAndValue();
}
System.arraycopy(indefData, dataSize,
newData, dataSize + numOfTotalLenBytes, unused);
return newData;
}
......
......@@ -56,7 +56,7 @@ public class JMap {
private static String FORCE_SA_OPTION = "-F";
// Default option (if nothing provided)
private static String DEFAULT_OPTION = "-heap";
private static String DEFAULT_OPTION = "-pmap";
public static void main(String[] args) throws Exception {
if (args.length == 0) {
......@@ -147,6 +147,7 @@ public class JMap {
// Invoke SA tool with the given arguments
private static void runTool(String option, String args[]) throws Exception {
String[][] tools = {
{ "-pmap", "sun.jvm.hotspot.tools.PMap" },
{ "-heap", "sun.jvm.hotspot.tools.HeapSummary" },
{ "-heap:format=b", "sun.jvm.hotspot.tools.HeapDumper" },
{ "-histo", "sun.jvm.hotspot.tools.ObjectHistogram" },
......
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -23,15 +23,14 @@
* have any questions.
*/
#include <jni.h>
#include "JPLISAgent.h"
#include "JPLISAssert.h"
#include "Utilities.h"
#include "JavaExceptions.h"
#include "FileSystemSupport.h" /* For uintptr_t */
#include "sun_instrument_InstrumentationImpl.h"
#include "typedefs.h"
/*
* Copyright 2003 Wily Technology, Inc.
......
......@@ -38,10 +38,9 @@
#include "JavaExceptions.h"
#include "EncodingSupport.h"
#include "FileSystemSupport.h" /* MAXPATHLEN */
#include "FileSystemSupport.h" /* For MAXPATHLEN & uintptr_t */
#include "sun_instrument_InstrumentationImpl.h"
#include "typedefs.h"
/*
* The JPLISAgent manages the initialization all of the Java programming language Agents.
......
......@@ -948,90 +948,8 @@ JVM_ReleaseUTF(const char *utf);
JNIEXPORT jboolean JNICALL
JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
/* Constants in class files */
#define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */
#define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */
#define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */
#define JVM_ACC_STATIC 0x0008 /* instance variable is static */
#define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */
#define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */
#define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */
#define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */
#define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */
#define JVM_ACC_TRANSIENT 0x0080 /* not persistant */
#define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */
#define JVM_ACC_NATIVE 0x0100 /* implemented in C */
#define JVM_ACC_INTERFACE 0x0200 /* class is an interface */
#define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */
#define JVM_ACC_STRICT 0x0800 /* strict floating point */
#define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */
#define JVM_ACC_ANNOTATION 0x2000 /* annotation type */
#define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */
#define JVM_ACC_PUBLIC_BIT 0
#define JVM_ACC_PRIVATE_BIT 1
#define JVM_ACC_PROTECTED_BIT 2
#define JVM_ACC_STATIC_BIT 3
#define JVM_ACC_FINAL_BIT 4
#define JVM_ACC_SYNCHRONIZED_BIT 5
#define JVM_ACC_SUPER_BIT 5
#define JVM_ACC_VOLATILE_BIT 6
#define JVM_ACC_BRIDGE_BIT 6
#define JVM_ACC_TRANSIENT_BIT 7
#define JVM_ACC_VARARGS_BIT 7
#define JVM_ACC_NATIVE_BIT 8
#define JVM_ACC_INTERFACE_BIT 9
#define JVM_ACC_ABSTRACT_BIT 10
#define JVM_ACC_STRICT_BIT 11
#define JVM_ACC_SYNTHETIC_BIT 12
#define JVM_ACC_ANNOTATION_BIT 13
#define JVM_ACC_ENUM_BIT 14
enum {
JVM_CONSTANT_Utf8 = 1,
JVM_CONSTANT_Unicode, /* unused */
JVM_CONSTANT_Integer,
JVM_CONSTANT_Float,
JVM_CONSTANT_Long,
JVM_CONSTANT_Double,
JVM_CONSTANT_Class,
JVM_CONSTANT_String,
JVM_CONSTANT_Fieldref,
JVM_CONSTANT_Methodref,
JVM_CONSTANT_InterfaceMethodref,
JVM_CONSTANT_NameAndType
};
/* Used in the newarray instruction. */
#define JVM_T_BOOLEAN 4
#define JVM_T_CHAR 5
#define JVM_T_FLOAT 6
#define JVM_T_DOUBLE 7
#define JVM_T_BYTE 8
#define JVM_T_SHORT 9
#define JVM_T_INT 10
#define JVM_T_LONG 11
/* JVM method signatures */
#define JVM_SIGNATURE_ARRAY '['
#define JVM_SIGNATURE_BYTE 'B'
#define JVM_SIGNATURE_CHAR 'C'
#define JVM_SIGNATURE_CLASS 'L'
#define JVM_SIGNATURE_ENDCLASS ';'
#define JVM_SIGNATURE_ENUM 'E'
#define JVM_SIGNATURE_FLOAT 'F'
#define JVM_SIGNATURE_DOUBLE 'D'
#define JVM_SIGNATURE_FUNC '('
#define JVM_SIGNATURE_ENDFUNC ')'
#define JVM_SIGNATURE_INT 'I'
#define JVM_SIGNATURE_LONG 'J'
#define JVM_SIGNATURE_SHORT 'S'
#define JVM_SIGNATURE_VOID 'V'
#define JVM_SIGNATURE_BOOLEAN 'Z'
/* Get classfile constants */
#include "classfile_constants.h"
/*
* A function defined by the byte-code verifier and called by the VM.
......@@ -1329,23 +1247,6 @@ JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);
JNIEXPORT jint JNICALL
JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);
/*
* These routines are only reentrant on Windows
*/
#ifdef WIN32
JNIEXPORT struct protoent * JNICALL
JVM_GetProtoByName(char* name);
JNIEXPORT struct hostent* JNICALL
JVM_GetHostByAddr(const char* name, int len, int type);
JNIEXPORT struct hostent* JNICALL
JVM_GetHostByName(char* name);
#endif /* _WINDOWS */
JNIEXPORT int JNICALL
JVM_GetHostName(char* name, int namelen);
......
/*
* Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
#ifndef _JAVASOFT_OPCODES_H_
#define _JAVASOFT_OPCODES_H_
typedef enum {
opc_nop = 0,
opc_aconst_null = 1,
opc_iconst_m1 = 2,
opc_iconst_0 = 3,
opc_iconst_1 = 4,
opc_iconst_2 = 5,
opc_iconst_3 = 6,
opc_iconst_4 = 7,
opc_iconst_5 = 8,
opc_lconst_0 = 9,
opc_lconst_1 = 10,
opc_fconst_0 = 11,
opc_fconst_1 = 12,
opc_fconst_2 = 13,
opc_dconst_0 = 14,
opc_dconst_1 = 15,
opc_bipush = 16,
opc_sipush = 17,
opc_ldc = 18,
opc_ldc_w = 19,
opc_ldc2_w = 20,
opc_iload = 21,
opc_lload = 22,
opc_fload = 23,
opc_dload = 24,
opc_aload = 25,
opc_iload_0 = 26,
opc_iload_1 = 27,
opc_iload_2 = 28,
opc_iload_3 = 29,
opc_lload_0 = 30,
opc_lload_1 = 31,
opc_lload_2 = 32,
opc_lload_3 = 33,
opc_fload_0 = 34,
opc_fload_1 = 35,
opc_fload_2 = 36,
opc_fload_3 = 37,
opc_dload_0 = 38,
opc_dload_1 = 39,
opc_dload_2 = 40,
opc_dload_3 = 41,
opc_aload_0 = 42,
opc_aload_1 = 43,
opc_aload_2 = 44,
opc_aload_3 = 45,
opc_iaload = 46,
opc_laload = 47,
opc_faload = 48,
opc_daload = 49,
opc_aaload = 50,
opc_baload = 51,
opc_caload = 52,
opc_saload = 53,
opc_istore = 54,
opc_lstore = 55,
opc_fstore = 56,
opc_dstore = 57,
opc_astore = 58,
opc_istore_0 = 59,
opc_istore_1 = 60,
opc_istore_2 = 61,
opc_istore_3 = 62,
opc_lstore_0 = 63,
opc_lstore_1 = 64,
opc_lstore_2 = 65,
opc_lstore_3 = 66,
opc_fstore_0 = 67,
opc_fstore_1 = 68,
opc_fstore_2 = 69,
opc_fstore_3 = 70,
opc_dstore_0 = 71,
opc_dstore_1 = 72,
opc_dstore_2 = 73,
opc_dstore_3 = 74,
opc_astore_0 = 75,
opc_astore_1 = 76,
opc_astore_2 = 77,
opc_astore_3 = 78,
opc_iastore = 79,
opc_lastore = 80,
opc_fastore = 81,
opc_dastore = 82,
opc_aastore = 83,
opc_bastore = 84,
opc_castore = 85,
opc_sastore = 86,
opc_pop = 87,
opc_pop2 = 88,
opc_dup = 89,
opc_dup_x1 = 90,
opc_dup_x2 = 91,
opc_dup2 = 92,
opc_dup2_x1 = 93,
opc_dup2_x2 = 94,
opc_swap = 95,
opc_iadd = 96,
opc_ladd = 97,
opc_fadd = 98,
opc_dadd = 99,
opc_isub = 100,
opc_lsub = 101,
opc_fsub = 102,
opc_dsub = 103,
opc_imul = 104,
opc_lmul = 105,
opc_fmul = 106,
opc_dmul = 107,
opc_idiv = 108,
opc_ldiv = 109,
opc_fdiv = 110,
opc_ddiv = 111,
opc_irem = 112,
opc_lrem = 113,
opc_frem = 114,
opc_drem = 115,
opc_ineg = 116,
opc_lneg = 117,
opc_fneg = 118,
opc_dneg = 119,
opc_ishl = 120,
opc_lshl = 121,
opc_ishr = 122,
opc_lshr = 123,
opc_iushr = 124,
opc_lushr = 125,
opc_iand = 126,
opc_land = 127,
opc_ior = 128,
opc_lor = 129,
opc_ixor = 130,
opc_lxor = 131,
opc_iinc = 132,
opc_i2l = 133,
opc_i2f = 134,
opc_i2d = 135,
opc_l2i = 136,
opc_l2f = 137,
opc_l2d = 138,
opc_f2i = 139,
opc_f2l = 140,
opc_f2d = 141,
opc_d2i = 142,
opc_d2l = 143,
opc_d2f = 144,
opc_i2b = 145,
opc_i2c = 146,
opc_i2s = 147,
opc_lcmp = 148,
opc_fcmpl = 149,
opc_fcmpg = 150,
opc_dcmpl = 151,
opc_dcmpg = 152,
opc_ifeq = 153,
opc_ifne = 154,
opc_iflt = 155,
opc_ifge = 156,
opc_ifgt = 157,
opc_ifle = 158,
opc_if_icmpeq = 159,
opc_if_icmpne = 160,
opc_if_icmplt = 161,
opc_if_icmpge = 162,
opc_if_icmpgt = 163,
opc_if_icmple = 164,
opc_if_acmpeq = 165,
opc_if_acmpne = 166,
opc_goto = 167,
opc_jsr = 168,
opc_ret = 169,
opc_tableswitch = 170,
opc_lookupswitch = 171,
opc_ireturn = 172,
opc_lreturn = 173,
opc_freturn = 174,
opc_dreturn = 175,
opc_areturn = 176,
opc_return = 177,
opc_getstatic = 178,
opc_putstatic = 179,
opc_getfield = 180,
opc_putfield = 181,
opc_invokevirtual = 182,
opc_invokespecial = 183,
opc_invokestatic = 184,
opc_invokeinterface = 185,
opc_xxxunusedxxx = 186,
opc_new = 187,
opc_newarray = 188,
opc_anewarray = 189,
opc_arraylength = 190,
opc_athrow = 191,
opc_checkcast = 192,
opc_instanceof = 193,
opc_monitorenter = 194,
opc_monitorexit = 195,
opc_wide = 196,
opc_multianewarray = 197,
opc_ifnull = 198,
opc_ifnonnull = 199,
opc_goto_w = 200,
opc_jsr_w = 201,
opc_breakpoint = 202,
opc_ldc_quick = 203,
opc_ldc_w_quick = 204,
opc_ldc2_w_quick = 205,
opc_getfield_quick = 206,
opc_putfield_quick = 207,
opc_getfield2_quick = 208,
opc_putfield2_quick = 209,
opc_getstatic_quick = 210,
opc_putstatic_quick = 211,
opc_getstatic2_quick = 212,
opc_putstatic2_quick = 213,
opc_invokevirtual_quick = 214,
opc_invokenonvirtual_quick = 215,
opc_invokesuper_quick = 216,
opc_invokestatic_quick = 217,
opc_invokeinterface_quick = 218,
opc_invokevirtualobject_quick = 219,
opc_invokeignored_quick = 220,
opc_new_quick = 221,
opc_anewarray_quick = 222,
opc_multianewarray_quick = 223,
opc_checkcast_quick = 224,
opc_instanceof_quick = 225,
opc_invokevirtual_quick_w = 226,
opc_getfield_quick_w = 227,
opc_putfield_quick_w = 228,
opc_nonnull_quick = 229,
opc_first_unused_index = 230,
opc_software = 254,
opc_hardware = 255,
opc_dummy = (int)0xF0000000U /* portability change, opc_invokeinit in the
* verifier requires more than 8 bits.
*/
} opcode_type;
#endif /* !_JAVASOFT_OPCODES_H_ */
/*
* Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
const short opcode_length[256] = {
1, /* nop */
1, /* aconst_null */
1, /* iconst_m1 */
1, /* iconst_0 */
1, /* iconst_1 */
1, /* iconst_2 */
1, /* iconst_3 */
1, /* iconst_4 */
1, /* iconst_5 */
1, /* lconst_0 */
1, /* lconst_1 */
1, /* fconst_0 */
1, /* fconst_1 */
1, /* fconst_2 */
1, /* dconst_0 */
1, /* dconst_1 */
2, /* bipush */
3, /* sipush */
2, /* ldc */
3, /* ldc_w */
3, /* ldc2_w */
2, /* iload */
2, /* lload */
2, /* fload */
2, /* dload */
2, /* aload */
1, /* iload_0 */
1, /* iload_1 */
1, /* iload_2 */
1, /* iload_3 */
1, /* lload_0 */
1, /* lload_1 */
1, /* lload_2 */
1, /* lload_3 */
1, /* fload_0 */
1, /* fload_1 */
1, /* fload_2 */
1, /* fload_3 */
1, /* dload_0 */
1, /* dload_1 */
1, /* dload_2 */
1, /* dload_3 */
1, /* aload_0 */
1, /* aload_1 */
1, /* aload_2 */
1, /* aload_3 */
1, /* iaload */
1, /* laload */
1, /* faload */
1, /* daload */
1, /* aaload */
1, /* baload */
1, /* caload */
1, /* saload */
2, /* istore */
2, /* lstore */
2, /* fstore */
2, /* dstore */
2, /* astore */
1, /* istore_0 */
1, /* istore_1 */
1, /* istore_2 */
1, /* istore_3 */
1, /* lstore_0 */
1, /* lstore_1 */
1, /* lstore_2 */
1, /* lstore_3 */
1, /* fstore_0 */
1, /* fstore_1 */
1, /* fstore_2 */
1, /* fstore_3 */
1, /* dstore_0 */
1, /* dstore_1 */
1, /* dstore_2 */
1, /* dstore_3 */
1, /* astore_0 */
1, /* astore_1 */
1, /* astore_2 */
1, /* astore_3 */
1, /* iastore */
1, /* lastore */
1, /* fastore */
1, /* dastore */
1, /* aastore */
1, /* bastore */
1, /* castore */
1, /* sastore */
1, /* pop */
1, /* pop2 */
1, /* dup */
1, /* dup_x1 */
1, /* dup_x2 */
1, /* dup2 */
1, /* dup2_x1 */
1, /* dup2_x2 */
1, /* swap */
1, /* iadd */
1, /* ladd */
1, /* fadd */
1, /* dadd */
1, /* isub */
1, /* lsub */
1, /* fsub */
1, /* dsub */
1, /* imul */
1, /* lmul */
1, /* fmul */
1, /* dmul */
1, /* idiv */
1, /* ldiv */
1, /* fdiv */
1, /* ddiv */
1, /* irem */
1, /* lrem */
1, /* frem */
1, /* drem */
1, /* ineg */
1, /* lneg */
1, /* fneg */
1, /* dneg */
1, /* ishl */
1, /* lshl */
1, /* ishr */
1, /* lshr */
1, /* iushr */
1, /* lushr */
1, /* iand */
1, /* land */
1, /* ior */
1, /* lor */
1, /* ixor */
1, /* lxor */
3, /* iinc */
1, /* i2l */
1, /* i2f */
1, /* i2d */
1, /* l2i */
1, /* l2f */
1, /* l2d */
1, /* f2i */
1, /* f2l */
1, /* f2d */
1, /* d2i */
1, /* d2l */
1, /* d2f */
1, /* i2b */
1, /* i2c */
1, /* i2s */
1, /* lcmp */
1, /* fcmpl */
1, /* fcmpg */
1, /* dcmpl */
1, /* dcmpg */
3, /* ifeq */
3, /* ifne */
3, /* iflt */
3, /* ifge */
3, /* ifgt */
3, /* ifle */
3, /* if_icmpeq */
3, /* if_icmpne */
3, /* if_icmplt */
3, /* if_icmpge */
3, /* if_icmpgt */
3, /* if_icmple */
3, /* if_acmpeq */
3, /* if_acmpne */
3, /* goto */
3, /* jsr */
2, /* ret */
99, /* tableswitch */
99, /* lookupswitch */
1, /* ireturn */
1, /* lreturn */
1, /* freturn */
1, /* dreturn */
1, /* areturn */
1, /* return */
3, /* getstatic */
3, /* putstatic */
3, /* getfield */
3, /* putfield */
3, /* invokevirtual */
3, /* invokespecial */
3, /* invokestatic */
5, /* invokeinterface */
0, /* xxxunusedxxx */
3, /* new */
2, /* newarray */
3, /* anewarray */
1, /* arraylength */
1, /* athrow */
3, /* checkcast */
3, /* instanceof */
1, /* monitorenter */
1, /* monitorexit */
0, /* wide */
4, /* multianewarray */
3, /* ifnull */
3, /* ifnonnull */
5, /* goto_w */
5, /* jsr_w */
1, /* breakpoint */
2, /* ldc_quick */
3, /* ldc_w_quick */
3, /* ldc2_w_quick */
3, /* getfield_quick */
3, /* putfield_quick */
3, /* getfield2_quick */
3, /* putfield2_quick */
3, /* getstatic_quick */
3, /* putstatic_quick */
3, /* getstatic2_quick */
3, /* putstatic2_quick */
3, /* invokevirtual_quick */
3, /* invokenonvirtual_quick */
3, /* invokesuper_quick */
3, /* invokestatic_quick */
5, /* invokeinterface_quick */
3, /* invokevirtualobject_quick */
3, /* invokeignored_quick */
3, /* new_quick */
3, /* anewarray_quick */
4, /* multianewarray_quick */
3, /* checkcast_quick */
3, /* instanceof_quick */
3, /* invokevirtual_quick_w */
3, /* getfield_quick_w */
3, /* putfield_quick_w */
1, /* nonnull_quick */
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
};
# Copyright 1994-2007 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# Any line that doesn't have a-z in the 1st column is a comment.
#
# The first column is the name of the opcodes. The second column is the
# total length of the instruction. We use 99 for tableswitch and
# tablelookup, which must always be treated as special cases.
#
# The third and fourth colum give what the opcode pops off the stack, and
# what it then pushes back onto the stack
# - <no effect on stack>
# I integer
# L long integer
# F float
# D double float
# A address [array or object]
# O object only
# R return address (for jsr)
# a integer, array, or object
# ? unknown
# [I], [L], [F], [D], [A], [B], [C], [?]
# array of integer, long, float, double, address, bytes,
# chars, or anything
# 1,2,3,4,+ used by stack duplicating/popping routines.
#
# 1,2,3,4 represent >>any<< stack type except long or double. Two numbers
# separated by a + (in the third column) indicate that the two, together, can
# be used for a double or long. (Or they can represent two non-long items).
#
# The fifth column provides an *approximate* relative cost of executing the
# opcode. It is used by the instruction profiler. See profiler.h for
# blurb.
nop 1 - - 1 /* nop */
aconst_null 1 - A 1 /* push null object */
iconst_m1 1 - I 1 /* push integer constant -1 */
iconst_0 1 - I 1 /* push integer constant 0 */
iconst_1 1 - I 1 /* push integer constant 1 */
iconst_2 1 - I 1 /* push integer constant 2 */
iconst_3 1 - I 1 /* push integer constant 3 */
iconst_4 1 - I 1 /* push integer constant 4 */
iconst_5 1 - I 1 /* push integer constant 5 */
lconst_0 1 - L 1 /* push long 0L */
lconst_1 1 - L 1 /* push long 1L */
fconst_0 1 - F 1 /* push float constant 0.0 */
fconst_1 1 - F 1 /* push float constant 1.0 */
fconst_2 1 - F 1 /* push float constant 2.0 */
dconst_0 1 - D 1 /* push double float constant 0.0d */
dconst_1 1 - D 1 /* push double float constant 1.0d */
bipush 2 - I 1 /* push byte-sized value */
sipush 3 - I 1 /* push two-byte value */
ldc 2 - ? 1 /* load a const from constant table */
ldc_w 3 - ? 1
ldc2_w 3 - ? 1 /* load a 2-word constant . . . */
iload 2 - I 1 /* load local integer variable */
lload 2 - L 1 /* load local long variable */
fload 2 - F 1 /* load local floating variable */
dload 2 - D 1 /* load local double variable */
aload 2 - A 1 /* load local object variable */
iload_0 1 - I 1 /* load local integer variable #0 */
iload_1 1 - I 1 /* load local integer variable #1 */
iload_2 1 - I 1 /* load local integer variable #2 */
iload_3 1 - I 1 /* load local integer variable #3 */
lload_0 1 - L 1 /* load local long variable #0 */
lload_1 1 - L 1 /* load local long variable #1 */
lload_2 1 - L 1 /* load local long variable #2 */
lload_3 1 - L 1 /* load local long variable #3 */
fload_0 1 - F 1 /* load local float variable #0 */
fload_1 1 - F 1 /* load local float variable #1 */
fload_2 1 - F 1 /* load local float variable #2 */
fload_3 1 - F 1 /* load local float variable #3 */
dload_0 1 - D 1 /* load lcl double float variable #0 */
dload_1 1 - D 1 /* load lcl double float variable #1 */
dload_2 1 - D 1 /* load lcl double float variable #2 */
dload_3 1 - D 1 /* load lcl double float variable #3 */
aload_0 1 - A 1 /* load local object variable #0 */
aload_1 1 - A 1 /* load local object variable #1 */
aload_2 1 - A 1 /* load local object variable #2 */
aload_3 1 - A 1 /* load local object variable #3 */
iaload 1 [I]I I 1 /* load from array of integer */
laload 1 [L]I L 1 /* load from array of long */
faload 1 [F]I F 1 /* load from array of float */
daload 1 [D]I D 1 /* load from array of double */
aaload 1 [A]I A 1 /* load from array of object */
baload 1 [B]I I 1 /* load from array of (signed) bytes */
caload 1 [C]I I 1 /* load from array of chars */
saload 1 [S]I I 1 /* load from array of (signed) shorts */
istore 2 I - 1 /* store local integer variable */
lstore 2 L - 1 /* store local long variable */
fstore 2 F - 1 /* store local float variable */
dstore 2 D - 1 /* store local double variable */
astore 2 A - 1 /* store local object variable */
istore_0 1 I - 1 /* store local integer variable #0 */
istore_1 1 I - 1 /* store local integer variable #1 */
istore_2 1 I - 1 /* store local integer variable #2 */
istore_3 1 I - 1 /* store local integer variable #3 */
lstore_0 1 L - 1 /* store local long variable #0 */
lstore_1 1 L - 1 /* store local long variable #1 */
lstore_2 1 L - 1 /* store local long variable #2 */
lstore_3 1 L - 1 /* store local long variable #3 */
fstore_0 1 F - 1 /* store local float variable #0 */
fstore_1 1 F - 1 /* store local float variable #1 */
fstore_2 1 F - 1 /* store local float variable #2 */
fstore_3 1 F - 1 /* store local float variable #3 */
dstore_0 1 D - 1 /* store lcl double float variable #0 */
dstore_1 1 D - 1 /* store lcl double float variable #1 */
dstore_2 1 D - 1 /* store lcl double float variable #2 */
dstore_3 1 D - 1 /* store lcl double float variable #3 */
astore_0 1 A - 1 /* store local object variable #0 */
astore_1 1 A - 1 /* store local object variable #1 */
astore_2 1 A - 1 /* store local object variable #2 */
astore_3 1 A - 1 /* store local object variable #3 */
iastore 1 [I]II - 1 /* store into array of int */
lastore 1 [L]IL - 1 /* store into array of long */
fastore 1 [F]IF - 1 /* store into array of float */
dastore 1 [D]ID - 1 /* store into array of double float */
aastore 1 [A]IA - 1 /* store into array of object */
bastore 1 [B]II - 1 /* store into array of (signed) bytes */
castore 1 [C]II - 1 /* store into array of chars */
sastore 1 [S]II - 1 /* store into array of (signed) shorts*/
pop 1 1 - 1 /* pop top element */
pop2 1 2+1 - 1 /* pop top two elements */
dup 1 1 11 1 /* dup top element */
dup_x1 1 21 121 1 /* dup top element. Skip one */
dup_x2 1 3+21 1321 1 /* dup top element. Skip two */
dup2 1 2+1 2121 1 /* dup top two elements. */
dup2_x1 1 32+1 21321 1 /* dup top two elements. Skip one */
dup2_x2 1 4+32+1 214321 1 /* dup top two elements. Skip two */
swap 1 21 12 1 /* swap top two elements of stack. */
iadd 1 II I 1 /* integer add */
ladd 1 LL L 1 /* long add */
fadd 1 FF F 1 /* floating add */
dadd 1 DD D 1 /* double float add */
isub 1 II I 1 /* integer subtract */
lsub 1 LL L 1 /* long subtract */
fsub 1 FF F 1 /* floating subtract */
dsub 1 DD D 1 /* floating double subtract */
imul 1 II I 1 /* integer multiply */
lmul 1 LL L 1 /* long multiply */
fmul 1 FF F 1 /* floating multiply */
dmul 1 DD D 1 /* double float multiply */
idiv 1 II I 1 /* integer divide */
ldiv 1 LL L 1 /* long divide */
fdiv 1 FF F 1 /* floating divide */
ddiv 1 DD D 1 /* double float divide */
irem 1 II I 1 /* integer mod */
lrem 1 LL L 1 /* long mod */
frem 1 FF F 1 /* floating mod */
drem 1 DD D 1 /* double float mod */
ineg 1 I I 1 /* integer negate */
lneg 1 L L 1 /* long negate */
fneg 1 F F 1 /* floating negate */
dneg 1 D D 1 /* double float negate */
ishl 1 II I 1 /* shift left */
lshl 1 LI L 1 /* long shift left */
ishr 1 II I 1 /* shift right */
lshr 1 LI L 1 /* long shift right */
iushr 1 II I 1 /* unsigned shift right */
lushr 1 LI L 1 /* long unsigned shift right */
iand 1 II I 1 /* boolean and */
land 1 LL L 1 /* long boolean and */
ior 1 II I 1 /* boolean or */
lor 1 LL L 1 /* long boolean or */
ixor 1 II I 1 /* boolean xor */
lxor 1 LL L 1 /* long boolean xor */
iinc 3 - - 1 /* increment lcl variable by constant */
i2l 1 I L 1 /* integer to long */
i2f 1 I F 1 /* integer to float */
i2d 1 I D 1 /* integer to double */
l2i 1 L I 1 /* long to integer */
l2f 1 L F 1 /* long to float */
l2d 1 L D 1 /* long to double */
f2i 1 F I 1 /* float to integer */
f2l 1 F L 1 /* float to long */
f2d 1 F D 1 /* float to double */
d2i 1 D I 1 /* double to integer */
d2l 1 D L 1 /* double to long */
d2f 1 D F 1 /* double to float */
i2b 1 I I 1 /* integer to byte */
i2c 1 I I 1 /* integer to character */
i2s 1 I I 1 /* integer to signed short */
lcmp 1 LL I 1 /* long compare */
fcmpl 1 FF I 1 /* float compare. -1 on incomparable */
fcmpg 1 FF I 1 /* float compare. 1 on incomparable */
dcmpl 1 DD I 1 /* dbl floating cmp. -1 on incomp */
dcmpg 1 DD I 1 /* dbl floating cmp. 1 on incomp */
ifeq 3 I - 1 /* goto if equal */
ifne 3 I - 1 /* goto if not equal */
iflt 3 I - 1 /* goto if less than */
ifge 3 I - 1 /* goto if greater than or equal */
ifgt 3 I - 1 /* goto if greater than */
ifle 3 I - 1 /* goto if less than or equal */
if_icmpeq 3 II - 1 /* compare top two elements of stack */
if_icmpne 3 II - 1 /* compare top two elements of stack */
if_icmplt 3 II - 1 /* compare top two elements of stack */
if_icmpge 3 II - 1 /* compare top two elements of stack */
if_icmpgt 3 II - 1 /* compare top two elements of stack */
if_icmple 3 II - 1 /* compare top two elements of stack */
if_acmpeq 3 AA - 1 /* compare top two objects of stack */
if_acmpne 3 AA - 1 /* compare top two objects of stack */
goto 3 - - 1 /* unconditional goto */
jsr 3 - R 1 /* jump subroutine */
ret 2 - - 1 /* return from subroutine */
tableswitch 99 I - 1 /* goto (case) */
lookupswitch 99 I - 1 /* goto (case) */
ireturn 1 I - 1 /* return integer from procedure */
lreturn 1 L - 1 /* return long from procedure */
freturn 1 F - 1 /* return float from procedure */
dreturn 1 D - 1 /* return double from procedure */
areturn 1 A - 1 /* return object from procedure */
return 1 - - 1 /* return (void) from procedure */
getstatic 3 - ? 1 /* get static field value. */
putstatic 3 ? - 1 /* assign static field value */
getfield 3 A ? 1 /* get field value from object. */
putfield 3 ? - 1 /* assign field value to object. */
invokevirtual 3 ? ? 1 /* call method, based on object. */
invokespecial 3 ? ? 1 /* call method, not based on object. */
invokestatic 3 ? ? 1 /* call a static method. */
invokeinterface 5 ? ? 1 /* call an interface method */
xxxunusedxxx 0 ? ? 1 /* was newfromname */
new 3 - A 1 /* Create a new object */
newarray 2 I A 1 /* Create a new array of non-objects*/
anewarray 3 I A 1 /* Create a new array of objects */
arraylength 1 [?] I 1 /* get length of array */
athrow 1 O - 1 /* throw an exception */
checkcast 3 A A 1 /* error if object not of given type */
instanceof 3 A I 1 /* is object of given type? */
monitorenter 1 A - 1 /* enter a monitored region of code */
monitorexit 1 A - 1 /* exit a monitored region of code */
wide 0 - - 1 /* prefix operation. */
multianewarray 4 ? A 1 /* create multidimensional array */
ifnull 3 A - 1 /* goto if null */
ifnonnull 3 A - 1 /* goto if not null */
# The following instructions are "long" versions. They allow access to
# variables with index greater than 255.
goto_w 5 - - 1 /* unconditional goto. 4byte offset */
jsr_w 5 - R 1 /* jump subroutine. 4byte offset */
breakpoint 1 - - 1 /* call breakpoint handler */
# The compiler will not generate any of the following instructions. That
# are created by the interpreter from the non _quick versions of the
# instructions.
ldc_quick 2 - ? 1
ldc_w_quick 3 - ? 1
ldc2_w_quick 3 - ? 1
getfield_quick 3 A ? 1
putfield_quick 3 ? - 1
getfield2_quick 3 A ? 1
putfield2_quick 3 ? - 1
getstatic_quick 3 - ? 1
putstatic_quick 3 ? - 1
getstatic2_quick 3 - ? 1
putstatic2_quick 3 ? _ 1
invokevirtual_quick 3 ? ? 1
invokenonvirtual_quick 3 ? ? 1
invokesuper_quick 3 ? ? 1
invokestatic_quick 3 ? ? 1
invokeinterface_quick 5 ? ? 1
invokevirtualobject_quick 3 ? ? 1
invokeignored_quick 3 ? ? 1
new_quick 3 - A 1
anewarray_quick 3 I A 1
multianewarray_quick 4 ? A 1
checkcast_quick 3 A A 1
instanceof_quick 3 A I 1
# The following are generated when the offset is bigger than 255
invokevirtual_quick_w 3 ? ? 1
getfield_quick_w 3 A ? 1
putfield_quick_w 3 ? - 1
# used for simplification
nonnull_quick 1 A - 1 /* throw exception if stacktop null */
/*
* Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
char const opcode_weight[256] = {
1, /* nop */
1, /* aconst_null */
1, /* iconst_m1 */
1, /* iconst_0 */
1, /* iconst_1 */
1, /* iconst_2 */
1, /* iconst_3 */
1, /* iconst_4 */
1, /* iconst_5 */
1, /* lconst_0 */
1, /* lconst_1 */
1, /* fconst_0 */
1, /* fconst_1 */
1, /* fconst_2 */
1, /* dconst_0 */
1, /* dconst_1 */
1, /* bipush */
1, /* sipush */
1, /* ldc */
1, /* ldc_w */
1, /* ldc2_w */
1, /* iload */
1, /* lload */
1, /* fload */
1, /* dload */
1, /* aload */
1, /* iload_0 */
1, /* iload_1 */
1, /* iload_2 */
1, /* iload_3 */
1, /* lload_0 */
1, /* lload_1 */
1, /* lload_2 */
1, /* lload_3 */
1, /* fload_0 */
1, /* fload_1 */
1, /* fload_2 */
1, /* fload_3 */
1, /* dload_0 */
1, /* dload_1 */
1, /* dload_2 */
1, /* dload_3 */
1, /* aload_0 */
1, /* aload_1 */
1, /* aload_2 */
1, /* aload_3 */
1, /* iaload */
1, /* laload */
1, /* faload */
1, /* daload */
1, /* aaload */
1, /* baload */
1, /* caload */
1, /* saload */
1, /* istore */
1, /* lstore */
1, /* fstore */
1, /* dstore */
1, /* astore */
1, /* istore_0 */
1, /* istore_1 */
1, /* istore_2 */
1, /* istore_3 */
1, /* lstore_0 */
1, /* lstore_1 */
1, /* lstore_2 */
1, /* lstore_3 */
1, /* fstore_0 */
1, /* fstore_1 */
1, /* fstore_2 */
1, /* fstore_3 */
1, /* dstore_0 */
1, /* dstore_1 */
1, /* dstore_2 */
1, /* dstore_3 */
1, /* astore_0 */
1, /* astore_1 */
1, /* astore_2 */
1, /* astore_3 */
1, /* iastore */
1, /* lastore */
1, /* fastore */
1, /* dastore */
1, /* aastore */
1, /* bastore */
1, /* castore */
1, /* sastore */
1, /* pop */
1, /* pop2 */
1, /* dup */
1, /* dup_x1 */
1, /* dup_x2 */
1, /* dup2 */
1, /* dup2_x1 */
1, /* dup2_x2 */
1, /* swap */
1, /* iadd */
1, /* ladd */
1, /* fadd */
1, /* dadd */
1, /* isub */
1, /* lsub */
1, /* fsub */
1, /* dsub */
1, /* imul */
1, /* lmul */
1, /* fmul */
1, /* dmul */
1, /* idiv */
1, /* ldiv */
1, /* fdiv */
1, /* ddiv */
1, /* irem */
1, /* lrem */
1, /* frem */
1, /* drem */
1, /* ineg */
1, /* lneg */
1, /* fneg */
1, /* dneg */
1, /* ishl */
1, /* lshl */
1, /* ishr */
1, /* lshr */
1, /* iushr */
1, /* lushr */
1, /* iand */
1, /* land */
1, /* ior */
1, /* lor */
1, /* ixor */
1, /* lxor */
1, /* iinc */
1, /* i2l */
1, /* i2f */
1, /* i2d */
1, /* l2i */
1, /* l2f */
1, /* l2d */
1, /* f2i */
1, /* f2l */
1, /* f2d */
1, /* d2i */
1, /* d2l */
1, /* d2f */
1, /* i2b */
1, /* i2c */
1, /* i2s */
1, /* lcmp */
1, /* fcmpl */
1, /* fcmpg */
1, /* dcmpl */
1, /* dcmpg */
1, /* ifeq */
1, /* ifne */
1, /* iflt */
1, /* ifge */
1, /* ifgt */
1, /* ifle */
1, /* if_icmpeq */
1, /* if_icmpne */
1, /* if_icmplt */
1, /* if_icmpge */
1, /* if_icmpgt */
1, /* if_icmple */
1, /* if_acmpeq */
1, /* if_acmpne */
1, /* goto */
1, /* jsr */
1, /* ret */
1, /* tableswitch */
1, /* lookupswitch */
1, /* ireturn */
1, /* lreturn */
1, /* freturn */
1, /* dreturn */
1, /* areturn */
1, /* return */
1, /* getstatic */
1, /* putstatic */
1, /* getfield */
1, /* putfield */
1, /* invokevirtual */
1, /* invokespecial */
1, /* invokestatic */
1, /* invokeinterface */
1, /* xxxunusedxxx */
1, /* new */
1, /* newarray */
1, /* anewarray */
1, /* arraylength */
1, /* athrow */
1, /* checkcast */
1, /* instanceof */
1, /* monitorenter */
1, /* monitorexit */
1, /* wide */
1, /* multianewarray */
1, /* ifnull */
1, /* ifnonnull */
1, /* goto_w */
1, /* jsr_w */
1, /* breakpoint */
1, /* ldc_quick */
1, /* ldc_w_quick */
1, /* ldc2_w_quick */
1, /* getfield_quick */
1, /* putfield_quick */
1, /* getfield2_quick */
1, /* putfield2_quick */
1, /* getstatic_quick */
1, /* putstatic_quick */
1, /* getstatic2_quick */
1, /* putstatic2_quick */
1, /* invokevirtual_quick */
1, /* invokenonvirtual_quick */
1, /* invokesuper_quick */
1, /* invokestatic_quick */
1, /* invokeinterface_quick */
1, /* invokevirtualobject_quick */
1, /* invokeignored_quick */
1, /* new_quick */
1, /* anewarray_quick */
1, /* multianewarray_quick */
1, /* checkcast_quick */
1, /* instanceof_quick */
1, /* invokevirtual_quick_w */
1, /* getfield_quick_w */
1, /* putfield_quick_w */
1, /* nonnull_quick */
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
NoWideOpcode(nop)
NoWideOpcode(aconst_null)
NoWideOpcode(iconst_m1)
NoWideOpcode(iconst_0)
NoWideOpcode(iconst_1)
NoWideOpcode(iconst_2)
NoWideOpcode(iconst_3)
NoWideOpcode(iconst_4)
NoWideOpcode(iconst_5)
NoWideOpcode(lconst_0)
NoWideOpcode(lconst_1)
NoWideOpcode(fconst_0)
NoWideOpcode(fconst_1)
NoWideOpcode(fconst_2)
NoWideOpcode(dconst_0)
NoWideOpcode(dconst_1)
NoWideOpcode(bipush)
NoWideOpcode(sipush)
NoWideOpcode(ldc)
NoWideOpcode(ldc_w)
NoWideOpcode(ldc2_w)
WideOpcode(iload)
WideOpcode(lload)
WideOpcode(fload)
WideOpcode(dload)
WideOpcode(aload)
NoWideOpcode(iload_0)
NoWideOpcode(iload_1)
NoWideOpcode(iload_2)
NoWideOpcode(iload_3)
NoWideOpcode(lload_0)
NoWideOpcode(lload_1)
NoWideOpcode(lload_2)
NoWideOpcode(lload_3)
NoWideOpcode(fload_0)
NoWideOpcode(fload_1)
NoWideOpcode(fload_2)
NoWideOpcode(fload_3)
NoWideOpcode(dload_0)
NoWideOpcode(dload_1)
NoWideOpcode(dload_2)
NoWideOpcode(dload_3)
NoWideOpcode(aload_0)
NoWideOpcode(aload_1)
NoWideOpcode(aload_2)
NoWideOpcode(aload_3)
NoWideOpcode(iaload)
NoWideOpcode(laload)
NoWideOpcode(faload)
NoWideOpcode(daload)
NoWideOpcode(aaload)
NoWideOpcode(baload)
NoWideOpcode(caload)
NoWideOpcode(saload)
WideOpcode(istore)
WideOpcode(lstore)
WideOpcode(fstore)
WideOpcode(dstore)
WideOpcode(astore)
NoWideOpcode(istore_0)
NoWideOpcode(istore_1)
NoWideOpcode(istore_2)
NoWideOpcode(istore_3)
NoWideOpcode(lstore_0)
NoWideOpcode(lstore_1)
NoWideOpcode(lstore_2)
NoWideOpcode(lstore_3)
NoWideOpcode(fstore_0)
NoWideOpcode(fstore_1)
NoWideOpcode(fstore_2)
NoWideOpcode(fstore_3)
NoWideOpcode(dstore_0)
NoWideOpcode(dstore_1)
NoWideOpcode(dstore_2)
NoWideOpcode(dstore_3)
NoWideOpcode(astore_0)
NoWideOpcode(astore_1)
NoWideOpcode(astore_2)
NoWideOpcode(astore_3)
NoWideOpcode(iastore)
NoWideOpcode(lastore)
NoWideOpcode(fastore)
NoWideOpcode(dastore)
NoWideOpcode(aastore)
NoWideOpcode(bastore)
NoWideOpcode(castore)
NoWideOpcode(sastore)
NoWideOpcode(pop)
NoWideOpcode(pop2)
NoWideOpcode(dup)
NoWideOpcode(dup_x1)
NoWideOpcode(dup_x2)
NoWideOpcode(dup2)
NoWideOpcode(dup2_x1)
NoWideOpcode(dup2_x2)
NoWideOpcode(swap)
NoWideOpcode(iadd)
NoWideOpcode(ladd)
NoWideOpcode(fadd)
NoWideOpcode(dadd)
NoWideOpcode(isub)
NoWideOpcode(lsub)
NoWideOpcode(fsub)
NoWideOpcode(dsub)
NoWideOpcode(imul)
NoWideOpcode(lmul)
NoWideOpcode(fmul)
NoWideOpcode(dmul)
NoWideOpcode(idiv)
NoWideOpcode(ldiv)
NoWideOpcode(fdiv)
NoWideOpcode(ddiv)
NoWideOpcode(irem)
NoWideOpcode(lrem)
NoWideOpcode(frem)
NoWideOpcode(drem)
NoWideOpcode(ineg)
NoWideOpcode(lneg)
NoWideOpcode(fneg)
NoWideOpcode(dneg)
NoWideOpcode(ishl)
NoWideOpcode(lshl)
NoWideOpcode(ishr)
NoWideOpcode(lshr)
NoWideOpcode(iushr)
NoWideOpcode(lushr)
NoWideOpcode(iand)
NoWideOpcode(land)
NoWideOpcode(ior)
NoWideOpcode(lor)
NoWideOpcode(ixor)
NoWideOpcode(lxor)
WideOpcode(iinc)
NoWideOpcode(i2l)
NoWideOpcode(i2f)
NoWideOpcode(i2d)
NoWideOpcode(l2i)
NoWideOpcode(l2f)
NoWideOpcode(l2d)
NoWideOpcode(f2i)
NoWideOpcode(f2l)
NoWideOpcode(f2d)
NoWideOpcode(d2i)
NoWideOpcode(d2l)
NoWideOpcode(d2f)
NoWideOpcode(i2b)
NoWideOpcode(i2c)
NoWideOpcode(i2s)
NoWideOpcode(lcmp)
NoWideOpcode(fcmpl)
NoWideOpcode(fcmpg)
NoWideOpcode(dcmpl)
NoWideOpcode(dcmpg)
NoWideOpcode(ifeq)
NoWideOpcode(ifne)
NoWideOpcode(iflt)
NoWideOpcode(ifge)
NoWideOpcode(ifgt)
NoWideOpcode(ifle)
NoWideOpcode(if_icmpeq)
NoWideOpcode(if_icmpne)
NoWideOpcode(if_icmplt)
NoWideOpcode(if_icmpge)
NoWideOpcode(if_icmpgt)
NoWideOpcode(if_icmple)
NoWideOpcode(if_acmpeq)
NoWideOpcode(if_acmpne)
NoWideOpcode(goto)
NoWideOpcode(jsr)
WideOpcode(ret)
NoWideOpcode(tableswitch)
NoWideOpcode(lookupswitch)
NoWideOpcode(ireturn)
NoWideOpcode(lreturn)
NoWideOpcode(freturn)
NoWideOpcode(dreturn)
NoWideOpcode(areturn)
NoWideOpcode(return)
NoWideOpcode(getstatic)
NoWideOpcode(putstatic)
NoWideOpcode(getfield)
NoWideOpcode(putfield)
NoWideOpcode(invokevirtual)
NoWideOpcode(invokespecial)
NoWideOpcode(invokestatic)
NoWideOpcode(invokeinterface)
NoWideOpcode(xxxunusedxxx)
NoWideOpcode(new)
NoWideOpcode(newarray)
NoWideOpcode(anewarray)
NoWideOpcode(arraylength)
NoWideOpcode(athrow)
NoWideOpcode(checkcast)
NoWideOpcode(instanceof)
NoWideOpcode(monitorenter)
NoWideOpcode(monitorexit)
NoWideOpcode(wide)
NoWideOpcode(multianewarray)
NoWideOpcode(ifnull)
NoWideOpcode(ifnonnull)
NoWideOpcode(goto_w)
NoWideOpcode(jsr_w)
NoWideOpcode(breakpoint)
NoWideOpcode(ldc_quick)
NoWideOpcode(ldc_w_quick)
NoWideOpcode(ldc2_w_quick)
NoWideOpcode(getfield_quick)
NoWideOpcode(putfield_quick)
NoWideOpcode(getfield2_quick)
NoWideOpcode(putfield2_quick)
NoWideOpcode(getstatic_quick)
NoWideOpcode(putstatic_quick)
NoWideOpcode(getstatic2_quick)
NoWideOpcode(putstatic2_quick)
NoWideOpcode(invokevirtual_quick)
NoWideOpcode(invokenonvirtual_quick)
NoWideOpcode(invokesuper_quick)
NoWideOpcode(invokestatic_quick)
NoWideOpcode(invokeinterface_quick)
NoWideOpcode(invokevirtualobject_quick)
NoWideOpcode(invokeignored_quick)
NoWideOpcode(new_quick)
NoWideOpcode(anewarray_quick)
NoWideOpcode(multianewarray_quick)
NoWideOpcode(checkcast_quick)
NoWideOpcode(instanceof_quick)
NoWideOpcode(invokevirtual_quick_w)
NoWideOpcode(getfield_quick_w)
NoWideOpcode(putfield_quick_w)
NoWideOpcode(nonnull_quick)
NoWideOpcode(Illegal230)
NoWideOpcode(Illegal231)
NoWideOpcode(Illegal232)
NoWideOpcode(Illegal233)
NoWideOpcode(Illegal234)
NoWideOpcode(Illegal235)
NoWideOpcode(Illegal236)
NoWideOpcode(Illegal237)
NoWideOpcode(Illegal238)
NoWideOpcode(Illegal239)
NoWideOpcode(Illegal240)
NoWideOpcode(Illegal241)
NoWideOpcode(Illegal242)
NoWideOpcode(Illegal243)
NoWideOpcode(Illegal244)
NoWideOpcode(Illegal245)
NoWideOpcode(Illegal246)
NoWideOpcode(Illegal247)
NoWideOpcode(Illegal248)
NoWideOpcode(Illegal249)
NoWideOpcode(Illegal250)
NoWideOpcode(Illegal251)
NoWideOpcode(Illegal252)
NoWideOpcode(Illegal253)
NoWideOpcode(Illegal254)
NoWideOpcode(Illegal255)
/*
* Copyright 1994-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
#ifndef _JAVASOFT_SYS_API_H_
#define _JAVASOFT_SYS_API_H_
#include "hpi.h"
extern HPI_MemoryInterface *hpi_memory_interface;
extern HPI_LibraryInterface *hpi_library_interface;
extern HPI_SystemInterface *hpi_system_interface;
extern HPI_ThreadInterface *hpi_thread_interface;
extern HPI_FileInterface *hpi_file_interface;
extern HPI_SocketInterface *hpi_socket_interface;
#define sysMalloc(x) hpi_memory_interface->Malloc(x)
#define sysRealloc(x,y) hpi_memory_interface->Realloc(x,y)
#define sysFree(x) hpi_memory_interface->Free(x)
#define sysCalloc(x,y) hpi_memory_interface->Calloc(x,y)
#define sysStrdup(x) hpi_memory_interface->Strdup(x)
#define sysMapMem(x,y) hpi_memory_interface->MapMem(x,y)
#define sysUnmapMem(x,y,z) hpi_memory_interface->UnmapMem(x,y,z)
#define sysCommitMem(x,y,z) hpi_memory_interface->CommitMem(x,y,z)
#define sysDecommitMem(x,y,z) hpi_memory_interface->DecommitMem(x,y,z)
#define sysAllocBlock(x,y) hpi_memory_interface->AllocBlock(x,y)
#define sysFreeBlock(x) hpi_memory_interface->FreeBlock(x)
#define sysBuildLibName(a,b,c,d) hpi_library_interface->BuildLibName(a,b,c,d)
#define sysBuildFunName(a,b,c,d) hpi_library_interface->BuildFunName(a,b,c,d)
#define sysLoadLibrary(a,b,c) hpi_library_interface->LoadLibrary(a,b,c)
#define sysUnloadLibrary(a) hpi_library_interface->UnloadLibrary(a)
#define sysFindLibraryEntry(a,b) hpi_library_interface->FindLibraryEntry(a,b)
#define sysGetSysInfo() hpi_system_interface->GetSysInfo()
#define sysGetMilliTicks() hpi_system_interface->GetMilliTicks()
#define sysTimeMillis() hpi_system_interface->TimeMillis()
#define sysSignal(a,b) hpi_system_interface->Signal(a,b)
#define sysRaise(a) hpi_system_interface->Raise(a)
#define sysSignalNotify(a) hpi_system_interface->SignalNotify(a)
#define sysSignalWait() hpi_system_interface->SignalWait()
#define sysShutdown() hpi_system_interface->Shutdown()
#define sysSetLoggingLevel(a) hpi_system_interface->SetLoggingLevel(a)
#define sysSetMonitoringOn(a) hpi_system_interface->SetMonitoringOn(a)
#define sysGetLastErrorString(a,b) hpi_system_interface->GetLastErrorString(a,b)
#define sysThreadBootstrap(a,b,c) hpi_thread_interface->ThreadBootstrap(a,b,c)
#define sysThreadCreate(a,b,c,d) hpi_thread_interface->ThreadCreate(a,b,c,d)
#define sysThreadSelf() hpi_thread_interface->ThreadSelf()
#define sysThreadYield() hpi_thread_interface->ThreadYield()
#define sysThreadSuspend(a) hpi_thread_interface->ThreadSuspend(a)
#define sysThreadResume(a) hpi_thread_interface->ThreadResume(a)
#define sysThreadSetPriority(a,b) hpi_thread_interface->ThreadSetPriority(a,b)
#define sysThreadGetPriority(a,b) hpi_thread_interface->ThreadGetPriority(a,b)
#define sysThreadStackPointer(a) hpi_thread_interface->ThreadStackPointer(a)
#define sysThreadStackTop(a) hpi_thread_interface->ThreadStackTop(a)
#define sysThreadRegs(a,b) hpi_thread_interface->ThreadRegs(a,b)
#define sysThreadSingle() hpi_thread_interface->ThreadSingle()
#define sysThreadMulti() hpi_thread_interface->ThreadMulti()
#define sysThreadCheckStack() hpi_thread_interface->ThreadCheckStack()
#define sysThreadPostException(a,b) \
hpi_thread_interface->ThreadPostException(a,b)
#define sysThreadInterrupt(a) hpi_thread_interface->ThreadInterrupt(a)
#define sysThreadIsInterrupted(a,b) \
hpi_thread_interface->ThreadIsInterrupted(a,b)
#define sysThreadAlloc(a) hpi_thread_interface->ThreadAlloc(a)
#define sysThreadFree() hpi_thread_interface->ThreadFree()
#define sysThreadCPUTime() hpi_thread_interface->ThreadCPUTime()
#define sysThreadGetStatus(a,b) hpi_thread_interface->ThreadGetStatus(a,b)
#define sysThreadEnumerateOver(a,b) \
hpi_thread_interface->ThreadEnumerateOver(a,b)
#define sysThreadIsRunning(a) hpi_thread_interface->ThreadIsRunning(a)
#define sysThreadProfSuspend(a) hpi_thread_interface->ThreadProfSuspend(a)
#define sysThreadProfResume(a) hpi_thread_interface->ThreadProfResume(a)
#define sysAdjustTimeSlice(a) hpi_thread_interface->AdjustTimeSlice(a)
#define sysMonitorSizeof() hpi_thread_interface->MonitorSizeof()
#define sysMonitorInit(a) hpi_thread_interface->MonitorInit(a)
#define sysMonitorDestroy(a) hpi_thread_interface->MonitorDestroy(a)
#define sysMonitorEnter(a,b) hpi_thread_interface->MonitorEnter(a,b)
#define sysMonitorEntered(a,b) hpi_thread_interface->MonitorEntered(a,b)
#define sysMonitorExit(a,b) hpi_thread_interface->MonitorExit(a,b)
#define sysMonitorNotify(a,b) hpi_thread_interface->MonitorNotify(a,b)
#define sysMonitorNotifyAll(a,b) hpi_thread_interface->MonitorNotifyAll(a,b)
#define sysMonitorWait(a,b,c) hpi_thread_interface->MonitorWait(a,b,c)
#define sysMonitorInUse(a) hpi_thread_interface->MonitorInUse(a)
#define sysMonitorOwner(a) hpi_thread_interface->MonitorOwner(a)
#define sysMonitorGetInfo(a,b) hpi_thread_interface->MonitorGetInfo(a,b)
#define sysThreadInterruptEvent() hpi_thread_interface->ThreadInterruptEvent()
#define sysThreadNativeID(a) hpi_thread_interface->ThreadNativeID(a)
#define sysNativePath(a) hpi_file_interface->NativePath(a)
#define sysFileType(a) hpi_file_interface->FileType(a)
#define sysOpen(a,b,c) hpi_file_interface->Open(a,b,c)
#define sysClose(a) hpi_file_interface->Close(a)
#define sysSeek(a,b,c) hpi_file_interface->Seek(a,b,c)
#define sysSetLength(a,b) hpi_file_interface->SetLength(a,b)
#define sysSync(a) hpi_file_interface->Sync(a)
#define sysAvailable(a,b) hpi_file_interface->Available(a,b)
#define sysRead(a,b,c) hpi_file_interface->Read(a,b,c)
#define sysWrite(a,b,c) hpi_file_interface->Write(a,b,c)
#define sysFileSizeFD(a,b) hpi_file_interface->FileSizeFD(a,b)
#define sysSocketClose(a) hpi_socket_interface->Close(a)
#define sysSocketShutdown(a,b) hpi_socket_interface->SocketShutdown(a,b)
#define sysSocketAvailable(a,b) hpi_socket_interface->Available(a,b)
#define sysConnect(a,b,c) hpi_socket_interface->Connect(a,b,c)
#define sysBind(a,b,c) hpi_socket_interface->Bind(a,b,c)
#define sysAccept(a,b,c) hpi_socket_interface->Accept(a,b,c)
#define sysGetSockName(a,b,c) hpi_socket_interface->GetSocketName(a,b,c)
#define sysSendTo(a,b,c,d,e,f) hpi_socket_interface->SendTo(a,b,c,d,e,f)
#define sysRecvFrom(a,b,c,d,e,f) hpi_socket_interface->RecvFrom(a,b,c,d,e,f)
#define sysListen(a,b) hpi_socket_interface->Listen(a,b)
#define sysRecv(a,b,c,d) hpi_socket_interface->Recv(a,b,c,d)
#define sysSend(a,b,c,d) hpi_socket_interface->Send(a,b,c,d)
#define sysTimeout(a,b) hpi_socket_interface->Timeout(a,b)
#define sysGetHostName(a, b) hpi_socket_interface->GetHostName(a, b)
#define sysGetHostByAddr(a, b, c) hpi_socket_interface->GetHostByAddr(a, b, c)
#define sysGetHostByName(a) hpi_socket_interface->GetHostByName(a)
#define sysSocket(a,b,c) hpi_socket_interface->Socket(a,b,c)
#define sysGetSockOpt(a, b, c, d, e) hpi_socket_interface->SocketGetOption(a, b, c, d, e)
#define sysSetSockOpt(a, b, c, d, e) hpi_socket_interface->SocketSetOption(a, b, c, d, e)
#define sysGetProtoByName(a) hpi_socket_interface->GetProtoByName(a)
#define SYS_SIG_DFL HPI_SIG_DFL
#define SYS_SIG_ERR HPI_SIG_ERR
#define SYS_SIG_IGN HPI_SIG_IGN
#define SYS_OK HPI_OK
#define SYS_ERR HPI_ERR
#define SYS_INTRPT HPI_INTRPT
#define SYS_TIMEOUT HPI_TIMEOUT
#define SYS_NOMEM HPI_NOMEM
#define SYS_NORESOURCE HPI_NORESOURCE
#define SYS_THREAD_RUNNABLE HPI_THREAD_RUNNABLE
#define SYS_THREAD_MONITOR_WAIT HPI_THREAD_MONITOR_WAIT
#define SYS_THREAD_CONDVAR_WAIT HPI_THREAD_CONDVAR_WAIT
#define MinimumPriority HPI_MINIMUM_PRIORITY
#define MaximumPriority HPI_MAXIMUM_PRIORITY
#define NormalPriority HPI_NORMAL_PRIORITY
#define SYS_THREAD_SUSPENDED HPI_THREAD_SUSPENDED
#define SYS_THREAD_INTERRUPTED HPI_THREAD_INTERRUPTED
#define PAGE_ALIGNMENT HPI_PAGE_ALIGNMENT
#define SYS_TIMEOUT_INFINITY HPI_TIMEOUT_INFINITY
#define SYS_FILETYPE_REGULAR HPI_FILETYPE_REGULAR
#define SYS_FILETYPE_DIRECTORY HPI_FILETYPE_DIRECTORY
#define SYS_FILETYPE_OTHER HPI_FILETYPE_OTHER
#endif /* !_JAVASOFT_SYS_API_H_ */
/*
* Copyright 1994-2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
#ifndef _JAVASOFT_TYPEDEFS_H_
#define _JAVASOFT_TYPEDEFS_H_
#include "typedefs_md.h" /* for int64_t */
/*
* Macros to deal with the JavaVM's stack alignment. Many machines
* require doublewords to be double aligned. This union is used by
* code in math.h as a more portable way do alingnment on machines
* that require it. This union and the macros that use it came from
* Netscape.
*/
#ifdef HAVE_ALIGNED_LONGLONGS
#define GET_INT64(_t,_addr) \
((((int32_t*) &(_t))[0] = ((int32_t*)(_addr))[0]), \
(((int32_t*) &(_t))[1] = ((int32_t*)(_addr))[1]), \
(_t).j )
#define SET_INT64(_t, _addr, _v) \
( (_t).j = (_v), \
((int32_t*)(_addr))[0] = ((int32_t*) &(_t))[0], \
((int32_t*)(_addr))[1] = ((int32_t*) &(_t))[1] )
#else
#define GET_INT64(_t,_addr) (*(int64_t*)(_addr))
#define SET_INT64(_t, _addr, _v) (*(int64_t*)(_addr) = (_v))
#endif
/* If double's must be aligned on doubleword boundaries then define this */
#ifdef HAVE_ALIGNED_DOUBLES
#define GET_DOUBLE(_t,_addr) \
((((int32_t*) &(_t))[0] = ((int32_t*)(_addr))[0]), \
(((int32_t*) &(_t))[1] = ((int32_t*)(_addr))[1]), \
(_t).d )
#define SET_DOUBLE(_t, _addr, _v) \
( (_t).d = (_v), \
((int32_t*)(_addr))[0] = ((int32_t*) &(_t))[0], \
((int32_t*)(_addr))[1] = ((int32_t*) &(_t))[1] )
#else
#define GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
#define SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
#endif
/* If pointers are 64bits then define this */
#ifdef HAVE_64BIT_POINTERS
#define GET_HANDLE(_t,_addr) \
( ((int32_t*) &(_t))[0] = ((int32_t*)(_addr))[0]), \
((int32_t*) &(_t))[1] = ((int32_t*)(_addr))[1]), \
(void*) (_t).l )
#define SET_HANDLE(_t, _addr, _v) \
( *(void**) &((_t).l) = (_v), \
((int32_t*)(_addr))[0] = ((int32_t*) &(_t))[0], \
((int32_t*)(_addr))[1] = ((int32_t*) &(_t))[1] )
#else
#define GET_HANDLE(_t,_addr) (*(JHandle*)(_addr))
#define SET_HANDLE(_t, _addr, _v) (*(JHandle*)(_addr) = (_v))
#endif
/*
* Printf-style formatters for fixed- and variable-width types as pointers and
* integers.
*
* Each platform-specific definitions file "typedefs_md.h"
* must define the macro FORMAT64_MODIFIER, which is the modifier for '%x' or
* '%d' formats to indicate a 64-bit quantity; commonly "l" (in LP64) or "ll"
* (in ILP32).
*/
/* Format 32-bit quantities. */
#define INT32_FORMAT "%d"
#define UINT32_FORMAT "%u"
#define PTR32_FORMAT "0x%08x"
/* Format 64-bit quantities. */
#define INT64_FORMAT "%" FORMAT64_MODIFIER "d"
#define UINT64_FORMAT "%" FORMAT64_MODIFIER "u"
#define PTR64_FORMAT "0x%016" FORMAT64_MODIFIER "x"
/* Format pointers and size_t (or size_t-like integer types) which change size
* between 32- and 64-bit.
*/
#if defined(_LP64) || defined(_WIN64)
#define PTR_FORMAT PTR64_FORMAT
#define SIZE_FORMAT UINT64_FORMAT
#define SSIZE_FORMAT INT64_FORMAT
#else
#define PTR_FORMAT PTR32_FORMAT
#define SIZE_FORMAT UINT32_FORMAT
#define SSIZE_FORMAT INT32_FORMAT
#endif
#define INTPTR_FORMAT PTR_FORMAT
#endif /* !_JAVASOFT_TYPEDEFS_H_ */
/*
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -126,15 +126,15 @@ void band::readData(int expectedLength) {
(*save_meta_rp) = (byte) XB;
cm.init(u->rp, u->rplimit, u->meta_rp, 0, defc, length, null);
(*save_meta_rp) = save_meta_xb; // put it back, just to be tidy
NOT_PRODUCT(cp2 = (u->meta_rp - meta_rp0));
NOT_PRODUCT(cp2 = (int)(u->meta_rp - meta_rp0));
}
rplimit = u->rp;
rewind();
#ifndef PRODUCT
printcr(3,"readFrom %s at %p [%d values, %d bytes, cp=%d/%d]",
(name?name:"(band)"), minRP(), length, size(), cp1, cp2);
PRINTCR((3,"readFrom %s at %p [%d values, %d bytes, cp=%d/%d]",
(name?name:"(band)"), minRP(), length, size(), cp1, cp2));
if (u->verbose_bands || u->verbose >= 4) dump();
if (ix != null && u->verbose != 0 && length > 0) {
......@@ -421,18 +421,22 @@ const band_init all_band_inits[] = {
BAND_INIT(file_modtime, DELTA5_spec, 0),
BAND_INIT(file_options, UNSIGNED5_spec, 0),
//BAND_INIT(file_bits, BYTE1_spec, 0),
{0}
#ifndef PRODUCT
{ 0, 0, 0, 0 }
#else
{ 0, 0 }
#endif
};
#define NUM_BAND_INITS \
(sizeof(all_band_inits)/sizeof(all_band_inits[0]))
band* band::makeBands(unpacker* u) {
band* all_bands = U_NEW(band, BAND_LIMIT);
band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
for (int i = 0; i < BAND_LIMIT; i++) {
assert((byte*)&all_band_inits[i+1]
< (byte*)all_band_inits+sizeof(all_band_inits));
const band_init& bi = all_band_inits[i];
band& b = all_bands[i];
band& b = tmp_all_bands[i];
coding* defc = coding::findBySpec(bi.defc);
assert((defc == null) == (bi.defc == -1)); // no garbage, please
assert(defc == null || !defc->isMalloc);
......@@ -446,13 +450,13 @@ band* band::makeBands(unpacker* u) {
b.name = bi.name;
#endif
}
return all_bands;
return tmp_all_bands;
}
void band::initIndexes(unpacker* u) {
band* all_bands = u->all_bands;
band* tmp_all_bands = u->all_bands;
for (int i = 0; i < BAND_LIMIT; i++) {
band* scan = &all_bands[i];
band* scan = &tmp_all_bands[i];
uint tag = scan->ixTag; // Cf. #define INDEX(tag) above
if (tag != 0 && tag != CONSTANT_Literal && (tag & SUBINDEX_BIT) == 0) {
scan->setIndex(u->cp.getIndex(tag));
......
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -71,15 +71,17 @@ void bytes::realloc(size_t len_) {
void bytes::free() {
if (ptr == dummy) return; // escaping from an error
if (ptr != null) mtrace('f', ptr, 0);
if (ptr != null) ::free(ptr);
if (ptr != null) {
mtrace('f', ptr, 0);
::free(ptr);
}
len = 0;
ptr = 0;
}
int bytes::indexOf(byte c) {
byte* p = (byte*) memchr(ptr, c, len);
return (p == 0) ? -1 : p - ptr;
return (p == 0) ? -1 : (int)(p - ptr);
}
byte* bytes::writeTo(byte* bp) {
......@@ -174,8 +176,10 @@ void ptrlist::freeAll() {
int len = length();
for (int i = 0; i < len; i++) {
void* p = (void*) get(i);
if (p != null) mtrace('f', p, 0);
if (p != null) ::free(p);
if (p != null) {
mtrace('f', p, 0);
::free(p);
}
}
free();
}
......
/*
* Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -117,7 +117,7 @@ struct fillbytes {
struct ptrlist : fillbytes {
typedef const void* cvptr;
int length() { return size() / sizeof(cvptr); }
int length() { return (int)(size() / sizeof(cvptr)); }
cvptr* base() { return (cvptr*) fillbytes::base(); }
cvptr& get(int i) { return *(cvptr*)loc(i * sizeof(cvptr)); }
cvptr* limit() { return (cvptr*) fillbytes::limit(); }
......@@ -133,7 +133,7 @@ struct ptrlist : fillbytes {
::qsort((ptrls).base(), (ptrls).length(), sizeof(void*), fn)
struct intlist : fillbytes {
int length() { return size() / sizeof(int); }
int length() { return (int)(size() / sizeof(int)); }
int* base() { return (int*) fillbytes::base(); }
int& get(int i) { return *(int*)loc(i * sizeof(int)); }
int* limit() { return (int*) fillbytes::limit(); }
......
/*
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -113,7 +113,7 @@ coding* coding::init() {
jlong maxNegCode = range-1;
while (IS_NEG_CODE(S, maxPosCode)) --maxPosCode;
while (!IS_NEG_CODE(S, maxNegCode)) --maxNegCode;
int maxPos = decode_sign(S, maxPosCode);
int maxPos = decode_sign(S, (uint)maxPosCode);
if (maxPos < 0)
this->max = INT_MAX_VALUE; // 32-bit wraparound
else
......@@ -121,7 +121,7 @@ coding* coding::init() {
if (maxNegCode < 0)
this->min = 0; // No negative codings at all.
else
this->min = decode_sign(S, maxNegCode);
this->min = decode_sign(S, (uint)maxNegCode);
}
}
......@@ -149,10 +149,10 @@ coding* coding::findBySpec(int spec) {
coding* ptr = NEW(coding, 1);
CHECK_NULL_0(ptr);
coding* c = ptr->initFrom(spec);
if (c == null) mtrace('f', ptr, 0);
if (c == null)
if (c == null) {
mtrace('f', ptr, 0);
::free(ptr);
else
} else
// else caller should free it...
c->isMalloc = true;
return c;
......@@ -167,9 +167,10 @@ coding* coding::findBySpec(int B, int H, int S, int D) {
}
void coding::free() {
if (isMalloc) mtrace('f', this, 0);
if (isMalloc)
if (isMalloc) {
mtrace('f', this, 0);
::free(this);
}
}
void coding_method::reset(value_stream* state) {
......@@ -187,7 +188,7 @@ uint coding::parse(byte* &rp, int B, int H) {
byte* ptr = rp;
// hand peel the i==0 part of the loop:
uint b_i = *ptr++ & 0xFF;
if (B == 1 || b_i < L)
if (B == 1 || b_i < (uint)L)
{ rp = ptr; return b_i; }
uint sum = b_i;
uint H_i = H;
......@@ -195,7 +196,7 @@ uint coding::parse(byte* &rp, int B, int H) {
for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
b_i = *ptr++ & 0xFF;
sum += b_i * H_i;
if (i == B || b_i < L)
if (i == B || b_i < (uint)L)
{ rp = ptr; return sum; }
H_i *= H;
}
......@@ -210,7 +211,7 @@ uint coding::parse_lgH(byte* &rp, int B, int H, int lgH) {
byte* ptr = rp;
// hand peel the i==0 part of the loop:
uint b_i = *ptr++ & 0xFF;
if (B == 1 || b_i < L)
if (B == 1 || b_i < (uint)L)
{ rp = ptr; return b_i; }
uint sum = b_i;
uint lg_H_i = lgH;
......@@ -218,7 +219,7 @@ uint coding::parse_lgH(byte* &rp, int B, int H, int lgH) {
for (int i = 2; i <= B_MAX; i++) { // easy for compilers to unroll if desired
b_i = *ptr++ & 0xFF;
sum += b_i << lg_H_i;
if (i == B || b_i < L)
if (i == B || b_i < (uint)L)
{ rp = ptr; return sum; }
lg_H_i += lgH;
}
......@@ -237,7 +238,7 @@ void coding::parseMultiple(byte* &rp, int N, byte* limit, int B, int H) {
byte* ptr = rp;
if (B == 1 || H == 256) {
size_t len = (size_t)N*B;
if (len / B != N || ptr+len > limit) {
if (len / B != (size_t)N || ptr+len > limit) {
abort(ERB);
return;
}
......@@ -325,7 +326,7 @@ static maybe_inline
int getPopValue(value_stream* self, uint uval) {
if (uval > 0) {
// note that the initial parse performed a range check
assert(uval <= self->cm->fVlength);
assert(uval <= (uint)self->cm->fVlength);
return self->cm->fValues[uval-1];
} else {
// take an unfavored value
......@@ -368,7 +369,7 @@ int coding::sumInUnsignedRange(int x, int y) {
static maybe_inline
int getDeltaValue(value_stream* self, uint uval, bool isSubrange) {
assert((bool)(self->c.isSubrange) == isSubrange);
assert((uint)(self->c.isSubrange) == (uint)isSubrange);
assert(self->c.isSubrange | self->c.isFullRange);
if (isSubrange)
return self->sum = self->c.sumInUnsignedRange(self->sum, (int)uval);
......@@ -443,7 +444,7 @@ int value_stream::getInt() {
uval = coding::parse(rp, B, H);
if (S != 0)
uval = (uint) decode_sign(S, uval);
return getDeltaValue(this, uval, c.isSubrange);
return getDeltaValue(this, uval, (bool)c.isSubrange);
case cmk_BHS1D1full:
assert(S == 1 && D == 1 && c.isFullRange);
......@@ -499,6 +500,9 @@ int value_stream::getInt() {
assert(c.spec == BYTE1_spec);
assert(B == 1 && H == 256 && S == 0 && D == 0);
return getPopValue(this, *rp++ & 0xFF);
default:
break;
}
assert(false);
return 0;
......@@ -695,7 +699,7 @@ void coding_method::init(byte* &band_rp, byte* band_limit,
for (int i = 0; i < N; i++) {
uint val = vs.getInt();
if (val == 0) UN += 1;
if (!(val <= fVlength)) {
if (!(val <= (uint)fVlength)) {
abort("pop token out of range");
return;
}
......@@ -728,6 +732,7 @@ void coding_method::init(byte* &band_rp, byte* band_limit,
switch (self->vs0.cmk) {
case cmk_BHS0: cmk2 = cmk_pop_BHS0; break;
case cmk_BYTE1: cmk2 = cmk_pop_BYTE1; break;
default: break;
}
self->vs0.cmk = cmk2;
if (self != this) {
......@@ -947,15 +952,17 @@ coding basic_codings[] = {
CODING_INIT(4,240,1,1),
CODING_INIT(4,248,0,1),
CODING_INIT(4,248,1,1),
0
CODING_INIT(0,0,0,0)
};
#define BASIC_INDEX_LIMIT \
(sizeof(basic_codings)/sizeof(basic_codings[0])-1)
(int)(sizeof(basic_codings)/sizeof(basic_codings[0])-1)
coding* coding::findByIndex(int idx) {
assert(_meta_canon_min == 1);
assert(_meta_canon_max+1 == BASIC_INDEX_LIMIT);
#ifndef PRODUCT
/* Tricky assert here, constants and gcc complains about it without local. */
int index_limit = BASIC_INDEX_LIMIT;
assert(_meta_canon_min == 1 && _meta_canon_max+1 == index_limit);
#endif
if (idx >= _meta_canon_min && idx <= _meta_canon_max)
return basic_codings[idx].init();
else
......
/*
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -35,9 +35,11 @@ struct unpacker;
#define CODING_D(x) ((x)>>0 & 0xF)
#define CODING_INIT(B, H, S, D) \
{ CODING_SPEC(B, H, S, D) }
{ CODING_SPEC(B, H, S, D) , 0, 0, 0, 0, 0, 0, 0, 0}
#define long do_not_use_C_long_types_use_jlong_or_int
// For debugging purposes, some compilers do not like this and will complain.
// #define long do_not_use_C_long_types_use_jlong_or_int
// Use of the type "long" is problematic, do not use it.
struct coding {
int spec; // B,H,S,D
......
/*
* Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -45,15 +45,15 @@
#ifdef PRODUCT
#define IF_PRODUCT(xxx) xxx
#define NOT_PRODUCT(xxx)
#define assert(p) (0)
#define printcr false &&
#define assert(p)
#define PRINTCR(args)
#else
#define IF_PRODUCT(xxx)
#define NOT_PRODUCT(xxx) xxx
#define assert(p) ((p) || (assert_failed(#p), 1))
#define printcr u->verbose && u->printcr_if_verbose
#define assert(p) ((p) || assert_failed(#p))
#define PRINTCR(args) u->verbose && u->printcr_if_verbose args
extern "C" void breakpoint();
extern void assert_failed(const char*);
extern int assert_failed(const char*);
#define BREAK (breakpoint())
#endif
......@@ -79,7 +79,7 @@ extern void assert_failed(const char*);
#define lengthof(array) (sizeof(array)/sizeof(array[0]))
#define NEW(T, n) (T*) must_malloc(sizeof(T)*(n))
#define NEW(T, n) (T*) must_malloc((int)(sizeof(T)*(n)))
#define U_NEW(T, n) (T*) u->alloc(sizeof(T)*(n))
#define T_NEW(T, n) (T*) u->temp_alloc(sizeof(T)*(n))
......@@ -121,12 +121,12 @@ enum { false, true };
#define null (0)
#ifndef __sparc
#define intptr_t jlong
#endif
#define ptrlowbits(x) ((int) (intptr_t)(x))
/* Must cast to void *, then size_t, then int. */
#define ptrlowbits(x) ((int)(size_t)(void*)(x))
/* Back and forth from jlong to pointer */
#define ptr2jlong(x) ((jlong)(size_t)(void*)(x))
#define jlong2ptr(x) ((void*)(size_t)(x))
// Keys used by Java:
#define UNPACK_DEFLATE_HINT "unpack.deflate.hint"
......
/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -59,7 +59,8 @@ static jlong read_input_via_jni(unpacker* self,
void* buf, jlong minlen, jlong maxlen);
static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
unpacker* uPtr = (unpacker*) env->GetLongField(pObj, unpackerPtrFID);
unpacker* uPtr;
uPtr = (unpacker*)jlong2ptr(env->GetLongField(pObj, unpackerPtrFID));
//fprintf(stderr, "get_unpacker(%p) uPtr=%p\n", pObj, uPtr);
if (uPtr == null) {
if (noCreate) return null;
......@@ -71,7 +72,7 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
//fprintf(stderr, "get_unpacker(%p) uPtr=%p initializing\n", pObj, uPtr);
uPtr->init(read_input_via_jni);
uPtr->jniobj = (void*) env->NewGlobalRef(pObj);
env->SetLongField(pObj, unpackerPtrFID, (jlong)uPtr);
env->SetLongField(pObj, unpackerPtrFID, ptr2jlong(uPtr));
}
uPtr->jnienv = env; // keep refreshing this in case of MT access
return uPtr;
......@@ -150,7 +151,7 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_start(JNIEnv *env, jobject pObj,
size_t buflen = 0;
if (pBuf != null) {
buf = env->GetDirectBufferAddress(pBuf);
buflen = env->GetDirectBufferCapacity(pBuf);
buflen = (size_t)env->GetDirectBufferCapacity(pBuf);
if (buflen == 0) buf = null;
if (buf == null) { THROW_IOE(ERROR_INTERNAL); return 0; }
if ((size_t)offset >= buflen)
......
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -86,13 +86,13 @@ static jlong read_input_via_stdio(unpacker* u,
readlen = (int)(maxlen - numread);
int nr = 0;
if (u->infileptr != null) {
nr = fread(bufptr, 1, readlen, u->infileptr);
nr = (int)fread(bufptr, 1, readlen, u->infileptr);
} else {
#ifndef WIN32
// we prefer unbuffered inputs
nr = read(u->infileno, bufptr, readlen);
nr = (int)read(u->infileno, bufptr, readlen);
#else
nr = fread(bufptr, 1, readlen, stdin);
nr = (int)fread(bufptr, 1, readlen, stdin);
#endif
}
if (nr <= 0) {
......@@ -279,7 +279,6 @@ int unpacker::run(int argc, char **argv) {
char** argbuf = init_args(argc, argv, envargc);
char** arg0 = argbuf+envargc;
char** argp = argbuf;
int ach;
int verbose = 0;
char* logfile = null;
......@@ -370,7 +369,7 @@ int unpacker::run(int argc, char **argv) {
int magic;
// check for GZIP input
magic = read_magic(&u, peek, sizeof(peek));
magic = read_magic(&u, peek, (int)sizeof(peek));
if ((magic & GZIP_MAGIC_MASK) == GZIP_MAGIC) {
// Oops; must slap an input filter on this data.
setup_gzin(&u);
......@@ -397,8 +396,8 @@ int unpacker::run(int argc, char **argv) {
if (u.aborting()) break;
// Peek ahead for more data.
magic = read_magic(&u, peek, sizeof(peek));
if (magic != JAVA_PACKAGE_MAGIC) {
magic = read_magic(&u, peek, (int)sizeof(peek));
if (magic != (int)JAVA_PACKAGE_MAGIC) {
if (magic != EOF_MAGIC)
u.abort("garbage after end of pack archive");
break; // all done
......
/*
* Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -314,7 +314,7 @@ struct unpacker {
void readBandData(band** body, uint count); // recursive helper
layout_definition* getLayout(uint idx) {
if (idx >= layouts.length()) return null;
if (idx >= (uint)layouts.length()) return null;
return (layout_definition*) layouts.get(idx);
}
......@@ -332,12 +332,12 @@ struct unpacker {
int predefCount(uint idx);
bool isRedefined(uint idx) {
assert(idx < flag_limit);
return ((redef >> idx) & 1);
if (idx >= flag_limit) return false;
return (bool)((redef >> idx) & 1);
}
bool isPredefined(uint idx) {
assert(idx < flag_limit);
return (((predef & ~redef) >> idx) & 1);
if (idx >= flag_limit) return false;
return (bool)(((predef & ~redef) >> idx) & 1);
}
julong flagIndexMask() {
return (predef | redef);
......@@ -345,9 +345,9 @@ struct unpacker {
bool isIndex(uint idx) {
assert(flag_limit != 0); // must be set up already
if (idx < flag_limit)
return (((predef | redef) >> idx) & 1);
return (bool)(((predef | redef) >> idx) & 1);
else
return (idx - flag_limit < overflow_count.length());
return (idx - flag_limit < (uint)overflow_count.length());
}
int& getCount(uint idx) {
assert(isIndex(idx));
......
/*
* Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -65,7 +65,7 @@ void* must_malloc(int size) {
void mkdirs(int oklen, char* path) {
if (strlen(path) <= oklen) return;
if (strlen(path) <= (size_t)oklen) return;
char dir[PATH_MAX];
strcpy(dir, path);
......@@ -79,12 +79,13 @@ void mkdirs(int oklen, char* path) {
#ifndef PRODUCT
void breakpoint() { } // hook for debugger
void assert_failed(const char* p) {
int assert_failed(const char* p) {
char message[1<<12];
sprintf(message, "@assert failed: %s\n", p);
fprintf(stdout, 1+message);
breakpoint();
unpack_abort(message);
return 0;
}
#endif
......
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -27,7 +27,7 @@
void* must_malloc(int size);
#ifndef USE_MTRACE
#define mtrace(c, ptr, size) (0)
#define mtrace(c, ptr, size)
#else
void mtrace(char c, void* ptr, size_t size);
#endif
......
/*
* Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -85,7 +85,7 @@ void jar::init(unpacker* u_) {
// Write data to the ZIP output stream.
void jar::write_data(void* buff, int len) {
while (len > 0) {
int rc = fwrite(buff, 1, len, jarfp);
int rc = (int)fwrite(buff, 1, len, jarfp);
if (rc <= 0) {
fprintf(u->errstrm, "Error: write on output file failed err=%d\n",errno);
exit(1); // Called only from the native standalone unpacker
......@@ -98,17 +98,17 @@ void jar::write_data(void* buff, int len) {
void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
int len, int clen, uLong crc) {
uint fname_length = strlen(fname);
uint fname_length = (uint)strlen(fname);
ushort header[23];
if (modtime == 0) modtime = default_modtime;
uLong dostime = get_dostime(modtime);
header[0] = SWAP_BYTES(0x4B50);
header[1] = SWAP_BYTES(0x0201);
header[2] = SWAP_BYTES(0xA);
header[0] = (ushort)SWAP_BYTES(0x4B50);
header[1] = (ushort)SWAP_BYTES(0x0201);
header[2] = (ushort)SWAP_BYTES(0xA);
// required version
header[3] = SWAP_BYTES(0xA);
header[3] = (ushort)SWAP_BYTES(0xA);
// flags 02 = maximum sub-compression flag
header[4] = ( store ) ? 0x0 : SWAP_BYTES(0x2);
......@@ -117,23 +117,23 @@ void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
header[5] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
// Last modified date and time.
header[6] = GET_INT_LO(dostime);
header[7] = GET_INT_HI(dostime);
header[6] = (ushort)GET_INT_LO(dostime);
header[7] = (ushort)GET_INT_HI(dostime);
// CRC
header[8] = GET_INT_LO(crc);
header[9] = GET_INT_HI(crc);
header[8] = (ushort)GET_INT_LO(crc);
header[9] = (ushort)GET_INT_HI(crc);
// Compressed length:
header[10] = GET_INT_LO(clen);
header[11] = GET_INT_HI(clen);
header[10] = (ushort)GET_INT_LO(clen);
header[11] = (ushort)GET_INT_HI(clen);
// Uncompressed length.
header[12] = GET_INT_LO(len);
header[13] = GET_INT_HI(len);
header[12] = (ushort)GET_INT_LO(len);
header[13] = (ushort)GET_INT_HI(len);
// Filename length
header[14] = SWAP_BYTES(fname_length);
header[14] = (ushort)SWAP_BYTES(fname_length);
// So called "extra field" length.
header[15] = 0;
// So called "comment" length.
......@@ -146,8 +146,8 @@ void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
header[19] = 0;
header[20] = 0;
// Offset within ZIP file.
header[21] = GET_INT_LO(output_file_offset);
header[22] = GET_INT_HI(output_file_offset);
header[21] = (ushort)GET_INT_LO(output_file_offset);
header[22] = (ushort)GET_INT_HI(output_file_offset);
// Copy the whole thing into the central directory.
central_directory.append(header, sizeof(header));
......@@ -160,17 +160,17 @@ void jar::add_to_jar_directory(const char* fname, bool store, int modtime,
void jar::write_jar_header(const char* fname, bool store, int modtime,
int len, int clen, uint crc) {
uint fname_length = strlen(fname);
uint fname_length = (uint)strlen(fname);
ushort header[15];
if (modtime == 0) modtime = default_modtime;
uLong dostime = get_dostime(modtime);
// ZIP LOC magic.
header[0] = SWAP_BYTES(0x4B50);
header[1] = SWAP_BYTES(0x0403);
header[0] = (ushort)SWAP_BYTES(0x4B50);
header[1] = (ushort)SWAP_BYTES(0x0403);
// Version
header[2] = SWAP_BYTES(0xA);
header[2] = (ushort)SWAP_BYTES(0xA);
// flags 02 = maximum sub-compression flag
header[3] = ( store ) ? 0x0 : SWAP_BYTES(0x2);
......@@ -179,31 +179,31 @@ void jar::write_jar_header(const char* fname, bool store, int modtime,
header[4] = ( store ) ? 0x0 : SWAP_BYTES(0x08);
// Last modified date and time.
header[5] = GET_INT_LO(dostime);
header[6] = GET_INT_HI(dostime);
header[5] = (ushort)GET_INT_LO(dostime);
header[6] = (ushort)GET_INT_HI(dostime);
// CRC
header[7] = GET_INT_LO(crc);
header[8] = GET_INT_HI(crc);
header[7] = (ushort)GET_INT_LO(crc);
header[8] = (ushort)GET_INT_HI(crc);
// Compressed length:
header[9] = GET_INT_LO(clen);
header[10] = GET_INT_HI(clen);
header[9] = (ushort)GET_INT_LO(clen);
header[10] = (ushort)GET_INT_HI(clen);
// Uncompressed length.
header[11] = GET_INT_LO(len);
header[12] = GET_INT_HI(len);
header[11] = (ushort)GET_INT_LO(len);
header[12] = (ushort)GET_INT_HI(len);
// Filename length
header[13] = SWAP_BYTES(fname_length);
header[13] = (ushort)SWAP_BYTES(fname_length);
// So called "extra field" length.
header[14] = 0;
// Write the LOC header to the output file.
write_data(header, sizeof(header));
write_data(header, (int)sizeof(header));
// Copy the fname to the header.
write_data((char*)fname, fname_length);
write_data((char*)fname, (int)fname_length);
}
static const char marker_comment[] = ZIP_ARCHIVE_MARKER_COMMENT;
......@@ -214,32 +214,32 @@ void jar::write_central_directory() {
ushort header[11];
// Create the End of Central Directory structure.
header[0] = SWAP_BYTES(0x4B50);
header[1] = SWAP_BYTES(0x0605);
header[0] = (ushort)SWAP_BYTES(0x4B50);
header[1] = (ushort)SWAP_BYTES(0x0605);
// disk numbers
header[2] = 0;
header[3] = 0;
// Number of entries in central directory.
header[4] = SWAP_BYTES(central_directory_count);
header[5] = SWAP_BYTES(central_directory_count);
header[4] = (ushort)SWAP_BYTES(central_directory_count);
header[5] = (ushort)SWAP_BYTES(central_directory_count);
// Size of the central directory}
header[6] = GET_INT_LO(central_directory.size());
header[7] = GET_INT_HI(central_directory.size());
header[6] = (ushort)GET_INT_LO((int)central_directory.size());
header[7] = (ushort)GET_INT_HI((int)central_directory.size());
// Offset of central directory within disk.
header[8] = GET_INT_LO(output_file_offset);
header[9] = GET_INT_HI(output_file_offset);
header[8] = (ushort)GET_INT_LO(output_file_offset);
header[9] = (ushort)GET_INT_HI(output_file_offset);
// zipfile comment length;
header [10] = SWAP_BYTES(mc.len);
header [10] = (ushort)SWAP_BYTES((int)mc.len);
// Write the central directory.
printcr(2, "Central directory at %d\n", output_file_offset);
PRINTCR((2, "Central directory at %d\n", output_file_offset));
write_data(central_directory.b);
// Write the End of Central Directory structure.
printcr(2, "end-of-directory at %d\n", output_file_offset);
write_data(header, sizeof(header));
PRINTCR((2, "end-of-directory at %d\n", output_file_offset));
write_data(header, (int)sizeof(header));
printcr(2, "writing zip comment\n");
PRINTCR((2, "writing zip comment\n"));
// Write the comment.
write_data(mc);
}
......@@ -249,7 +249,7 @@ void jar::write_central_directory() {
// Open a Jar file and initialize.
void jar::openJarFile(const char* fname) {
if (!jarfp) {
printcr(1, "jar::openJarFile: opening %s\n",fname);
PRINTCR((1, "jar::openJarFile: opening %s\n",fname));
jarfp = fopen(fname, "wb");
if (!jarfp) {
fprintf(u->errstrm, "Error: Could not open jar file: %s\n",fname);
......@@ -262,25 +262,25 @@ void jar::openJarFile(const char* fname) {
void jar::addJarEntry(const char* fname,
bool deflate_hint, int modtime,
bytes& head, bytes& tail) {
int len = head.len + tail.len;
int len = (int)(head.len + tail.len);
int clen = 0;
uint crc = get_crc32(0L,Z_NULL,0);
uint crc = get_crc32(0,Z_NULL,0);
if (head.len != 0)
crc = get_crc32(crc, (uchar *)head.ptr, head.len);
crc = get_crc32(crc, (uchar *)head.ptr, (uint)head.len);
if (tail.len != 0)
crc = get_crc32(crc, (uchar *)tail.ptr, tail.len);
crc = get_crc32(crc, (uchar *)tail.ptr, (uint)tail.len);
bool deflate = (deflate_hint && len > 0);
if (deflate) {
if (deflate_bytes(head, tail) == false) {
printcr(2, "Reverting to store fn=%s\t%d -> %d\n",
fname, len, deflated.size());
PRINTCR((2, "Reverting to store fn=%s\t%d -> %d\n",
fname, len, deflated.size()));
deflate = false;
}
}
clen = (deflate) ? deflated.size() : len;
clen = (int)((deflate) ? deflated.size() : len);
add_to_jar_directory(fname, !deflate, modtime, len, clen, crc);
write_jar_header( fname, !deflate, modtime, len, clen, crc);
......@@ -306,7 +306,7 @@ void jar::closeJarFile(bool central) {
if (central) write_central_directory();
fflush(jarfp);
fclose(jarfp);
printcr(2, "jar::closeJarFile:closed jar-file\n");
PRINTCR((2, "jar::closeJarFile:closed jar-file\n"));
}
reset();
}
......@@ -338,6 +338,7 @@ uLong jar::get_dostime(int modtime) {
default_modtime = modtime; // catch a reasonable default
time_t t = modtime;
struct tm sbuf;
(void)memset((void*)&sbuf,0, sizeof(sbuf));
struct tm* s = gmtime_r(&t, &sbuf);
modtime_cache = modtime;
dostime_cache = dostime(s->tm_year + 1900, s->tm_mon + 1, s->tm_mday,
......@@ -355,7 +356,7 @@ uLong jar::get_dostime(int modtime) {
input data
*/
bool jar::deflate_bytes(bytes& head, bytes& tail) {
int len = head.len + tail.len;
int len = (int)(head.len + tail.len);
z_stream zs;
BYTES_OF(zs).clear();
......@@ -368,26 +369,26 @@ bool jar::deflate_bytes(bytes& head, bytes& tail) {
if (error != Z_OK) {
switch (error) {
case Z_MEM_ERROR:
printcr(2, "Error: deflate error : Out of memory \n");
PRINTCR((2, "Error: deflate error : Out of memory \n"));
break;
case Z_STREAM_ERROR:
printcr(2,"Error: deflate error : Invalid compression level \n");
PRINTCR((2,"Error: deflate error : Invalid compression level \n"));
break;
case Z_VERSION_ERROR:
printcr(2,"Error: deflate error : Invalid version\n");
PRINTCR((2,"Error: deflate error : Invalid version\n"));
break;
default:
printcr(2,"Error: Internal deflate error error = %d\n", error);
PRINTCR((2,"Error: Internal deflate error error = %d\n", error));
}
return false;
}
deflated.empty();
zs.next_out = (uchar*) deflated.grow(len + (len/2));
zs.avail_out = deflated.size();
zs.avail_out = (int)deflated.size();
zs.next_in = (uchar*)head.ptr;
zs.avail_in = head.len;
zs.avail_in = (int)head.len;
bytes* first = &head;
bytes* last = &tail;
......@@ -400,28 +401,28 @@ bool jar::deflate_bytes(bytes& head, bytes& tail) {
if (first != null && error == Z_OK) {
zs.next_in = (uchar*) first->ptr;
zs.avail_in = first->len;
zs.avail_in = (int)first->len;
error = deflate(&zs, Z_NO_FLUSH);
}
if (error == Z_OK) {
zs.next_in = (uchar*) last->ptr;
zs.avail_in = last->len;
zs.avail_in = (int)last->len;
error = deflate(&zs, Z_FINISH);
}
if (error == Z_STREAM_END) {
if (len > zs.total_out ) {
printcr(2, "deflate compressed data %d -> %d\n", len, zs.total_out);
if (len > (int)zs.total_out ) {
PRINTCR((2, "deflate compressed data %d -> %d\n", len, zs.total_out));
deflated.b.len = zs.total_out;
deflateEnd(&zs);
return true;
}
printcr(2, "deflate expanded data %d -> %d\n", len, zs.total_out);
PRINTCR((2, "deflate expanded data %d -> %d\n", len, zs.total_out));
deflateEnd(&zs);
return false;
}
deflateEnd(&zs);
printcr(2, "Error: deflate error deflate did not finish error=%d\n",error);
PRINTCR((2, "Error: deflate error deflate did not finish error=%d\n",error));
return false;
}
......@@ -486,7 +487,7 @@ void gunzip::init(unpacker* u_) {
BYTES_OF(*this).clear();
u = u_;
assert(u->gzin == null); // once only, please
read_input_fn = (void*)(intptr_t)u->read_input_fn;
read_input_fn = (void*)u->read_input_fn;
zstream = NEW(z_stream, 1);
u->gzin = this;
u->read_input_fn = read_input_via_gzip;
......@@ -555,7 +556,7 @@ void gunzip::read_fixed_field(char* buf, size_t buflen) {
if (aborting()) return;
jlong nr = ((unpacker::read_input_fn_t)read_input_fn)
(u, buf, buflen, buflen);
if (nr != buflen)
if ((size_t)nr != buflen)
u->abort("short stream header");
}
......
/*
* Copyright 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -69,7 +69,7 @@ struct jar {
// Private Methods
void write_data(void* ptr, int len);
void write_data(bytes& b) { write_data(b.ptr, b.len); }
void write_data(bytes& b) { write_data(b.ptr, (int)b.len); }
void add_to_jar_directory(const char* fname, bool store, int modtime,
int len, int clen, uLong crc);
void write_jar_header(const char* fname, bool store, int modtime,
......
/*
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -246,7 +246,7 @@ VerifyClassname(char *name, jboolean allowArrayClass)
/* skip over the fieldname. Slashes are okay */
p = skip_over_fieldname(name, JNI_TRUE, length);
}
return (p != 0 && p - name == length);
return (p != 0 && p - name == (ptrdiff_t)length);
}
/*
......
/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,6 +26,9 @@
#ifndef JDWP_UTIL_MD_H
#define JDWP_UTIL_MD_H
#include <stddef.h>
#include <stdint.h> /* To get uintptr_t */
#include <limits.h>
#include <sys/types.h>
......
/*
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -23,5 +23,8 @@
* have any questions.
*/
#include <stddef.h>
#include <stdint.h> /* For uintprt_t */
#include <stdlib.h>
#include <sys/param.h> /* For MAXPATHLEN */
/*
* Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -34,6 +34,8 @@
#include <dirent.h> /* For DIR */
#include <sys/param.h> /* For MAXPATHLEN */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
#include <stddef.h> /* For ptrdiff_t */
#include <stdint.h> /* For uintptr_t */
#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
......
此差异已折叠。
/*
* Copyright 2000-2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -24,15 +24,12 @@
*/
/*
* Solaris dependent type definitions includes intptr_t, etc
* Solaris/Linux dependent type definitions includes intptr_t, etc
*/
#include <stddef.h>
#include <stdint.h> /* For uintptr_t */
#include <stdlib.h>
#include <sys/types.h>
/*
* Linux version of <sys/types.h> does not define intptr_t
*/
#ifdef __linux__
#include <stdint.h>
#include <malloc.h>
#endif /* __linux__ */
/*
* Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -28,7 +28,7 @@
/* Make sure ptrdiff_t is defined */
#include <stddef.h>
#include "typedefs.h"
#include <stdint.h> /* For uintptr_t */
#define jlong_high(a) ((jint)((a)>>32))
#define jlong_low(a) ((jint)(a))
......
......@@ -206,10 +206,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/*
* Class: java_net_NetworkInterface
* Method: getByIndex
* Method: getByIndex0
* Signature: (Ljava/lang/String;)Ljava/net/NetworkInterface;
*/
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0
(JNIEnv *env, jclass cls, jint index) {
netif *ifs, *curr;
......
......@@ -1741,7 +1741,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
* (for IF).
*/
if (index > 0) {
ni = Java_java_net_NetworkInterface_getByIndex(env, ni_class,
ni = Java_java_net_NetworkInterface_getByIndex0(env, ni_class,
index);
if (ni == NULL) {
char errmsg[255];
......
/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,6 +26,7 @@
#ifndef JDWP_UTIL_MD_H
#define JDWP_UTIL_MD_H
#include <stddef.h> /* for uintptr_t */
#include <stdlib.h> /* for _MAx_PATH */
typedef unsigned __int64 UNSIGNED_JLONG;
......
/*
* Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -29,7 +29,6 @@
#include "hpi_impl.h"
#include "mutex_md.h"
#include "typedefs.h"
struct sockaddr;
......
/*
* Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1994-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -35,7 +35,6 @@
#include "threads_md.h"
#include "monitor_md.h"
#include "typedefs.h"
/*
......
/*
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -23,6 +23,7 @@
* have any questions.
*/
#include <stddef.h> /* For uintprt_t */
#include <stdlib.h>
#define MAXPATHLEN _MAX_PATH
......@@ -53,6 +53,7 @@ typedef struct {
WIN32_FIND_DATA find_data;
} DIR;
#include <stddef.h> /* For uintptr_t */
#include <stdlib.h>
#define JVM_MAXPATHLEN _MAX_PATH
......@@ -65,6 +66,19 @@ typedef struct {
JNIEXPORT void * JNICALL
JVM_GetThreadInterruptEvent();
/*
* These routines are only reentrant on Windows
*/
JNIEXPORT struct protoent * JNICALL
JVM_GetProtoByName(char* name);
JNIEXPORT struct hostent* JNICALL
JVM_GetHostByAddr(const char* name, int len, int type);
JNIEXPORT struct hostent* JNICALL
JVM_GetHostByName(char* name);
/*
* File I/O
*/
......
此差异已折叠。
......@@ -576,10 +576,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
/*
* Class: NetworkInterface
* Method: getByIndex
* Method: getByIndex0_XP
* Signature: (I)LNetworkInterface;
*/
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex_XP
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0_XP
(JNIEnv *env, jclass cls, jint index)
{
netif *ifList, *curr;
......
......@@ -2090,7 +2090,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
* (for IF).
*/
if (index > 0) {
ni = Java_java_net_NetworkInterface_getByIndex(env, ni_class,
ni = Java_java_net_NetworkInterface_getByIndex0(env, ni_class,
index);
if (ni == NULL) {
char errmsg[255];
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册