changeset 519:c5f211538cad

Merge
author tbell
date Mon, 25 Aug 2008 23:37:31 -0700
parents 9f53e194687c 872241636752
children cf4894b78ceb
files src/share/javavm/include/opcodes.h src/share/javavm/include/opcodes.length src/share/javavm/include/opcodes.list src/share/javavm/include/opcodes.weight src/share/javavm/include/opcodes.wide src/share/javavm/include/sys_api.h src/share/javavm/include/typedefs.h src/solaris/javavm/include/typedefs_md.h src/windows/javavm/include/typedefs_md.h
diffstat 51 files changed, 1274 insertions(+), 2790 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/Defs.gmk	Mon Aug 25 23:33:24 2008 -0700
+++ b/make/common/Defs.gmk	Mon Aug 25 23:37:31 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/make/java/net/mapfile-vers	Mon Aug 25 23:33:24 2008 -0700
+++ b/make/java/net/mapfile-vers	Mon Aug 25 23:37:31 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/make/java/verify/Makefile	Mon Aug 25 23:33:24 2008 -0700
+++ b/make/java/verify/Makefile	Mon Aug 25 23:37:31 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/make/netbeans/awt2d/README	Mon Aug 25 23:33:24 2008 -0700
+++ b/make/netbeans/awt2d/README	Mon Aug 25 23:37:31 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/make/tools/GenerateCharacter/check_class.c.template	Mon Aug 25 23:33:24 2008 -0700
+++ b/make/tools/GenerateCharacter/check_class.c.template	Mon Aug 25 23:37:31 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/src/share/back/debugDispatch.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/back/debugDispatch.c	Mon Aug 25 23:37:31 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/src/share/back/error_messages.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/back/error_messages.c	Mon Aug 25 23:37:31 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/src/share/back/inStream.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/back/inStream.c	Mon Aug 25 23:37:31 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/src/share/back/outStream.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/back/outStream.h	Mon Aug 25 23:37:31 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/src/share/classes/java/net/NetworkInterface.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/java/net/NetworkInterface.java	Mon Aug 25 23:37:31 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/src/share/classes/java/net/ServerSocket.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/java/net/ServerSocket.java	Mon Aug 25 23:37:31 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/src/share/classes/java/util/EnumSet.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/java/util/EnumSet.java	Mon Aug 25 23:37:31 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/src/share/classes/javax/net/ssl/SSLServerSocket.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/javax/net/ssl/SSLServerSocket.java	Mon Aug 25 23:37:31 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/src/share/classes/sun/nio/cs/UTF_8.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/sun/nio/cs/UTF_8.java	Mon Aug 25 23:37:31 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
  *
- * UCS-2 uses 1-3, UTF-16 uses 1-4, UCS-4 uses 1-6
+ * #    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
+ *
+ * 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;
         }
 
-        private final Surrogate.Generator sgg = new Surrogate.Generator();
+        //  [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 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);
+            int dlASCII = dp + Math.min(sl - sp, dl - dp);
 
