--- a/jdk/make/common/Defs.gmk Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/make/common/Defs.gmk Fri Aug 29 12:40:58 2008 -0700
@@ -451,7 +451,7 @@
# 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)
#
--- a/jdk/make/java/net/mapfile-vers Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/make/java/net/mapfile-vers Fri Aug 29 12:40:58 2008 -0700
@@ -57,7 +57,7 @@
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;
--- a/jdk/make/java/verify/Makefile Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/make/java/verify/Makefile Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
#
-# 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
@@ -53,12 +53,6 @@
check_format.c
#
-# libverify.so needs these 2 header files (opcodes.h opcodes.length)
-# from the VM.
-#
-CPPFLAGS += -I$(SHARE_SRC)/javavm/include
-
-#
# Targets.
#
ifeq ($(PLATFORM), solaris)
--- a/jdk/make/netbeans/awt2d/README Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/make/netbeans/awt2d/README Fri Aug 29 12:40:58 2008 -0700
@@ -145,7 +145,6 @@
(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;
--- a/jdk/make/tools/GenerateCharacter/check_class.c.template Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/make/tools/GenerateCharacter/check_class.c.template Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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);
--- a/jdk/src/share/back/debugDispatch.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/back/debugDispatch.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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;
--- a/jdk/src/share/back/error_messages.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/back/error_messages.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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
--- a/jdk/src/share/back/inStream.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/back/inStream.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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)
--- a/jdk/src/share/back/outStream.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/back/outStream.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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"
--- a/jdk/src/share/classes/java/net/NetworkInterface.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/java/net/NetworkInterface.java Fri Aug 29 12:40:58 2008 -0700
@@ -203,11 +203,17 @@
}
/**
- * 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 @@
* 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 @@
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;
--- a/jdk/src/share/classes/java/net/ServerSocket.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/java/net/ServerSocket.java Fri Aug 29 12:40:58 2008 -0700
@@ -142,14 +142,18 @@
* 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 @@
* 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 @@
* 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
--- a/jdk/src/share/classes/java/util/EnumSet.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/java/util/EnumSet.java Fri Aug 29 12:40:58 2008 -0700
@@ -432,4 +432,11 @@
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");
+ }
}
--- a/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/SSLServerSocket.java Fri Aug 29 12:40:58 2008 -0700
@@ -108,9 +108,12 @@
* <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 @@
* 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 @@
* <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
--- a/jdk/src/share/classes/sun/nio/cs/UTF_8.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/UTF_8.java Fri Aug 29 12:40:58 2008 -0700
@@ -25,34 +25,36 @@
package sun.nio.cs;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.BufferOverflowException;
-import java.nio.BufferUnderflowException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.MalformedInputException;
-import java.nio.charset.UnmappableCharacterException;
-
-/*
- * # Bits Bit pattern
- * 1 7 0xxxxxxx
- * 2 11 110xxxxx 10xxxxxx
- * 3 16 1110xxxx 10xxxxxx 10xxxxxx
- * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
- * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
- * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+/* Legal UTF-8 Byte Sequences
+ *
+ * # Code Points Bits Bit/Byte pattern
+ * 1 7 0xxxxxxx
+ * U+0000..U+007F 00..7F
+ *
+ * 2 11 110xxxxx 10xxxxxx
+ * U+0080..U+07FF C2..DF 80..BF
*
- * UCS-2 uses 1-3, UTF-16 uses 1-4, UCS-4 uses 1-6
+ * 3 16 1110xxxx 10xxxxxx 10xxxxxx
+ * U+0800..U+0FFF E0 A0..BF 80..BF
+ * U+1000..U+FFFF E1..EF 80..BF 80..BF
+ *
+ * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ * U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
+ * U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
+ * U+100000..U10FFFF F4 80..8F 80..BF 80..BF
+ *
*/
class UTF_8 extends Unicode
{
-
public UTF_8() {
super("UTF-8", StandardCharsets.aliases_UTF_8);
}
@@ -69,304 +71,250 @@
return new Encoder(this);
}
+ static final void updatePositions(Buffer src, int sp,
+ Buffer dst, int dp) {
+ src.position(sp - src.arrayOffset());
+ dst.position(dp - dst.arrayOffset());
+ }
private static class Decoder extends CharsetDecoder {
private Decoder(Charset cs) {
super(cs, 1.0f, 1.0f);
}
- private boolean isContinuation(int b) {
- return ((b & 0xc0) == 0x80);
+ private static boolean isNotContinuation(int b) {
+ return (b & 0xc0) != 0x80;
+ }
+
+ // [C2..DF] [80..BF]
+ private static boolean isMalformed2(int b1, int b2) {
+ return (b1 & 0x1e) == 0x0 || (b2 & 0xc0) != 0x80;
+ }
+
+ // [E0] [A0..BF] [80..BF]
+ // [E1..EF] [80..BF] [80..BF]
+ private static boolean isMalformed3(int b1, int b2, int b3) {
+ return (b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) ||
+ (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80;
+ }
+
+ // [F0] [90..BF] [80..BF] [80..BF]
+ // [F1..F3] [80..BF] [80..BF] [80..BF]
+ // [F4] [80..8F] [80..BF] [80..BF]
+ // only check 80-be range here, the [0xf0,0x80...] and [0xf4,0x90-...]
+ // will be checked by Surrogate.neededFor(uc)
+ private static boolean isMalformed4(int b2, int b3, int b4) {
+ return (b2 & 0xc0) != 0x80 || (b3 & 0xc0) != 0x80 ||
+ (b4 & 0xc0) != 0x80;
+ }
+
+ private static CoderResult lookupN(ByteBuffer src, int n)
+ {
+ for (int i = 1; i < n; i++) {
+ if (isNotContinuation(src.get()))
+ return CoderResult.malformedForLength(i);
+ }
+ return CoderResult.malformedForLength(n);
}
- private final Surrogate.Generator sgg = new Surrogate.Generator();
+ private static CoderResult malformedN(ByteBuffer src, int nb) {
+ switch (nb) {
+ case 1:
+ int b1 = src.get();
+ if ((b1 >> 2) == -2) {
+ // 5 bytes 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+ if (src.remaining() < 4)
+ return CoderResult.UNDERFLOW;
+ return lookupN(src, 5);
+ }
+ if ((b1 >> 1) == -2) {
+ // 6 bytes 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+ if (src.remaining() < 5)
+ return CoderResult.UNDERFLOW;
+ return lookupN(src, 6);
+ }
+ return CoderResult.malformedForLength(1);
+ case 2: // always 1
+ return CoderResult.malformedForLength(1);
+ case 3:
+ b1 = src.get();
+ int b2 = src.get(); // no need to lookup b3
+ return CoderResult.malformedForLength(
+ ((b1 == (byte)0xe0 && (b2 & 0xe0) == 0x80) ||
+ isNotContinuation(b2))?1:2);
+ case 4: // we don't care the speed here
+ b1 = src.get() & 0xff;
+ b2 = src.get() & 0xff;
+ if (b1 > 0xf4 ||
+ (b1 == 0xf0 && (b2 < 0x90 || b2 > 0xbf)) ||
+ (b1 == 0xf4 && (b2 & 0xf0) != 0x80) ||
+ isNotContinuation(b2))
+ return CoderResult.malformedForLength(1);
+ if (isNotContinuation(src.get()))
+ return CoderResult.malformedForLength(2);
+ return CoderResult.malformedForLength(3);
+ default:
+ assert false;
+ return null;
+ }
+ }
+
+ private static CoderResult malformed(ByteBuffer src, int sp,
+ CharBuffer dst, int dp,
+ int nb)
+ {
+ src.position(sp - src.arrayOffset());
+ CoderResult cr = malformedN(src, nb);
+ updatePositions(src, sp, dst, dp);
+ return cr;
+ }
+
+ private static CoderResult malformed(ByteBuffer src,
+ int mark, int nb)
+ {
+ src.position(mark);
+ CoderResult cr = malformedN(src, nb);
+ src.position(mark);
+ return cr;
+ }
+
+ private static CoderResult xflow(Buffer src, int sp, int sl,
+ Buffer dst, int dp, int nb) {
+ updatePositions(src, sp, dst, dp);
+ return (nb == 0 || sl - sp < nb)
+ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW;
+ }
+
+ private static CoderResult xflow(Buffer src, int mark, int nb) {
+ CoderResult cr = (nb == 0 || src.remaining() < (nb - 1))
+ ?CoderResult.UNDERFLOW:CoderResult.OVERFLOW;
+ src.position(mark);
+ return cr;
+ }
private CoderResult decodeArrayLoop(ByteBuffer src,
CharBuffer dst)
{
+ // This method is optimized for ASCII input.
byte[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
- assert (sp <= sl);
- sp = (sp <= sl ? sp : sl);
+
char[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
- assert (dp <= dl);
- dp = (dp <= dl ? dp : dl);
-
- try {
- while (sp < sl) {
- int b1 = sa[sp];
- int b2, b3;
- switch ((b1 >> 4) & 0x0f) {
-
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 7:
- // 1 byte, 7 bits: 0xxxxxxx
- if (dl - dp < 1)
- return CoderResult.OVERFLOW;
- da[dp++] = (char)(b1 & 0x7f);
- sp++;
- continue;
+ int dlASCII = dp + Math.min(sl - sp, dl - dp);
- case 12: case 13:
- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
- if (sl - sp < 2)
- return CoderResult.UNDERFLOW;
- if (dl - dp < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation(b2 = sa[sp + 1]))
- return CoderResult.malformedForLength(1);
- da[dp++] = ((char)(((b1 & 0x1f) << 6) |
- ((b2 & 0x3f) << 0)));
- sp += 2;
- continue;
-
- case 14:
- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
- if (sl - sp < 3)
- return CoderResult.UNDERFLOW;
- if (dl - dp < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation(b2 = sa[sp + 1]))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = sa[sp + 2]))
- return CoderResult.malformedForLength(2);
- da[dp++] = ((char)(((b1 & 0x0f) << 12) |
- ((b2 & 0x3f) << 06) |
- ((b3 & 0x3f) << 0)));
- sp += 3;
- continue;
-
- case 15:
- // 4, 5, or 6 bytes
-
- int b4, b5, b6, uc, n;
- switch (b1 & 0x0f) {
+ // ASCII only loop
+ while (dp < dlASCII && sa[sp] >= 0)
+ da[dp++] = (char)sa[sp++];
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 7:
- // 4 bytes, 21 bits
- if (sl - sp < 4)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = sa[sp + 1]))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = sa[sp + 2]))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = sa[sp + 3]))
- return CoderResult.malformedForLength(3);
- uc = (((b1 & 0x07) << 18) |
- ((b2 & 0x3f) << 12) |
- ((b3 & 0x3f) << 06) |
- ((b4 & 0x3f) << 00));
- n = 4;
- break;
-
- case 8: case 9: case 10: case 11:
- // 5 bytes, 26 bits
- if (sl - sp < 5)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = sa[sp + 1]))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = sa[sp + 2]))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = sa[sp + 3]))
- return CoderResult.malformedForLength(3);
- if (!isContinuation(b5 = sa[sp + 4]))
- return CoderResult.malformedForLength(4);
- uc = (((b1 & 0x03) << 24) |
- ((b2 & 0x3f) << 18) |
- ((b3 & 0x3f) << 12) |
- ((b4 & 0x3f) << 06) |
- ((b5 & 0x3f) << 00));
- n = 5;
- break;
-
- case 12: case 13:
- // 6 bytes, 31 bits
- if (sl - sp < 6)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = sa[sp + 1]))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = sa[sp + 2]))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = sa[sp + 3]))
- return CoderResult.malformedForLength(3);
- if (!isContinuation(b5 = sa[sp + 4]))
- return CoderResult.malformedForLength(4);
- if (!isContinuation(b6 = sa[sp + 5]))
- return CoderResult.malformedForLength(5);
- uc = (((b1 & 0x01) << 30) |
- ((b2 & 0x3f) << 24) |
- ((b3 & 0x3f) << 18) |
- ((b4 & 0x3f) << 12) |
- ((b5 & 0x3f) << 06) |
- ((b6 & 0x3f)));
- n = 6;
- break;
-
- default:
- return CoderResult.malformedForLength(1);
-
- }
-
- int gn = sgg.generate(uc, n, da, dp, dl);
- if (gn < 0)
- return sgg.error();
- dp += gn;
- sp += n;
- continue;
-
- default:
- return CoderResult.malformedForLength(1);
-
+ while (sp < sl) {
+ int b1 = sa[sp];
+ if (b1 >= 0) {
+ // 1 byte, 7 bits: 0xxxxxxx
+ if (dp >= dl)
+ return xflow(src, sp, sl, dst, dp, 1);
+ da[dp++] = (char)b1;
+ sp++;
+ } else if ((b1 >> 5) == -2) {
+ // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
+ if (sl - sp < 2 || dp >= dl)
+ return xflow(src, sp, sl, dst, dp, 2);
+ int b2 = sa[sp + 1];
+ if (isMalformed2(b1, b2))
+ return malformed(src, sp, dst, dp, 2);
+ da[dp++] = (char) (((b1 << 6) ^ b2) ^ 0x0f80);
+ sp += 2;
+ } else if ((b1 >> 4) == -2) {
+ // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
+ if (sl - sp < 3 || dp >= dl)
+ return xflow(src, sp, sl, dst, dp, 3);
+ int b2 = sa[sp + 1];
+ int b3 = sa[sp + 2];
+ if (isMalformed3(b1, b2, b3))
+ return malformed(src, sp, dst, dp, 3);
+ da[dp++] = (char) (((b1 << 12) ^ (b2 << 6) ^ b3) ^ 0x1f80);
+ sp += 3;
+ } else if ((b1 >> 3) == -2) {
+ // 4 bytes, 21 bits: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ if (sl - sp < 4 || dl - dp < 2)
+ return xflow(src, sp, sl, dst, dp, 4);
+ int b2 = sa[sp + 1];
+ int b3 = sa[sp + 2];
+ int b4 = sa[sp + 3];
+ int uc = ((b1 & 0x07) << 18) |
+ ((b2 & 0x3f) << 12) |
+ ((b3 & 0x3f) << 06) |
+ (b4 & 0x3f);
+ if (isMalformed4(b2, b3, b4) ||
+ !Surrogate.neededFor(uc)) {
+ return malformed(src, sp, dst, dp, 4);
}
-
- }
-
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(sp - src.arrayOffset());
- dst.position(dp - dst.arrayOffset());
+ da[dp++] = Surrogate.high(uc);
+ da[dp++] = Surrogate.low(uc);
+ sp += 4;
+ } else
+ return malformed(src, sp, dst, dp, 1);
}
+ return xflow(src, sp, sl, dst, dp, 0);
}
private CoderResult decodeBufferLoop(ByteBuffer src,
CharBuffer dst)
{
int mark = src.position();
- try {
- while (src.hasRemaining()) {
- int b1 = src.get();
- int b2, b3;
- switch ((b1 >> 4) & 0x0f) {
-
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 7:
- // 1 byte, 7 bits: 0xxxxxxx
- if (dst.remaining() < 1)
- return CoderResult.OVERFLOW;
- dst.put((char)b1);
- mark++;
- continue;
-
- case 12: case 13:
- // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
- if (src.remaining() < 1)
- return CoderResult.UNDERFLOW;
- if (dst.remaining() < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation(b2 = src.get()))
- return CoderResult.malformedForLength(1);
- dst.put((char)(((b1 & 0x1f) << 6) |
- ((b2 & 0x3f) << 0)));
- mark += 2;
- continue;
-
- case 14:
- // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
- if (src.remaining() < 2)
- return CoderResult.UNDERFLOW;
- if (dst.remaining() < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation(b2 = src.get()))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = src.get()))
- return CoderResult.malformedForLength(2);
- dst.put((char)(((b1 & 0x0f) << 12) |
- ((b2 & 0x3f) << 06) |
- ((b3 & 0x3f) << 0)));
- mark += 3;
- continue;
-
- case 15:
- // 4, 5, or 6 bytes
-
- int b4, b5, b6, uc, n;
- switch (b1 & 0x0f) {
-
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 7:
- // 4 bytes, 21 bits
- if (src.remaining() < 3)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = src.get()))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = src.get()))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = src.get()))
- return CoderResult.malformedForLength(3);
- uc = (((b1 & 0x07) << 18) |
- ((b2 & 0x3f) << 12) |
- ((b3 & 0x3f) << 06) |
- ((b4 & 0x3f) << 00));
- n = 4;
- break;
-
- case 8: case 9: case 10: case 11:
- // 5 bytes, 26 bits
- if (src.remaining() < 4)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = src.get()))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = src.get()))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = src.get()))
- return CoderResult.malformedForLength(3);
- if (!isContinuation(b5 = src.get()))
- return CoderResult.malformedForLength(4);
- uc = (((b1 & 0x03) << 24) |
- ((b2 & 0x3f) << 18) |
- ((b3 & 0x3f) << 12) |
- ((b4 & 0x3f) << 06) |
- ((b5 & 0x3f) << 00));
- n = 5;
- break;
-
- case 12: case 13:
- // 6 bytes, 31 bits
- if (src.remaining() < 5)
- return CoderResult.UNDERFLOW;
- if (!isContinuation(b2 = src.get()))
- return CoderResult.malformedForLength(1);
- if (!isContinuation(b3 = src.get()))
- return CoderResult.malformedForLength(2);
- if (!isContinuation(b4 = src.get()))
- return CoderResult.malformedForLength(3);
- if (!isContinuation(b5 = src.get()))
- return CoderResult.malformedForLength(4);
- if (!isContinuation(b6 = src.get()))
- return CoderResult.malformedForLength(5);
- uc = (((b1 & 0x01) << 30) |
- ((b2 & 0x3f) << 24) |
- ((b3 & 0x3f) << 18) |
- ((b4 & 0x3f) << 12) |
- ((b5 & 0x3f) << 06) |
- ((b6 & 0x3f)));
- n = 6;
- break;
-
- default:
- return CoderResult.malformedForLength(1);
-
- }
-
- if (sgg.generate(uc, n, dst) < 0)
- return sgg.error();
- mark += n;
- continue;
-
- default:
- return CoderResult.malformedForLength(1);
-
+ int limit = src.limit();
+ while (mark < limit) {
+ int b1 = src.get();
+ if (b1 >= 0) {
+ // 1 byte, 7 bits: 0xxxxxxx
+ if (dst.remaining() < 1)
+ return xflow(src, mark, 1); //overflow
+ dst.put((char)b1);
+ mark++;
+ } else if ((b1 >> 5) == -2) {
+ // 2 bytes, 11 bits: 110xxxxx 10xxxxxx
+ if (limit - mark < 2|| dst.remaining() < 1)
+ return xflow(src, mark, 2);
+ int b2 = src.get();
+ if (isMalformed2(b1, b2))
+ return malformed(src, mark, 2);
+ dst.put((char) (((b1 << 6) ^ b2) ^ 0x0f80));
+ mark += 2;
+ } else if ((b1 >> 4) == -2) {
+ // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
+ if (limit - mark < 3 || dst.remaining() < 1)
+ return xflow(src, mark, 3);
+ int b2 = src.get();
+ int b3 = src.get();
+ if (isMalformed3(b1, b2, b3))
+ return malformed(src, mark, 3);
+ dst.put((char) (((b1 << 12) ^ (b2 << 6) ^ b3) ^ 0x1f80));
+ mark += 3;
+ } else if ((b1 >> 3) == -2) {
+ // 4 bytes, 21 bits: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ if (limit - mark < 4 || dst.remaining() < 2)
+ return xflow(src, mark, 4);
+ int b2 = src.get();
+ int b3 = src.get();
+ int b4 = src.get();
+ int uc = ((b1 & 0x07) << 18) |
+ ((b2 & 0x3f) << 12) |
+ ((b3 & 0x3f) << 06) |
+ (b4 & 0x3f);
+ if (isMalformed4(b2, b3, b4) ||
+ !Surrogate.neededFor(uc)) { // shortest form check
+ return malformed(src, mark, 4);
}
-
+ dst.put(Surrogate.high(uc));
+ dst.put(Surrogate.low(uc));
+ mark += 4;
+ } else {
+ return malformed(src, mark, 1);
}
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(mark);
}
+ return xflow(src, mark, 0);
}
protected CoderResult decodeLoop(ByteBuffer src,
@@ -377,10 +325,8 @@
else
return decodeBufferLoop(src, dst);
}
-
}
-
private static class Encoder extends CharsetEncoder {
private Encoder(Charset cs) {
@@ -391,141 +337,126 @@
return !Surrogate.is(c);
}
- private final Surrogate.Parser sgp = new Surrogate.Parser();
+ public boolean isLegalReplacement(byte[] repl) {
+ return ((repl.length == 1 && repl[0] >= 0) ||
+ super.isLegalReplacement(repl));
+ }
+ private static CoderResult overflow(CharBuffer src, int sp,
+ ByteBuffer dst, int dp) {
+ updatePositions(src, sp, dst, dp);
+ return CoderResult.OVERFLOW;
+ }
+
+ private static CoderResult overflow(CharBuffer src, int mark) {
+ src.position(mark);
+ return CoderResult.OVERFLOW;
+ }
+
+ private Surrogate.Parser sgp;
private CoderResult encodeArrayLoop(CharBuffer src,
ByteBuffer dst)
{
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
- assert (sp <= sl);
- sp = (sp <= sl ? sp : sl);
+
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
- assert (dp <= dl);
- dp = (dp <= dl ? dp : dl);
-
- try {
- while (sp < sl) {
- char c = sa[sp];
-
- if (c < 0x80) {
- // Have at most seven bits
- if (dp >= dl)
- return CoderResult.OVERFLOW;
- da[dp++] = (byte)c;
- sp++;
- continue;
- }
+ int dlASCII = dp + Math.min(sl - sp, dl - dp);
- if (!Surrogate.is(c)) {
- // 2 bytes, 11 bits
- if (c < 0x800) {
- if (dl - dp < 2)
- return CoderResult.OVERFLOW;
- da[dp++] = (byte)(0xc0 | ((c >> 06)));
- da[dp++] = (byte)(0x80 | ((c >> 00) & 0x3f));
- sp++;
- continue;
- }
- if (c <= '\uFFFF') {
- // 3 bytes, 16 bits
- if (dl - dp < 3)
- return CoderResult.OVERFLOW;
- da[dp++] = (byte)(0xe0 | ((c >> 12)));
- da[dp++] = (byte)(0x80 | ((c >> 06) & 0x3f));
- da[dp++] = (byte)(0x80 | ((c >> 00) & 0x3f));
- sp++;
- continue;
- }
+ //ASCII only loop
+ while (dp < dlASCII && sa[sp] < '\u0080')
+ da[dp++] = (byte) sa[sp++];
+ while (sp < sl) {
+ int c = sa[sp];
+ if (c < 0x80) {
+ // Have at most seven bits
+ if (dp >= dl)
+ return overflow(src, sp, dst, dp);
+ da[dp++] = (byte)c;
+ } else if (c < 0x800) {
+ // 2 bytes, 11 bits
+ if (dl - dp < 2)
+ return overflow(src, sp, dst, dp);
+ da[dp++] = (byte)(0xc0 | ((c >> 06)));
+ da[dp++] = (byte)(0x80 | (c & 0x3f));
+ } else if (Surrogate.is(c)) {
+ // Have a surrogate pair
+ if (sgp == null)
+ sgp = new Surrogate.Parser();
+ int uc = sgp.parse((char)c, sa, sp, sl);
+ if (uc < 0) {
+ updatePositions(src, sp, dst, dp);
+ return sgp.error();
}
-
- // Have a surrogate pair
- int uc = sgp.parse(c, sa, sp, sl);
- if (uc < 0)
- return sgp.error();
- if (uc < 0x200000) {
- if (dl - dp < 4)
- return CoderResult.OVERFLOW;
- da[dp++] = (byte)(0xf0 | ((uc >> 18)));
- da[dp++] = (byte)(0x80 | ((uc >> 12) & 0x3f));
- da[dp++] = (byte)(0x80 | ((uc >> 06) & 0x3f));
- da[dp++] = (byte)(0x80 | ((uc >> 00) & 0x3f));
- sp += sgp.increment();
- continue;
- }
- assert false;
-
+ if (dl - dp < 4)
+ return overflow(src, sp, dst, dp);
+ da[dp++] = (byte)(0xf0 | ((uc >> 18)));
+ da[dp++] = (byte)(0x80 | ((uc >> 12) & 0x3f));
+ da[dp++] = (byte)(0x80 | ((uc >> 06) & 0x3f));
+ da[dp++] = (byte)(0x80 | (uc & 0x3f));
+ sp++; // 2 chars
+ } else {
+ // 3 bytes, 16 bits
+ if (dl - dp < 3)
+ return overflow(src, sp, dst, dp);
+ da[dp++] = (byte)(0xe0 | ((c >> 12)));
+ da[dp++] = (byte)(0x80 | ((c >> 06) & 0x3f));
+ da[dp++] = (byte)(0x80 | (c & 0x3f));
}
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(sp - src.arrayOffset());
- dst.position(dp - dst.arrayOffset());
+ sp++;
}
+ updatePositions(src, sp, dst, dp);
+ return CoderResult.UNDERFLOW;
}
private CoderResult encodeBufferLoop(CharBuffer src,
ByteBuffer dst)
{
int mark = src.position();
- try {
- while (src.hasRemaining()) {
- char c = src.get();
-
- if (c < 0x80) {
- // Have at most seven bits
- if (!dst.hasRemaining())
- return CoderResult.OVERFLOW;
- dst.put((byte)c);
- mark++;
- continue;
+ while (src.hasRemaining()) {
+ int c = src.get();
+ if (c < 0x80) {
+ // Have at most seven bits
+ if (!dst.hasRemaining())
+ return overflow(src, mark);
+ dst.put((byte)c);
+ } else if (c < 0x800) {
+ // 2 bytes, 11 bits
+ if (dst.remaining() < 2)
+ return overflow(src, mark);
+ dst.put((byte)(0xc0 | ((c >> 06))));
+ dst.put((byte)(0x80 | (c & 0x3f)));
+ } else if (Surrogate.is(c)) {
+ // Have a surrogate pair
+ if (sgp == null)
+ sgp = new Surrogate.Parser();
+ int uc = sgp.parse((char)c, src);
+ if (uc < 0) {
+ src.position(mark);
+ return sgp.error();
}
-
- if (!Surrogate.is(c)) {
- if (c < 0x800) {
- // 2 bytes, 11 bits
- if (dst.remaining() < 2)
- return CoderResult.OVERFLOW;
- dst.put((byte)(0xc0 | ((c >> 06))));
- dst.put((byte)(0x80 | ((c >> 00) & 0x3f)));
- mark++;
- continue;
- }
- if (c <= '\uFFFF') {
- // 3 bytes, 16 bits
- if (dst.remaining() < 3)
- return CoderResult.OVERFLOW;
- dst.put((byte)(0xe0 | ((c >> 12))));
- dst.put((byte)(0x80 | ((c >> 06) & 0x3f)));
- dst.put((byte)(0x80 | ((c >> 00) & 0x3f)));
- mark++;
- continue;
- }
- }
-
- // Have a surrogate pair
- int uc = sgp.parse(c, src);
- if (uc < 0)
- return sgp.error();
- if (uc < 0x200000) {
- if (dst.remaining() < 4)
- return CoderResult.OVERFLOW;
- dst.put((byte)(0xf0 | ((uc >> 18))));
- dst.put((byte)(0x80 | ((uc >> 12) & 0x3f)));
- dst.put((byte)(0x80 | ((uc >> 06) & 0x3f)));
- dst.put((byte)(0x80 | ((uc >> 00) & 0x3f)));
- mark += sgp.increment();
- continue;
- }
- assert false;
-
+ if (dst.remaining() < 4)
+ return overflow(src, mark);
+ dst.put((byte)(0xf0 | ((uc >> 18))));
+ dst.put((byte)(0x80 | ((uc >> 12) & 0x3f)));
+ dst.put((byte)(0x80 | ((uc >> 06) & 0x3f)));
+ dst.put((byte)(0x80 | (uc & 0x3f)));
+ mark++; //2 chars
+ } else {
+ // 3 bytes, 16 bits
+ if (dst.remaining() < 3)
+ return overflow(src, mark);
+ dst.put((byte)(0xe0 | ((c >> 12))));
+ dst.put((byte)(0x80 | ((c >> 06) & 0x3f)));
+ dst.put((byte)(0x80 | (c & 0x3f)));
}
- return CoderResult.UNDERFLOW;
- } finally {
- src.position(mark);
+ mark++;
}
+ src.position(mark);
+ return CoderResult.UNDERFLOW;
}
protected final CoderResult encodeLoop(CharBuffer src,
@@ -536,7 +467,5 @@
else
return encodeBufferLoop(src, dst);
}
-
}
-
}
--- a/jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/sun/security/util/DerIndefLenConverter.java Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
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 @@
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 @@
int lenByte = data[dataPos++] & 0xff;
if (isIndefinite(lenByte)) {
ndefsList.add(new Integer(dataPos));
+ unresolved++;
return curLen;
}
if (isLongForm(lenByte)) {
@@ -308,15 +311,21 @@
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 @@
writeTag();
writeLengthAndValue();
}
+ System.arraycopy(indefData, dataSize,
+ newData, dataSize + numOfTotalLenBytes, unused);
return newData;
}
--- a/jdk/src/share/classes/sun/tools/jmap/JMap.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/classes/sun/tools/jmap/JMap.java Fri Aug 29 12:40:58 2008 -0700
@@ -56,7 +56,7 @@
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 @@
// 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" },
--- a/jdk/src/share/instrument/InstrumentationImplNativeMethods.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/instrument/InstrumentationImplNativeMethods.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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.
--- a/jdk/src/share/instrument/JPLISAgent.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/instrument/JPLISAgent.c Fri Aug 29 12:40:58 2008 -0700
@@ -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.
--- a/jdk/src/share/javavm/export/jvm.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/javavm/export/jvm.h Fri Aug 29 12:40:58 2008 -0700
@@ -948,90 +948,8 @@
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 @@
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);
--- a/jdk/src/share/javavm/include/opcodes.h Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-/*
- * 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_ */
--- a/jdk/src/share/javavm/include/opcodes.length Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-/*
- * 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,
-};
--- a/jdk/src/share/javavm/include/opcodes.list Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,301 +0,0 @@
-# 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 */
--- a/jdk/src/share/javavm/include/opcodes.weight Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-/*
- * 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,
-};
--- a/jdk/src/share/javavm/include/opcodes.wide Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +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)
--- a/jdk/src/share/javavm/include/sys_api.h Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
- * 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_ */
--- a/jdk/src/share/javavm/include/typedefs.h Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * 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_ */
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
(*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 @@
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 @@
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));
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bytes.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bytes.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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::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 @@
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();
}
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bytes.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bytes.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 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 @@
::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(); }
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
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 @@
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* 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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_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
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/coding.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/coding.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
#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
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
#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 @@
#define null (0)
-#ifndef __sparc
-#define intptr_t jlong
-#endif
+/* Must cast to void *, then size_t, then int. */
+#define ptrlowbits(x) ((int)(size_t)(void*)(x))
-#define ptrlowbits(x) ((int) (intptr_t)(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"
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
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 @@
//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 @@
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)
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/main.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
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 @@
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 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 @@
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
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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
@@ -27,6 +27,21 @@
// Program for unpacking specially compressed Java packages.
// John R. Rose
+/*
+ * When compiling for a 64bit LP64 system (longs and pointers being 64bits),
+ * the printf format %ld is correct and use of %lld will cause warning
+ * errors from some compilers (gcc/g++).
+ * _LP64 can be explicitly set (used on Linux).
+ * Solaris compilers will define __sparcv9 or __x86_64 on 64bit compilations.
+ */
+#if defined(_LP64) || defined(__sparcv9) || defined(__x86_64)
+ #define LONG_LONG_FORMAT "%ld"
+ #define LONG_LONG_HEX_FORMAT "%lx"
+#else
+ #define LONG_LONG_FORMAT "%lld"
+ #define LONG_LONG_HEX_FORMAT "%016llx"
+#endif
+
#include <sys/types.h>
#include <stdio.h>
@@ -253,12 +268,12 @@
inline cpindex* cpool::getFieldIndex(entry* classRef) {
assert(classRef->tagMatches(CONSTANT_Class));
- assert((uint)classRef->inord < tag_count[CONSTANT_Class]);
+ assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
return &member_indexes[classRef->inord*2+0];
}
inline cpindex* cpool::getMethodIndex(entry* classRef) {
assert(classRef->tagMatches(CONSTANT_Class));
- assert((uint)classRef->inord < tag_count[CONSTANT_Class]);
+ assert((uint)classRef->inord < (uint)tag_count[CONSTANT_Class]);
return &member_indexes[classRef->inord*2+1];
}
@@ -341,7 +356,7 @@
rplimit += nr;
fetch -= nr;
bytes_read += nr;
- assert(remaining == (input.limit() - rplimit));
+ assert(remaining == (julong)(input.limit() - rplimit));
}
return true;
}
@@ -441,9 +456,13 @@
e->requestOutputIndex(cp, -size);
// Later on we'll fix the bits.
class_fixup_type.addByte(size);
- class_fixup_offset.add(wpoffset());
+ class_fixup_offset.add((int)wpoffset());
class_fixup_ref.add(e);
- return !assert(1) ? 0 : 0x20+size; // 0x22 is easy to eyeball
+#ifdef PRODUCT
+ return 0;
+#else
+ return 0x20+size; // 0x22 is easy to eyeball
+#endif
}
}
@@ -472,7 +491,7 @@
void* unpacker::alloc_heap(size_t size, bool smallOK, bool temp) {
CHECK_0;
if (!smallOK || size > SMALL) {
- void* res = must_malloc(size);
+ void* res = must_malloc((int)size);
(temp ? &tmallocs : &mallocs)->add(res);
return res;
}
@@ -481,7 +500,7 @@
xsmallbuf.init(CHUNK);
(temp ? &tmallocs : &mallocs)->add(xsmallbuf.base());
}
- int growBy = size;
+ int growBy = (int)size;
growBy += -growBy & 7; // round up mod 8
return xsmallbuf.grow(growBy);
}
@@ -514,7 +533,7 @@
FIRST_READ = MAGIC_BYTES + AH_LENGTH_MIN
};
bool foreign_buf = (read_input_fn == null);
- byte initbuf[FIRST_READ + C_SLOP + 200]; // 200 is for JAR I/O
+ byte initbuf[(int)FIRST_READ + (int)C_SLOP + 200]; // 200 is for JAR I/O
if (foreign_buf) {
// inbytes is all there is
input.set(inbytes);
@@ -553,7 +572,7 @@
// Copy until EOF; assume the JAR file is the last segment.
fprintf(errstrm, "Copy-mode.\n");
for (;;) {
- jarout->write_data(rp, input_remaining());
+ jarout->write_data(rp, (int)input_remaining());
if (foreign_buf)
break; // one-time use of a passed in buffer
if (input.size() < CHUNK) {
@@ -572,7 +591,7 @@
// Read the magic number.
magic = 0;
- for (int i1 = 0; i1 < sizeof(magic); i1++) {
+ for (int i1 = 0; i1 < (int)sizeof(magic); i1++) {
magic <<= 8;
magic += (*rp++ & 0xFF);
}
@@ -586,7 +605,7 @@
majver = hdr.getInt();
hdrVals += 2;
- if (magic != JAVA_PACKAGE_MAGIC ||
+ if (magic != (int)JAVA_PACKAGE_MAGIC ||
(majver != JAVA5_PACKAGE_MAJOR_VERSION &&
majver != JAVA6_PACKAGE_MAJOR_VERSION) ||
(minver != JAVA5_PACKAGE_MINOR_VERSION &&
@@ -633,19 +652,19 @@
// Now we can size the whole archive.
// Read everything else into a mega-buffer.
rp = hdr.rp;
- int header_size_0 = (rp - input.base()); // used-up header (4byte + 3int)
- int header_size_1 = (rplimit - rp); // buffered unused initial fragment
+ int header_size_0 = (int)(rp - input.base()); // used-up header (4byte + 3int)
+ int header_size_1 = (int)(rplimit - rp); // buffered unused initial fragment
int header_size = header_size_0+header_size_1;
unsized_bytes_read = header_size_0;
CHECK;
if (foreign_buf) {
- if (archive_size > header_size_1) {
+ if (archive_size > (size_t)header_size_1) {
abort("EOF reading fixed input buffer");
return;
}
} else if (archive_size > 0) {
- input.set(U_NEW(byte, (size_t) header_size_0 + archive_size + C_SLOP),
- (size_t) header_size_0 + archive_size);
+ input.set(U_NEW(byte, (size_t)(header_size_0 + archive_size + C_SLOP)),
+ (size_t) header_size_0 + (size_t)archive_size);
assert(input.limit()[0] == 0);
// Move all the bytes we read initially into the real buffer.
input.b.copyFrom(initbuf, header_size);
@@ -712,7 +731,7 @@
}
int cp_counts[N_TAGS_IN_ORDER];
- for (int k = 0; k < N_TAGS_IN_ORDER; k++) {
+ for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
if (!(archive_options & AO_HAVE_CP_NUMBERS)) {
switch (TAGS_IN_ORDER[k]) {
case CONSTANT_Integer:
@@ -753,7 +772,10 @@
abort("EOF reading archive header");
// Now size the CP.
- assert(N_TAGS_IN_ORDER == cpool::NUM_COUNTS);
+#ifndef PRODUCT
+ bool x = (N_TAGS_IN_ORDER == cpool::NUM_COUNTS);
+ assert(x);
+#endif //PRODUCT
cp.init(this, cp_counts);
CHECK;
@@ -766,7 +788,7 @@
// meta-bytes, if any, immediately follow archive header
//band_headers.readData(band_headers_size);
ensure_input(band_headers_size);
- if (input_remaining() < band_headers_size) {
+ if (input_remaining() < (size_t)band_headers_size) {
abort("EOF reading band headers");
return;
}
@@ -789,12 +811,14 @@
void unpacker::finish() {
if (verbose >= 1) {
fprintf(errstrm,
- "A total of %lld bytes were read in %d segment(s).\n",
- bytes_read_before_reset+bytes_read,
+ "A total of "
+ LONG_LONG_FORMAT " bytes were read in %d segment(s).\n",
+ (bytes_read_before_reset+bytes_read),
segments_read_before_reset+1);
fprintf(errstrm,
- "A total of %lld file content bytes were written.\n",
- bytes_written_before_reset+bytes_written);
+ "A total of "
+ LONG_LONG_FORMAT " file content bytes were written.\n",
+ (bytes_written_before_reset+bytes_written));
fprintf(errstrm,
"A total of %d files (of which %d are classes) were written to output.\n",
files_written_before_reset+files_written,
@@ -822,7 +846,7 @@
int next_entry = 0;
// Size the constant pool:
- for (int k = 0; k < N_TAGS_IN_ORDER; k++) {
+ for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
byte tag = TAGS_IN_ORDER[k];
int len = counts[k];
tag_count[tag] = len;
@@ -902,8 +926,8 @@
}
static int compare_Utf8_chars(bytes& b1, bytes& b2) {
- int l1 = b1.len;
- int l2 = b2.len;
+ int l1 = (int)b1.len;
+ int l2 = (int)b2.len;
int l0 = (l1 < l2) ? l1 : l2;
byte* p1 = b1.ptr;
byte* p2 = b2.ptr;
@@ -949,10 +973,12 @@
// First band: Read lengths of shared prefixes.
if (len > PREFIX_SKIP_2)
cp_Utf8_prefix.readData(len - PREFIX_SKIP_2);
+ NOT_PRODUCT(else cp_Utf8_prefix.readData(0)); // for asserts
// Second band: Read lengths of unshared suffixes:
if (len > SUFFIX_SKIP_1)
cp_Utf8_suffix.readData(len - SUFFIX_SKIP_1);
+ NOT_PRODUCT(else cp_Utf8_suffix.readData(0)); // for asserts
bytes* allsuffixes = T_NEW(bytes, len);
CHECK;
@@ -999,7 +1025,7 @@
CHECK;
tmallocs.add(chars.ptr); // free it later
} else {
- int shrink = chars.limit() - chp;
+ int shrink = (int)(chars.limit() - chp);
chars.len -= shrink;
charbuf.b.len -= shrink; // ungrow to reclaim buffer space
// Note that we did not reclaim the final '\0'.
@@ -1008,7 +1034,9 @@
}
}
//cp_Utf8_chars.done();
- if (assert(1)) charbuf.b.set(null, 0); // tidy
+#ifndef PRODUCT
+ charbuf.b.set(null, 0); // tidy
+#endif
// Fourth band: Go back and size the specially packed strings.
int maxlen = 0;
@@ -1041,7 +1069,7 @@
for (i = 0; i < len; i++) {
bytes& chars = allsuffixes[i];
if (chars.ptr != null) continue; // already input
- int suffix = chars.len; // pick up the hack
+ int suffix = (int)chars.len; // pick up the hack
uint size3 = suffix * 3;
if (suffix == 0) continue; // done with empty string
chars.malloc(size3);
@@ -1071,7 +1099,7 @@
for (i = 0; i < len; i++) {
bytes& chars = allsuffixes[i];
int prefix = (i < PREFIX_SKIP_2)? 0: cp_Utf8_prefix.getInt();
- int suffix = chars.len;
+ int suffix = (int)chars.len;
byte* fillp;
// by induction, the buffer is already filled with the prefix
// make sure the prefix value is not corrupted, though:
@@ -1084,7 +1112,7 @@
fillp = chars.writeTo(fillp);
assert(bigbuf.inBounds(fillp));
*fillp = 0; // bigbuf must contain a well-formed Utf8 string
- int length = fillp - bigbuf.ptr;
+ int length = (int)(fillp - bigbuf.ptr);
bytes& value = cpMap[i].value.b;
value.set(U_NEW(byte, length+1), length);
value.copyFrom(bigbuf.ptr, length);
@@ -1215,12 +1243,12 @@
int i;
- for (int k = 0; k < N_TAGS_IN_ORDER; k++) {
+ for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
byte tag = TAGS_IN_ORDER[k];
int len = cp.tag_count[tag];
int base = cp.tag_base[tag];
- printcr(1,"Reading %d %s entries...", len, NOT_PRODUCT(TAG_NAME[tag])+0);
+ PRINTCR((1,"Reading %d %s entries...", len, NOT_PRODUCT(TAG_NAME[tag])+0));
entry* cpMap = &cp.entries[base];
for (i = 0; i < len; i++) {
cpMap[i].tag = tag;
@@ -1282,7 +1310,7 @@
#ifndef PRODUCT
cpindex* ix = &cp.tag_index[tag];
assert(ix->ixTag == tag);
- assert(ix->len == len);
+ assert((int)ix->len == len);
assert(ix->base1 == cpMap);
#endif
CHECK;
@@ -1293,7 +1321,7 @@
cp.initMemberIndexes();
CHECK;
- printcr(1,"parsed %d constant pool entries in %d bytes", cp.nentries, (rp - rp0));
+ PRINTCR((1,"parsed %d constant pool entries in %d bytes", cp.nentries, (rp - rp0)));
#define SNAME(n,s) #s "\0"
const char* symNames = (
@@ -1307,7 +1335,7 @@
bytes name; name.set(symNames);
if (name.len > 0 && name.ptr[0] != '0') {
cp.sym[sn] = cp.ensureUtf8(name);
- printcr(4, "well-known sym %d=%s", sn, cp.sym[sn]->string());
+ PRINTCR((4, "well-known sym %d=%s", sn, cp.sym[sn]->string()));
}
symNames += name.len + 1; // skip trailing null to next name
}
@@ -1352,7 +1380,7 @@
assert(flag_limit != 0); // must be set up already
if (idx >= 0) {
// Fixed attr.
- if (idx >= flag_limit)
+ if (idx >= (int)flag_limit)
abort("attribute index too large");
if (isRedefined(idx))
abort("redefined attribute index");
@@ -1635,7 +1663,7 @@
for (;;) {
int caseval = 0;
lp = parseNumeral(lp, caseval);
- band_stack.add((void*)caseval);
+ band_stack.add((void*)(size_t)caseval);
if (*lp == '-') {
// new in version 160, allow (1-5) for (1,2,3,4,5)
if (u->majver < JAVA6_PACKAGE_MAJOR_VERSION) {
@@ -1654,7 +1682,7 @@
}
for (;;) {
++caseval;
- band_stack.add((void*)caseval);
+ band_stack.add((void*)(size_t)caseval);
if (caseval == caselimit) break;
}
}
@@ -1921,7 +1949,7 @@
for (byte* cp = ptr + pos; --cp >= ptr; ) {
assert(x.inBounds(cp));
if (*cp >= chmin && *cp <= chmax)
- return cp - ptr;
+ return (int)(cp - ptr);
}
return -1;
}
@@ -1976,7 +2004,7 @@
entry* inner = ic_this_class.getRef();
CHECK;
uint inord = inner->inord;
- assert(inord < cp.tag_count[CONSTANT_Class]);
+ assert(inord < (uint)cp.tag_count[CONSTANT_Class]);
if (ic_index[inord] != null) {
abort("identical inner class");
break;
@@ -2003,10 +2031,10 @@
bytes number;
bytes name;
// Parse n into pkgOuter and name (and number).
- printcr(5, "parse short IC name %s", n.ptr);
+ PRINTCR((5, "parse short IC name %s", n.ptr));
int dollar1, dollar2; // pointers to $ in the pattern
// parse n = (<pkg>/)*<outer>($<number>)?($<name>)?
- int nlen = n.len;
+ int nlen = (int)n.len;
int pkglen = lastIndexOf(SLASH_MIN, SLASH_MAX, n, nlen) + 1;
dollar2 = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, n, nlen);
if (dollar2 < 0) {
@@ -2035,8 +2063,8 @@
pkgOuter = n.slice(0, dollar1);
else
pkgOuter.set(null,0);
- printcr(5,"=> %s$ 0%s $%s",
- pkgOuter.string(), number.string(), name.string());
+ PRINTCR((5,"=> %s$ 0%s $%s",
+ pkgOuter.string(), number.string(), name.string()));
if (pkgOuter.ptr != null)
ics[i].outer = cp.ensureClass(pkgOuter);
@@ -2049,7 +2077,7 @@
if (ics[i].outer != null) {
uint outord = ics[i].outer->inord;
if (outord != NO_INORD) {
- assert(outord < cp.tag_count[CONSTANT_Class]);
+ assert(outord < (uint)cp.tag_count[CONSTANT_Class]);
ics[i].next_sibling = ic_child_index[outord];
ic_child_index[outord] = &ics[i];
}
@@ -2060,8 +2088,7 @@
}
void unpacker::read_classes() {
- int i;
- printcr(1," ...scanning %d classes...", class_count);
+ PRINTCR((1," ...scanning %d classes...", class_count));
class_this.readData(class_count);
class_super.readData(class_count);
class_interface_count.readData(class_count);
@@ -2070,6 +2097,7 @@
CHECK;
#if 0
+ int i;
// Make a little mark on super-classes.
for (i = 0; i < class_count; i++) {
entry* e = class_super.getRefN();
@@ -2099,8 +2127,8 @@
read_code_headers();
- printcr(1,"scanned %d classes, %d fields, %d methods, %d code headers",
- class_count, field_count, method_count, code_count);
+ PRINTCR((1,"scanned %d classes, %d fields, %d methods, %d code headers",
+ class_count, field_count, method_count, code_count));
}
maybe_inline
@@ -2137,7 +2165,7 @@
}
indexBits &= indexMask; // ignore classfile flag bits
for (idx = 0; indexBits != 0; idx++, indexBits >>= 1) {
- ad.flag_count[idx] += (indexBits & 1);
+ ad.flag_count[idx] += (int)(indexBits & 1);
}
}
// we'll scan these again later for output:
@@ -2337,7 +2365,7 @@
for (idx = 0; idx < ad.layouts.length(); idx++) {
if (ad.getLayout(idx) == null)
continue; // none at this fixed index <32
- if (idx < ad.flag_limit && ad.isPredefined(idx))
+ if (idx < (int)ad.flag_limit && ad.isPredefined(idx))
continue; // already handled
if (ad.getCount(idx) == 0)
continue; // no attributes of this type (then why transmit layouts?)
@@ -2351,9 +2379,9 @@
if (count == 0) return;
layout_definition* lo = getLayout(idx);
if (lo != null) {
- printcr(1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
+ PRINTCR((1, "counted %d [redefined = %d predefined = %d] attributes of type %s.%s",
count, isRedefined(idx), isPredefined(idx),
- ATTR_CONTEXT_NAME[attrc], lo->name);
+ ATTR_CONTEXT_NAME[attrc], lo->name));
}
bool hasCallables = lo->hasCallables();
band** bands = lo->bands();
@@ -2376,13 +2404,13 @@
}
}
// Now consult whichever callables have non-zero entry counts.
- readBandData(bands, -1);
+ readBandData(bands, (uint)-1);
}
}
// Recursive helper to the previous function:
void unpacker::attr_definitions::readBandData(band** body, uint count) {
- int i, j, k;
+ int j, k;
for (j = 0; body[j] != null; j++) {
band& b = *body[j];
if (b.defc != null) {
@@ -2427,7 +2455,7 @@
}
break;
case EK_CBLE:
- assert(count == -1); // incoming count is meaningless
+ assert((int)count == -1); // incoming count is meaningless
k = b.length;
assert(k >= 0);
// This is intended and required for non production mode.
@@ -2490,7 +2518,7 @@
assert(le_kind == EK_INT || le_kind == EK_REPL || le_kind == EK_UN);
x = b.getInt();
- assert(!b.le_bci || prevBCI == to_bci(prevBII));
+ assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
switch (b.le_bci) {
case EK_BCI: // PH: transmit R(bci), store bci
x = to_bci(prevBII = x);
@@ -2505,7 +2533,7 @@
prevBCI += x;
break;
}
- assert(!b.le_bci || prevBCI == to_bci(prevBII));
+ assert(!b.le_bci || prevBCI == (int)to_bci(prevBII));
switch (b.le_len) {
case 0: break;
@@ -2721,8 +2749,8 @@
// Cf. PackageReader.readByteCodes
inline // called exactly once => inline
void unpacker::read_bcs() {
- printcr(3, "reading compressed bytecodes and operands for %d codes...",
- code_count);
+ PRINTCR((3, "reading compressed bytecodes and operands for %d codes...",
+ code_count));
// read from bc_codes and bc_case_count
fillbytes all_switch_ops;
@@ -2825,18 +2853,18 @@
// Go through the formality, so we can use it in a regular fashion later:
assert(rp == rp0);
- bc_codes.readData(opptr - rp);
+ bc_codes.readData((int)(opptr - rp));
int i = 0;
// To size instruction bands correctly, we need info on switches:
- bc_case_count.readData(all_switch_ops.size());
- for (i = 0; i < all_switch_ops.size(); i++) {
+ bc_case_count.readData((int)all_switch_ops.size());
+ for (i = 0; i < (int)all_switch_ops.size(); i++) {
int caseCount = bc_case_count.getInt();
int bc = all_switch_ops.getByte(i);
bc_label.expectMoreLength(1+caseCount); // default label + cases
bc_case_value.expectMoreLength(bc == bc_tableswitch ? 1 : caseCount);
- printcr(2, "switch bc=%d caseCount=%d", bc, caseCount);
+ PRINTCR((2, "switch bc=%d caseCount=%d", bc, caseCount));
}
bc_case_count.rewind(); // uses again for output
@@ -2849,15 +2877,14 @@
// The bc_escbyte band is counted by the immediately previous band.
bc_escbyte.readData(bc_escsize.getIntTotal());
- printcr(3, "scanned %d opcode and %d operand bytes for %d codes...",
+ PRINTCR((3, "scanned %d opcode and %d operand bytes for %d codes...",
(int)(bc_codes.size()),
(int)(bc_escsize.maxRP() - bc_case_value.minRP()),
- code_count);
+ code_count));
}
void unpacker::read_bands() {
byte* rp0 = rp;
- int i;
read_file_header();
CHECK;
@@ -2886,9 +2913,9 @@
/// CP routines
entry*& cpool::hashTabRef(byte tag, bytes& b) {
- printcr(5, "hashTabRef tag=%d %s[%d]", tag, b.string(), b.len);
- uint hash = tag + b.len;
- for (int i = 0; i < b.len; i++) {
+ PRINTCR((5, "hashTabRef tag=%d %s[%d]", tag, b.string(), b.len));
+ uint hash = tag + (int)b.len;
+ for (int i = 0; i < (int)b.len; i++) {
hash = hash * 31 + (0xFF & b.ptr[i]);
}
entry** ht = hashTab;
@@ -2905,15 +2932,15 @@
// Note: hash2 must be relatively prime to hlen, hence the "|1".
hash2 = (((hash % 499) & (hlen-1)) | 1);
hash1 += hash2;
- if (hash1 >= hlen) hash1 -= hlen;
- assert(hash1 < hlen);
+ if (hash1 >= (uint)hlen) hash1 -= hlen;
+ assert(hash1 < (uint)hlen);
assert(++probes < hlen);
}
#ifndef PRODUCT
hash_probes[0] += 1;
hash_probes[1] += probes;
#endif
- printcr(5, " => @%d %p", hash1, ht[hash1]);
+ PRINTCR((5, " => @%d %p", hash1, ht[hash1]));
return ht[hash1];
}
@@ -2939,7 +2966,7 @@
u->saveTo(e.value.b, b);
assert(&e >= first_extra_entry);
insert_extra(&e, tag_extras[CONSTANT_Utf8]);
- printcr(4,"ensureUtf8 miss %s", e.string());
+ PRINTCR((4,"ensureUtf8 miss %s", e.string()));
return ix = &e;
}
@@ -2961,7 +2988,7 @@
e.value.b = utf->value.b;
assert(&e >= first_extra_entry);
insert_extra(&e, tag_extras[CONSTANT_Class]);
- printcr(4,"ensureClass miss %s", e.string());
+ PRINTCR((4,"ensureClass miss %s", e.string()));
return &e;
}
@@ -2980,7 +3007,7 @@
int refnum = 0;
bytes form = e.refs[refnum++]->asUtf8();
buf.empty();
- for (int j = 0; j < form.len; j++) {
+ for (int j = 0; j < (int)form.len; j++) {
int c = form.ptr[j];
buf.addByte(c);
if (c == 'L') {
@@ -2990,7 +3017,7 @@
}
assert(refnum == e.nrefs);
bytes& sig = buf.b;
- printcr(5,"signature %d %s -> %s", i, form.ptr, sig.ptr);
+ PRINTCR((5,"signature %d %s -> %s", i, form.ptr, sig.ptr));
// try to find a pre-existing Utf8:
entry* &e2 = hashTabRef(CONSTANT_Utf8, sig);
@@ -2999,7 +3026,7 @@
e.value.b = e2->value.b;
e.refs[0] = e2;
e.nrefs = 1;
- printcr(5,"signature replaced %d => %s", i, e.string());
+ PRINTCR((5,"signature replaced %d => %s", i, e.string()));
nreused++;
} else {
// there is no other replacement; reuse this CP entry as a Utf8
@@ -3007,15 +3034,15 @@
e.tag = CONSTANT_Utf8;
e.nrefs = 0;
e2 = &e;
- printcr(5,"signature changed %d => %s", e.inord, e.string());
+ PRINTCR((5,"signature changed %d => %s", e.inord, e.string()));
}
nsigs++;
}
- printcr(1,"expanded %d signatures (reused %d utfs)", nsigs, nreused);
+ PRINTCR((1,"expanded %d signatures (reused %d utfs)", nsigs, nreused));
buf.free();
// go expunge all references to remaining signatures:
- for (i = 0; i < nentries; i++) {
+ for (i = 0; i < (int)nentries; i++) {
entry& e = entries[i];
for (int j = 0; j < e.nrefs; j++) {
entry*& e2 = e.refs[j];
@@ -3028,7 +3055,7 @@
void cpool::initMemberIndexes() {
// This function does NOT refer to any class schema.
// It is totally internal to the cpool.
- int i, j, len;
+ int i, j;
// Get the pre-existing indexes:
int nclasses = tag_count[CONSTANT_Class];
@@ -3047,13 +3074,13 @@
for (j = 0; j < nfields; j++) {
entry& f = fields[j];
i = f.memberClass()->inord;
- assert((uint)i < nclasses);
+ assert(i < nclasses);
field_counts[i]++;
}
for (j = 0; j < nmethods; j++) {
entry& m = methods[j];
i = m.memberClass()->inord;
- assert((uint)i < nclasses);
+ assert(i < nclasses);
method_counts[i]++;
}
@@ -3068,8 +3095,8 @@
// reuse field_counts and member_counts as fill pointers:
field_counts[i] = fbase;
method_counts[i] = mbase;
- printcr(3, "class %d fields @%d[%d] methods @%d[%d]",
- i, fbase, fc, mbase, mc);
+ PRINTCR((3, "class %d fields @%d[%d] methods @%d[%d]",
+ i, fbase, fc, mbase, mc));
fbase += fc+1;
mbase += mc+1;
// (the +1 leaves a space between every subarray)
@@ -3093,18 +3120,18 @@
#ifndef PRODUCT
// Test the result immediately on every class and field.
int fvisited = 0, mvisited = 0;
- int prevord;
+ int prevord, len;
for (i = 0; i < nclasses; i++) {
entry* cls = &classes[i];
cpindex* fix = getFieldIndex(cls);
cpindex* mix = getMethodIndex(cls);
- printcr(2, "field and method index for %s [%d] [%d]",
- cls->string(), mix->len, fix->len);
+ PRINTCR((2, "field and method index for %s [%d] [%d]",
+ cls->string(), mix->len, fix->len));
prevord = -1;
for (j = 0, len = fix->len; j < len; j++) {
entry* f = fix->get(j);
assert(f != null);
- printcr(3, "- field %s", f->string());
+ PRINTCR((3, "- field %s", f->string()));
assert(f->memberClass() == cls);
assert(prevord < (int)f->inord);
prevord = f->inord;
@@ -3115,7 +3142,7 @@
for (j = 0, len = mix->len; j < len; j++) {
entry* m = mix->get(j);
assert(m != null);
- printcr(3, "- method %s", m->string());
+ PRINTCR((3, "- method %s", m->string()));
assert(m->memberClass() == cls);
assert(prevord < (int)m->inord);
prevord = m->inord;
@@ -3164,7 +3191,7 @@
outputEntries.empty();
#ifndef PRODUCT
// they must all be clear now
- for (i = 0; i < nentries; i++)
+ for (i = 0; i < (int)nentries; i++)
assert(entries[i].outputIndex == NOT_REQUESTED);
#endif
}
@@ -3215,7 +3242,7 @@
static uint checkStart = 0;
int checkStep = 1;
if (nentries > 100) checkStep = nentries / 100;
- for (i = (checkStart++ % checkStep); i < nentries; i += checkStep) {
+ for (i = (int)(checkStart++ % checkStep); i < (int)nentries; i += checkStep) {
entry& e = entries[i];
if (e.outputIndex != NOT_REQUESTED) {
assert(outputEntries.contains(&e));
@@ -3225,7 +3252,7 @@
}
// check hand-initialization of TAG_ORDER
- for (i = 0; i < N_TAGS_IN_ORDER; i++) {
+ for (i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
byte tag = TAGS_IN_ORDER[i];
assert(TAG_ORDER[tag] == i+1);
}
@@ -3247,7 +3274,7 @@
if (e.isDoubleWord()) nextIndex++; // do not use the next index
}
outputIndexLimit = nextIndex;
- printcr(3,"renumbering CP to %d entries", outputIndexLimit);
+ PRINTCR((3,"renumbering CP to %d entries", outputIndexLimit));
}
#ifndef PRODUCT
@@ -3257,9 +3284,9 @@
static bytes& getbuf(int len) { // for debugging only!
static int bn = 0;
- static bytes bufs[8] = { 0 };
+ static bytes bufs[8];
bytes& buf = bufs[bn++ & 7];
- while (buf.len < len+10)
+ while ((int)buf.len < len+10)
buf.realloc(buf.len ? buf.len * 2 : 1000);
buf.ptr[0] = 0; // for the sake of strcat
return buf;
@@ -3285,7 +3312,7 @@
case CONSTANT_Long:
case CONSTANT_Double:
buf = getbuf(24);
- sprintf((char*)buf.ptr, "0x%016llx", value.l);
+ sprintf((char*)buf.ptr, "0x" LONG_LONG_HEX_FORMAT, value.l);
break;
default:
if (nrefs == 0) {
@@ -3296,7 +3323,7 @@
} else {
char* s1 = refs[0]->string();
char* s2 = refs[1]->string();
- buf = getbuf(strlen(s1) + 1 + strlen(s2) + 4 + 1);
+ buf = getbuf((int)strlen(s1) + 1 + (int)strlen(s2) + 4 + 1);
buf.strcat(s1).strcat(" ").strcat(s2);
if (nrefs > 2) buf.strcat(" ...");
}
@@ -3409,7 +3436,9 @@
segments_read_before_reset += 1;
if (verbose >= 2) {
fprintf(errstrm,
- "After segment %d, %lld bytes read and %lld bytes written.\n",
+ "After segment %d, "
+ LONG_LONG_FORMAT " bytes read and "
+ LONG_LONG_FORMAT " bytes written.\n",
segments_read_before_reset-1,
bytes_read_before_reset, bytes_written_before_reset);
fprintf(errstrm,
@@ -3475,7 +3504,9 @@
int i;
NOT_PRODUCT(debug_u = this);
BYTES_OF(*this).clear();
- if (assert(1)) free(); // just to make sure freeing is idempotent
+#ifndef PRODUCT
+ free(); // just to make sure freeing is idempotent
+#endif
this->u = this; // self-reference for U_NEW macro
errstrm = stdout; // default error-output
log_file = LOGFILE_STDOUT;
@@ -3621,7 +3652,7 @@
maybe_inline
void unpacker::put_label(int curIP, int size) {
code_fixup_type.addByte(size);
- code_fixup_offset.add(put_empty(size));
+ code_fixup_offset.add((int)put_empty(size));
code_fixup_source.add(curIP);
}
@@ -3658,7 +3689,7 @@
}
for (int curIP = 0; ; curIP++) {
- int curPC = wpoffset() - codeBase;
+ int curPC = (int)(wpoffset() - codeBase);
bcimap.add(curPC);
ensure_put_space(10); // covers most instrs w/o further bounds check
int bc = *opptr++ & 0xFF;
@@ -3702,7 +3733,7 @@
put_label(curIP, 4); //int lVal = bc_label.getInt();
}
}
- assert(to_bci(curIP) == curPC);
+ assert((int)to_bci(curIP) == curPC);
continue;
}
case bc_iinc:
@@ -3805,7 +3836,7 @@
assert(bc <= bc_jsr_w);
put_label(curIP, 4); //putu4(lVal);
}
- assert(to_bci(curIP) == curPC);
+ assert((int)to_bci(curIP) == curPC);
continue;
}
bc_which = ref_band_for_op(bc);
@@ -3880,7 +3911,7 @@
//bcimap.add(curPC); // PC limit is already also in map, from bc_end_marker
// Armed with a bcimap, we can now fix up all the labels.
- for (int i = 0; i < code_fixup_type.size(); i++) {
+ for (int i = 0; i < (int)code_fixup_type.size(); i++) {
int type = code_fixup_type.getByte(i);
byte* bp = wp_at(code_fixup_offset.get(i));
int curIP = code_fixup_source.get(i);
@@ -3896,7 +3927,7 @@
inline // called exactly once => inline
void unpacker::write_code() {
- int i, j;
+ int j;
int max_stack, max_locals, handler_count, cflags;
get_code_header(max_stack, max_locals, handler_count, cflags);
@@ -3919,7 +3950,7 @@
CHECK;
byte* bcbasewp = wp_at(bcbase);
- putu4_at(bcbasewp, wp - (bcbasewp+4)); // size of code attr
+ putu4_at(bcbasewp, (int)(wp - (bcbasewp+4))); // size of code attr
putu2(handler_count);
for (j = 0; j < handler_count; j++) {
@@ -3968,10 +3999,10 @@
if ((indexBits & 1) != 0)
bitIndexes[biCount++] = idx;
}
- assert(biCount <= lengthof(bitIndexes));
+ assert(biCount <= (int)lengthof(bitIndexes));
// Write a provisional attribute count, perhaps to be corrected later.
- int naOffset = wpoffset();
+ int naOffset = (int)wpoffset();
int na0 = biCount + oiCount;
putu2(na0);
@@ -3986,7 +4017,7 @@
entry* ref; // scratch
size_t abase = put_empty(2+4);
CHECK_0;
- if (idx < ad.flag_limit && ad.isPredefined(idx)) {
+ if (idx < (int)ad.flag_limit && ad.isPredefined(idx)) {
// Switch on the attrc and idx simultaneously.
switch (ADH_BYTE(attrc, idx)) {
@@ -4020,16 +4051,16 @@
if (ref == null) {
bytes& n = cur_class->ref(0)->value.b;
// parse n = (<pkg>/)*<outer>?($<id>)*
- int pkglen = lastIndexOf(SLASH_MIN, SLASH_MAX, n, n.len)+1;
+ int pkglen = lastIndexOf(SLASH_MIN, SLASH_MAX, n, (int)n.len)+1;
bytes prefix = n.slice(pkglen, n.len);
for (;;) {
// Work backwards, finding all '$', '#', etc.
- int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, prefix.len);
+ int dollar = lastIndexOf(DOLLAR_MIN, DOLLAR_MAX, prefix, (int)prefix.len);
if (dollar < 0) break;
prefix = prefix.slice(0, dollar);
}
const char* suffix = ".java";
- int len = prefix.len + strlen(suffix);
+ int len = (int)(prefix.len + strlen(suffix));
bytes name; name.set(T_NEW(byte, len + 1), len);
name.strcat(prefix).strcat(suffix);
ref = cp.ensureUtf8(name);
@@ -4081,7 +4112,7 @@
// (253) [(1)(2)(2)]
// (254) [(1)(2)(2)(2)]
putu2(code_StackMapTable_offset.getInt());
- for (int j2 = (tag - 251); j2 > 0; j2--) {
+ for (int k = (tag - 251); k > 0; k--) {
put_stackmap_type();
}
} else {
@@ -4165,7 +4196,7 @@
abort("bad layout index");
break;
}
- assert(lo->idx == idx);
+ assert((int)lo->idx == idx);
aname = lo->nameEntry;
if (aname == null) {
bytes nameb; nameb.set(lo->name);
@@ -4198,7 +4229,7 @@
// patch the name and length
putref(aname);
- putu4(wp1 - (wp+4)); // put the attr size
+ putu4((int)(wp1 - (wp+4))); // put the attr size
wp = wp1;
na++; // count the attrs actually written
}
@@ -4279,7 +4310,7 @@
cur_class_has_local_ics = false; // may be set true by write_attrs
- int naOffset = wpoffset();
+ int naOffset = (int)wpoffset();
int na = write_attrs(ATTR_CONTEXT_CLASS, (kflags & indexMask));
@@ -4448,7 +4479,7 @@
putu1(tag);
switch (tag) {
case CONSTANT_Utf8:
- putu2(e.value.b.len);
+ putu2((int)e.value.b.len);
put_bytes(e.value.b);
break;
case CONSTANT_Integer:
@@ -4479,7 +4510,7 @@
#ifndef PRODUCT
total_cp_size[0] += cp.outputIndexLimit;
- total_cp_size[1] += cur_classfile_head.size();
+ total_cp_size[1] += (int)cur_classfile_head.size();
#endif
close_output();
}
@@ -4544,7 +4575,7 @@
if (cur_file.name[0] == '\0') {
bytes& prefix = cur_class->ref(0)->value.b;
const char* suffix = ".class";
- int len = prefix.len + strlen(suffix);
+ int len = (int)(prefix.len + strlen(suffix));
bytes name; name.set(T_NEW(byte, len + 1), len);
cur_file.name = name.strcat(prefix).strcat(suffix).strval();
}
@@ -4564,7 +4595,7 @@
}
if (rpleft < cur_file.size) {
// Caller must read the rest.
- size_t fleft = cur_file.size - rpleft;
+ size_t fleft = (size_t)cur_file.size - rpleft;
bytes_read += fleft; // Credit it to the overall archive size.
}
}
@@ -4580,7 +4611,7 @@
julong fsize = f->size;
#ifndef PRODUCT
if (nowrite NOT_PRODUCT(|| skipfiles-- > 0)) {
- printcr(2,"would write %d bytes to %s", (int) fsize, f->name);
+ PRINTCR((2,"would write %d bytes to %s", (int) fsize, f->name));
return;
}
#endif
@@ -4623,7 +4654,8 @@
part1, part2);
}
if (verbose >= 3) {
- fprintf(errstrm, "Wrote %lld bytes to: %s\n", fsize, f->name);
+ fprintf(errstrm, "Wrote "
+ LONG_LONG_FORMAT " bytes to: %s\n", fsize, f->name);
}
}
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
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 @@
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 @@
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));
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 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 @@
#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
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/utils.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/utils.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
// 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::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 @@
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 @@
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::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 @@
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 @@
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 @@
// 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::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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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");
}
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
// 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,
--- a/jdk/src/share/native/common/check_code.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/common/check_code.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1994-2007 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
@@ -87,10 +87,7 @@
#include "jni.h"
#include "jvm.h"
-#include "typedefs.h"
-
-#include "opcodes.h"
-#include "opcodes.length"
+#include "classfile_constants.h"
#include "opcodes.in_out"
#define MAX_ARRAY_DIMENSIONS 255
@@ -161,8 +158,8 @@
#define NULL_FULLINFO MAKE_FULLINFO(ITEM_Object, 0, 0)
-/* opc_invokespecial calls to <init> need to be treated special */
-#define opc_invokeinit 0x100
+/* JVM_OPC_invokespecial calls to <init> need to be treated special */
+#define JVM_OPC_invokeinit 0x100
/* A hash mechanism used by the verifier.
* Maps class names to unique 16 bit integers.
@@ -301,7 +298,7 @@
typedef unsigned short flag_type;
struct instruction_data_type {
- opcode_type opcode; /* may turn into "canonical" opcode */
+ int opcode; /* may turn into "canonical" opcode */
unsigned changed:1; /* has it changed */
unsigned protected:1; /* must accessor be a subclass of "this" */
union {
@@ -345,7 +342,7 @@
static void verify_field(context_type *context, jclass cb, int index);
static void verify_opcode_operands (context_type *, unsigned int inumber, int offset);
-static void set_protected(context_type *, unsigned int inumber, int key, opcode_type);
+static void set_protected(context_type *, unsigned int inumber, int key, int);
static jboolean is_superclass(context_type *, fullinfo_type);
static void initialize_exception_table(context_type *);
@@ -1084,7 +1081,7 @@
int *code_data = context->code_data;
int mi = context->method_index;
unsigned char *code = context->code;
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
int var;
/*
@@ -1096,17 +1093,17 @@
switch (opcode) {
- case opc_jsr:
+ case JVM_OPC_jsr:
/* instruction of ret statement */
this_idata->operand2.i = UNKNOWN_RET_INSTRUCTION;
/* FALLTHROUGH */
- case opc_ifeq: case opc_ifne: case opc_iflt:
- case opc_ifge: case opc_ifgt: case opc_ifle:
- case opc_ifnull: case opc_ifnonnull:
- case opc_if_icmpeq: case opc_if_icmpne: case opc_if_icmplt:
- case opc_if_icmpge: case opc_if_icmpgt: case opc_if_icmple:
- case opc_if_acmpeq: case opc_if_acmpne:
- case opc_goto: {
+ case JVM_OPC_ifeq: case JVM_OPC_ifne: case JVM_OPC_iflt:
+ case JVM_OPC_ifge: case JVM_OPC_ifgt: case JVM_OPC_ifle:
+ case JVM_OPC_ifnull: case JVM_OPC_ifnonnull:
+ case JVM_OPC_if_icmpeq: case JVM_OPC_if_icmpne: case JVM_OPC_if_icmplt:
+ case JVM_OPC_if_icmpge: case JVM_OPC_if_icmpgt: case JVM_OPC_if_icmple:
+ case JVM_OPC_if_acmpeq: case JVM_OPC_if_acmpne:
+ case JVM_OPC_goto: {
/* Set the ->operand to be the instruction number of the target. */
int jump = (((signed char)(code[offset+1])) << 8) + code[offset+2];
int target = offset + jump;
@@ -1116,11 +1113,11 @@
break;
}
- case opc_jsr_w:
+ case JVM_OPC_jsr_w:
/* instruction of ret statement */
this_idata->operand2.i = UNKNOWN_RET_INSTRUCTION;
/* FALLTHROUGH */
- case opc_goto_w: {
+ case JVM_OPC_goto_w: {
/* Set the ->operand to be the instruction number of the target. */
int jump = (((signed char)(code[offset+1])) << 24) +
(code[offset+2] << 16) + (code[offset+3] << 8) +
@@ -1132,8 +1129,8 @@
break;
}
- case opc_tableswitch:
- case opc_lookupswitch: {
+ case JVM_OPC_tableswitch:
+ case JVM_OPC_lookupswitch: {
/* Set the ->operand to be a table of possible instruction targets. */
int *lpc = (int *) UCALIGN(code + offset + 1);
int *lptr;
@@ -1147,7 +1144,7 @@
CCerror(context, "Non zero padding bytes in switch");
}
}
- if (opcode == opc_tableswitch) {
+ if (opcode == JVM_OPC_tableswitch) {
keys = ntohl(lpc[2]) - ntohl(lpc[1]) + 1;
delta = 1;
} else {
@@ -1169,7 +1166,7 @@
for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) {
int target = offset + ntohl(lptr[0]);
if (!isLegalTarget(context, target))
- CCerror(context, "Illegal branch in opc_tableswitch");
+ CCerror(context, "Illegal branch in tableswitch");
saved_operand[k + 1] = code_data[target];
}
saved_operand[0] = keys + 1; /* number of successors */
@@ -1177,7 +1174,7 @@
break;
}
- case opc_ldc: {
+ case JVM_OPC_ldc: {
/* Make sure the constant pool item is the right type. */
int key = code[offset + 1];
int types = (1 << JVM_CONSTANT_Integer) | (1 << JVM_CONSTANT_Float) |
@@ -1190,7 +1187,7 @@
break;
}
- case opc_ldc_w: {
+ case JVM_OPC_ldc_w: {
/* Make sure the constant pool item is the right type. */
int key = (code[offset + 1] << 8) + code[offset + 2];
int types = (1 << JVM_CONSTANT_Integer) | (1 << JVM_CONSTANT_Float) |
@@ -1203,7 +1200,7 @@
break;
}
- case opc_ldc2_w: {
+ case JVM_OPC_ldc2_w: {
/* Make sure the constant pool item is the right type. */
int key = (code[offset + 1] << 8) + code[offset + 2];
int types = (1 << JVM_CONSTANT_Double) | (1 << JVM_CONSTANT_Long);
@@ -1212,28 +1209,28 @@
break;
}
- case opc_getfield: case opc_putfield:
- case opc_getstatic: case opc_putstatic: {
+ case JVM_OPC_getfield: case JVM_OPC_putfield:
+ case JVM_OPC_getstatic: case JVM_OPC_putstatic: {
/* Make sure the constant pool item is the right type. */
int key = (code[offset + 1] << 8) + code[offset + 2];
this_idata->operand.i = key;
verify_constant_pool_type(context, key, 1 << JVM_CONSTANT_Fieldref);
- if (opcode == opc_getfield || opcode == opc_putfield)
+ if (opcode == JVM_OPC_getfield || opcode == JVM_OPC_putfield)
set_protected(context, inumber, key, opcode);
break;
}
- case opc_invokevirtual:
- case opc_invokespecial:
- case opc_invokestatic:
- case opc_invokeinterface: {
+ case JVM_OPC_invokevirtual:
+ case JVM_OPC_invokespecial:
+ case JVM_OPC_invokestatic:
+ case JVM_OPC_invokeinterface: {
/* Make sure the constant pool item is the right type. */
int key = (code[offset + 1] << 8) + code[offset + 2];
const char *methodname;
jclass cb = context->class;
fullinfo_type clazz_info;
int is_constructor, is_internal;
- int kind = (opcode == opc_invokeinterface
+ int kind = (opcode == JVM_OPC_invokeinterface
? 1 << JVM_CONSTANT_InterfaceMethodref
: 1 << JVM_CONSTANT_Methodref);
/* Make sure the constant pool item is the right type. */
@@ -1249,16 +1246,16 @@
this_idata->operand.i = key;
this_idata->operand2.fi = clazz_info;
if (is_constructor) {
- if (opcode != opc_invokespecial) {
+ if (opcode != JVM_OPC_invokespecial) {
CCerror(context,
"Must call initializers using invokespecial");
}
- this_idata->opcode = opc_invokeinit;
+ this_idata->opcode = JVM_OPC_invokeinit;
} else {
if (is_internal) {
CCerror(context, "Illegal call to internal method");
}
- if (opcode == opc_invokespecial
+ if (opcode == JVM_OPC_invokespecial
&& clazz_info != context->currentclass_info
&& clazz_info != context->superclass_info) {
int not_found = 1;
@@ -1290,7 +1287,7 @@
}
}
}
- if (opcode == opc_invokeinterface) {
+ if (opcode == JVM_OPC_invokeinterface) {
unsigned int args1;
unsigned int args2;
const char *signature =
@@ -1300,25 +1297,25 @@
args2 = code[offset + 3];
if (args1 != args2) {
CCerror(context,
- "Inconsistent args_size for opc_invokeinterface");
+ "Inconsistent args_size for invokeinterface");
}
if (code[offset + 4] != 0) {
CCerror(context,
"Fourth operand byte of invokeinterface must be zero");
}
pop_and_free(context);
- } else if (opcode == opc_invokevirtual
- || opcode == opc_invokespecial)
+ } else if (opcode == JVM_OPC_invokevirtual
+ || opcode == JVM_OPC_invokespecial)
set_protected(context, inumber, key, opcode);
break;
}
- case opc_instanceof:
- case opc_checkcast:
- case opc_new:
- case opc_anewarray:
- case opc_multianewarray: {
+ case JVM_OPC_instanceof:
+ case JVM_OPC_checkcast:
+ case JVM_OPC_new:
+ case JVM_OPC_anewarray:
+ case JVM_OPC_multianewarray: {
/* Make sure the constant pool item is a class */
int key = (code[offset + 1] << 8) + code[offset + 2];
fullinfo_type target;
@@ -1327,14 +1324,14 @@
if (GET_ITEM_TYPE(target) == ITEM_Bogus)
CCerror(context, "Illegal type");
switch(opcode) {
- case opc_anewarray:
+ case JVM_OPC_anewarray:
if ((GET_INDIRECTION(target)) >= MAX_ARRAY_DIMENSIONS)
CCerror(context, "Array with too many dimensions");
this_idata->operand.fi = MAKE_FULLINFO(GET_ITEM_TYPE(target),
GET_INDIRECTION(target) + 1,
GET_EXTRA_INFO(target));
break;
- case opc_new:
+ case JVM_OPC_new:
if (WITH_ZERO_EXTRA_INFO(target) !=
MAKE_FULLINFO(ITEM_Object, 0, 0))
CCerror(context, "Illegal creation of multi-dimensional array");
@@ -1343,10 +1340,10 @@
this_idata->operand.fi = MAKE_FULLINFO(ITEM_NewObject, 0, inumber);
this_idata->operand2.fi = target;
break;
- case opc_multianewarray:
+ case JVM_OPC_multianewarray:
this_idata->operand.fi = target;
this_idata->operand2.i = code[offset + 3];
- if ( (this_idata->operand2.i > GET_INDIRECTION(target))
+ if ( (this_idata->operand2.i > (int)GET_INDIRECTION(target))
|| (this_idata->operand2.i == 0))
CCerror(context, "Illegal dimension argument");
break;
@@ -1356,8 +1353,8 @@
break;
}
- case opc_newarray: {
- /* Cache the result of the opc_newarray into the operand slot */
+ case JVM_OPC_newarray: {
+ /* Cache the result of the JVM_OPC_newarray into the operand slot */
fullinfo_type full_info;
switch (code[offset + 1]) {
case JVM_T_INT:
@@ -1376,78 +1373,78 @@
full_info = MAKE_FULLINFO(ITEM_Short, 1, 0); break;
default:
full_info = 0; /* Keep lint happy */
- CCerror(context, "Bad type passed to opc_newarray");
+ CCerror(context, "Bad type passed to newarray");
}
this_idata->operand.fi = full_info;
break;
}
/* Fudge iload_x, aload_x, etc to look like their generic cousin. */
- case opc_iload_0: case opc_iload_1: case opc_iload_2: case opc_iload_3:
- this_idata->opcode = opc_iload;
- var = opcode - opc_iload_0;
+ case JVM_OPC_iload_0: case JVM_OPC_iload_1: case JVM_OPC_iload_2: case JVM_OPC_iload_3:
+ this_idata->opcode = JVM_OPC_iload;
+ var = opcode - JVM_OPC_iload_0;
goto check_local_variable;
- case opc_fload_0: case opc_fload_1: case opc_fload_2: case opc_fload_3:
- this_idata->opcode = opc_fload;
- var = opcode - opc_fload_0;
+ case JVM_OPC_fload_0: case JVM_OPC_fload_1: case JVM_OPC_fload_2: case JVM_OPC_fload_3:
+ this_idata->opcode = JVM_OPC_fload;
+ var = opcode - JVM_OPC_fload_0;
goto check_local_variable;
- case opc_aload_0: case opc_aload_1: case opc_aload_2: case opc_aload_3:
- this_idata->opcode = opc_aload;
- var = opcode - opc_aload_0;
+ case JVM_OPC_aload_0: case JVM_OPC_aload_1: case JVM_OPC_aload_2: case JVM_OPC_aload_3:
+ this_idata->opcode = JVM_OPC_aload;
+ var = opcode - JVM_OPC_aload_0;
goto check_local_variable;
- case opc_lload_0: case opc_lload_1: case opc_lload_2: case opc_lload_3:
- this_idata->opcode = opc_lload;
- var = opcode - opc_lload_0;
+ case JVM_OPC_lload_0: case JVM_OPC_lload_1: case JVM_OPC_lload_2: case JVM_OPC_lload_3:
+ this_idata->opcode = JVM_OPC_lload;
+ var = opcode - JVM_OPC_lload_0;
goto check_local_variable2;
- case opc_dload_0: case opc_dload_1: case opc_dload_2: case opc_dload_3:
- this_idata->opcode = opc_dload;
- var = opcode - opc_dload_0;
+ case JVM_OPC_dload_0: case JVM_OPC_dload_1: case JVM_OPC_dload_2: case JVM_OPC_dload_3:
+ this_idata->opcode = JVM_OPC_dload;
+ var = opcode - JVM_OPC_dload_0;
goto check_local_variable2;
- case opc_istore_0: case opc_istore_1: case opc_istore_2: case opc_istore_3:
- this_idata->opcode = opc_istore;
- var = opcode - opc_istore_0;
+ case JVM_OPC_istore_0: case JVM_OPC_istore_1: case JVM_OPC_istore_2: case JVM_OPC_istore_3:
+ this_idata->opcode = JVM_OPC_istore;
+ var = opcode - JVM_OPC_istore_0;
goto check_local_variable;
- case opc_fstore_0: case opc_fstore_1: case opc_fstore_2: case opc_fstore_3:
- this_idata->opcode = opc_fstore;
- var = opcode - opc_fstore_0;
+ case JVM_OPC_fstore_0: case JVM_OPC_fstore_1: case JVM_OPC_fstore_2: case JVM_OPC_fstore_3:
+ this_idata->opcode = JVM_OPC_fstore;
+ var = opcode - JVM_OPC_fstore_0;
goto check_local_variable;
- case opc_astore_0: case opc_astore_1: case opc_astore_2: case opc_astore_3:
- this_idata->opcode = opc_astore;
- var = opcode - opc_astore_0;
+ case JVM_OPC_astore_0: case JVM_OPC_astore_1: case JVM_OPC_astore_2: case JVM_OPC_astore_3:
+ this_idata->opcode = JVM_OPC_astore;
+ var = opcode - JVM_OPC_astore_0;
goto check_local_variable;
- case opc_lstore_0: case opc_lstore_1: case opc_lstore_2: case opc_lstore_3:
- this_idata->opcode = opc_lstore;
- var = opcode - opc_lstore_0;
+ case JVM_OPC_lstore_0: case JVM_OPC_lstore_1: case JVM_OPC_lstore_2: case JVM_OPC_lstore_3:
+ this_idata->opcode = JVM_OPC_lstore;
+ var = opcode - JVM_OPC_lstore_0;
goto check_local_variable2;
- case opc_dstore_0: case opc_dstore_1: case opc_dstore_2: case opc_dstore_3:
- this_idata->opcode = opc_dstore;
- var = opcode - opc_dstore_0;
+ case JVM_OPC_dstore_0: case JVM_OPC_dstore_1: case JVM_OPC_dstore_2: case JVM_OPC_dstore_3:
+ this_idata->opcode = JVM_OPC_dstore;
+ var = opcode - JVM_OPC_dstore_0;
goto check_local_variable2;
- case opc_wide:
+ case JVM_OPC_wide:
this_idata->opcode = code[offset + 1];
var = (code[offset + 2] << 8) + code[offset + 3];
switch(this_idata->opcode) {
- case opc_lload: case opc_dload:
- case opc_lstore: case opc_dstore:
+ case JVM_OPC_lload: case JVM_OPC_dload:
+ case JVM_OPC_lstore: case JVM_OPC_dstore:
goto check_local_variable2;
default:
goto check_local_variable;
}
- case opc_iinc: /* the increment amount doesn't matter */
- case opc_ret:
- case opc_aload: case opc_iload: case opc_fload:
- case opc_astore: case opc_istore: case opc_fstore:
+ case JVM_OPC_iinc: /* the increment amount doesn't matter */
+ case JVM_OPC_ret:
+ case JVM_OPC_aload: case JVM_OPC_iload: case JVM_OPC_fload:
+ case JVM_OPC_astore: case JVM_OPC_istore: case JVM_OPC_fstore:
var = code[offset + 1];
check_local_variable:
/* Make sure that the variable number isn't illegal. */
@@ -1456,7 +1453,7 @@
CCerror(context, "Illegal local variable number");
break;
- case opc_lload: case opc_dload: case opc_lstore: case opc_dstore:
+ case JVM_OPC_lload: case JVM_OPC_dload: case JVM_OPC_lstore: case JVM_OPC_dstore:
var = code[offset + 1];
check_local_variable2:
/* Make sure that the variable number isn't illegal. */
@@ -1466,7 +1463,7 @@
break;
default:
- if (opcode >= opc_breakpoint)
+ if (opcode > JVM_OPC_MAX)
CCerror(context, "Quick instructions shouldn't appear yet.");
break;
} /* of switch */
@@ -1474,11 +1471,11 @@
static void
-set_protected(context_type *context, unsigned int inumber, int key, opcode_type opcode)
+set_protected(context_type *context, unsigned int inumber, int key, int opcode)
{
JNIEnv *env = context->env;
fullinfo_type clazz_info;
- if (opcode != opc_invokevirtual && opcode != opc_invokespecial) {
+ if (opcode != JVM_OPC_invokevirtual && opcode != JVM_OPC_invokespecial) {
clazz_info = cp_index_to_class_fullinfo(context, key,
JVM_CONSTANT_Fieldref);
} else {
@@ -1497,7 +1494,7 @@
calledClass = (*env)->NewLocalRef(env, calledClass);
do {
jclass tmp_cb;
- if (opcode != opc_invokevirtual && opcode != opc_invokespecial) {
+ if (opcode != JVM_OPC_invokevirtual && opcode != JVM_OPC_invokespecial) {
access = JVM_GetCPFieldModifiers
(env, context->class, key, calledClass);
} else {
@@ -1607,9 +1604,10 @@
*/
static int instruction_length(unsigned char *iptr, unsigned char *end)
{
+ static unsigned char opcode_length[] = JVM_OPCODE_LENGTH_INITIALIZER;
int instruction = *iptr;
switch (instruction) {
- case opc_tableswitch: {
+ case JVM_OPC_tableswitch: {
int *lpc = (int *)UCALIGN(iptr + 1);
int index;
if (lpc + 2 >= (int *)end) {
@@ -1623,7 +1621,7 @@
}
}
- case opc_lookupswitch: {
+ case JVM_OPC_lookupswitch: {
int *lpc = (int *) UCALIGN(iptr + 1);
int npairs;
if (lpc + 1 >= (int *)end)
@@ -1638,18 +1636,18 @@
return (unsigned char *)(&lpc[2 * (npairs + 1)]) - iptr;
}
- case opc_wide:
+ case JVM_OPC_wide:
if (iptr + 1 >= end)
return -1; /* do not read pass the end */
switch(iptr[1]) {
- case opc_ret:
- case opc_iload: case opc_istore:
- case opc_fload: case opc_fstore:
- case opc_aload: case opc_astore:
- case opc_lload: case opc_lstore:
- case opc_dload: case opc_dstore:
+ case JVM_OPC_ret:
+ case JVM_OPC_iload: case JVM_OPC_istore:
+ case JVM_OPC_fload: case JVM_OPC_fstore:
+ case JVM_OPC_aload: case JVM_OPC_astore:
+ case JVM_OPC_lload: case JVM_OPC_lstore:
+ case JVM_OPC_dload: case JVM_OPC_dstore:
return 4;
- case opc_iinc:
+ case JVM_OPC_iinc:
return 6;
default:
return -1;
@@ -1767,7 +1765,7 @@
jclass cb = context->class;
int max_stack_size = JVM_GetMethodIxMaxStack(env, cb, mi);
instruction_data_type *idata = context->instruction_data;
- int icount = context->instruction_count;
+ unsigned int icount = context->instruction_count;
jboolean work_to_do = JNI_TRUE;
unsigned int inumber;
@@ -1839,7 +1837,7 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
int operand = this_idata->operand.i;
int register_count = this_idata->register_info.register_count;
fullinfo_type *registers = this_idata->register_info.registers;
@@ -1849,17 +1847,17 @@
switch (opcode) {
default:
return;
- case opc_iload: case opc_iinc:
+ case JVM_OPC_iload: case JVM_OPC_iinc:
type = ITEM_Integer; break;
- case opc_fload:
+ case JVM_OPC_fload:
type = ITEM_Float; break;
- case opc_aload:
+ case JVM_OPC_aload:
type = ITEM_Object; break;
- case opc_ret:
+ case JVM_OPC_ret:
type = ITEM_ReturnAddress; break;
- case opc_lload:
+ case JVM_OPC_lload:
type = ITEM_Long; double_word = JNI_TRUE; break;
- case opc_dload:
+ case JVM_OPC_dload:
type = ITEM_Double; double_word = JNI_TRUE; break;
}
if (!double_word) {
@@ -1871,7 +1869,7 @@
}
reg = registers[operand];
- if (WITH_ZERO_EXTRA_INFO(reg) == MAKE_FULLINFO(type, 0, 0)) {
+ if (WITH_ZERO_EXTRA_INFO(reg) == (unsigned)MAKE_FULLINFO(type, 0, 0)) {
/* the register is obviously of the given type */
return;
} else if (GET_INDIRECTION(reg) > 0 && type == ITEM_Object) {
@@ -1882,7 +1880,7 @@
operand);
/* alternatively
(GET_ITEM_TYPE(reg) == ITEM_ReturnAddress)
- && (opcode == opc_iload)
+ && (opcode == JVM_OPC_iload)
&& (type == ITEM_Object || type == ITEM_Integer)
but this never occurs
*/
@@ -1902,8 +1900,8 @@
"Accessing value from uninitialized register pair %d/%d",
operand, operand+1);
} else {
- if ((registers[operand] == MAKE_FULLINFO(type, 0, 0)) &&
- (registers[operand + 1] == MAKE_FULLINFO(type + 1, 0, 0))) {
+ if ((registers[operand] == (unsigned)MAKE_FULLINFO(type, 0, 0)) &&
+ (registers[operand + 1] == (unsigned)MAKE_FULLINFO(type + 1, 0, 0))) {
return;
} else {
CCerror(context, "Register pair %d/%d contains wrong type",
@@ -1922,16 +1920,16 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
switch (opcode) {
- case opc_return:
+ case JVM_OPC_return:
/* We need a constructor, but we aren't guaranteed it's called */
if ((this_idata->or_flags & FLAG_NEED_CONSTRUCTOR) &&
!(this_idata->and_flags & FLAG_CONSTRUCTED))
CCerror(context, "Constructor must call super() or this()");
/* fall through */
- case opc_ireturn: case opc_lreturn:
- case opc_freturn: case opc_dreturn: case opc_areturn:
+ case JVM_OPC_ireturn: case JVM_OPC_lreturn:
+ case JVM_OPC_freturn: case JVM_OPC_dreturn: case JVM_OPC_areturn:
if (this_idata->or_flags & FLAG_NO_RETURN)
/* This method cannot exit normally */
CCerror(context, "Cannot return normally");
@@ -1950,7 +1948,7 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
stack_item_type *stack = this_idata->stack_info.stack;
int stack_size = this_idata->stack_info.stack_size;
char *stack_operands, *p;
@@ -1958,7 +1956,7 @@
fullinfo_type stack_extra_info_buffer[256]; /* save info popped off stack */
fullinfo_type *stack_extra_info = &stack_extra_info_buffer[256];
fullinfo_type full_info; /* only used in case of invoke instructions */
- fullinfo_type put_full_info; /* only used in case opc_putstatic and opc_putfield */
+ fullinfo_type put_full_info; /* only used in case JVM_OPC_putstatic and JVM_OPC_putfield */
switch(opcode) {
default:
@@ -1966,7 +1964,7 @@
stack_operands = opcode_in_out[opcode][0];
break;
- case opc_putstatic: case opc_putfield: {
+ case JVM_OPC_putstatic: case JVM_OPC_putfield: {
/* The top thing on the stack depends on the signature of
* the object. */
int operand = this_idata->operand.i;
@@ -1981,7 +1979,7 @@
print_formatted_fieldname(context, operand);
}
#endif
- if (opcode == opc_putfield)
+ if (opcode == JVM_OPC_putfield)
*ip++ = 'A'; /* object for putfield */
*ip++ = signature_to_fieldtype(context, &signature, &put_full_info);
*ip = '\0';
@@ -1990,9 +1988,9 @@
break;
}
- case opc_invokevirtual: case opc_invokespecial:
- case opc_invokeinit: /* invokespecial call to <init> */
- case opc_invokestatic: case opc_invokeinterface: {
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit: /* invokespecial call to <init> */
+ case JVM_OPC_invokestatic: case JVM_OPC_invokeinterface: {
/* The top stuff on the stack depends on the method signature */
int operand = this_idata->operand.i;
const char *signature =
@@ -2007,9 +2005,9 @@
print_formatted_methodname(context, operand);
}
#endif
- if (opcode != opc_invokestatic)
+ if (opcode != JVM_OPC_invokestatic)
/* First, push the object */
- *ip++ = (opcode == opc_invokeinit ? '@' : 'A');
+ *ip++ = (opcode == JVM_OPC_invokeinit ? '@' : 'A');
for (p = signature + 1; *p != JVM_SIGNATURE_ENDFUNC; ) {
*ip++ = signature_to_fieldtype(context, &p, &full_info);
if (ip >= buffer + sizeof(buffer) - 1)
@@ -2022,7 +2020,7 @@
break;
}
- case opc_multianewarray: {
+ case JVM_OPC_multianewarray: {
/* Count can't be larger than 255. So can't overflow buffer */
int count = this_idata->operand2.i; /* number of ints on stack */
memset(buffer, 'I', count);
@@ -2062,19 +2060,19 @@
* one of the special cases */
if ( (WITH_ZERO_EXTRA_INFO(top_type) ==
MAKE_FULLINFO(ITEM_ReturnAddress, 0, 0))
- && (opcode == opc_astore))
+ && (opcode == JVM_OPC_astore))
break;
if ( (GET_ITEM_TYPE(top_type) == ITEM_NewObject
|| (GET_ITEM_TYPE(top_type) == ITEM_InitObject))
- && ((opcode == opc_astore) || (opcode == opc_aload)
- || (opcode == opc_ifnull) || (opcode == opc_ifnonnull)))
+ && ((opcode == JVM_OPC_astore) || (opcode == JVM_OPC_aload)
+ || (opcode == JVM_OPC_ifnull) || (opcode == JVM_OPC_ifnonnull)))
break;
/* The 2nd edition VM of the specification allows field
* initializations before the superclass initializer,
* if the field is defined within the current class.
*/
if ( (GET_ITEM_TYPE(top_type) == ITEM_InitObject)
- && (opcode == opc_putfield)) {
+ && (opcode == JVM_OPC_putfield)) {
int operand = this_idata->operand.i;
int access_bits = JVM_GetCPFieldModifiers(context->env,
context->class,
@@ -2231,7 +2229,7 @@
*/
switch (opcode) {
default: break;
- case opc_aastore: { /* array index object */
+ case JVM_OPC_aastore: { /* array index object */
fullinfo_type array_type = stack_extra_info[0];
fullinfo_type object_type = stack_extra_info[2];
fullinfo_type target_type = decrement_indirection(array_type);
@@ -2246,12 +2244,12 @@
break;
}
- case opc_putfield:
- case opc_getfield:
- case opc_putstatic: {
+ case JVM_OPC_putfield:
+ case JVM_OPC_getfield:
+ case JVM_OPC_putstatic: {
int operand = this_idata->operand.i;
fullinfo_type stack_object = stack_extra_info[0];
- if (opcode == opc_putfield || opcode == opc_getfield) {
+ if (opcode == JVM_OPC_putfield || opcode == JVM_OPC_getfield) {
if (!isAssignableTo
(context,
stack_object,
@@ -2266,8 +2264,8 @@
CCerror(context, "Bad access to protected data");
}
}
- if (opcode == opc_putfield || opcode == opc_putstatic) {
- int item = (opcode == opc_putfield ? 1 : 0);
+ if (opcode == JVM_OPC_putfield || opcode == JVM_OPC_putstatic) {
+ int item = (opcode == JVM_OPC_putfield ? 1 : 0);
if (!isAssignableTo(context,
stack_extra_info[item], put_full_info)) {
CCerror(context, "Bad type in putfield/putstatic");
@@ -2276,23 +2274,23 @@
break;
}
- case opc_athrow:
+ case JVM_OPC_athrow:
if (!isAssignableTo(context, stack_extra_info[0],
context->throwable_info)) {
CCerror(context, "Can only throw Throwable objects");
}
break;
- case opc_aaload: { /* array index */
+ case JVM_OPC_aaload: { /* array index */
/* We need to pass the information to the stack updater */
fullinfo_type array_type = stack_extra_info[0];
context->swap_table[0] = decrement_indirection(array_type);
break;
}
- case opc_invokevirtual: case opc_invokespecial:
- case opc_invokeinit:
- case opc_invokeinterface: case opc_invokestatic: {
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit:
+ case JVM_OPC_invokeinterface: case JVM_OPC_invokestatic: {
int operand = this_idata->operand.i;
const char *signature =
JVM_GetCPMethodSignatureUTF(context->env,
@@ -2301,15 +2299,15 @@
int item;
const char *p;
check_and_push(context, signature, VM_STRING_UTF);
- if (opcode == opc_invokestatic) {
+ if (opcode == JVM_OPC_invokestatic) {
item = 0;
- } else if (opcode == opc_invokeinit) {
+ } else if (opcode == JVM_OPC_invokeinit) {
fullinfo_type init_type = this_idata->operand2.fi;
fullinfo_type object_type = stack_extra_info[0];
context->swap_table[0] = object_type; /* save value */
if (GET_ITEM_TYPE(stack_extra_info[0]) == ITEM_NewObject) {
/* We better be calling the appropriate init. Find the
- * inumber of the "opc_new" instruction", and figure
+ * inumber of the "JVM_OPC_new" instruction", and figure
* out what the type really is.
*/
unsigned int new_inumber = GET_EXTRA_INFO(stack_extra_info[0]);
@@ -2341,7 +2339,7 @@
CCerror(context,
"Incompatible object argument for function call");
}
- if (opcode == opc_invokespecial
+ if (opcode == JVM_OPC_invokespecial
&& !isAssignableTo(context, object_type,
context->currentclass_info)) {
/* Make sure object argument is assignment compatible to current class */
@@ -2381,13 +2379,13 @@
break;
}
- case opc_return:
+ case JVM_OPC_return:
if (context->return_type != MAKE_FULLINFO(ITEM_Void, 0, 0))
CCerror(context, "Wrong return type in function");
break;
- case opc_ireturn: case opc_lreturn: case opc_freturn:
- case opc_dreturn: case opc_areturn: {
+ case JVM_OPC_ireturn: case JVM_OPC_lreturn: case JVM_OPC_freturn:
+ case JVM_OPC_dreturn: case JVM_OPC_areturn: {
fullinfo_type target_type = context->return_type;
fullinfo_type object_type = stack_extra_info[0];
if (!isAssignableTo(context, object_type, target_type)) {
@@ -2396,7 +2394,7 @@
break;
}
- case opc_new: {
+ case JVM_OPC_new: {
/* Make sure that nothing on the stack already looks like what
* we want to create. I can't image how this could possibly happen
* but we should test for it anyway, since if it could happen, the
@@ -2433,7 +2431,7 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
int operand = this_idata->operand.i;
int register_count = this_idata->register_info.register_count;
fullinfo_type *registers = this_idata->register_info.registers;
@@ -2453,11 +2451,11 @@
/* Remember, we've already verified the type at the top of the stack. */
switch (opcode) {
default: break;
- case opc_istore: case opc_fstore: case opc_astore:
+ case JVM_OPC_istore: case JVM_OPC_fstore: case JVM_OPC_astore:
access = ACCESS_SINGLE;
goto continue_store;
- case opc_lstore: case opc_dstore:
+ case JVM_OPC_lstore: case JVM_OPC_dstore:
access = ACCESS_DOUBLE;
goto continue_store;
@@ -2484,16 +2482,16 @@
break;
}
- case opc_iload: case opc_fload: case opc_aload:
- case opc_iinc: case opc_ret:
+ case JVM_OPC_iload: case JVM_OPC_fload: case JVM_OPC_aload:
+ case JVM_OPC_iinc: case JVM_OPC_ret:
access = ACCESS_SINGLE;
break;
- case opc_lload: case opc_dload:
+ case JVM_OPC_lload: case JVM_OPC_dload:
access = ACCESS_DOUBLE;
break;
- case opc_jsr: case opc_jsr_w:
+ case JVM_OPC_jsr: case JVM_OPC_jsr_w:
for (i = 0; i < new_mask_count; i++)
if (new_masks[i].entry == operand)
CCerror(context, "Recursive call to jsr entry");
@@ -2501,8 +2499,8 @@
new_mask_count++;
break;
- case opc_invokeinit:
- case opc_new: {
+ case JVM_OPC_invokeinit:
+ case JVM_OPC_new: {
/* For invokeinit, an uninitialized object has been initialized.
* For new, all previous occurrences of an uninitialized object
* from the same instruction must be made bogus.
@@ -2588,7 +2586,7 @@
flag_type or_flags = this_idata->or_flags;
/* Set the "we've done a constructor" flag */
- if (this_idata->opcode == opc_invokeinit) {
+ if (this_idata->opcode == JVM_OPC_invokeinit) {
fullinfo_type from = context->swap_table[0];
if (from == MAKE_FULLINFO(ITEM_InitObject, 0, 0))
and_flags |= FLAG_CONSTRUCTED;
@@ -2611,7 +2609,7 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
int operand = this_idata->operand.i;
int stack_size = new_stack_info->stack_size;
@@ -2631,7 +2629,7 @@
stack_results = opcode_in_out[opcode][1];
break;
- case opc_ldc: case opc_ldc_w: case opc_ldc2_w: {
+ case JVM_OPC_ldc: case JVM_OPC_ldc_w: case JVM_OPC_ldc2_w: {
/* Look to constant pool to determine correct result. */
unsigned char *type_table = context->constant_types;
switch (type_table[operand]) {
@@ -2661,7 +2659,7 @@
break;
}
- case opc_getstatic: case opc_getfield: {
+ case JVM_OPC_getstatic: case JVM_OPC_getfield: {
/* Look to signature to determine correct result. */
int operand = this_idata->operand.i;
const char *signature = JVM_GetCPFieldSignatureUTF(context->env,
@@ -2680,9 +2678,9 @@
break;
}
- case opc_invokevirtual: case opc_invokespecial:
- case opc_invokeinit:
- case opc_invokestatic: case opc_invokeinterface: {
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit:
+ case JVM_OPC_invokestatic: case JVM_OPC_invokeinterface: {
/* Look to signature to determine correct result. */
int operand = this_idata->operand.i;
const char *signature = JVM_GetCPMethodSignatureUTF(context->env,
@@ -2703,28 +2701,28 @@
break;
}
- case opc_aconst_null:
+ case JVM_OPC_aconst_null:
stack_results = opcode_in_out[opcode][1];
full_info = NULL_FULLINFO; /* special NULL */
break;
- case opc_new:
- case opc_checkcast:
- case opc_newarray:
- case opc_anewarray:
- case opc_multianewarray:
+ case JVM_OPC_new:
+ case JVM_OPC_checkcast:
+ case JVM_OPC_newarray:
+ case JVM_OPC_anewarray:
+ case JVM_OPC_multianewarray:
stack_results = opcode_in_out[opcode][1];
/* Conveniently, this result type is stored here */
full_info = this_idata->operand.fi;
break;
- case opc_aaload:
+ case JVM_OPC_aaload:
stack_results = opcode_in_out[opcode][1];
/* pop_stack() saved value for us. */
full_info = context->swap_table[0];
break;
- case opc_aload:
+ case JVM_OPC_aload:
stack_results = opcode_in_out[opcode][1];
/* The register hasn't been modified, so we can use its value. */
full_info = this_idata->register_info.registers[operand];
@@ -2772,7 +2770,7 @@
stack_size++;
} /* outer for loop */
- if (opcode == opc_invokeinit) {
+ if (opcode == JVM_OPC_invokeinit) {
/* If there are any instances of "from" on the stack, we need to
* replace it with "to", since calling <init> initializes all versions
* of the object, obviously. */
@@ -2807,7 +2805,7 @@
{
instruction_data_type *idata = context->instruction_data;
instruction_data_type *this_idata = &idata[inumber];
- opcode_type opcode = this_idata->opcode;
+ int opcode = this_idata->opcode;
int operand = this_idata->operand.i;
struct handler_info_type *handler_info = context->handler_info;
int handler_info_length =
@@ -2827,35 +2825,35 @@
buffer[0] = inumber + 1;
break;
- case opc_ifeq: case opc_ifne: case opc_ifgt:
- case opc_ifge: case opc_iflt: case opc_ifle:
- case opc_ifnull: case opc_ifnonnull:
- case opc_if_icmpeq: case opc_if_icmpne: case opc_if_icmpgt:
- case opc_if_icmpge: case opc_if_icmplt: case opc_if_icmple:
- case opc_if_acmpeq: case opc_if_acmpne:
+ case JVM_OPC_ifeq: case JVM_OPC_ifne: case JVM_OPC_ifgt:
+ case JVM_OPC_ifge: case JVM_OPC_iflt: case JVM_OPC_ifle:
+ case JVM_OPC_ifnull: case JVM_OPC_ifnonnull:
+ case JVM_OPC_if_icmpeq: case JVM_OPC_if_icmpne: case JVM_OPC_if_icmpgt:
+ case JVM_OPC_if_icmpge: case JVM_OPC_if_icmplt: case JVM_OPC_if_icmple:
+ case JVM_OPC_if_acmpeq: case JVM_OPC_if_acmpne:
successors_count = 2;
buffer[0] = inumber + 1;
buffer[1] = operand;
break;
- case opc_jsr: case opc_jsr_w:
+ case JVM_OPC_jsr: case JVM_OPC_jsr_w:
if (this_idata->operand2.i != UNKNOWN_RET_INSTRUCTION)
idata[this_idata->operand2.i].changed = JNI_TRUE;
/* FALLTHROUGH */
- case opc_goto: case opc_goto_w:
+ case JVM_OPC_goto: case JVM_OPC_goto_w:
successors_count = 1;
buffer[0] = operand;
break;
- case opc_ireturn: case opc_lreturn: case opc_return:
- case opc_freturn: case opc_dreturn: case opc_areturn:
- case opc_athrow:
+ case JVM_OPC_ireturn: case JVM_OPC_lreturn: case JVM_OPC_return:
+ case JVM_OPC_freturn: case JVM_OPC_dreturn: case JVM_OPC_areturn:
+ case JVM_OPC_athrow:
/* The testing for the returns is handled in pop_stack() */
successors_count = 0;
break;
- case opc_ret: {
+ case JVM_OPC_ret: {
/* This is slightly slow, but good enough for a seldom used instruction.
* The EXTRA_ITEM_INFO of the ITEM_ReturnAddress indicates the
* address of the first instruction of the subroutine. We can return
@@ -2866,16 +2864,16 @@
int called_instruction = GET_EXTRA_INFO(registers[operand]);
int i, count, *ptr;;
for (i = context->instruction_count, count = 0; --i >= 0; ) {
- if (((idata[i].opcode == opc_jsr) ||
- (idata[i].opcode == opc_jsr_w)) &&
+ if (((idata[i].opcode == JVM_OPC_jsr) ||
+ (idata[i].opcode == JVM_OPC_jsr_w)) &&
(idata[i].operand.i == called_instruction))
count++;
}
this_idata->operand2.ip = ptr = NEW(int, count + 1);
*ptr++ = count;
for (i = context->instruction_count, count = 0; --i >= 0; ) {
- if (((idata[i].opcode == opc_jsr) ||
- (idata[i].opcode == opc_jsr_w)) &&
+ if (((idata[i].opcode == JVM_OPC_jsr) ||
+ (idata[i].opcode == JVM_OPC_jsr_w)) &&
(idata[i].operand.i == called_instruction))
*ptr++ = i + 1;
}
@@ -2886,8 +2884,8 @@
}
- case opc_tableswitch:
- case opc_lookupswitch:
+ case JVM_OPC_tableswitch:
+ case JVM_OPC_lookupswitch:
successors = this_idata->operand.ip; /* use this instead */
successors_count = *successors++;
break;
@@ -2907,9 +2905,9 @@
handler_info = context->handler_info;
for (i = handler_info_length; --i >= 0; handler_info++) {
- if (handler_info->start <= inumber && handler_info->end > inumber) {
+ if (handler_info->start <= (int)inumber && handler_info->end > (int)inumber) {
int handler = handler_info->handler;
- if (opcode != opc_invokeinit) {
+ if (opcode != JVM_OPC_invokeinit) {
merge_into_one_successor(context, inumber, handler,
&this_idata->register_info, /* old */
&handler_info->stack_info,
@@ -2984,9 +2982,9 @@
* ret are executed. Thus uninitialized objects can't propagate
* into or out of a subroutine.
*/
- if (idata[from_inumber].opcode == opc_ret ||
- idata[from_inumber].opcode == opc_jsr ||
- idata[from_inumber].opcode == opc_jsr_w) {
+ if (idata[from_inumber].opcode == JVM_OPC_ret ||
+ idata[from_inumber].opcode == JVM_OPC_jsr ||
+ idata[from_inumber].opcode == JVM_OPC_jsr_w) {
int new_register_count = new_register_info->register_count;
fullinfo_type *new_registers = new_register_info->registers;
int i;
@@ -3036,7 +3034,7 @@
* that needs to get merged into the new instruction is a joining
* of info from the ret instruction with stuff in the jsr instruction
*/
- if (idata[from_inumber].opcode == opc_ret && !isException) {
+ if (idata[from_inumber].opcode == JVM_OPC_ret && !isException) {
int new_register_count = new_register_info->register_count;
fullinfo_type *new_registers = new_register_info->registers;
int new_mask_count = new_register_info->mask_count;
@@ -3045,7 +3043,7 @@
int called_instruction = GET_EXTRA_INFO(new_registers[operand]);
instruction_data_type *jsr_idata = &idata[to_inumber - 1];
register_info_type *jsr_reginfo = &jsr_idata->register_info;
- if (jsr_idata->operand2.i != from_inumber) {
+ if (jsr_idata->operand2.i != (int)from_inumber) {
if (jsr_idata->operand2.i != UNKNOWN_RET_INSTRUCTION)
CCerror(context, "Multiple returns to single jsr");
jsr_idata->operand2.i = from_inumber;
@@ -3675,7 +3673,7 @@
char *buffer = buffer_space;
char *finish = strchr(p, JVM_SIGNATURE_ENDCLASS);
int length = finish - p;
- if (length + 1 > sizeof(buffer_space)) {
+ if (length + 1 > (int)sizeof(buffer_space)) {
buffer = malloc(length + 1);
check_and_push(context, buffer, VM_MALLOC_BLK);
}
--- a/jdk/src/share/native/common/check_format.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/share/native/common/check_format.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 @@
/* 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);
}
/*
--- a/jdk/src/solaris/back/util_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/back/util_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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>
--- a/jdk/src/solaris/instrument/FileSystemSupport_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/instrument/FileSystemSupport_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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 */
+
--- a/jdk/src/solaris/javavm/export/jvm_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/javavm/export/jvm_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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"}
--- a/jdk/src/solaris/javavm/include/typedefs_md.h Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Solaris-dependent types for Green threads
- */
-
-#ifndef _JAVASOFT_SOLARIS_TYPES_MD_H_
-#define _JAVASOFT_SOLARIS_TYPES_MD_H_
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifdef __linux__
-#include <stdint.h>
-#define HAVE_INTPTR_T
-#define _UINT64_T
-#endif
-
-#define int8_t char
-
-/* Fix for varargs differences on PowerPC */
-#if defined(__powerpc__)
-#define VARGS(x) (x)
-#else
-#define VARGS(x) (&x)
-#endif /* __powerpc__ */
-
-
-#if defined(__alpha__)
-#define PTR_IS_64 1
-#define LONG_IS_64 1
-#else
-#define PTR_IS_32 1
-#endif
-
-/* don't redefine typedef's on Solaris 2.6 or Later */
-
-#if !defined(_ILP32) && !defined(_LP64)
-
-#ifndef HAVE_INTPTR_T
-#ifdef LONG_IS_64
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-#else
-typedef int intptr_t;
-typedef unsigned int uintptr_t;
-#endif /* LONG_IS_64 */
-#endif /* don't HAVE_INTPTR_T */
-
-#ifndef _UINT64_T
-#define _UINT64_T
-#ifdef LONG_IS_64
-typedef unsigned long uint64_t;
-#else
-typedef unsigned long long uint64_t;
-#endif
-#define _UINT32_T
-#ifndef uint32_t /* [sbb] scaffolding */
-typedef unsigned int uint32_t;
-#endif /* [sbb] scaffolding */
-#if defined(__linux__)
-typedef unsigned int uint_t;
-#endif
-#endif
-
-#ifndef __BIT_TYPES_DEFINED__
-/* that should get Linux, at least */
-#ifndef _INT64_T
-#define _INT64_T
-#ifdef LONG_IS_64
-typedef long int64_t;
-#else
-typedef long long int64_t;
-#endif
-#define _INT32_T
-#ifndef int32_t /* [sbb] scaffolding */
-typedef int int32_t;
-#endif /* [sbb] scaffolding */
-#if defined(__linux__)
-typedef int int_t;
-#endif
-#endif
-#endif /* __BIT_TYPES_DEFINED__ */
-
-#endif /* !defined(_ILP32) && !defined(_LP64) */
-
-/* use these macros when the compiler supports the long long type */
-
-#define ll_high(a) ((uint32_t)(((uint64_t)(a))>>32))
-#define ll_low(a) ((uint32_t)(a))
-#define int2ll(a) ((int64_t)(a))
-#define ll2int(a) ((int)(a))
-#define ll_add(a, b) ((int64_t)(a) + (int64_t)(b))
-#define ll_and(a, b) ((int64_t)(a) & (int64_t)(b))
-#define ll_div(a, b) ((int64_t)(a) / (int64_t)(b))
-#define ll_mul(a, b) ((int64_t)(a) * (int64_t)(b))
-#define ll_neg(a) (-(a))
-#define ll_not(a) (~(uint64_t)(a))
-#define ll_or(a, b) ((uint64_t)(a) | (b))
-#define ll_shl(a, n) ((uint64_t)(a) << (n))
-#define ll_shr(a, n) ((int64_t)(a) >> (n))
-#define ll_sub(a, b) ((uint64_t)(a) - (b))
-#define ll_ushr(a, n) ((uint64_t)(a) >>(n))
-#define ll_xor(a, b) ((int64_t)(a) ^ (int64_t)(b))
-#define uint2ll(a) ((uint64_t)(a))
-#define ll_rem(a,b) ((int64_t)(a) % (int64_t)(b))
-
-extern int32_t float2l(float f);
-extern int32_t double2l(double d);
-extern int64_t float2ll(float f);
-extern int64_t double2ll(double d);
-
-#define ll2float(a) ((float) (a))
-#define ll2double(a) ((double) (a))
-
-/* Useful on machines where jlong and jdouble have different endianness. */
-#define ll2double_bits(a) ((void) 0)
-
-/* comparison operators */
-#define ll_ltz(ll) ((ll)<0)
-#define ll_gez(ll) ((ll)>=0)
-#define ll_eqz(a) ((a) == 0)
-#define ll_nez(a) ((a) != 0)
-#define ll_eq(a, b) ((a) == (b))
-#define ll_ne(a,b) ((a) != (b))
-#define ll_ge(a,b) ((a) >= (b))
-#define ll_le(a,b) ((a) <= (b))
-#define ll_lt(a,b) ((a) < (b))
-#define ll_gt(a,b) ((a) > (b))
-
-#define ll_zero_const ((int64_t) 0)
-#define ll_one_const ((int64_t) 1)
-
-extern void ll2str(int64_t a, char *s, char *limit);
-
-#define ll2ptr(a) ((void*)(uintptr_t)(a))
-#define ptr2ll(a) ((int64_t)(uintptr_t)(a))
-
-#ifdef ppc
-#define HAVE_ALIGNED_DOUBLES
-#define HAVE_ALIGNED_LONGLONGS
-#endif
-
-/* printf format modifier for printing pointers */
-#ifdef _LP64
-#define FORMAT64_MODIFIER "l"
-#else
-#define FORMAT64_MODIFIER "ll"
-#endif
-
-#endif /* !_JAVASOFT_SOLARIS_TYPES_MD_H_ */
--- a/jdk/src/solaris/native/common/gdefs_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/native/common/gdefs_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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__ */
+
--- a/jdk/src/solaris/native/common/jlong_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/native/common/jlong_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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))
--- a/jdk/src/solaris/native/java/net/NetworkInterface.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/native/java/net/NetworkInterface.c Fri Aug 29 12:40:58 2008 -0700
@@ -206,10 +206,10 @@
/*
* 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;
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Fri Aug 29 12:40:58 2008 -0700
@@ -1741,7 +1741,7 @@
* (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];
--- a/jdk/src/windows/back/util_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/back/util_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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;
--- a/jdk/src/windows/hpi/src/socket_md.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/hpi/src/socket_md.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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;
--- a/jdk/src/windows/hpi/src/threads_md.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/hpi/src/threads_md.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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"
/*
--- a/jdk/src/windows/instrument/FileSystemSupport_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/instrument/FileSystemSupport_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * 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
--- a/jdk/src/windows/javavm/export/jvm_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/javavm/export/jvm_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -53,6 +53,7 @@
WIN32_FIND_DATA find_data;
} DIR;
+#include <stddef.h> /* For uintptr_t */
#include <stdlib.h>
#define JVM_MAXPATHLEN _MAX_PATH
@@ -66,6 +67,19 @@
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
*/
--- a/jdk/src/windows/javavm/include/typedefs_md.h Thu Aug 28 11:05:27 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Win32 dependent type definitions
- */
-
-#ifndef _JAVASOFT_WIN32_TYPEDEF_MD_H_
-#define _JAVASOFT_WIN32_TYPEDEF_MD_H_
-
-#include <windows.h>
-
-#define VARGS(x) (&x)
-
-typedef char int8_t;
-typedef __int16 int16_t;
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned int uint_t;
-typedef unsigned __int32 uint32_t;
-typedef unsigned __int64 uint64_t;
-
-/* Make sure that we have the intptr_t and uintptr_t definitions */
-#ifndef _INTPTR_T_DEFINED
-#ifdef _WIN64
-typedef __int64 intptr_t;
-#else
-typedef int intptr_t;
-#endif
-#define _INTPTR_T_DEFINED
-#endif
-
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-
-typedef intptr_t ssize_t;
-
-/* use these macros when the compiler supports the long long type */
-
-#define ll_high(a) ((long)((a)>>32))
-#define ll_low(a) ((long)(a))
-#define int2ll(a) ((int64_t)(a))
-#define ll2int(a) ((int)(a))
-#define ll_add(a, b) ((a) + (b))
-#define ll_and(a, b) ((a) & (b))
-#define ll_div(a, b) ((a) / (b))
-#define ll_mul(a, b) ((a) * (b))
-#define ll_neg(a) (-(a))
-#define ll_not(a) (~(a))
-#define ll_or(a, b) ((a) | (b))
-/* THE FOLLOWING DEFINITION IS NOW A FUNCTION CALL IN ORDER TO WORKAROUND
- OPTIMIZER BUG IN MSVC++ 2.1 (see system_md.c)
- #define ll_shl(a, n) ((a) << (n)) */
-#define ll_shr(a, n) ((a) >> (n))
-#define ll_sub(a, b) ((a) - (b))
-#define ll_ushr(a, n) ((uint64_t)(a) >> (n))
-#define ll_xor(a, b) ((a) ^ (b))
-#define uint2ll(a) ((uint64_t)(unsigned long)(a))
-#define ll_rem(a,b) ((a) % (b))
-
-int32_t float2l(float f);
-int32_t double2l(double f);
-int64_t float2ll(float f);
-int64_t double2ll(double f);
-#define ll2float(a) ((float) (a))
-#define ll2double(a) ((double) (a))
-
-/* Useful on machines where jlong and jdouble have different endianness. */
-#define ll2double_bits(a) ((void) 0)
-
-/* comparison operators */
-#define ll_ltz(ll) ((ll) < 0)
-#define ll_gez(ll) ((ll) >= 0)
-#define ll_eqz(a) ((a) == 0)
-#define ll_nez(a) ((a) != 0)
-#define ll_eq(a, b) ((a) == (b))
-#define ll_ne(a,b) ((a) != (b))
-#define ll_ge(a,b) ((a) >= (b))
-#define ll_le(a,b) ((a) <= (b))
-#define ll_lt(a,b) ((a) < (b))
-#define ll_gt(a,b) ((a) > (b))
-
-#define ll_zero_const ((int64_t) 0)
-#define ll_one_const ((int64_t) 1)
-
-int64_t ll_shl(int64_t a, int bits);
-
-#define ll2ptr(a) ((void*)(a))
-#define ptr2ll(a) ((jlong)(a))
-
-/* printf format modifier for printing pointers */
-#define FORMAT64_MODIFIER "I64"
-
-#endif /* !_JAVASOFT_WIN32_TYPEDEF_MD_H_ */
--- a/jdk/src/windows/native/java/net/NetworkInterface.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c Fri Aug 29 12:40:58 2008 -0700
@@ -554,11 +554,11 @@
ni_childsID = (*env)->GetFieldID(env, ni_class, "childs", "[Ljava/net/NetworkInterface;");
ni_ctor = (*env)->GetMethodID(env, ni_class, "<init>", "()V");
- ni_iacls = (*env)->FindClass(env, "Ljava/net/InetAddress;");
+ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
ni_iaAddr = (*env)->GetFieldID(env, ni_iacls, "address", "I");
- ni_ia4cls = (*env)->FindClass(env, "Ljava/net/Inet4Address;");
+ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
ni_ia4Ctor = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
@@ -762,17 +762,17 @@
/*
* Class: NetworkInterface
- * Method: getByIndex
+ * Method: getByIndex0
* Signature: (I)LNetworkInterface;
*/
-JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex
+JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0
(JNIEnv *env, jclass cls, jint index)
{
netif *ifList, *curr;
jobject netifObj = NULL;
if (os_supports_ipv6 && ipv6_available()) {
- return Java_java_net_NetworkInterface_getByIndex_XP (env, cls, index);
+ return Java_java_net_NetworkInterface_getByIndex0_XP (env, cls, index);
}
/* get the list of interfaces */
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c Fri Aug 29 12:40:58 2008 -0700
@@ -576,10 +576,10 @@
/*
* 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;
--- a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Fri Aug 29 12:40:58 2008 -0700
@@ -2090,7 +2090,7 @@
* (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];
--- a/jdk/src/windows/native/java/net/net_util_md.c Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.c Fri Aug 29 12:40:58 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 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,6 @@
#include "net_util.h"
#include "jni.h"
-#include "typedefs.h"
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
--- a/jdk/src/windows/native/java/net/net_util_md.h Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.h Fri Aug 29 12:40:58 2008 -0700
@@ -329,7 +329,7 @@
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
(JNIEnv *env, jclass cls, jstring name);
-JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex_XP
+JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0_XP
(JNIEnv *env, jclass cls, jint index);
JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0_XP
--- a/jdk/test/com/sun/jdi/ClassesByName2Test.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/com/sun/jdi/ClassesByName2Test.java Fri Aug 29 12:40:58 2008 -0700
@@ -134,10 +134,11 @@
}
}
}
- /*
- * resume the target listening for events
- */
- listenUntilVMDisconnect();
+
+
+ // Doing vm().exit(0) instead of listenUntilVMDisconnect()
+ // speeds up the test up by more than 50% in -server -Xcomp (solsparc32-fastdebug)
+ vm().exit(0);
/*
* deal with results of test
--- a/jdk/test/com/sun/jdi/ConnectedVMs.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/com/sun/jdi/ConnectedVMs.java Fri Aug 29 12:40:58 2008 -0700
@@ -28,7 +28,10 @@
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g InstTarg.java
- * @run main ConnectedVMs InstTarg
+ * @run main ConnectedVMs "Kill"
+ * @run main ConnectedVMs "Resume to exit"
+ * @run main ConnectedVMs "dispose()"
+ * @run main ConnectedVMs "exit()"
*
* @summary ConnectedVMs checks the method
* VirtualMachineManager.connectedVirtualMachines()
@@ -40,14 +43,10 @@
public class ConnectedVMs extends TestScaffold {
static int failCount = 0;;
- static int pass;
- static String[] passNames = {"Kill", "Resume to exit",
- "dispose()", "exit()"};
+ static String passName;
public static void main(String args[]) throws Exception {
- for (pass=0; pass < passNames.length; pass++) {
- new ConnectedVMs(args).startTests();
- }
+ new ConnectedVMs(args[0]).startTests();
if (failCount > 0) {
throw new RuntimeException(
"VirtualMachineManager.connectedVirtualMachines() " +
@@ -58,16 +57,17 @@
}
}
- ConnectedVMs(String args[]) throws Exception {
- super(args);
- System.out.println("create");
+ ConnectedVMs(String name) throws Exception {
+ super(new String[0]);
+ passName = name;
+ System.out.println("create " + passName);
}
void vms(int expected) {
List vms = Bootstrap.virtualMachineManager().
connectedVirtualMachines();
if (vms.size() != expected) {
- System.out.println("FAILURE! " + passNames[pass] +
+ System.out.println("FAILURE! " + passName +
" - expected: " + expected +
", got: " + vms.size());
++failCount;
@@ -75,27 +75,22 @@
}
protected void runTests() throws Exception {
- System.out.println("Testing " + passNames[pass]);
+ System.out.println("Testing " + passName);
vms(0);
startToMain("InstTarg");
ThreadReference thread = waitForVMStart();
StepEvent stepEvent = stepIntoLine(thread);
vms(1);
- // pick a way to die
- switch (pass) {
- case 0:
- vm().process().destroy();
- break;
- case 1:
- vm().resume();
- break;
- case 2:
- vm().dispose();
- break;
- case 3:
- vm().exit(1);
- break;
+ // pick a way to die based on the input arg.
+ if (passName.equals("Kill")) {
+ vm().process().destroy();
+ } else if (passName.equals("Resume to exit")) {
+ vm().resume();
+ } else if (passName.equals("dispose()")) {
+ vm().dispose();
+ } else if (passName.equals("exit()")) {
+ vm().exit(1);
}
resumeToVMDisconnect();
--- a/jdk/test/com/sun/jdi/sde/MangleStepTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/com/sun/jdi/sde/MangleStepTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -10,7 +10,11 @@
* @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
* @run compile MangleStepTest.java
* @run compile -g onion/pickle/Mangle.java
- * @run main MangleStepTest unset Java XYZ Rats bogus
+ * @run main MangleStepTest unset
+ * @run main MangleStepTest Java
+ * @run main MangleStepTest XYZ
+ * @run main MangleStepTest Rats
+ * @run main MangleStepTest bogus
*/
import com.sun.jdi.*;
import com.sun.jdi.event.*;
@@ -32,9 +36,7 @@
public static void main(String[] args) throws Exception {
testSetUp();
- for (int i = 0; i < args.length; ++i) {
- new MangleStepTest(args[i]).startTests();
- }
+ new MangleStepTest(args[0]).startTests();
if (aTestFailed) {
throw new Exception("MangleStepTest: failed");
}
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java Fri Aug 29 12:40:58 2008 -0700
@@ -197,8 +197,12 @@
synchronized (ready) {
// wait until WaitingThread about to wait for objC
thrsync.waitForSignal();
- // give chance to enter wait.
- goSleep(100);
+
+ int retryCount = 0;
+ while (waiter.getState() != Thread.State.WAITING
+ && retryCount++ < 500) {
+ goSleep(100);
+ }
checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
synchronized (objC) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkInterface/IndexTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6717876
+ * @summary Make java.net.NetworkInterface.getIndex() public
+ */
+
+import java.net.*;
+import java.util.Enumeration;
+
+public class IndexTest {
+ public static void main(String[] args) throws Exception {
+ Enumeration<NetworkInterface> netifs = NetworkInterface.getNetworkInterfaces();
+ NetworkInterface nif = null;
+ while (netifs.hasMoreElements()) {
+ nif = netifs.nextElement();
+ int index = nif.getIndex();
+ if (index >= 0) {
+ NetworkInterface nif2 = NetworkInterface.getByIndex(index);
+ if (! nif.equals(nif2)) {
+ throw new RuntimeException("both interfaces should be equal");
+ }
+ }
+ }
+ try {
+ nif = NetworkInterface.getByIndex(-1);
+ throw new RuntimeException("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // OK
+ }
+ // In all likelyhood, this interface should not exist.
+ nif = NetworkInterface.getByIndex(Integer.MAX_VALUE - 1);
+ if (nif != null) {
+ throw new RuntimeException("getByIndex() should have returned null");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumSet/BogusEnumSet.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,93 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along 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.
+ */
+
+/*
+ * @test
+ * @bug 6739302
+ * @summary Check that deserialization preserves EnumSet integrity
+ * @author Josh Bloch
+ */
+
+import java.util.*;
+import java.io.*;
+
+public class BogusEnumSet {
+ public static void main(String[] args) throws Throwable {
+ byte[] serializedForm = {
+ (byte)0xac, (byte)0xed, 0x0, 0x5, 0x73, 0x72, 0x0, 0x18,
+ 0x6a, 0x61, 0x76, 0x61, 0x2e, 0x75, 0x74, 0x69,
+ 0x6c, 0x2e, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x45,
+ 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x74, 0x2f, 0x58, 0x6f, (byte)0xc7,
+ 0x7e, (byte)0xb0, (byte)0xd0, 0x7e, 0x2, 0x0, 0x1, 0x4a, 0x0, 0x8,
+ 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x78, 0x72, 0x0,
+ 0x11, 0x6a, 0x61, 0x76, 0x61, 0x2e, 0x75, 0x74, 0x69,
+ 0x6c, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x74, 0xe,
+ 0x3, 0x21, 0x6a, (byte)0xcd, (byte)0x8c, 0x29, (byte)0xdd, 0x2,
+ 0x0, 0x2, 0x4c, 0x0, 0xb, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+ 0x54, 0x79, 0x70, 0x65, 0x74, 0x0, 0x11, 0x4c, 0x6a, 0x61, 0x76,
+ 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x43, 0x6c, 0x61, 0x73,
+ 0x73, 0x3b, 0x5b, 0x0, 0x8, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72,
+ 0x73, 0x65, 0x74, 0x0, 0x11, 0x5b, 0x4c, 0x6a, 0x61, 0x76, 0x61,
+ 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x45, 0x6e, 0x75, 0x6d, 0x3b,
+ 0x78, 0x70, 0x76, 0x72, 0x0, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x2e,
+ 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x54, 0x68, 0x72, 0x65, 0x61,
+ 0x64, 0x24, 0x53, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x78, 0x72, 0x0, 0xe, 0x6a, 0x61,
+ 0x76, 0x61, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x45, 0x6e, 0x75,
+ 0x6d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x78,
+ 0x70, 0x75, 0x72, 0x0, 0x19, 0x5b, 0x4c, 0x6a, 0x61, 0x76, 0x61,
+ 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x54, 0x68, 0x72, 0x65, 0x61,
+ 0x64, 0x24, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3b, 0x68, (byte)0xa3,
+ (byte)0xb5, (byte)0xd5, 0x11, 0x7d, 0x1b, (byte)0xb3, 0x2, 0x0,
+ 0x0, 0x78, 0x70, 0x0, 0x0, 0x0, 0x6, 0x7e, 0x71, 0x0, 0x7e, 0x0,
+ 0x5, 0x74, 0x0, 0x3, 0x4e, 0x45, 0x57, 0x7e, 0x71, 0x0, 0x7e, 0x0,
+ 0x5, 0x74, 0x0, 0x8, 0x52, 0x55, 0x4e, 0x4e, 0x41, 0x42, 0x4c, 0x45,
+ 0x7e, 0x71, 0x0, 0x7e, 0x0, 0x5, 0x74, 0x0, 0x7, 0x42, 0x4c, 0x4f,
+ 0x43, 0x4b, 0x45, 0x44, 0x7e, 0x71, 0x0, 0x7e, 0x0, 0x5, 0x74, 0x0,
+ 0x7, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x7e, 0x71, 0x0,
+ 0x7e, 0x0, 0x5, 0x74, 0x0, 0xd, 0x54, 0x49, 0x4d, 0x45, 0x44,
+ 0x5f, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x7e, 0x71, 0x0,
+ 0x7e, 0x0, 0x5, 0x74, 0x0, 0xa, 0x54, 0x45, 0x52, 0x4d, 0x49,
+ 0x4e, 0x41, 0x54, 0x45, 0x44, (byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff
+ };
+
+ try {
+ // Should fail, but instead creates corrupt EnumSet
+ @SuppressWarnings("unchecked")
+ EnumSet<Thread.State> es = (EnumSet<Thread.State>)
+ deserialize(serializedForm);
+
+ // Demonstrates corruption
+ System.out.println("Enum size: " + Thread.State.values().length); // 6
+ System.out.println("Set size: " + es.size()); // 64
+ System.out.println("Set: " + es); // Throws IndexOutOfBoundsException
+ throw new AssertionError("Expected exception InvalidObjectException not thrown");
+ } catch (java.io.InvalidObjectException _) { /* OK */ }
+ }
+
+ private static Object deserialize(byte[] sf) throws Throwable {
+ return new ObjectInputStream(
+ new ByteArrayInputStream(sf))
+ .readObject();
+ }
+}
--- a/jdk/test/javax/script/E4XErrorTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/E4XErrorTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6346734
+ * @bug 6346734 6705893
* @summary We do *not* support E4X (ECMAScript for XML) in our
* implementation. We want to throw error on XML literals
* as early as possible rather than at "runtime" - i.e., when
@@ -37,9 +37,10 @@
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine jsengine = manager.getEngineByName("js");
+ ScriptEngine jsengine = Helper.getJsEngine(manager);
if (jsengine == null) {
- throw new RuntimeException("no js engine found");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
// The test below depends on the error message content
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/script/Helper.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+import javax.script.*;
+
+/**
+ * Helper class to consolidate testing requirements for a js engine.
+ * A js engine is required as part of Sun's product JDK.
+ */
+public class Helper {
+ private Helper() {}; // Don't instantiate
+
+ public static ScriptEngine getJsEngine(ScriptEngineManager m) {
+ ScriptEngine e = m.getEngineByName("js");
+ if (e == null &&
+ System.getProperty("java.runtime.name").startsWith("Java(TM)")) {
+ // A js engine is requied for Sun's product JDK
+ throw new RuntimeException("no js engine found");
+ }
+ return e;
+ }
+}
--- a/jdk/test/javax/script/JavaScriptScopeTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/JavaScriptScopeTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6346733
+ * @bug 6346733 6705893
* @summary Verify that independent Bindings instances don't
* get affected by default scope assignments. Also, verify
* that script globals can be created and accessed from Java
@@ -36,9 +36,10 @@
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine jsengine = manager.getEngineByName("js");
+ ScriptEngine jsengine = Helper.getJsEngine(manager);
if (jsengine == null) {
- throw new RuntimeException("no js engine found");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
jsengine.eval("var v = 'hello';");
// Create a new scope
--- a/jdk/test/javax/script/NullUndefinedVarTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/NullUndefinedVarTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6346732
+ * @bug 6346732 6705893
* @summary should be able to assign null and undefined
* value to JavaScript global variables.
*/
@@ -34,9 +34,10 @@
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine jsengine = manager.getEngineByName("js");
+ ScriptEngine jsengine = Helper.getJsEngine(manager);
if (jsengine == null) {
- throw new RuntimeException("no js engine found");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
jsengine.eval("var n = null; " +
"if (n !== null) throw 'expecting null';" +
--- a/jdk/test/javax/script/PluggableContextTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/PluggableContextTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6398614
+ * @bug 6398614 6705893
* @summary Create a user defined ScriptContext and check
* that script can access variables from non-standard scopes
*/
@@ -35,7 +35,11 @@
ScriptEngineManager m = new ScriptEngineManager();
ScriptContext ctx = new MyContext();
ctx.setAttribute("x", "hello", MyContext.APP_SCOPE);
- ScriptEngine e = m.getEngineByName("js");
+ ScriptEngine e = Helper.getJsEngine(m);
+ if (e == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
// the following reference to 'x' throws exception
// if APP_SCOPE is not searched.
e.eval("x", ctx);
--- a/jdk/test/javax/script/ProviderTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/ProviderTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -35,9 +35,10 @@
if (se == null) {
throw new RuntimeException("can't locate dummy engine");
}
- se = manager.getEngineByName("js");
+ se = Helper.getJsEngine(manager);
if (se == null) {
- throw new RuntimeException("can't locate JavaScript engine");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
}
}
--- a/jdk/test/javax/script/RhinoExceptionTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/RhinoExceptionTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,8 +23,8 @@
/*
* @test
- * @bug 6474943
- * @summary Test that Rhion exception messages are
+ * @bug 6474943 6705893
+ * @summary Test that Rhino exception messages are
* available from ScriptException.
*/
@@ -36,7 +36,11 @@
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine engine = m.getEngineByName("js");
+ ScriptEngine engine = Helper.getJsEngine(m);
+ if (engine == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
engine.put("msg", ERROR_MSG);
try {
engine.eval("throw new Error(msg);");
--- a/jdk/test/javax/script/Test1.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test1.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Create JavaScript engine and execute a simple script.
* Tests script engine discovery mechanism.
*/
@@ -35,9 +35,10 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest1\n");
ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine jsengine = manager.getEngineByName("js");
+ ScriptEngine jsengine = Helper.getJsEngine(manager);
if (jsengine == null) {
- throw new RuntimeException("no js engine found");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
jsengine.eval(new FileReader(
new File(System.getProperty("test.src", "."), "Test1.js")));
--- a/jdk/test/javax/script/Test2.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test2.java Fri Aug 29 12:40:58 2008 -0700
@@ -50,7 +50,11 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest2\n");
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine eng = m.getEngineByName("js");
+ ScriptEngine eng = Helper.getJsEngine(m);
+ if (eng == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
eng.put("Testobj", new Testobj("Hello World"));
eng.eval(new FileReader(
new File(System.getProperty("test.src", "."), "Test2.js")));
--- a/jdk/test/javax/script/Test3.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test3.java Fri Aug 29 12:40:58 2008 -0700
@@ -4,6 +4,7 @@
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
+
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
@@ -23,7 +24,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test engine and global scopes
*/
@@ -37,7 +38,11 @@
final Reader reader = new FileReader(
new File(System.getProperty("test.src", "."), "Test3.js"));
ScriptEngineManager m = new ScriptEngineManager();
- final ScriptEngine engine = m.getEngineByName("js");
+ final ScriptEngine engine = Helper.getJsEngine(m);
+ if (engine == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
Bindings en = new SimpleBindings();
engine.setBindings(en, ScriptContext.ENGINE_SCOPE);
en.put("key", "engine value");
--- a/jdk/test/javax/script/Test4.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test4.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test script functions implementing Java interface
*/
@@ -34,7 +34,11 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest4\n");
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine e = m.getEngineByName("js");
+ ScriptEngine e = Helper.getJsEngine(m);
+ if (e == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
e.eval(new FileReader(
new File(System.getProperty("test.src", "."), "Test4.js")));
Invocable inv = (Invocable)e;
--- a/jdk/test/javax/script/Test5.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test5.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Tests engine, global scopes and scope hiding.
*/
@@ -34,7 +34,11 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest5\n");
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine engine = m.getEngineByName("js");
+ ScriptEngine engine = Helper.getJsEngine(m);
+ if (engine == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
Bindings g = new SimpleBindings();
Bindings e = new SimpleBindings();
g.put("key", "value in global");
--- a/jdk/test/javax/script/Test6.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test6.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test basic script compilation. Value eval'ed from
* compiled and interpreted scripts should be same.
*/
@@ -35,7 +35,11 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest6\n");
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine engine = m.getEngineByName("js");
+ ScriptEngine engine = Helper.getJsEngine(m);
+ if (engine == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
Reader reader = new FileReader(
new File(System.getProperty("test.src", "."), "Test6.js"));
engine.eval(reader);
--- a/jdk/test/javax/script/Test7.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test7.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Tests importPackage and java access in script
*/
@@ -37,7 +37,11 @@
new File(System.getProperty("test.src", "."), "Test7.js");
Reader r = new FileReader(file);
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine eng = m.getEngineByName("js");
+ ScriptEngine eng = Helper.getJsEngine(m);
+ if (eng == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
eng.put("filename", file.getAbsolutePath());
eng.eval(r);
String str = (String)eng.get("firstLine");
--- a/jdk/test/javax/script/Test8.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/Test8.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test invoking script function or method from Java
*/
@@ -34,7 +34,11 @@
public static void main(String[] args) throws Exception {
System.out.println("\nTest8\n");
ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine e = m.getEngineByName("js");
+ ScriptEngine e = Helper.getJsEngine(m);
+ if (e == null) {
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
+ }
e.eval(new FileReader(
new File(System.getProperty("test.src", "."), "Test8.js")));
Invocable inv = (Invocable)e;
--- a/jdk/test/javax/script/VersionTest.java Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/javax/script/VersionTest.java Fri Aug 29 12:40:58 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6346729
+ * @bug 6346729 6705893
* @summary Create JavaScript engine and check language and engine version
*/
@@ -37,9 +37,10 @@
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
- ScriptEngine jsengine = manager.getEngineByName("js");
+ ScriptEngine jsengine = Helper.getJsEngine(manager);
if (jsengine == null) {
- throw new RuntimeException("no js engine found");
+ System.out.println("Warning: No js engine found; test vacuously passes.");
+ return;
}
String langVersion = jsengine.getFactory().getLanguageVersion();
if (! langVersion.equals(JS_LANG_VERSION)) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/nio/cs/TestUTF8.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,393 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4486841
+ * @summary Test UTF-8 charset
+ */
+
+import java.nio.charset.*;
+import java.nio.*;
+import java.util.*;
+
+public class TestUTF8 {
+ static char[] decode(byte[] bb, String csn, boolean testDirect)
+ throws Exception {
+ CharsetDecoder dec = Charset.forName(csn).newDecoder();
+ ByteBuffer bbf;
+ CharBuffer cbf;
+ if (testDirect) {
+ bbf = ByteBuffer.allocateDirect(bb.length);
+ cbf = ByteBuffer.allocateDirect(bb.length*2).asCharBuffer();
+ bbf.put(bb).flip();
+ } else {
+ bbf = ByteBuffer.wrap(bb);
+ cbf = CharBuffer.allocate(bb.length);
+ }
+ CoderResult cr = dec.decode(bbf, cbf, true);
+ if (cr != CoderResult.UNDERFLOW)
+ throw new RuntimeException("Decoding err: " + csn);
+ char[] cc = new char[cbf.position()];
+ cbf.flip(); cbf.get(cc);
+ return cc;
+
+ }
+
+ static CoderResult decodeCR(byte[] bb, String csn, boolean testDirect)
+ throws Exception {
+ CharsetDecoder dec = Charset.forName(csn).newDecoder();
+ ByteBuffer bbf;
+ CharBuffer cbf;
+ if (testDirect) {
+ bbf = ByteBuffer.allocateDirect(bb.length);
+ cbf = ByteBuffer.allocateDirect(bb.length*2).asCharBuffer();
+ bbf.put(bb).flip();
+ } else {
+ bbf = ByteBuffer.wrap(bb);
+ cbf = CharBuffer.allocate(bb.length);
+ }
+ return dec.decode(bbf, cbf, true);
+ }
+
+ static byte[] encode(char[] cc, String csn, boolean testDirect)
+ throws Exception {
+ ByteBuffer bbf;
+ CharBuffer cbf;
+ CharsetEncoder enc = Charset.forName(csn).newEncoder();
+ if (testDirect) {
+ bbf = ByteBuffer.allocateDirect(cc.length * 4);
+ cbf = ByteBuffer.allocateDirect(cc.length * 2).asCharBuffer();
+ cbf.put(cc).flip();
+ } else {
+ bbf = ByteBuffer.allocate(cc.length * 4);
+ cbf = CharBuffer.wrap(cc);
+ }
+
+ CoderResult cr = enc.encode(cbf, bbf, true);
+ if (cr != CoderResult.UNDERFLOW)
+ throw new RuntimeException("Encoding err: " + csn);
+ byte[] bb = new byte[bbf.position()];
+ bbf.flip(); bbf.get(bb);
+ return bb;
+ }
+
+ static CoderResult encodeCR(char[] cc, String csn, boolean testDirect)
+ throws Exception {
+ ByteBuffer bbf;
+ CharBuffer cbf;
+ CharsetEncoder enc = Charset.forName(csn).newEncoder();
+ if (testDirect) {
+ bbf = ByteBuffer.allocateDirect(cc.length * 4);
+ cbf = ByteBuffer.allocateDirect(cc.length * 2).asCharBuffer();
+ cbf.put(cc).flip();
+ } else {
+ bbf = ByteBuffer.allocate(cc.length * 4);
+ cbf = CharBuffer.wrap(cc);
+ }
+ return enc.encode(cbf, bbf, true);
+ }
+
+ static char[] getUTFChars() {
+ char[] cc = new char[0x10000 - 0xe000 + 0xd800 + //bmp
+ (0x110000 - 0x10000) * 2]; //supp
+ int pos = 0;
+ int i = 0;
+ for (i = 0; i < 0xd800; i++)
+ cc[pos++] = (char)i;
+ for (i = 0xe000; i < 0x10000; i++)
+ cc[pos++] = (char)i;
+ for (i = 0x10000; i < 0x110000; i++) {
+ pos += Character.toChars(i, cc, pos);
+ }
+ return cc;
+ }
+
+ static int to3ByteUTF8(char c, byte[] bb, int pos) {
+ bb[pos++] = (byte)(0xe0 | ((c >> 12)));
+ bb[pos++] = (byte)(0x80 | ((c >> 06) & 0x3f));
+ bb[pos++] = (byte)(0x80 | ((c >> 00) & 0x3f));
+ return 3;
+ }
+
+ static void checkRoundtrip(String csn) throws Exception {
+ System.out.printf(" Check roundtrip <%s>...", csn);
+ char[] cc = getUTFChars();
+ byte[] bb = encode(cc, csn, false);
+ char[] ccO = decode(bb, csn, false);
+
+ if (!Arrays.equals(cc, ccO)) {
+ System.out.printf(" non-direct failed");
+ }
+ bb = encode(cc, csn, true);
+ ccO = decode(bb, csn, true);
+ if (!Arrays.equals(cc, ccO)) {
+ System.out.printf(" (direct) failed");
+ }
+ System.out.println();
+ }
+
+ static void check6ByteSurrs(String csn) throws Exception {
+ System.out.printf(" Check 6-byte Surrogates <%s>...%n", csn);
+ byte[] bb = new byte[(0x110000 - 0x10000) * 6];
+ char[] cc = new char[(0x110000 - 0x10000) * 2];
+ int bpos = 0;
+ int cpos = 0;
+ for (int i = 0x10000; i < 0x110000; i++) {
+ Character.toChars(i, cc, cpos);
+ bpos += to3ByteUTF8(cc[cpos], bb, bpos);
+ bpos += to3ByteUTF8(cc[cpos + 1], bb, bpos);
+ cpos += 2;
+ }
+
+ char[] ccO = decode(bb, csn, false);
+ if (!Arrays.equals(cc, ccO)) {
+ System.out.printf(" decoding failed%n");
+ }
+ ccO = decode(bb, csn, true);
+ if (!Arrays.equals(cc, ccO)) {
+ System.out.printf(" decoding(direct) failed%n");
+ }
+ }
+
+ static void compare(String csn1, String csn2) throws Exception {
+ System.out.printf(" Diff <%s> <%s>...%n", csn1, csn2);
+ char[] cc = getUTFChars();
+
+ byte[] bb1 = encode(cc, csn1, false);
+ byte[] bb2 = encode(cc, csn2, false);
+ if (!Arrays.equals(bb1, bb2))
+ System.out.printf(" encoding failed%n");
+ char[] cc1 = decode(bb1, csn1, false);
+ char[] cc2 = decode(bb1, csn2, false);
+ if (!Arrays.equals(cc1, cc2)) {
+ System.out.printf(" decoding failed%n");
+ }
+
+ bb1 = encode(cc, csn1, true);
+ bb2 = encode(cc, csn2, true);
+ if (!Arrays.equals(bb1, bb2))
+ System.out.printf(" encoding (direct) failed%n");
+ cc1 = decode(bb1, csn1, true);
+ cc2 = decode(bb1, csn2, true);
+ if (!Arrays.equals(cc1, cc2)) {
+ System.out.printf(" decoding (direct) failed%n");
+ }
+ }
+
+ // The first byte is the length of malformed bytes
+ static byte[][] malformed = {
+ // One-byte sequences:
+ {1, (byte)0xFF },
+ {1, (byte)0xC0 },
+ {1, (byte)0x80 },
+
+ {1, (byte)0xFF, (byte)0xFF}, // all ones
+ {1, (byte)0xA0, (byte)0x80}, // 101x first byte first nibble
+
+ // Two-byte sequences:
+ {1, (byte)0xC0, (byte)0x80}, // invalid first byte
+ {1, (byte)0xC1, (byte)0xBF}, // invalid first byte
+ {1, (byte)0xC2, (byte)0x00}, // invalid second byte
+ {1, (byte)0xC2, (byte)0xC0}, // invalid second byte
+ {1, (byte)0xD0, (byte)0x00}, // invalid second byte
+ {1, (byte)0xD0, (byte)0xC0}, // invalid second byte
+ {1, (byte)0xDF, (byte)0x00}, // invalid second byte
+ {1, (byte)0xDF, (byte)0xC0}, // invalid second byte
+
+ // Three-byte sequences
+ {1, (byte)0xE0, (byte)0x80, (byte)0x80}, // 111x first byte first nibble
+ {1, (byte)0xE0, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
+ {1, (byte)0xE0, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
+ {1, (byte)0xE0, (byte)0x9F, (byte)0xBF }, // U+07FF zero-padded
+
+ {1, (byte)0xE0, (byte)0xC0, (byte)0xBF }, // invalid second byte
+ {2, (byte)0xE0, (byte)0xA0, (byte)0x7F }, // invalid third byte
+ {2, (byte)0xE0, (byte)0xA0, (byte)0xC0 }, // invalid third byte
+ {1, (byte)0xFF, (byte)0xFF, (byte)0xFF }, // all ones
+ {1, (byte)0xE0, (byte)0xC0, (byte)0x80 }, // invalid second byte
+ {1, (byte)0xE0, (byte)0x80, (byte)0xC0 }, // invalid first byte
+
+ // Four-byte sequences
+ {1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
+ {1, (byte)0xF0, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
+ {1, (byte)0xF0, (byte)0x80, (byte)0x9F, (byte)0xBF }, // U+007F zero-padded
+ {1, (byte)0xF0, (byte)0x8F, (byte)0xBF, (byte)0xBF }, // U+07FF zero-padded
+
+ {1, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF }, // all ones
+ {1, (byte)0xF0, (byte)0x80, (byte)0x80, (byte)0x80}, // invalid second byte
+ {1, (byte)0xF0, (byte)0xC0, (byte)0x80, (byte)0x80 }, // invalid second byte
+ {2, (byte)0xF0, (byte)0x90, (byte)0xC0, (byte)0x80 }, // invalid third byte
+ {3, (byte)0xF0, (byte)0x90, (byte)0x80, (byte)0xC0 }, // invalid third byte
+
+ {1, (byte)0xF1, (byte)0xC0, (byte)0x80, (byte)0x80 }, // invalid second byte
+ {2, (byte)0xF1, (byte)0x80, (byte)0xC0, (byte)0x80 }, // invalid third byte
+ {3, (byte)0xF1, (byte)0x80, (byte)0x80, (byte)0xC0 }, // invalid forth byte
+ {1, (byte)0xF4, (byte)0x90, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
+ {1, (byte)0xF4, (byte)0xC0, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
+ {1, (byte)0xF5, (byte)0x80, (byte)0x80, (byte)0xC0 }, // out-range 4-byte
+
+ // Five-byte sequences
+ {5, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80}, // invalid first byte
+ {5, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
+ {5, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
+ {5, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0xBF }, // U+07FF zero-padded
+ {5, (byte)0xF8, (byte)0x80, (byte)0x8F, (byte)0xBF, (byte)0xBF }, // U+FFFF zero-padded
+
+ {1, (byte)0xF8, (byte)0xC0, (byte)0x80, (byte)0x80, (byte)0x80},
+ {2, (byte)0xF8, (byte)0x80, (byte)0xC0, (byte)0x80, (byte)0x80 },
+ {3, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0xC1, (byte)0xBF },
+ {4, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0xC0 },
+
+ // Six-byte sequences
+ {6, (byte)0xFC, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80 }, // U+0000 zero-padded
+ {6, (byte)0xFC, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x81, (byte)0xBF }, // U+007F zero-padded
+ {6, (byte)0xFC, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0xBF }, // U+07FF zero-padded
+ {6, (byte)0xFC, (byte)0x80, (byte)0x80, (byte)0x8F, (byte)0xBF, (byte)0xBF }, // U+FFFF zero-padded
+ {1, (byte)0xF8, (byte)0xC0, (byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80 },
+ {2, (byte)0xF8, (byte)0x80, (byte)0xC0, (byte)0x80, (byte)0x80, (byte)0x80 },
+ {3, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0xC1, (byte)0xBF, (byte)0x80 },
+ {4, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0xC0, (byte)0x80 },
+ {5, (byte)0xF8, (byte)0x80, (byte)0x80, (byte)0x9F, (byte)0x80, (byte)0xC0 },
+ };
+
+ static void checkMalformed(String csn) throws Exception {
+ boolean failed = false;
+ System.out.printf(" Check malformed <%s>...%n", csn);
+ for (boolean direct: new boolean[] {false, true}) {
+ for (byte[] bins : malformed) {
+ int mlen = bins[0];
+ byte[] bin = Arrays.copyOfRange(bins, 1, bins.length);
+ CoderResult cr = decodeCR(bin, csn, direct);
+ String ashex = "";
+ for (int i = 0; i < bin.length; i++) {
+ if (i > 0) ashex += " ";
+ ashex += Integer.toBinaryString((int)bin[i] & 0xff);
+ }
+ if (!cr.isMalformed()) {
+ System.out.printf(" FAIL(direct=%b): [%s] not malformed.\n", direct, ashex);
+ failed = true;
+ } else if (cr.length() != mlen) {
+ System.out.printf(" FAIL(direct=%b): [%s] malformed[len=%d].\n", direct, ashex, cr.length());
+ failed = true;
+ }
+ }
+ }
+ if (failed)
+ throw new RuntimeException("Check malformed failed " + csn);
+ }
+
+ static boolean check(CharsetDecoder dec, byte[] utf8s, boolean direct, int[] flow) {
+ int inPos = flow[0];
+ int inLen = flow[1];
+ int outPos = flow[2];
+ int outLen = flow[3];
+ int expedInPos = flow[4];
+ int expedOutPos = flow[5];
+ CoderResult expedCR = (flow[6]==0)?CoderResult.UNDERFLOW
+ :CoderResult.OVERFLOW;
+ ByteBuffer bbf;
+ CharBuffer cbf;
+ if (direct) {
+ bbf = ByteBuffer.allocateDirect(inPos + utf8s.length);
+ cbf = ByteBuffer.allocateDirect((outPos + outLen)*2).asCharBuffer();
+ } else {
+ bbf = ByteBuffer.allocate(inPos + utf8s.length);
+ cbf = CharBuffer.allocate(outPos + outLen);
+ }
+ bbf.position(inPos);
+ bbf.put(utf8s).flip().position(inPos).limit(inPos + inLen);
+ cbf.position(outPos);
+ dec.reset();
+ CoderResult cr = dec.decode(bbf, cbf, false);
+ if (cr != expedCR ||
+ bbf.position() != expedInPos ||
+ cbf.position() != expedOutPos) {
+ System.out.printf("Expected(direct=%5b): [", direct);
+ for (int i:flow) System.out.print(" " + i);
+ System.out.println("] CR=" + cr +
+ ", inPos=" + bbf.position() +
+ ", outPos=" + cbf.position());
+ return false;
+ }
+ return true;
+ }
+
+ static void checkUnderOverflow(String csn) throws Exception {
+ System.out.printf(" Check under/overflow <%s>...%n", csn);
+ CharsetDecoder dec = Charset.forName(csn).newDecoder();
+ boolean failed = false;
+ byte[] utf8s = new String("\u007f\u07ff\ue000\ud800\udc00").getBytes("UTF-8");
+ int inlen = utf8s.length;
+
+ for (int inoff = 0; inoff < 20; inoff++) {
+ for (int outoff = 0; outoff < 20; outoff++) {
+ int[][] Flows = {
+ //inpos, inLen, outPos, outLen, inPosEP, outposEP, under(0)/over(1)
+ {inoff, inlen, outoff, 1, inoff + 1, outoff + 1, 1},
+ {inoff, inlen, outoff, 2, inoff + 3, outoff + 2, 1},
+ {inoff, inlen, outoff, 3, inoff + 6, outoff + 3, 1},
+ {inoff, inlen, outoff, 4, inoff + 6, outoff + 3, 1},
+ {inoff, inlen, outoff, 5, inoff + 10,outoff + 5, 0},
+ // underflow
+ {inoff, 1, outoff, 5, inoff + 1, outoff + 1, 0},
+ {inoff, 2, outoff, 5, inoff + 1, outoff + 1, 0},
+ {inoff, 3, outoff, 5, inoff + 3, outoff + 2, 0},
+ {inoff, 4, outoff, 5, inoff + 3, outoff + 2, 0},
+ {inoff, 5, outoff, 5, inoff + 3, outoff + 2, 0},
+ {inoff, 6, outoff, 5, inoff + 6, outoff + 3, 0},
+ {inoff, 7, outoff, 5, inoff + 6, outoff + 3, 0},
+ {inoff, 8, outoff, 5, inoff + 6, outoff + 3, 0},
+ {inoff, 9, outoff, 5, inoff + 6, outoff + 3, 0},
+ {inoff, 10, outoff, 5, inoff + 10,outoff + 5, 0},
+ // 2-byte underflow/overflow
+ {inoff, 2, outoff, 1, inoff + 1, outoff + 1, 0},
+ {inoff, 3, outoff, 1, inoff + 1, outoff + 1, 1},
+ // 3-byte underflow/overflow
+ {inoff, 4, outoff, 2, inoff + 3, outoff + 2, 0},
+ {inoff, 5, outoff, 2, inoff + 3, outoff + 2, 0},
+ {inoff, 6, outoff, 2, inoff + 3, outoff + 2, 1},
+ // 4-byte underflow/overflow
+ {inoff, 7, outoff, 4, inoff + 6, outoff + 3, 0},
+ {inoff, 8, outoff, 4, inoff + 6, outoff + 3, 0},
+ {inoff, 9, outoff, 4, inoff + 6, outoff + 3, 0},
+ {inoff, 10, outoff, 4, inoff + 6, outoff + 3, 1},
+ };
+ for (boolean direct: new boolean[] {false, true}) {
+ for (int[] flow: Flows) {
+ if (!check(dec, utf8s, direct, flow))
+ failed = true;
+ }
+ }}}
+ if (failed)
+ throw new RuntimeException("Check under/overflow failed " + csn);
+ }
+
+ public static void main(String[] args) throws Exception {
+ checkRoundtrip("UTF-8");
+ check6ByteSurrs("UTF-8");
+ //compare("UTF-8", "UTF-8-OLD");
+ checkMalformed("UTF-8");
+ checkUnderOverflow("UTF-8");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/util/DerValue/Indefinite.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6731685
+ * @summary CertificateFactory.generateCertificates throws IOException on PKCS7 cert chain
+ */
+
+import java.io.*;
+import sun.security.util.*;
+
+public class Indefinite {
+
+ public static void main(String[] args) throws Exception {
+ byte[] input = {
+ // An OCTET-STRING in 2 parts
+ 4, (byte)0x80, 4, 2, 'a', 'b', 4, 2, 'c', 'd', 0, 0,
+ // Garbage follows, may be falsely recognized as EOC
+ 0, 0, 0, 0
+ };
+ new DerValue(new ByteArrayInputStream(input));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jrunscript/CheckEngine.java Fri Aug 29 12:40:58 2008 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import javax.script.*;
+
+/*
+ * If the JDK being tested is <b>not</b> a Sun product JDK and a js
+ * engine is not present, return an exit code of 2 to indicate that
+ * the jrunscript tests which assume a js engine can be vacuously
+ * passed.
+ */
+public class CheckEngine {
+ public static void main(String... args) {
+ int exitCode = 0;
+ ScriptEngine engine =
+ (new ScriptEngineManager()).getEngineByName("js");
+
+ if (engine == null &&
+ !(System.getProperty("java.runtime.name").startsWith("Java(TM)"))) {
+ exitCode = 2;
+ }
+
+ System.exit(exitCode);
+ }
+}
--- a/jdk/test/sun/tools/jrunscript/common.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/common.sh Fri Aug 29 12:40:58 2008 -0700
@@ -52,4 +52,5 @@
JRUNSCRIPT="${TESTJAVA}/bin/jrunscript"
JAVAC="${TESTJAVA}/bin/javac"
+ JAVA="${TESTJAVA}/bin/java"
}
--- a/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscript-DTest.sh
# @summary Test that output of 'jrunscript -D'
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
# test whether value specifieD by -D option is passed
# to script as java.lang.System property. sysProps is
--- a/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscript-argsTest.sh
# @summary Test passing of script arguments from command line
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
# we check whether "excess" args are passed as script arguments
--- a/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscript-cpTest.sh
# @summary Test -cp option to set classpath
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
rm -f Hello.class
${JAVAC} ${TESTSRC}/Hello.java -d .
--- a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscript-eTest.sh
# @summary Test that output of 'jrunscript -e' matches the dash-e.out file
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
rm -f jrunscript-eTest.out 2>/dev/null
${JRUNSCRIPT} -e "println('hello')" > jrunscript-eTest.out 2>&1
--- a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscript-fTest.sh
# @summary Test that output of 'jrunscript -f' matches the dash-f.out file
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
rm -f jrunscript-fTest.out 2>/dev/null
${JRUNSCRIPT} -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
--- a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh Thu Aug 28 11:05:27 2008 -0700
+++ b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh Fri Aug 29 12:40:58 2008 -0700
@@ -25,13 +25,19 @@
# @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
# @run shell jrunscriptTest.sh
# @summary Test that output of 'jrunscript' interactive matches the repl.out file
. ${TESTSRC-.}/common.sh
setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+ echo "No js engine found and engine not required; test vacuously passes."
+ exit 0
+fi
rm -f jrunscriptTest.out 2>/dev/null
${JRUNSCRIPT} > jrunscriptTest.out 2>&1 <<EOF