-            try {
-                while (sp < sl) {
-                    int b1 = sa[sp];
-                    int b2, b3;
-                    switch ((b1 >> 4) & 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:
-                        // 1 byte, 7 bits: 0xxxxxxx
-                        if (dl - dp < 1)
-                            return CoderResult.OVERFLOW;
-                        da[dp++] = (char)(b1 & 0x7f);
-                        sp++;
-                        continue;
-
-                    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) {
-
-                        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);
+            int dlASCII = dp + Math.min(sl - sp, dl - dp);
 
-            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;
+            //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();
                     }
-
-                    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;
-                        }
-                    }
-
-                    // 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/src/share/classes/sun/security/util/DerIndefLenConverter.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/sun/security/util/DerIndefLenConverter.java	Mon Aug 25 23:37:31 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/src/share/classes/sun/tools/jmap/JMap.java	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/classes/sun/tools/jmap/JMap.java	Mon Aug 25 23:37:31 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/src/share/instrument/InstrumentationImplNativeMethods.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/instrument/InstrumentationImplNativeMethods.c	Mon Aug 25 23:37:31 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/src/share/instrument/JPLISAgent.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/instrument/JPLISAgent.c	Mon Aug 25 23:37:31 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/src/share/javavm/export/jvm.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/javavm/export/jvm.h	Mon Aug 25 23:37:31 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/src/share/javavm/include/opcodes.h	Mon Aug 25 23:33:24 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/src/share/javavm/include/opcodes.length	Mon Aug 25 23:33:24 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/src/share/javavm/include/opcodes.list	Mon Aug 25 23:33:24 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/src/share/javavm/include/opcodes.weight	Mon Aug 25 23:33:24 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/src/share/javavm/include/opcodes.wide	Mon Aug 25 23:33:24 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/src/share/javavm/include/sys_api.h	Mon Aug 25 23:33:24 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/src/share/javavm/include/typedefs.h	Mon Aug 25 23:33:24 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/src/share/native/common/check_code.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/native/common/check_code.c	Mon Aug 25 23:37:31 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/src/share/native/common/check_format.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/share/native/common/check_format.c	Mon Aug 25 23:37:31 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/src/solaris/back/util_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/back/util_md.h	Mon Aug 25 23:37:31 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/src/solaris/instrument/FileSystemSupport_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/instrument/FileSystemSupport_md.h	Mon Aug 25 23:37:31 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/src/solaris/javavm/export/jvm_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/javavm/export/jvm_md.h	Mon Aug 25 23:37:31 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/src/solaris/javavm/include/typedefs_md.h	Mon Aug 25 23:33:24 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/src/solaris/native/common/gdefs_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/native/common/gdefs_md.h	Mon Aug 25 23:37:31 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/src/solaris/native/common/jlong_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/native/common/jlong_md.h	Mon Aug 25 23:37:31 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/src/solaris/native/java/net/NetworkInterface.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/native/java/net/NetworkInterface.c	Mon Aug 25 23:37:31 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/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Mon Aug 25 23:37:31 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/src/windows/back/util_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/back/util_md.h	Mon Aug 25 23:37:31 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/src/windows/hpi/src/socket_md.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/hpi/src/socket_md.c	Mon Aug 25 23:37:31 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/src/windows/hpi/src/threads_md.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/hpi/src/threads_md.c	Mon Aug 25 23:37:31 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/src/windows/instrument/FileSystemSupport_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/instrument/FileSystemSupport_md.h	Mon Aug 25 23:37:31 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/src/windows/javavm/export/jvm_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/javavm/export/jvm_md.h	Mon Aug 25 23:37:31 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/src/windows/javavm/include/typedefs_md.h	Mon Aug 25 23:33:24 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/src/windows/native/java/net/NetworkInterface.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/native/java/net/NetworkInterface.c	Mon Aug 25 23:37:31 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/src/windows/native/java/net/NetworkInterface_winXP.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/native/java/net/NetworkInterface_winXP.c	Mon Aug 25 23:37:31 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/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Mon Aug 25 23:37:31 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/src/windows/native/java/net/net_util_md.c	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/native/java/net/net_util_md.c	Mon Aug 25 23:37:31 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/src/windows/native/java/net/net_util_md.h	Mon Aug 25 23:33:24 2008 -0700
+++ b/src/windows/native/java/net/net_util_md.h	Mon Aug 25 23:37:31 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/NetworkInterface/IndexTest.java	Mon Aug 25 23:37:31 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/test/java/util/EnumSet/BogusEnumSet.java	Mon Aug 25 23:37:31 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();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/nio/cs/TestUTF8.java	Mon Aug 25 23:37:31 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/test/sun/security/util/DerValue/Indefinite.java	Mon Aug 25 23:37:31 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));
+    }
+}