8135197: libjimage code needs translation from hotspot-ish to jdk-ish
authorjlaskey
Tue, 22 Sep 2015 12:47:40 -0300
changeset 32757 79d34d4b9627
parent 32756 acd1d25bbc77
child 32761 d7c393b4e0d3
8135197: libjimage code needs translation from hotspot-ish to jdk-ish Reviewed-by: rriggs, chegar Contributed-by: james.laskey@oracle.com
jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp
jdk/src/java.base/share/native/libjimage/endian.cpp
jdk/src/java.base/share/native/libjimage/endian.hpp
jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp
jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp
jdk/src/java.base/share/native/libjimage/imageFile.cpp
jdk/src/java.base/share/native/libjimage/imageFile.hpp
jdk/src/java.base/share/native/libjimage/inttypes.hpp
jdk/src/java.base/share/native/libjimage/jimage.cpp
jdk/src/java.base/share/native/libjimage/jimage.hpp
jdk/src/java.base/share/native/libjimage/osSupport.hpp
jdk/src/java.base/unix/native/libjimage/osSupport_unix.cpp
jdk/src/java.base/windows/native/libjimage/osSupport_windows.cpp
--- a/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include <string.h>
--- a/jdk/src/java.base/share/native/libjimage/endian.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/endian.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,11 +4,13 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include "endian.hpp"
@@ -27,20 +28,20 @@
 
 // Most modern compilers optimize the bswap routines to native instructions.
 inline static u2 bswap_16(u2 x) {
-  return ((x & 0xFF) << 8) |
-         ((x >> 8) & 0xFF);
+    return ((x & 0xFF) << 8) |
+           ((x >> 8) & 0xFF);
 }
 
 inline static u4 bswap_32(u4 x) {
-  return ((x & 0xFF) << 24) |
-       ((x & 0xFF00) << 8) |
-       ((x >> 8) & 0xFF00) |
-       ((x >> 24) & 0xFF);
+    return ((x & 0xFF) << 24) |
+           ((x & 0xFF00) << 8) |
+           ((x >> 8) & 0xFF00) |
+           ((x >> 24) & 0xFF);
 }
 
 inline static u8 bswap_64(u8 x) {
-  return (u8)bswap_32((u4)x) << 32 |
-         (u8)bswap_32((u4)(x >> 32));
+    return (u8)bswap_32((u4)x) << 32 |
+           (u8)bswap_32((u4)(x >> 32));
 }
 
 u2 NativeEndian::get(u2 x) { return x; }
@@ -76,27 +77,27 @@
 SwappingEndian SwappingEndian::_swapping;
 
 Endian* Endian::get_handler(bool big_endian) {
-  // If requesting little endian on a little endian machine or
-  // big endian on a big endian machine use native handler
-  if (big_endian == is_big_endian()) {
-    return NativeEndian::get_native();
-  } else {
-    // Use swapping handler.
-    return SwappingEndian::get_swapping();
-  }
+    // If requesting little endian on a little endian machine or
+    // big endian on a big endian machine use native handler
+    if (big_endian == is_big_endian()) {
+        return NativeEndian::get_native();
+    } else {
+        // Use swapping handler.
+        return SwappingEndian::get_swapping();
+    }
 }
 
 // Return a platform u2 from an array in which Big Endian is applied.
 u2 Endian::get_java(u1* x) {
-  return (u2) (x[0]<<8 | x[1]);
+    return (u2) (x[0]<<8 | x[1]);
 }
 
 // Add a platform u2 to the array as a Big Endian u2
 void Endian::set_java(u1* p, u2 x) {
-  p[0] = (x >> 8) & 0xff;
-  p[1] = x & 0xff;
+    p[0] = (x >> 8) & 0xff;
+    p[1] = x & 0xff;
 }
 
 Endian* Endian::get_native_handler() {
-  return NativeEndian::get_native();
+    return NativeEndian::get_native();
 }
--- a/jdk/src/java.base/share/native/libjimage/endian.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/endian.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,11 +4,13 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef LIBJIMAGE_ENDIAN_HPP
@@ -36,89 +37,89 @@
 // To retrieve a value using the approprate endian, use one of the overloaded
 // calls to get. To set a value, then use one of the overloaded set calls.
 // Ex.
-//      s4 value; // Imported value;
-//      ...
-//      Endian* endian = Endian::get_handler(true);  // Use big endian
-//      s4 corrected = endian->get(value);
-//      endian->set(value, 1);
+//          s4 value; // Imported value;
+//          ...
+//          Endian* endian = Endian::get_handler(true);  // Use big endian
+//          s4 corrected = endian->get(value);
+//          endian->set(value, 1);
 //
 class Endian {
 public:
-  virtual u2 get(u2 x) = 0;
-  virtual u4 get(u4 x) = 0;
-  virtual u8 get(u8 x) = 0;
-  virtual s2 get(s2 x) = 0;
-  virtual s4 get(s4 x) = 0;
-  virtual s8 get(s8 x) = 0;
+    virtual u2 get(u2 x) = 0;
+    virtual u4 get(u4 x) = 0;
+    virtual u8 get(u8 x) = 0;
+    virtual s2 get(s2 x) = 0;
+    virtual s4 get(s4 x) = 0;
+    virtual s8 get(s8 x) = 0;
 
-  virtual void set(u2& x, u2 y) = 0;
-  virtual void set(u4& x, u4 y) = 0;
-  virtual void set(u8& x, u8 y) = 0;
-  virtual void set(s2& x, s2 y) = 0;
-  virtual void set(s4& x, s4 y) = 0;
-  virtual void set(s8& x, s8 y) = 0;
+    virtual void set(u2& x, u2 y) = 0;
+    virtual void set(u4& x, u4 y) = 0;
+    virtual void set(u8& x, u8 y) = 0;
+    virtual void set(s2& x, s2 y) = 0;
+    virtual void set(s4& x, s4 y) = 0;
+    virtual void set(s8& x, s8 y) = 0;
 
-  // Quick little endian test.
-  static bool is_little_endian() {  u4 x = 1; return *(u1 *)&x != 0; }
+    // Quick little endian test.
+    static bool is_little_endian() { u4 x = 1; return *(u1 *)&x != 0; }
 
-  // Quick big endian test.
-  static bool is_big_endian() { return !is_little_endian(); }
+    // Quick big endian test.
+    static bool is_big_endian() { return !is_little_endian(); }
 
-  // Select an appropriate endian handler.
-  static Endian* get_handler(bool big_endian);
+    // Select an appropriate endian handler.
+    static Endian* get_handler(bool big_endian);
 
-  // Return the native endian handler.
-  static Endian* get_native_handler();
+    // Return the native endian handler.
+    static Endian* get_native_handler();
 
-  // get platform u2 from Java Big endian
-  static u2 get_java(u1* x);
-  // set platform u2 to Java Big endian
-  static void set_java(u1* p, u2 x);
+    // get platform u2 from Java Big endian
+    static u2 get_java(u1* x);
+    // set platform u2 to Java Big endian
+    static void set_java(u1* p, u2 x);
 };
 
 // Normal endian handling.
 class NativeEndian : public Endian {
 private:
-  static NativeEndian _native;
+    static NativeEndian _native;
 
 public:
-  u2 get(u2 x);
-  u4 get(u4 x);
-  u8 get(u8 x);
-  s2 get(s2 x);
-  s4 get(s4 x);
-  s8 get(s8 x);
+    u2 get(u2 x);
+    u4 get(u4 x);
+    u8 get(u8 x);
+    s2 get(s2 x);
+    s4 get(s4 x);
+    s8 get(s8 x);
 
-  void set(u2& x, u2 y);
-  void set(u4& x, u4 y);
-  void set(u8& x, u8 y);
-  void set(s2& x, s2 y);
-  void set(s4& x, s4 y);
-  void set(s8& x, s8 y);
+    void set(u2& x, u2 y);
+    void set(u4& x, u4 y);
+    void set(u8& x, u8 y);
+    void set(s2& x, s2 y);
+    void set(s4& x, s4 y);
+    void set(s8& x, s8 y);
 
-  static Endian* get_native() { return &_native; }
+    static Endian* get_native() { return &_native; }
 };
 
 // Swapping endian handling.
 class SwappingEndian : public Endian {
 private:
-  static SwappingEndian _swapping;
+    static SwappingEndian _swapping;
 
 public:
-  u2 get(u2 x);
-  u4 get(u4 x);
-  u8 get(u8 x);
-  s2 get(s2 x);
-  s4 get(s4 x);
-  s8 get(s8 x);
+    u2 get(u2 x);
+    u4 get(u4 x);
+    u8 get(u8 x);
+    s2 get(s2 x);
+    s4 get(s4 x);
+    s8 get(s8 x);
 
-  void set(u2& x, u2 y);
-  void set(u4& x, u4 y);
-  void set(u8& x, u8 y);
-  void set(s2& x, s2 y);
-  void set(s4& x, s4 y);
-  void set(s8& x, s8 y);
+    void set(u2& x, u2 y);
+    void set(u4& x, u4 y);
+    void set(u8& x, u8 y);
+    void set(s2& x, s2 y);
+    void set(s4& x, s4 y);
+    void set(s8& x, s8 y);
 
-  static Endian* get_swapping() { return &_swapping; }
+    static Endian* get_swapping() { return &_swapping; }
 };
 #endif // LIBJIMAGE_ENDIAN_HPP
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,11 +4,13 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,10 +21,8 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
-
 #include "jni.h"
 #include "imageDecompressor.hpp"
 #include "endian.hpp"
@@ -32,16 +32,17 @@
 #include <dlfcn.h>
 #endif
 
-typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
-static ZipInflateFully_t ZipInflateFully    = NULL;
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen,
+                                              void *outBuf, jlong outLen, char **pmsg);
+static ZipInflateFully_t ZipInflateFully        = NULL;
 
 #ifndef WIN32
-  #define JNI_LIB_PREFIX "lib"
-  #ifdef __APPLE__
-    #define JNI_LIB_SUFFIX ".dylib"
-  #else
-    #define JNI_LIB_SUFFIX ".so"
-  #endif
+    #define JNI_LIB_PREFIX "lib"
+    #ifdef __APPLE__
+        #define JNI_LIB_SUFFIX ".dylib"
+    #else
+        #define JNI_LIB_SUFFIX ".so"
+    #endif
 #endif
 
 /**
@@ -50,21 +51,21 @@
  * @return the address of the entry point or NULL
  */
 static void* findEntry(const char* name) {
-  void *addr = NULL;
+    void *addr = NULL;
 #ifdef WIN32
-  HMODULE handle = GetModuleHandle("zip.dll");
-  if (handle == NULL) {
-    return NULL;
-  }
-  addr = (void*) GetProcAddress(handle, name);
-  return addr;
+    HMODULE handle = GetModuleHandle("zip.dll");
+    if (handle == NULL) {
+        return NULL;
+    }
+    addr = (void*) GetProcAddress(handle, name);
+    return addr;
 #else
-  addr = dlopen(JNI_LIB_PREFIX "zip" JNI_LIB_SUFFIX, RTLD_GLOBAL|RTLD_LAZY);
-  if (addr == NULL) {
-    return NULL;
-  }
-  addr = dlsym(addr, name);
-  return addr;
+    addr = dlopen(JNI_LIB_PREFIX "zip" JNI_LIB_SUFFIX, RTLD_GLOBAL|RTLD_LAZY);
+    if (addr == NULL) {
+        return NULL;
+    }
+    addr = dlsym(addr, name);
+    return addr;
 #endif
 }
 
@@ -74,87 +75,87 @@
 int ImageDecompressor::_decompressors_num = 0;
 ImageDecompressor** ImageDecompressor::_decompressors = NULL;
 void ImageDecompressor::image_decompressor_init() {
-  if (_decompressors == NULL) {
-    ZipInflateFully = (ZipInflateFully_t) findEntry("ZIP_InflateFully");
-   assert(ZipInflateFully != NULL && "ZIP decompressor not found.");
-    _decompressors_num = 2;
-    _decompressors = new ImageDecompressor*[_decompressors_num];
-    _decompressors[0] = new ZipDecompressor("zip");
-    _decompressors[1] = new SharedStringDecompressor("compact-cp");
-  }
+    if (_decompressors == NULL) {
+        ZipInflateFully = (ZipInflateFully_t) findEntry("ZIP_InflateFully");
+     assert(ZipInflateFully != NULL && "ZIP decompressor not found.");
+        _decompressors_num = 2;
+        _decompressors = new ImageDecompressor*[_decompressors_num];
+        _decompressors[0] = new ZipDecompressor("zip");
+        _decompressors[1] = new SharedStringDecompressor("compact-cp");
+    }
 }
 
 void ImageDecompressor::image_decompressor_close() {
-  delete _decompressors;
+    delete _decompressors;
 }
 
 /*
  * Locate decompressor.
  */
 ImageDecompressor* ImageDecompressor::get_decompressor(const char * decompressor_name) {
-  image_decompressor_init();
-  for (int i = 0; i < _decompressors_num; i++) {
-    ImageDecompressor* decompressor = _decompressors[i];
-    assert(decompressor != NULL && "Decompressors not initialized.");
-    if (strcmp(decompressor->get_name(), decompressor_name) == 0) {
-      return decompressor;
+    image_decompressor_init();
+    for (int i = 0; i < _decompressors_num; i++) {
+        ImageDecompressor* decompressor = _decompressors[i];
+        assert(decompressor != NULL && "Decompressors not initialized.");
+        if (strcmp(decompressor->get_name(), decompressor_name) == 0) {
+            return decompressor;
+        }
     }
-  }
-  assert(false && "No decompressor found.");
-  return NULL;
+    assert(false && "No decompressor found.");
+    return NULL;
 }
 
 /*
  * Decompression entry point. Called from ImageFileReader::get_resource.
  */
 void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed,
-        u4 uncompressed_size, const ImageStrings* strings) {
-  bool has_header = false;
-  u1* decompressed_resource = compressed;
-  u1* compressed_resource = compressed;
+                u4 uncompressed_size, const ImageStrings* strings) {
+    bool has_header = false;
+    u1* decompressed_resource = compressed;
+    u1* compressed_resource = compressed;
 
-  // Resource could have been transformed by a stack of decompressors.
-  // Iterate and decompress resources until there is no more header.
-  do {
-    ResourceHeader _header;
-    memcpy(&_header, compressed_resource, sizeof (ResourceHeader));
-    has_header = _header._magic == ResourceHeader::resource_header_magic;
-    if (has_header) {
-      // decompressed_resource array contains the result of decompression
-      decompressed_resource = new u1[_header._uncompressed_size];
-      // Retrieve the decompressor name
-      const char* decompressor_name = strings->get(_header._decompressor_name_offset);
-      assert(decompressor_name && "image decompressor not found");
-      // Retrieve the decompressor instance
-      ImageDecompressor* decompressor = get_decompressor(decompressor_name);
-      assert(decompressor && "image decompressor not found");
-      u1* compressed_resource_base = compressed_resource;
-      compressed_resource += ResourceHeader::resource_header_length;
-      // Ask the decompressor to decompress the compressed content
-      decompressor->decompress_resource(compressed_resource, decompressed_resource,
-        &_header, strings);
-      if (compressed_resource_base != compressed) {
-        delete compressed_resource_base;
-      }
-      compressed_resource = decompressed_resource;
-    }
-  } while (has_header);
-  memcpy(uncompressed, decompressed_resource, uncompressed_size);
-  delete decompressed_resource;
+    // Resource could have been transformed by a stack of decompressors.
+    // Iterate and decompress resources until there is no more header.
+    do {
+        ResourceHeader _header;
+        memcpy(&_header, compressed_resource, sizeof (ResourceHeader));
+        has_header = _header._magic == ResourceHeader::resource_header_magic;
+        if (has_header) {
+            // decompressed_resource array contains the result of decompression
+            decompressed_resource = new u1[_header._uncompressed_size];
+            // Retrieve the decompressor name
+            const char* decompressor_name = strings->get(_header._decompressor_name_offset);
+            assert(decompressor_name && "image decompressor not found");
+            // Retrieve the decompressor instance
+            ImageDecompressor* decompressor = get_decompressor(decompressor_name);
+            assert(decompressor && "image decompressor not found");
+            u1* compressed_resource_base = compressed_resource;
+            compressed_resource += ResourceHeader::resource_header_length;
+            // Ask the decompressor to decompress the compressed content
+            decompressor->decompress_resource(compressed_resource, decompressed_resource,
+                &_header, strings);
+            if (compressed_resource_base != compressed) {
+                delete compressed_resource_base;
+            }
+            compressed_resource = decompressed_resource;
+        }
+    } while (has_header);
+    memcpy(uncompressed, decompressed_resource, uncompressed_size);
+    delete decompressed_resource;
 }
 
 // Zip decompressor
 
 void ZipDecompressor::decompress_resource(u1* data, u1* uncompressed,
-        ResourceHeader* header, const ImageStrings* strings) {
-  char* msg = NULL;
-  jboolean res = ZipDecompressor::decompress(data, header->_size, uncompressed,
-          header->_uncompressed_size, &msg);
-  assert(res && "decompression failed");
+                ResourceHeader* header, const ImageStrings* strings) {
+    char* msg = NULL;
+    jboolean res = ZipDecompressor::decompress(data, header->_size, uncompressed,
+                    header->_uncompressed_size, &msg);
+    assert(res && "decompression failed");
 }
 
 jboolean ZipDecompressor::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
-  return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+    return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
 }
 
 // END Zip Decompressor
@@ -163,141 +164,143 @@
 
 // array index is the constant pool tag. value is size.
 // eg: array[5]  = 8; means size of long is 8 bytes.
-const u1 SharedStringDecompressor::sizes[] = {0, 0, 0, 4, 4, 8, 8, 2, 2, 4, 4, 4, 4, 0, 0, 3, 2, 0, 4};
+const u1 SharedStringDecompressor::sizes[] = {
+    0, 0, 0, 4, 4, 8, 8, 2, 2, 4, 4, 4, 4, 0, 0, 3, 2, 0, 4
+};
 /**
  * Recreate the class by reconstructing the constant pool.
  */
 void SharedStringDecompressor::decompress_resource(u1* data,
-        u1* uncompressed_resource,
-        ResourceHeader* header, const ImageStrings* strings) {
-  u1* uncompressed_base = uncompressed_resource;
-  u1* data_base = data;
-  int header_size = 8; // magic + major + minor
-  memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
-  uncompressed_resource += header_size + 2;
-  data += header_size;
-  u2 cp_count = Endian::get_java(data);
-  data += 2;
-  for (int i = 1; i < cp_count; i++) {
-    u1 tag = *data;
-    data += 1;
-    switch (tag) {
+                u1* uncompressed_resource,
+                ResourceHeader* header, const ImageStrings* strings) {
+    u1* uncompressed_base = uncompressed_resource;
+    u1* data_base = data;
+    int header_size = 8; // magic + major + minor
+    memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
+    uncompressed_resource += header_size + 2;
+    data += header_size;
+    u2 cp_count = Endian::get_java(data);
+    data += 2;
+    for (int i = 1; i < cp_count; i++) {
+        u1 tag = *data;
+        data += 1;
+        switch (tag) {
 
-      case externalized_string:
-      { // String in Strings table
-        *uncompressed_resource = 1;
-        uncompressed_resource += 1;
-        int i = decompress_int(data);
-        const char * string = strings->get(i);
-        int str_length = (int) strlen(string);
-        Endian::set_java(uncompressed_resource, str_length);
-        uncompressed_resource += 2;
-        memcpy(uncompressed_resource, string, str_length);
-        uncompressed_resource += str_length;
-        break;
-      }
-      // Descriptor String has been split and types added to Strings table
-      case externalized_string_descriptor:
-      {
-        *uncompressed_resource = 1;
-        uncompressed_resource += 1;
-        int descriptor_index = decompress_int(data);
-        int indexes_length = decompress_int(data);
-        u1* length_address = uncompressed_resource;
-        uncompressed_resource += 2;
-        int desc_length = 0;
-        const char * desc_string = strings->get(descriptor_index);
-        if (indexes_length > 0) {
-          u1* indexes_base = data;
-          data += indexes_length;
-          char c = *desc_string;
-          do {
-            *uncompressed_resource = c;
-            uncompressed_resource++;
-            desc_length += 1;
-            /*
-             * Every L character is the marker we are looking at in order
-             * to reconstruct the descriptor. Each time an L is found, then
-             * we retrieve the couple token/token at the current index and
-             * add it to the descriptor.
-             * "(L;I)V" and "java/lang","String" couple of tokens,
-             * this becomes "(Ljava/lang/String;I)V"
-             */
-            if (c == 'L') {
-              int index = decompress_int(indexes_base);
-              const char * pkg = strings->get(index);
-              int str_length = (int) strlen(pkg);
-              // the case where we have a package.
-              // reconstruct the type full name
-              if (str_length > 0) {
-                int len = str_length + 1;
-                char* fullpkg = new char[len];
-                char* pkg_base = fullpkg;
-                memcpy(fullpkg, pkg, str_length);
-                fullpkg += str_length;
-                *fullpkg = '/';
-                memcpy(uncompressed_resource, pkg_base, len);
+            case externalized_string:
+            { // String in Strings table
+                *uncompressed_resource = 1;
+                uncompressed_resource += 1;
+                int i = decompress_int(data);
+                const char * string = strings->get(i);
+                int str_length = (int) strlen(string);
+                Endian::set_java(uncompressed_resource, str_length);
+                uncompressed_resource += 2;
+                memcpy(uncompressed_resource, string, str_length);
+                uncompressed_resource += str_length;
+                break;
+            }
+            // Descriptor String has been split and types added to Strings table
+            case externalized_string_descriptor:
+            {
+                *uncompressed_resource = 1;
+                uncompressed_resource += 1;
+                int descriptor_index = decompress_int(data);
+                int indexes_length = decompress_int(data);
+                u1* length_address = uncompressed_resource;
+                uncompressed_resource += 2;
+                int desc_length = 0;
+                const char * desc_string = strings->get(descriptor_index);
+                if (indexes_length > 0) {
+                    u1* indexes_base = data;
+                    data += indexes_length;
+                    char c = *desc_string;
+                    do {
+                        *uncompressed_resource = c;
+                        uncompressed_resource++;
+                        desc_length += 1;
+                        /*
+                         * Every L character is the marker we are looking at in order
+                         * to reconstruct the descriptor. Each time an L is found, then
+                         * we retrieve the couple token/token at the current index and
+                         * add it to the descriptor.
+                         * "(L;I)V" and "java/lang","String" couple of tokens,
+                         * this becomes "(Ljava/lang/String;I)V"
+                         */
+                        if (c == 'L') {
+                            int index = decompress_int(indexes_base);
+                            const char * pkg = strings->get(index);
+                            int str_length = (int) strlen(pkg);
+                            // the case where we have a package.
+                            // reconstruct the type full name
+                            if (str_length > 0) {
+                                int len = str_length + 1;
+                                char* fullpkg = new char[len];
+                                char* pkg_base = fullpkg;
+                                memcpy(fullpkg, pkg, str_length);
+                                fullpkg += str_length;
+                                *fullpkg = '/';
+                                memcpy(uncompressed_resource, pkg_base, len);
+                                uncompressed_resource += len;
+                                delete pkg_base;
+                                desc_length += len;
+                            } else { // Empty package
+                                // Nothing to do.
+                            }
+                            int classIndex = decompress_int(indexes_base);
+                            const char * clazz = strings->get(classIndex);
+                            int clazz_length = (int) strlen(clazz);
+                            memcpy(uncompressed_resource, clazz, clazz_length);
+                            uncompressed_resource += clazz_length;
+                            desc_length += clazz_length;
+                        }
+                        desc_string += 1;
+                        c = *desc_string;
+                    } while (c != '\0');
+                } else {
+                        desc_length = (int) strlen(desc_string);
+                        memcpy(uncompressed_resource, desc_string, desc_length);
+                        uncompressed_resource += desc_length;
+                }
+                Endian::set_java(length_address, desc_length);
+                break;
+            }
+
+            case constant_utf8:
+            { // UTF-8
+                *uncompressed_resource = tag;
+                uncompressed_resource += 1;
+                u2 str_length = Endian::get_java(data);
+                int len = str_length + 2;
+                memcpy(uncompressed_resource, data, len);
                 uncompressed_resource += len;
-                delete pkg_base;
-                desc_length += len;
-              } else { // Empty package
-                // Nothing to do.
-              }
-              int classIndex = decompress_int(indexes_base);
-              const char * clazz = strings->get(classIndex);
-              int clazz_length = (int) strlen(clazz);
-              memcpy(uncompressed_resource, clazz, clazz_length);
-              uncompressed_resource += clazz_length;
-              desc_length += clazz_length;
+                data += len;
+                break;
             }
-            desc_string += 1;
-            c = *desc_string;
-          } while (c != '\0');
-        } else {
-            desc_length = (int) strlen(desc_string);
-            memcpy(uncompressed_resource, desc_string, desc_length);
-            uncompressed_resource += desc_length;
-        }
-        Endian::set_java(length_address, desc_length);
-        break;
-      }
 
-      case constant_utf8:
-      { // UTF-8
-        *uncompressed_resource = tag;
-        uncompressed_resource += 1;
-        u2 str_length = Endian::get_java(data);
-        int len = str_length + 2;
-        memcpy(uncompressed_resource, data, len);
-        uncompressed_resource += len;
-        data += len;
-        break;
-      }
-
-      case constant_long:
-      case constant_double:
-      {
-        i++;
-      }
-      default:
-      {
-        *uncompressed_resource = tag;
-        uncompressed_resource += 1;
-        int size = sizes[tag];
-        memcpy(uncompressed_resource, data, size);
-        uncompressed_resource += size;
-        data += size;
-      }
+            case constant_long:
+            case constant_double:
+            {
+                i++;
+            }
+            default:
+            {
+                *uncompressed_resource = tag;
+                uncompressed_resource += 1;
+                int size = sizes[tag];
+                memcpy(uncompressed_resource, data, size);
+                uncompressed_resource += size;
+                data += size;
+            }
+        }
     }
-  }
-  u4 remain = header->_size - (int)(data - data_base);
-  u4 computed = (u4)(uncompressed_resource - uncompressed_base) + remain;
-  if (header->_uncompressed_size != computed)
-    printf("Failure, expecting %d but getting %d\n", header->_uncompressed_size,
-        computed);
-  assert(header->_uncompressed_size == computed &&
-        "Constant Pool reconstruction failed");
-  memcpy(uncompressed_resource, data, remain);
+    u4 remain = header->_size - (int)(data - data_base);
+    u4 computed = (u4)(uncompressed_resource - uncompressed_base) + remain;
+    if (header->_uncompressed_size != computed)
+        printf("Failure, expecting %d but getting %d\n", header->_uncompressed_size,
+                computed);
+    assert(header->_uncompressed_size == computed &&
+                "Constant Pool reconstruction failed");
+    memcpy(uncompressed_resource, data, remain);
 }
 
 /*
@@ -308,25 +311,25 @@
  * Example of compression: 1 is compressed on 1 byte: 10100001
  */
 int SharedStringDecompressor::decompress_int(unsigned char*& value) {
-  int len = 4;
-  int res = 0;
-  char b1 = *value;
-  if (is_compressed((signed char)b1)) { // compressed
-    len = get_compressed_length(b1);
-    char clearedValue = b1 &= 0x1F;
-    if (len == 1) {
-      res = clearedValue;
+    int len = 4;
+    int res = 0;
+    char b1 = *value;
+    if (is_compressed((signed char)b1)) { // compressed
+        len = get_compressed_length(b1);
+        char clearedValue = b1 &= 0x1F;
+        if (len == 1) {
+            res = clearedValue;
+        } else {
+            res = (clearedValue & 0xFF) << 8 * (len - 1);
+            for (int i = 1; i < len; i++) {
+                res |= (value[i]&0xFF) << 8 * (len - i - 1);
+            }
+        }
     } else {
-      res = (clearedValue & 0xFF) << 8 * (len - 1);
-      for (int i = 1; i < len; i++) {
-        res |= (value[i]&0xFF) << 8 * (len - i - 1);
-      }
+        res = (value[0] & 0xFF) << 24 | (value[1]&0xFF) << 16 |
+                    (value[2]&0xFF) << 8 | (value[3]&0xFF);
     }
-  } else {
-    res = (value[0] & 0xFF) << 24 | (value[1]&0xFF) << 16 |
-          (value[2]&0xFF) << 8 | (value[3]&0xFF);
-  }
-  value += len;
-  return res;
+    value += len;
+    return res;
 }
 // END Shared String decompressor
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,11 +4,13 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef LIBJIMAGE_IMAGEDECOMPRESSOR_HPP
@@ -47,16 +48,16 @@
  *   have been used to compress the resource.
  */
 struct ResourceHeader {
-  /* Length of header, needed to retrieve content offset */
-  static const u1 resource_header_length = 21;
-  /* magic bytes that identifies a compressed resource header*/
-  static const u4 resource_header_magic = 0xCAFEFAFA;
-  u4 _magic; // Resource header
-  u4 _size;  // Resource size
-  u4 _uncompressed_size;  // Expected uncompressed size
-  u4 _decompressor_name_offset;  // Strings table decompressor offset
-  u4 _decompressor_config_offset; // Strings table config offset
-  u1 _is_terminal; // Last decompressor 1, otherwise 0.
+    /* Length of header, needed to retrieve content offset */
+    static const u1 resource_header_length = 21;
+    /* magic bytes that identifies a compressed resource header*/
+    static const u4 resource_header_magic = 0xCAFEFAFA;
+    u4 _magic; // Resource header
+    u4 _size;    // Resource size
+    u4 _uncompressed_size;  // Expected uncompressed size
+    u4 _decompressor_name_offset;    // Strings table decompressor offset
+    u4 _decompressor_config_offset; // Strings table config offset
+    u1 _is_terminal; // Last decompressor 1, otherwise 0.
 };
 
 /*
@@ -77,36 +78,36 @@
 class ImageDecompressor {
 
 private:
-  const char* _name;
+    const char* _name;
 
-  /*
-   * Array of concrete decompressors. This array is used to retrieve the decompressor
-   * that can handle resource decompression.
-   */
-  static ImageDecompressor** _decompressors;
-  /**
-   * Num of decompressors
-   */
-  static int _decompressors_num;
-  /*
-   * Identifier of a decompressor. This name is the identification key to retrieve
-   * decompressor from a resource header.
-   */
-  inline const char* get_name() const { return _name; }
+    /*
+     * Array of concrete decompressors. This array is used to retrieve the decompressor
+     * that can handle resource decompression.
+     */
+    static ImageDecompressor** _decompressors;
+    /**
+     * Num of decompressors
+     */
+    static int _decompressors_num;
+    /*
+     * Identifier of a decompressor. This name is the identification key to retrieve
+     * decompressor from a resource header.
+     */
+    inline const char* get_name() const { return _name; }
 
 
 protected:
-  ImageDecompressor(const char* name) : _name(name) {
-  }
-  virtual void decompress_resource(u1* data, u1* uncompressed,
-    ResourceHeader* header, const ImageStrings* strings) = 0;
+    ImageDecompressor(const char* name) : _name(name) {
+    }
+    virtual void decompress_resource(u1* data, u1* uncompressed,
+        ResourceHeader* header, const ImageStrings* strings) = 0;
 
 public:
-  static void image_decompressor_init();
-  static void image_decompressor_close();
-  static ImageDecompressor* get_decompressor(const char * decompressor_name) ;
-  static void decompress_resource(u1* compressed, u1* uncompressed,
-    u4 uncompressed_size, const ImageStrings* strings);
+    static void image_decompressor_init();
+    static void image_decompressor_close();
+    static ImageDecompressor* get_decompressor(const char * decompressor_name) ;
+    static void decompress_resource(u1* compressed, u1* uncompressed,
+        u4 uncompressed_size, const ImageStrings* strings);
 };
 
 /**
@@ -114,10 +115,10 @@
  */
 class ZipDecompressor : public ImageDecompressor {
 public:
-  ZipDecompressor(const char* sym) : ImageDecompressor(sym) { }
-  void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
-    const ImageStrings* strings);
-  static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
+    ZipDecompressor(const char* sym) : ImageDecompressor(sym) { }
+    void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
+        const ImageStrings* strings);
+    static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
 };
 
 /*
@@ -131,32 +132,34 @@
  */
 class SharedStringDecompressor : public ImageDecompressor {
 private:
-  // the constant pool tag for UTF8 string located in strings table
-  static const int externalized_string = 23;
-  // the constant pool tag for UTF8 descriptors string located in strings table
-  static const int externalized_string_descriptor = 25;
-  // the constant pool tag for UTF8
-  static const int constant_utf8 = 1;
-  // the constant pool tag for long
-  static const int constant_long = 5;
-  // the constant pool tag for double
-  static const int constant_double = 6;
-  // array index is the constant pool tag. value is size.
-  // eg: array[5]  = 8; means size of long is 8 bytes.
-  static const u1 sizes[];
-  // bit 5 and 6 are used to store the length of the compressed integer.
-  // size can be 1 (01), 2 (10), 3 (11).
-  // 0x60 ==> 0110000
-  static const int compressed_index_size_mask = 0x60;
-  /*
-   * mask the length bits (5 and 6) and move to the right 5 bits.
-   */
-  inline static int get_compressed_length(char c) { return ((char) (c & compressed_index_size_mask) >> 5); }
-  inline static bool is_compressed(signed char b1) { return b1 < 0; }
-  static int decompress_int(unsigned char*& value);
+    // the constant pool tag for UTF8 string located in strings table
+    static const int externalized_string = 23;
+    // the constant pool tag for UTF8 descriptors string located in strings table
+    static const int externalized_string_descriptor = 25;
+    // the constant pool tag for UTF8
+    static const int constant_utf8 = 1;
+    // the constant pool tag for long
+    static const int constant_long = 5;
+    // the constant pool tag for double
+    static const int constant_double = 6;
+    // array index is the constant pool tag. value is size.
+    // eg: array[5]  = 8; means size of long is 8 bytes.
+    static const u1 sizes[];
+    // bit 5 and 6 are used to store the length of the compressed integer.
+    // size can be 1 (01), 2 (10), 3 (11).
+    // 0x60 ==> 0110000
+    static const int compressed_index_size_mask = 0x60;
+    /*
+     * mask the length bits (5 and 6) and move to the right 5 bits.
+     */
+    inline static int get_compressed_length(char c) {
+        return ((char) (c & compressed_index_size_mask) >> 5);
+    }
+    inline static bool is_compressed(signed char b1) { return b1 < 0; }
+    static int decompress_int(unsigned char*& value);
 public:
-  SharedStringDecompressor(const char* sym) : ImageDecompressor(sym){}
-  void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
-  const ImageStrings* strings);
+    SharedStringDecompressor(const char* sym) : ImageDecompressor(sym){}
+    void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
+    const ImageStrings* strings);
 };
 #endif // LIBJIMAGE_IMAGEDECOMPRESSOR_HPP
--- a/jdk/src/java.base/share/native/libjimage/imageFile.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/imageFile.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,11 +4,13 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include <assert.h>
@@ -50,268 +51,268 @@
 
 // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
 s4 ImageStrings::hash_code(const char* string, s4 seed) {
-  // Access bytes as unsigned.
-  u1* bytes = (u1*)string;
-  // Compute hash code.
-  for (u1 byte = *bytes++; byte; byte = *bytes++) {
-    seed = (seed * HASH_MULTIPLIER) ^ byte;
-  }
-  // Ensure the result is not signed.
-  return seed & 0x7FFFFFFF;
+    // Access bytes as unsigned.
+    u1* bytes = (u1*)string;
+    // Compute hash code.
+    for (u1 byte = *bytes++; byte; byte = *bytes++) {
+        seed = (seed * HASH_MULTIPLIER) ^ byte;
+    }
+    // Ensure the result is not signed.
+    return seed & 0x7FFFFFFF;
 }
 
 // Match up a string in a perfect hash table.
 // Returns the index where the name should be.
 // Result still needs validation for precise match (false positive.)
 s4 ImageStrings::find(Endian* endian, const char* name, s4* redirect, u4 length) {
-  // If the table is empty, then short cut.
-  if (!redirect || !length) {
+    // If the table is empty, then short cut.
+    if (!redirect || !length) {
+        return NOT_FOUND;
+    }
+    // Compute the basic perfect hash for name.
+    s4 hash_code = ImageStrings::hash_code(name);
+    // Modulo table size.
+    s4 index = hash_code % length;
+    // Get redirect entry.
+    //   value == 0 then not found
+    //   value < 0 then -1 - value is true index
+    //   value > 0 then value is seed for recomputing hash.
+    s4 value = endian->get(redirect[index]);
+    // if recompute is required.
+    if (value > 0 ) {
+        // Entry collision value, need to recompute hash.
+        hash_code = ImageStrings::hash_code(name, value);
+        // Modulo table size.
+        return hash_code % length;
+    } else if (value < 0) {
+        // Compute direct index.
+        return -1 - value;
+    }
+    // No entry found.
     return NOT_FOUND;
-  }
-  // Compute the basic perfect hash for name.
-  s4 hash_code = ImageStrings::hash_code(name);
-  // Modulo table size.
-  s4 index = hash_code % length;
-  // Get redirect entry.
-  //   value == 0 then not found
-  //   value < 0 then -1 - value is true index
-  //   value > 0 then value is seed for recomputing hash.
-  s4 value = endian->get(redirect[index]);
-  // if recompute is required.
-  if (value > 0 ) {
-    // Entry collision value, need to recompute hash.
-    hash_code = ImageStrings::hash_code(name, value);
-    // Modulo table size.
-    return hash_code % length;
-  } else if (value < 0) {
-    // Compute direct index.
-    return -1 - value;
-  }
-  // No entry found.
-  return NOT_FOUND;
 }
 
 // Test to see if UTF-8 string begins with the start UTF-8 string.  If so,
 // return non-NULL address of remaining portion of string.  Otherwise, return
-// NULL.  Used to test sections of a path without copying from image string
+// NULL.    Used to test sections of a path without copying from image string
 // table.
 const char* ImageStrings::starts_with(const char* string, const char* start) {
-  char ch1, ch2;
-  // Match up the strings the best we can.
-  while ((ch1 = *string) && (ch2 = *start)) {
-    if (ch1 != ch2) {
-      // Mismatch, return NULL.
-      return NULL;
+    char ch1, ch2;
+    // Match up the strings the best we can.
+    while ((ch1 = *string) && (ch2 = *start)) {
+        if (ch1 != ch2) {
+            // Mismatch, return NULL.
+            return NULL;
+        }
+        // Next characters.
+        string++, start++;
     }
-    // Next characters.
-    string++, start++;
-  }
-  // Return remainder of string.
-  return string;
+    // Return remainder of string.
+    return string;
 }
 
 // Inflates the attribute stream into individual values stored in the long
 // array _attributes. This allows an attribute value to be quickly accessed by
 // direct indexing.  Unspecified values default to zero (from constructor.)
 void ImageLocation::set_data(u1* data) {
-  // Deflate the attribute stream into an array of attributes.
-  u1 byte;
-  // Repeat until end header is found.
-  while ((byte = *data)) {
-    // Extract kind from header byte.
-    u1 kind = attribute_kind(byte);
-    assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
-    // Extract length of data (in bytes).
-    u1 n = attribute_length(byte);
-    // Read value (most significant first.)
-    _attributes[kind] = attribute_value(data + 1, n);
-    // Position to next attribute by skipping attribute header and data bytes.
-    data += n + 1;
-  }
+    // Deflate the attribute stream into an array of attributes.
+    u1 byte;
+    // Repeat until end header is found.
+    while ((byte = *data)) {
+        // Extract kind from header byte.
+        u1 kind = attribute_kind(byte);
+        assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
+        // Extract length of data (in bytes).
+        u1 n = attribute_length(byte);
+        // Read value (most significant first.)
+        _attributes[kind] = attribute_value(data + 1, n);
+        // Position to next attribute by skipping attribute header and data bytes.
+        data += n + 1;
+    }
 }
 
 // Zero all attribute values.
 void ImageLocation::clear_data() {
-  // Set defaults to zero.
-  memset(_attributes, 0, sizeof(_attributes));
+    // Set defaults to zero.
+    memset(_attributes, 0, sizeof(_attributes));
 }
 
 // ImageModuleData constructor maps out sub-tables for faster access.
 ImageModuleData::ImageModuleData(const ImageFileReader* image_file,
-        const char* module_data_name) :
-    _image_file(image_file),
-    _endian(image_file->endian()),
-    _strings(image_file->get_strings()) {
-  // Retrieve the resource containing the module data for the image file.
-  ImageLocation location;
-  bool found = image_file->find_location(module_data_name, location);
-  if (found) {
-    u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
-    _data = new u1[(size_t)data_size];
-    _image_file->get_resource(location, _data);
-    // Map out the header.
-    _header = (Header*)_data;
-    // Get the package to module entry count.
-    u4 ptm_count = _header->ptm_count(_endian);
-    // Get the module to package entry count.
-    u4 mtp_count = _header->mtp_count(_endian);
-    // Compute the offset of the package to module perfect hash redirect.
-    u4 ptm_redirect_offset = sizeof(Header);
-    // Compute the offset of the package to module data.
-    u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4);
-    // Compute the offset of the module to package perfect hash redirect.
-    u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData);
-    // Compute the offset of the module to package data.
-    u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4);
-    // Compute the offset of the module to package tables.
-    u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData);
-    // Compute the address of the package to module perfect hash redirect.
-    _ptm_redirect = (s4*)(_data + ptm_redirect_offset);
-    // Compute the address of the package to module data.
-    _ptm_data = (PTMData*)(_data + ptm_data_offset);
-    // Compute the address of the module to package perfect hash redirect.
-    _mtp_redirect = (s4*)(_data + mtp_redirect_offset);
-    // Compute the address of the module to package data.
-    _mtp_data = (MTPData*)(_data + mtp_data_offset);
-    // Compute the address of the module to package tables.
-    _mtp_packages = (s4*)(_data + mtp_packages_offset);
-  } else {
-    // No module data present.
-    _data = NULL;
-    _header = NULL;
-    _ptm_redirect = NULL;
-    _ptm_data = NULL;
-    _mtp_redirect = NULL;
-    _mtp_data = NULL;
-    _mtp_packages = NULL;
-  }
+                const char* module_data_name) :
+        _image_file(image_file),
+        _endian(image_file->endian()),
+        _strings(image_file->get_strings()) {
+    // Retrieve the resource containing the module data for the image file.
+    ImageLocation location;
+    bool found = image_file->find_location(module_data_name, location);
+    if (found) {
+        u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+        _data = new u1[(size_t)data_size];
+        _image_file->get_resource(location, _data);
+        // Map out the header.
+        _header = (Header*)_data;
+        // Get the package to module entry count.
+        u4 ptm_count = _header->ptm_count(_endian);
+        // Get the module to package entry count.
+        u4 mtp_count = _header->mtp_count(_endian);
+        // Compute the offset of the package to module perfect hash redirect.
+        u4 ptm_redirect_offset = sizeof(Header);
+        // Compute the offset of the package to module data.
+        u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4);
+        // Compute the offset of the module to package perfect hash redirect.
+        u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData);
+        // Compute the offset of the module to package data.
+        u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4);
+        // Compute the offset of the module to package tables.
+        u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData);
+        // Compute the address of the package to module perfect hash redirect.
+        _ptm_redirect = (s4*)(_data + ptm_redirect_offset);
+        // Compute the address of the package to module data.
+        _ptm_data = (PTMData*)(_data + ptm_data_offset);
+        // Compute the address of the module to package perfect hash redirect.
+        _mtp_redirect = (s4*)(_data + mtp_redirect_offset);
+        // Compute the address of the module to package data.
+        _mtp_data = (MTPData*)(_data + mtp_data_offset);
+        // Compute the address of the module to package tables.
+        _mtp_packages = (s4*)(_data + mtp_packages_offset);
+    } else {
+        // No module data present.
+        _data = NULL;
+        _header = NULL;
+        _ptm_redirect = NULL;
+        _ptm_data = NULL;
+        _mtp_redirect = NULL;
+        _mtp_data = NULL;
+        _mtp_packages = NULL;
+    }
 }
 
 // Release module data resource.
 ImageModuleData::~ImageModuleData() {
-  if (_data) {
-    delete _data;
-  }
+    if (_data) {
+        delete _data;
+    }
 }
 
 // Return the name of the module data resource.  Ex. "./lib/modules/file.jimage"
 // yields "file.jdata"
 void ImageModuleData::module_data_name(char* buffer, const char* image_file_name) {
-  // Locate the last slash in the file name path.
-  const char* slash = strrchr(image_file_name, FileSeparator);
-  // Trim the path to name and extension.
-  const char* name = slash ? slash + 1 : (char *)image_file_name;
-  // Locate the extension period.
-  const char* dot = strrchr(name, '.');
-  assert(dot && "missing extension on jimage name");
-  // Trim to only base name.
-  int length = (int)(dot - name);
-  strncpy(buffer, name, length);
-  buffer[length] = '\0';
-  // Append extension.
-  strcat(buffer, ".jdata");
+    // Locate the last slash in the file name path.
+    const char* slash = strrchr(image_file_name, FileSeparator);
+    // Trim the path to name and extension.
+    const char* name = slash ? slash + 1 : (char *)image_file_name;
+    // Locate the extension period.
+    const char* dot = strrchr(name, '.');
+    assert(dot && "missing extension on jimage name");
+    // Trim to only base name.
+    int length = (int)(dot - name);
+    strncpy(buffer, name, length);
+    buffer[length] = '\0';
+    // Append extension.
+    strcat(buffer, ".jdata");
 }
 
-// Return the module in which a package resides.  Returns NULL if not found.
+// Return the module in which a package resides.    Returns NULL if not found.
 const char* ImageModuleData::package_to_module(const char* package_name) {
-  // Test files may contain no module data.
-  if (_data != NULL) {
-    // Search the package to module table.
-    s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect,
-                                    _header->ptm_count(_endian));
-    // If entry is found.
-    if (index != ImageStrings::NOT_FOUND) {
-      // Retrieve the package to module entry.
-      PTMData* data = _ptm_data + index;
-      // Verify that it is the correct data.
-      if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) {
-        return NULL;
-      }
-      // Return the module name.
-      return get_string(data->module_name_offset(_endian));
+    // Test files may contain no module data.
+    if (_data != NULL) {
+        // Search the package to module table.
+        s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect,
+                                      _header->ptm_count(_endian));
+        // If entry is found.
+        if (index != ImageStrings::NOT_FOUND) {
+            // Retrieve the package to module entry.
+            PTMData* data = _ptm_data + index;
+            // Verify that it is the correct data.
+            if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) {
+                return NULL;
+            }
+            // Return the module name.
+            return get_string(data->module_name_offset(_endian));
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 // Returns all the package names in a module in a NULL terminated array.
 // Returns NULL if module not found.
 const char** ImageModuleData::module_to_packages(const char* module_name) {
-  // Test files may contain no module data.
-  if (_data != NULL) {
-    // Search the module to package table.
-    s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect,
-                                    _header->mtp_count(_endian));
-    // If entry is found.
-    if (index != ImageStrings::NOT_FOUND) {
-      // Retrieve the module to package entry.
-      MTPData* data = _mtp_data + index;
-      // Verify that it is the correct data.
-      if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) {
-        return NULL;
-      }
-      // Construct an array of all the package entries.
-      u4 count = data->package_count(_endian);
-      const char** packages = new const char*[count + 1];
-      s4 package_offset = data->package_offset(_endian);
-      for (u4 i = 0; i < count; i++) {
-        u4 package_name_offset = mtp_package(package_offset + i);
-        const char* package_name = get_string(package_name_offset);
-        packages[i] = package_name;
-      }
-      packages[count] = NULL;
-      return packages;
+    // Test files may contain no module data.
+    if (_data != NULL) {
+        // Search the module to package table.
+        s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect,
+                                      _header->mtp_count(_endian));
+        // If entry is found.
+        if (index != ImageStrings::NOT_FOUND) {
+            // Retrieve the module to package entry.
+            MTPData* data = _mtp_data + index;
+            // Verify that it is the correct data.
+            if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) {
+                return NULL;
+            }
+            // Construct an array of all the package entries.
+            u4 count = data->package_count(_endian);
+            const char** packages = new const char*[count + 1];
+            s4 package_offset = data->package_offset(_endian);
+            for (u4 i = 0; i < count; i++) {
+                u4 package_name_offset = mtp_package(package_offset + i);
+                const char* package_name = get_string(package_name_offset);
+                packages[i] = package_name;
+            }
+            packages[count] = NULL;
+            return packages;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 // Manage a table of open image files.  This table allows multiple access points
 // to share an open image.
 ImageFileReaderTable::ImageFileReaderTable() : _count(0), _max(_growth) {
-  _table = new ImageFileReader*[_max];
+    _table = new ImageFileReader*[_max];
 }
 
 ImageFileReaderTable::~ImageFileReaderTable() {
-  delete _table;
+    delete _table;
 }
 
 // Add a new image entry to the table.
 void ImageFileReaderTable::add(ImageFileReader* image) {
-  if (_count == _max) {
-    _max += _growth;
-    _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
-  }
-  _table[_count++] = image;
+    if (_count == _max) {
+        _max += _growth;
+        _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
+    }
+    _table[_count++] = image;
 }
 
 // Remove an image entry from the table.
 void ImageFileReaderTable::remove(ImageFileReader* image) {
-  s4 last = _count - 1;
-  for (s4 i = 0; _count; i++) {
-    if (_table[i] == image) {
-      if (i != last) {
-        _table[i] = _table[last];
-        _count = last;
-      }
-      break;
+    s4 last = _count - 1;
+    for (s4 i = 0; _count; i++) {
+        if (_table[i] == image) {
+            if (i != last) {
+                _table[i] = _table[last];
+                _count = last;
+            }
+            break;
+        }
     }
-  }
 
-  if (_count != 0 && _count == _max - _growth) {
-    _max -= _growth;
-    _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
-  }
+    if (_count != 0 && _count == _max - _growth) {
+        _max -= _growth;
+        _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
+    }
 }
 
 // Determine if image entry is in table.
 bool ImageFileReaderTable::contains(ImageFileReader* image) {
-  for (s4 i = 0; _count; i++) {
-    if (_table[i] == image) {
-      return true;
+    for (s4 i = 0; _count; i++) {
+        if (_table[i] == image) {
+            return true;
+        }
     }
-  }
-  return false;
+    return false;
 }
 
 // Table to manage multiple opens of an image file.
@@ -321,362 +322,362 @@
 
 // Open an image file, reuse structure if file already open.
 ImageFileReader* ImageFileReader::open(const char* name, bool big_endian) {
-  {
-    // Lock out _reader_table.
+    {
+        // Lock out _reader_table.
+        SimpleCriticalSectionLock cs(&_reader_table_lock);
+        // Search for an exist image file.
+        for (u4 i = 0; i < _reader_table.count(); i++) {
+            // Retrieve table entry.
+            ImageFileReader* reader = _reader_table.get(i);
+            // If name matches, then reuse (bump up use count.)
+            if (strcmp(reader->name(), name) == 0) {
+                reader->inc_use();
+                return reader;
+            }
+        }
+    } // Unlock the mutex
+
+    // Need a new image reader.
+    ImageFileReader* reader = new ImageFileReader(name, big_endian);
+    bool opened = reader->open();
+    // If failed to open.
+    if (!opened) {
+        delete reader;
+        return NULL;
+    }
+
+    // Lock to update
     SimpleCriticalSectionLock cs(&_reader_table_lock);
     // Search for an exist image file.
     for (u4 i = 0; i < _reader_table.count(); i++) {
-      // Retrieve table entry.
-      ImageFileReader* reader = _reader_table.get(i);
-      // If name matches, then reuse (bump up use count.)
-      if (strcmp(reader->name(), name) == 0) {
-        reader->inc_use();
-        return reader;
-      }
+        // Retrieve table entry.
+        ImageFileReader* existing_reader = _reader_table.get(i);
+        // If name matches, then reuse (bump up use count.)
+        if (strcmp(existing_reader->name(), name) == 0) {
+            existing_reader->inc_use();
+            reader->close();
+            delete reader;
+            return existing_reader;
+        }
     }
-  } // Unlock the mutex
-
-  // Need a new image reader.
-  ImageFileReader* reader = new ImageFileReader(name, big_endian);
-  bool opened = reader->open();
-  // If failed to open.
-  if (!opened) {
-    delete reader;
-    return NULL;
-  }
-
-  // Lock to update
-  SimpleCriticalSectionLock cs(&_reader_table_lock);
-  // Search for an exist image file.
-  for (u4 i = 0; i < _reader_table.count(); i++) {
-    // Retrieve table entry.
-    ImageFileReader* existing_reader = _reader_table.get(i);
-    // If name matches, then reuse (bump up use count.)
-    if (strcmp(existing_reader->name(), name) == 0) {
-      existing_reader->inc_use();
-      reader->close();
-      delete reader;
-      return existing_reader;
-    }
-  }
-  // Bump use count and add to table.
-  reader->inc_use();
-  _reader_table.add(reader);
-  return reader;
+    // Bump use count and add to table.
+    reader->inc_use();
+    _reader_table.add(reader);
+    return reader;
 }
 
 // Close an image file if the file is not in use elsewhere.
 void ImageFileReader::close(ImageFileReader *reader) {
-  // Lock out _reader_table.
-  SimpleCriticalSectionLock cs(&_reader_table_lock);
-  // If last use then remove from table and then close.
-  if (reader->dec_use()) {
-    _reader_table.remove(reader);
-    delete reader;
-  }
+    // Lock out _reader_table.
+    SimpleCriticalSectionLock cs(&_reader_table_lock);
+    // If last use then remove from table and then close.
+    if (reader->dec_use()) {
+        _reader_table.remove(reader);
+        delete reader;
+    }
 }
 
 // Return an id for the specifed ImageFileReader.
 u8 ImageFileReader::readerToID(ImageFileReader *reader) {
-  // ID is just the cloaked reader address.
-  return (u8)reader;
+    // ID is just the cloaked reader address.
+    return (u8)reader;
 }
 
 // Validate the image id.
 bool ImageFileReader::idCheck(u8 id) {
-  // Make sure the ID is a managed (_reader_table) reader.
-  SimpleCriticalSectionLock cs(&_reader_table_lock);
-  return _reader_table.contains((ImageFileReader*)id);
+    // Make sure the ID is a managed (_reader_table) reader.
+    SimpleCriticalSectionLock cs(&_reader_table_lock);
+    return _reader_table.contains((ImageFileReader*)id);
 }
 
 // Return an id for the specifed ImageFileReader.
 ImageFileReader* ImageFileReader::idToReader(u8 id) {
-  assert(idCheck(id) && "invalid image id");
-  return (ImageFileReader*)id;
+    assert(idCheck(id) && "invalid image id");
+    return (ImageFileReader*)id;
 }
 
 // Constructor intializes to a closed state.
 ImageFileReader::ImageFileReader(const char* name, bool big_endian) {
-  // Copy the image file name.
-   int len = (int) strlen(name) + 1;
-  _name = new char[len];
-  strncpy(_name, name, len);
-  // Initialize for a closed file.
-  _fd = -1;
-  _endian = Endian::get_handler(big_endian);
-  _index_data = NULL;
+    // Copy the image file name.
+     int len = (int) strlen(name) + 1;
+    _name = new char[len];
+    strncpy(_name, name, len);
+    // Initialize for a closed file.
+    _fd = -1;
+    _endian = Endian::get_handler(big_endian);
+    _index_data = NULL;
 }
 
 // Close image and free up data structures.
 ImageFileReader::~ImageFileReader() {
-  // Ensure file is closed.
-  close();
-  // Free up name.
-  if (_name) {
-    delete _name;
-    _name = NULL;
-  }
+    // Ensure file is closed.
+    close();
+    // Free up name.
+    if (_name) {
+        delete _name;
+        _name = NULL;
+    }
 }
 
 // Open image file for read access.
 bool ImageFileReader::open() {
-  char buffer[IMAGE_MAX_PATH];
+    char buffer[IMAGE_MAX_PATH];
 
-  // If file exists open for reading.
-  _fd = osSupport::openReadOnly(_name);
-  if (_fd == -1) {
-    return false;
-  }
-  // Retrieve the file size.
-  _file_size = osSupport::size(_name);
-  // Read image file header and verify it has a valid header.
-  size_t header_size = sizeof(ImageHeader);
-  if (_file_size < header_size ||
-    !read_at((u1*)&_header, header_size, 0) ||
-    _header.magic(_endian) != IMAGE_MAGIC ||
-    _header.major_version(_endian) != MAJOR_VERSION ||
-    _header.minor_version(_endian) != MINOR_VERSION) {
-    close();
-    return false;
-  }
-  // Size of image index.
-  _index_size = index_size();
-  // Make sure file is large enough to contain the index.
-  if (_file_size < _index_size) {
-    return false;
-  }
-  // Determine how much of the image is memory mapped.
-  size_t map_size = (size_t)(MemoryMapImage ? _file_size : _index_size);
-  // Memory map image (minimally the index.)
-  _index_data = (u1*)osSupport::map_memory(_fd, _name, 0, map_size);
-  assert(_index_data && "image file not memory mapped");
-  // Retrieve length of index perfect hash table.
-  u4 length = table_length();
-  // Compute offset of the perfect hash table redirect table.
-  u4 redirect_table_offset = (u4)header_size;
-  // Compute offset of index attribute offsets.
-  u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4);
-  // Compute offset of index location attribute data.
-  u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4);
-  // Compute offset of index string table.
-  u4 string_bytes_offset = location_bytes_offset + locations_size();
-  // Compute address of the perfect hash table redirect table.
-  _redirect_table = (s4*)(_index_data + redirect_table_offset);
-  // Compute address of index attribute offsets.
-  _offsets_table = (u4*)(_index_data + offsets_table_offset);
-  // Compute address of index location attribute data.
-  _location_bytes = _index_data + location_bytes_offset;
-  // Compute address of index string table.
-  _string_bytes = _index_data + string_bytes_offset;
+    // If file exists open for reading.
+    _fd = osSupport::openReadOnly(_name);
+    if (_fd == -1) {
+        return false;
+    }
+    // Retrieve the file size.
+    _file_size = osSupport::size(_name);
+    // Read image file header and verify it has a valid header.
+    size_t header_size = sizeof(ImageHeader);
+    if (_file_size < header_size ||
+        !read_at((u1*)&_header, header_size, 0) ||
+        _header.magic(_endian) != IMAGE_MAGIC ||
+        _header.major_version(_endian) != MAJOR_VERSION ||
+        _header.minor_version(_endian) != MINOR_VERSION) {
+        close();
+        return false;
+    }
+    // Size of image index.
+    _index_size = index_size();
+    // Make sure file is large enough to contain the index.
+    if (_file_size < _index_size) {
+        return false;
+    }
+    // Determine how much of the image is memory mapped.
+    size_t map_size = (size_t)(MemoryMapImage ? _file_size : _index_size);
+    // Memory map image (minimally the index.)
+    _index_data = (u1*)osSupport::map_memory(_fd, _name, 0, map_size);
+    assert(_index_data && "image file not memory mapped");
+    // Retrieve length of index perfect hash table.
+    u4 length = table_length();
+    // Compute offset of the perfect hash table redirect table.
+    u4 redirect_table_offset = (u4)header_size;
+    // Compute offset of index attribute offsets.
+    u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4);
+    // Compute offset of index location attribute data.
+    u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4);
+    // Compute offset of index string table.
+    u4 string_bytes_offset = location_bytes_offset + locations_size();
+    // Compute address of the perfect hash table redirect table.
+    _redirect_table = (s4*)(_index_data + redirect_table_offset);
+    // Compute address of index attribute offsets.
+    _offsets_table = (u4*)(_index_data + offsets_table_offset);
+    // Compute address of index location attribute data.
+    _location_bytes = _index_data + location_bytes_offset;
+    // Compute address of index string table.
+    _string_bytes = _index_data + string_bytes_offset;
 
-  // Initialize the module data
-  ImageModuleData::module_data_name(buffer, _name);
-  module_data = new ImageModuleData(this, buffer);
-  // Successful open.
-  return true;
+    // Initialize the module data
+    ImageModuleData::module_data_name(buffer, _name);
+    module_data = new ImageModuleData(this, buffer);
+    // Successful open.
+    return true;
 }
 
 // Close image file.
 void ImageFileReader::close() {
-  // Deallocate the index.
-  if (_index_data) {
-    osSupport::unmap_memory((char*)_index_data, _index_size);
-    _index_data = NULL;
-  }
-  // Close file.
-  if (_fd != -1) {
-    osSupport::close(_fd);
-    _fd = -1;
-  }
+    // Deallocate the index.
+    if (_index_data) {
+        osSupport::unmap_memory((char*)_index_data, _index_size);
+        _index_data = NULL;
+    }
+    // Close file.
+    if (_fd != -1) {
+        osSupport::close(_fd);
+        _fd = -1;
+    }
 }
 
 // Read directly from the file.
 bool ImageFileReader::read_at(u1* data, u8 size, u8 offset) const {
-  return (u8)osSupport::read(_fd, (char*)data, size, offset) == size;
+    return (u8)osSupport::read(_fd, (char*)data, size, offset) == size;
 }
 
-// Find the location attributes associated with the path.  Returns true if
+// Find the location attributes associated with the path.    Returns true if
 // the location is found, false otherwise.
 bool ImageFileReader::find_location(const char* path, ImageLocation& location) const {
-  // Locate the entry in the index perfect hash table.
-  s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
-  // If is found.
-  if (index != ImageStrings::NOT_FOUND) {
-    // Get address of first byte of location attribute stream.
-    u1* data = get_location_data(index);
-    // Expand location attributes.
-    location.set_data(data);
-    // Make sure result is not a false positive.
-    return verify_location(location, path);
-  }
-  return false;
+    // Locate the entry in the index perfect hash table.
+    s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
+    // If is found.
+    if (index != ImageStrings::NOT_FOUND) {
+        // Get address of first byte of location attribute stream.
+        u1* data = get_location_data(index);
+        // Expand location attributes.
+        location.set_data(data);
+        // Make sure result is not a false positive.
+        return verify_location(location, path);
+    }
+    return false;
 }
 
 // Find the location index and size associated with the path.
 // Returns the location index and size if the location is found, 0 otherwise.
 u4 ImageFileReader::find_location_index(const char* path, u8 *size) const {
-  // Locate the entry in the index perfect hash table.
-  s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
-  // If found.
-  if (index != ImageStrings::NOT_FOUND) {
-    // Get address of first byte of location attribute stream.
-    u4 offset = get_location_offset(index);
-    u1* data = get_location_offset_data(offset);
-    // Expand location attributes.
-    ImageLocation location(data);
-    // Make sure result is not a false positive.
-    if (verify_location(location, path)) {
-        *size = (jlong)location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
-        return offset;
+    // Locate the entry in the index perfect hash table.
+    s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
+    // If found.
+    if (index != ImageStrings::NOT_FOUND) {
+        // Get address of first byte of location attribute stream.
+        u4 offset = get_location_offset(index);
+        u1* data = get_location_offset_data(offset);
+        // Expand location attributes.
+        ImageLocation location(data);
+        // Make sure result is not a false positive.
+        if (verify_location(location, path)) {
+                *size = (jlong)location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+                return offset;
+        }
     }
-  }
-  return 0;      // not found
+    return 0;            // not found
 }
 
 // Assemble the location path from the string fragments indicated in the location attributes.
 void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const {
-  // Manage the image string table.
-  ImageStrings strings(_string_bytes, _header.strings_size(_endian));
-  // Position to first character of the path buffer.
-  char* next = path;
-  // Temp for string length.
-  size_t length;
-  // Get module string.
-  const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
-  // If module string is not empty string.
-  if (*module != '\0') {
-    // Get length of module name.
-    length = strlen(module);
-    // Make sure there is no buffer overflow.
-    assert(next - path + length + 2 < max && "buffer overflow");
-    // Append '/module/'.
-    *next++ = '/';
-    strncpy(next, module, length); next += length;
-    *next++ = '/';
-  }
-  // Get parent (package) string.
-  const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
-  // If parent string is not empty string.
-  if (*parent != '\0') {
-    // Get length of module string.
-    length = strlen(parent);
+    // Manage the image string table.
+    ImageStrings strings(_string_bytes, _header.strings_size(_endian));
+    // Position to first character of the path buffer.
+    char* next = path;
+    // Temp for string length.
+    size_t length;
+    // Get module string.
+    const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
+    // If module string is not empty string.
+    if (*module != '\0') {
+        // Get length of module name.
+        length = strlen(module);
+        // Make sure there is no buffer overflow.
+        assert(next - path + length + 2 < max && "buffer overflow");
+        // Append '/module/'.
+        *next++ = '/';
+        strncpy(next, module, length); next += length;
+        *next++ = '/';
+    }
+    // Get parent (package) string.
+    const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+    // If parent string is not empty string.
+    if (*parent != '\0') {
+        // Get length of module string.
+        length = strlen(parent);
+        // Make sure there is no buffer overflow.
+        assert(next - path + length + 1 < max && "buffer overflow");
+        // Append 'patent/' .
+        strncpy(next, parent, length); next += length;
+        *next++ = '/';
+    }
+    // Get base name string.
+    const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+    // Get length of base name.
+    length = strlen(base);
     // Make sure there is no buffer overflow.
-    assert(next - path + length + 1 < max && "buffer overflow");
-    // Append 'patent/' .
-    strncpy(next, parent, length); next += length;
-    *next++ = '/';
-  }
-  // Get base name string.
-  const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
-  // Get length of base name.
-  length = strlen(base);
-  // Make sure there is no buffer overflow.
-  assert(next - path + length < max && "buffer overflow");
-  // Append base name.
-  strncpy(next, base, length); next += length;
-  // Get extension string.
-  const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
-  // If extension string is not empty string.
-  if (*extension != '\0') {
-    // Get length of extension string.
-    length = strlen(extension);
+    assert(next - path + length < max && "buffer overflow");
+    // Append base name.
+    strncpy(next, base, length); next += length;
+    // Get extension string.
+    const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+    // If extension string is not empty string.
+    if (*extension != '\0') {
+        // Get length of extension string.
+        length = strlen(extension);
+        // Make sure there is no buffer overflow.
+        assert(next - path + length + 1 < max && "buffer overflow");
+        // Append '.extension' .
+        *next++ = '.';
+        strncpy(next, extension, length); next += length;
+    }
     // Make sure there is no buffer overflow.
-    assert(next - path + length + 1 < max && "buffer overflow");
-    // Append '.extension' .
-    *next++ = '.';
-    strncpy(next, extension, length); next += length;
-  }
-  // Make sure there is no buffer overflow.
-  assert((size_t)(next - path) < max && "buffer overflow");
-  // Terminate string.
-  *next = '\0';
+    assert((size_t)(next - path) < max && "buffer overflow");
+    // Terminate string.
+    *next = '\0';
 }
 
 // Verify that a found location matches the supplied path (without copying.)
 bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const {
-  // Manage the image string table.
-  ImageStrings strings(_string_bytes, _header.strings_size(_endian));
-  // Position to first character of the path string.
-  const char* next = path;
-  // Get module name string.
-  const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
-  // If module string is not empty.
-  if (*module != '\0') {
-    // Compare '/module/' .
-    if (*next++ != '/') return false;
-    if (!(next = ImageStrings::starts_with(next, module))) return false;
-    if (*next++ != '/') return false;
-  }
-  // Get parent (package) string
-  const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
-  // If parent string is not empty string.
-  if (*parent != '\0') {
-    // Compare 'parent/' .
-    if (!(next = ImageStrings::starts_with(next, parent))) return false;
-    if (*next++ != '/') return false;
-  }
-  // Get base name string.
-  const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
-  // Compare with basne name.
-  if (!(next = ImageStrings::starts_with(next, base))) return false;
-  // Get extension string.
-  const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
-  // If extension is not empty.
-  if (*extension != '\0') {
-    // Compare '.extension' .
-    if (*next++ != '.') return false;
-    if (!(next = ImageStrings::starts_with(next, extension))) return false;
-  }
-  // True only if complete match and no more characters.
-  return *next == '\0';
+    // Manage the image string table.
+    ImageStrings strings(_string_bytes, _header.strings_size(_endian));
+    // Position to first character of the path string.
+    const char* next = path;
+    // Get module name string.
+    const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
+    // If module string is not empty.
+    if (*module != '\0') {
+        // Compare '/module/' .
+        if (*next++ != '/') return false;
+        if (!(next = ImageStrings::starts_with(next, module))) return false;
+        if (*next++ != '/') return false;
+    }
+    // Get parent (package) string
+    const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+    // If parent string is not empty string.
+    if (*parent != '\0') {
+        // Compare 'parent/' .
+        if (!(next = ImageStrings::starts_with(next, parent))) return false;
+        if (*next++ != '/') return false;
+    }
+    // Get base name string.
+    const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+    // Compare with basne name.
+    if (!(next = ImageStrings::starts_with(next, base))) return false;
+    // Get extension string.
+    const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+    // If extension is not empty.
+    if (*extension != '\0') {
+        // Compare '.extension' .
+        if (*next++ != '.') return false;
+        if (!(next = ImageStrings::starts_with(next, extension))) return false;
+    }
+    // True only if complete match and no more characters.
+    return *next == '\0';
 }
 
 // Return the resource for the supplied location offset.
 void ImageFileReader::get_resource(u4 offset, u1* uncompressed_data) const {
-    // Get address of first byte of location attribute stream.
-    u1* data = get_location_offset_data(offset);
-    // Expand location attributes.
-    ImageLocation location(data);
-    // Read the data
-    get_resource(location, uncompressed_data);
+        // Get address of first byte of location attribute stream.
+        u1* data = get_location_offset_data(offset);
+        // Expand location attributes.
+        ImageLocation location(data);
+        // Read the data
+        get_resource(location, uncompressed_data);
 }
 
 // Return the resource for the supplied location.
 void ImageFileReader::get_resource(ImageLocation& location, u1* uncompressed_data) const {
-  // Retrieve the byte offset and size of the resource.
-  u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
-  u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
-  u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
-  // If the resource is compressed.
-  if (compressed_size != 0) {
-    u1* compressed_data;
-    // If not memory mapped read in bytes.
-    if (!MemoryMapImage) {
-      // Allocate buffer for compression.
-      compressed_data = new u1[(u4)compressed_size];
-      // Read bytes from offset beyond the image index.
-      bool is_read = read_at(compressed_data, compressed_size, _index_size + offset);
-      assert(is_read && "error reading from image or short read");
+    // Retrieve the byte offset and size of the resource.
+    u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+    u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+    u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+    // If the resource is compressed.
+    if (compressed_size != 0) {
+        u1* compressed_data;
+        // If not memory mapped read in bytes.
+        if (!MemoryMapImage) {
+            // Allocate buffer for compression.
+            compressed_data = new u1[(u4)compressed_size];
+            // Read bytes from offset beyond the image index.
+            bool is_read = read_at(compressed_data, compressed_size, _index_size + offset);
+            assert(is_read && "error reading from image or short read");
+        } else {
+            compressed_data = get_data_address() + offset;
+        }
+        // Get image string table.
+        const ImageStrings strings = get_strings();
+        // Decompress resource.
+        ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
+                        &strings);
+        // If not memory mapped then release temporary buffer.
+        if (!MemoryMapImage) {
+                delete compressed_data;
+        }
     } else {
-      compressed_data = get_data_address() + offset;
+        // Read bytes from offset beyond the image index.
+        bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
+        assert(is_read && "error reading from image or short read");
     }
-    // Get image string table.
-    const ImageStrings strings = get_strings();
-    // Decompress resource.
-    ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
-            &strings);
-    // If not memory mapped then release temporary buffer.
-    if (!MemoryMapImage) {
-        delete compressed_data;
-    }
-  } else {
-    // Read bytes from offset beyond the image index.
-    bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
-    assert(is_read && "error reading from image or short read");
-  }
 }
 
 // Return the ImageModuleData for this image
 ImageModuleData * ImageFileReader::get_image_module_data() {
-    return module_data;
+        return module_data;
 }
--- a/jdk/src/java.base/share/native/libjimage/imageFile.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/imageFile.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -1,14 +1,16 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.    Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
+ * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef LIBJIMAGE_IMAGEFILE_HPP
@@ -145,52 +146,52 @@
 // Manage image file string table.
 class ImageStrings {
 private:
-  u1* _data; // Data bytes for strings.
-  u4 _size; // Number of bytes in the string table.
+    u1* _data; // Data bytes for strings.
+    u4 _size;  // Number of bytes in the string table.
 public:
-  enum {
-    // Not found result from find routine.
-    NOT_FOUND = -1,
-    // Prime used to generate hash for Perfect Hashing.
-    HASH_MULTIPLIER = 0x01000193
-  };
+    enum {
+        // Not found result from find routine.
+        NOT_FOUND = -1,
+        // Prime used to generate hash for Perfect Hashing.
+        HASH_MULTIPLIER = 0x01000193
+    };
 
-  ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+    ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
 
-  // Return the UTF-8 string beginning at offset.
-  inline const char* get(u4 offset) const {
-    assert(offset < _size && "offset exceeds string table size");
-    return (const char*)(_data + offset);
-  }
+    // Return the UTF-8 string beginning at offset.
+    inline const char* get(u4 offset) const {
+        assert(offset < _size && "offset exceeds string table size");
+        return (const char*)(_data + offset);
+    }
 
-  // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
-  inline static u4 hash_code(const char* string) {
-    return hash_code(string, HASH_MULTIPLIER);
-  }
+    // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
+    inline static u4 hash_code(const char* string) {
+        return hash_code(string, HASH_MULTIPLIER);
+    }
 
-  // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
-  static s4 hash_code(const char* string, s4 seed);
+    // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+    static s4 hash_code(const char* string, s4 seed);
 
-  // Match up a string in a perfect hash table.  Result still needs validation
-  // for precise match.
-  static s4 find(Endian* endian, const char* name, s4* redirect, u4 length);
+    // Match up a string in a perfect hash table.    Result still needs validation
+    // for precise match.
+    static s4 find(Endian* endian, const char* name, s4* redirect, u4 length);
 
-  // Test to see if UTF-8 string begins with the start UTF-8 string.  If so,
-  // return non-NULL address of remaining portion of string.  Otherwise, return
-  // NULL.  Used to test sections of a path without copying from image string
-  // table.
-  static const char* starts_with(const char* string, const char* start);
+    // Test to see if UTF-8 string begins with the start UTF-8 string.  If so,
+    // return non-NULL address of remaining portion of string.  Otherwise, return
+    // NULL.    Used to test sections of a path without copying from image string
+    // table.
+    static const char* starts_with(const char* string, const char* start);
 
-  // Test to see if UTF-8 string begins with start char.  If so, return non-NULL
-  // address of remaining portion of string.  Otherwise, return NULL.  Used
-  // to test a character of a path without copying.
-  inline static const char* starts_with(const char* string, const char ch) {
-    return *string == ch ? string + 1 : NULL;
-  }
+    // Test to see if UTF-8 string begins with start char.  If so, return non-NULL
+    // address of remaining portion of string.  Otherwise, return NULL.  Used
+    // to test a character of a path without copying.
+    inline static const char* starts_with(const char* string, const char ch) {
+        return *string == ch ? string + 1 : NULL;
+    }
 };
 
-// Manage image file location attribute data.  Within an image, a location's
-// attributes are compressed into a stream of bytes.  An attribute stream is
+// Manage image file location attribute data.    Within an image, a location's
+// attributes are compressed into a stream of bytes.    An attribute stream is
 // composed of individual attribute sequences.  Each attribute sequence begins with
 // a header byte containing the attribute 'kind' (upper 5 bits of header) and the
 // 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
@@ -208,91 +209,91 @@
 //
 // Notes:
 //  - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
-//    streams will contain zero byte values to represent lesser significant bits.
-//    Thus, detecting a zero byte is not sufficient to detect the end of an attribute
-//    stream.
+//      streams will contain zero byte values to represent lesser significant bits.
+//      Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+//      stream.
 //  - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
-//    storing the resources.  Thus, in an image this represents the number of bytes
-//    after the index.
+//      storing the resources.  Thus, in an image this represents the number of bytes
+//      after the index.
 //  - Currently, compressed resources are represented by having a non-zero
-//    ATTRIBUTE_COMPRESSED value.  This represents the number of bytes stored in the
-//    image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
-//    inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
-//    of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
-//    in memory.  In the future, additional compression techniques will be used and
-//    represented differently.
+//      ATTRIBUTE_COMPRESSED value.  This represents the number of bytes stored in the
+//      image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+//      inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+//      of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+//      in memory.  In the future, additional compression techniques will be used and
+//      represented differently.
 //  - Package strings include trailing slash and extensions include prefix period.
 //
 class ImageLocation {
 public:
-  enum {
-    ATTRIBUTE_END,          // End of attribute stream marker
-    ATTRIBUTE_MODULE,       // String table offset of module name
-    ATTRIBUTE_PARENT,       // String table offset of resource path parent
-    ATTRIBUTE_BASE,         // String table offset of resource path base
-    ATTRIBUTE_EXTENSION,    // String table offset of resource path extension
-    ATTRIBUTE_OFFSET,       // Container byte offset of resource
-    ATTRIBUTE_COMPRESSED,   // In image byte size of the compressed resource
-    ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
-    ATTRIBUTE_COUNT         // Number of attribute kinds
-  };
+    enum {
+        ATTRIBUTE_END,                  // End of attribute stream marker
+        ATTRIBUTE_MODULE,               // String table offset of module name
+        ATTRIBUTE_PARENT,               // String table offset of resource path parent
+        ATTRIBUTE_BASE,                 // String table offset of resource path base
+        ATTRIBUTE_EXTENSION,        // String table offset of resource path extension
+        ATTRIBUTE_OFFSET,               // Container byte offset of resource
+        ATTRIBUTE_COMPRESSED,       // In image byte size of the compressed resource
+        ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
+        ATTRIBUTE_COUNT                 // Number of attribute kinds
+    };
 
 private:
-  // Values of inflated attributes.
-  u8 _attributes[ATTRIBUTE_COUNT];
+    // Values of inflated attributes.
+    u8 _attributes[ATTRIBUTE_COUNT];
 
-  // Return the attribute value number of bytes.
-  inline static u1 attribute_length(u1 data) {
-    return (data & 0x7) + 1;
-  }
+    // Return the attribute value number of bytes.
+    inline static u1 attribute_length(u1 data) {
+        return (data & 0x7) + 1;
+    }
 
-  // Return the attribute kind.
-  inline static u1 attribute_kind(u1 data) {
-    u1 kind = data >> 3;
-    assert(kind < ATTRIBUTE_COUNT && "invalid attribute kind");
-    return kind;
-  }
+    // Return the attribute kind.
+    inline static u1 attribute_kind(u1 data) {
+        u1 kind = data >> 3;
+        assert(kind < ATTRIBUTE_COUNT && "invalid attribute kind");
+        return kind;
+    }
 
-  // Return the attribute length.
-  inline static u8 attribute_value(u1* data, u1 n) {
-    assert(0 < n && n <= 8 && "invalid attribute value length");
-    u8 value = 0;
-    // Most significant bytes first.
-    for (u1 i = 0; i < n; i++) {
-      value <<= 8;
-      value |= data[i];
+    // Return the attribute length.
+    inline static u8 attribute_value(u1* data, u1 n) {
+        assert(0 < n && n <= 8 && "invalid attribute value length");
+        u8 value = 0;
+        // Most significant bytes first.
+        for (u1 i = 0; i < n; i++) {
+            value <<= 8;
+            value |= data[i];
+        }
+        return value;
     }
-    return value;
-  }
 
 public:
-  ImageLocation() {
-    clear_data();
-  }
+    ImageLocation() {
+        clear_data();
+    }
 
-  ImageLocation(u1* data) {
-    clear_data();
-    set_data(data);
-  }
+    ImageLocation(u1* data) {
+        clear_data();
+        set_data(data);
+    }
 
-  // Inflates the attribute stream into individual values stored in the long
-  // array _attributes. This allows an attribute value to be quickly accessed by
-  // direct indexing. Unspecified values default to zero.
-  void set_data(u1* data);
+    // Inflates the attribute stream into individual values stored in the long
+    // array _attributes. This allows an attribute value to be quickly accessed by
+    // direct indexing. Unspecified values default to zero.
+    void set_data(u1* data);
 
-  // Zero all attribute values.
-  void clear_data();
+    // Zero all attribute values.
+    void clear_data();
 
-  // Retrieve an attribute value from the inflated array.
-  inline u8 get_attribute(u1 kind) const {
-    assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT && "invalid attribute kind");
-    return _attributes[kind];
-  }
+    // Retrieve an attribute value from the inflated array.
+    inline u8 get_attribute(u1 kind) const {
+        assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT && "invalid attribute kind");
+        return _attributes[kind];
+    }
 
-  // Retrieve an attribute string value from the inflated array.
-  inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
-    return strings.get((u4)get_attribute(kind));
-  }
+    // Retrieve an attribute string value from the inflated array.
+    inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+        return strings.get((u4)get_attribute(kind));
+    }
 };
 
 //
@@ -306,133 +307,133 @@
 // padding for hash table lookup.)
 //
 // Format:
-//    Count of package to module entries
-//    Count of module to package entries
-//    Perfect Hash redirect table[Count of package to module entries]
-//    Package to module entries[Count of package to module entries]
-//        Offset to package name in string table
-//        Offset to module name in string table
-//    Perfect Hash redirect table[Count of module to package entries]
-//    Module to package entries[Count of module to package entries]
-//        Offset to module name in string table
-//        Count of packages in module
-//        Offset to first package in packages table
-//    Packages[]
-//        Offset to package name in string table
+//      Count of package to module entries
+//      Count of module to package entries
+//      Perfect Hash redirect table[Count of package to module entries]
+//      Package to module entries[Count of package to module entries]
+//          Offset to package name in string table
+//          Offset to module name in string table
+//      Perfect Hash redirect table[Count of module to package entries]
+//      Module to package entries[Count of module to package entries]
+//          Offset to module name in string table
+//          Count of packages in module
+//          Offset to first package in packages table
+//      Packages[]
+//          Offset to package name in string table
 //
 // Manage the image module meta data.
 class ImageModuleData {
-  class Header {
-  private:
-    u4 _ptm_count;      // Count of package to module entries
-    u4 _mtp_count;      // Count of module to package entries
-  public:
-    inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); }
-    inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); }
-  };
+    class Header {
+    private:
+        u4 _ptm_count;          // Count of package to module entries
+        u4 _mtp_count;          // Count of module to package entries
+    public:
+        inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); }
+        inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); }
+    };
 
-  // Hashtable entry
-  class HashData {
-  private:
-    u4 _name_offset;    // Name offset in string table
-  public:
-    inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); }
-  };
+    // Hashtable entry
+    class HashData {
+    private:
+        u4 _name_offset;        // Name offset in string table
+    public:
+        inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); }
+    };
 
-  // Package to module hashtable entry
-  class PTMData : public HashData {
-  private:
-    u4 _module_name_offset; // Module name offset in string table
-  public:
-    inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); }
-  };
+    // Package to module hashtable entry
+    class PTMData : public HashData {
+    private:
+        u4 _module_name_offset; // Module name offset in string table
+    public:
+        inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); }
+    };
 
-  // Module to package hashtable entry
-  class MTPData : public HashData {
-  private:
-    u4 _package_count;     // Number of packages in module
-    u4 _package_offset;    // Offset in package list
-  public:
-    inline u4 package_count(Endian* endian)  const { return endian->get(_package_count); }
-    inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); }
-  };
+    // Module to package hashtable entry
+    class MTPData : public HashData {
+    private:
+        u4 _package_count;       // Number of packages in module
+        u4 _package_offset;      // Offset in package list
+    public:
+        inline u4 package_count(Endian* endian)  const { return endian->get(_package_count); }
+        inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); }
+    };
 
-  const ImageFileReader* _image_file; // Source image file
-  Endian* _endian;                    // Endian handler
-  ImageStrings _strings;              // Image file strings
-  u1* _data;                          // Module data resource data
-  u8 _data_size;                      // Size of resource data
-  Header* _header;                    // Module data header
-  s4* _ptm_redirect;                  // Package to module hashtable redirect
-  PTMData* _ptm_data;                 // Package to module data
-  s4* _mtp_redirect;                  // Module to packages hashtable redirect
-  MTPData* _mtp_data;                 // Module to packages data
-  s4* _mtp_packages;                  // Package data (name offsets)
+    const ImageFileReader* _image_file; // Source image file
+    Endian* _endian;       // Endian handler
+    ImageStrings _strings; // Image file strings
+    u1* _data;             // Module data resource data
+    u8 _data_size;         // Size of resource data
+    Header* _header;       // Module data header
+    s4* _ptm_redirect;     // Package to module hashtable redirect
+    PTMData* _ptm_data;    // Package to module data
+    s4* _mtp_redirect;     // Module to packages hashtable redirect
+    MTPData* _mtp_data;    // Module to packages data
+    s4* _mtp_packages;     // Package data (name offsets)
 
-  // Return a string from the string table.
-  inline const char* get_string(u4 offset) {
-    return _strings.get(offset);
-  }
+    // Return a string from the string table.
+    inline const char* get_string(u4 offset) {
+        return _strings.get(offset);
+    }
 
-  inline u4 mtp_package(u4 index) {
-    return _endian->get(_mtp_packages[index]);
-  }
+    inline u4 mtp_package(u4 index) {
+        return _endian->get(_mtp_packages[index]);
+    }
 
 public:
-  ImageModuleData(const ImageFileReader* image_file, const char* module_data_name);
-  ~ImageModuleData();
+    ImageModuleData(const ImageFileReader* image_file, const char* module_data_name);
+    ~ImageModuleData();
 
-  // Return the name of the module data resource.
-  static void module_data_name(char* buffer, const char* image_file_name);
+    // Return the name of the module data resource.
+    static void module_data_name(char* buffer, const char* image_file_name);
 
-  // Return the module in which a package resides.  Returns NULL if not found.
-  const char* package_to_module(const char* package_name);
+    // Return the module in which a package resides.    Returns NULL if not found.
+    const char* package_to_module(const char* package_name);
 
-  // Returns all the package names in a module in a NULL terminated array.
-  // Returns NULL if module not found.
-  const char** module_to_packages(const char* module_name);
+    // Returns all the package names in a module in a NULL terminated array.
+    // Returns NULL if module not found.
+    const char** module_to_packages(const char* module_name);
 };
 
 // Image file header, starting at offset 0.
 class ImageHeader {
 private:
-  u4 _magic;           // Image file marker
-  u4 _version;         // Image file major version number
-  u4 _flags;           // Image file flags
-  u4 _resource_count;  // Number of resources in file
-  u4 _table_length;    // Number of slots in index tables
-  u4 _locations_size;  // Number of bytes in attribute table
-  u4 _strings_size;    // Number of bytes in string table
+    u4 _magic;          // Image file marker
+    u4 _version;        // Image file major version number
+    u4 _flags;          // Image file flags
+    u4 _resource_count; // Number of resources in file
+    u4 _table_length;   // Number of slots in index tables
+    u4 _locations_size; // Number of bytes in attribute table
+    u4 _strings_size;   // Number of bytes in string table
 
 public:
-  u4 magic() const { return _magic; }
-  u4 magic(Endian* endian) const { return endian->get(_magic); }
-  void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); }
+    u4 magic() const { return _magic; }
+    u4 magic(Endian* endian) const { return endian->get(_magic); }
+    void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); }
 
-  u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; }
-  u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; }
-  void set_version(Endian* endian, u4 major_version, u4 minor_version) {
-    return endian->set(_version, major_version << 16 | minor_version);
-  }
+    u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; }
+    u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; }
+    void set_version(Endian* endian, u4 major_version, u4 minor_version) {
+        return endian->set(_version, major_version << 16 | minor_version);
+    }
 
-  u4 flags(Endian* endian) const { return endian->get(_flags); }
-  void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); }
+    u4 flags(Endian* endian) const { return endian->get(_flags); }
+    void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); }
 
-  u4 resource_count(Endian* endian) const { return endian->get(_resource_count); }
-  void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); }
+    u4 resource_count(Endian* endian) const { return endian->get(_resource_count); }
+    void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); }
 
-  u4 table_length(Endian* endian) const { return endian->get(_table_length); }
-  void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); }
+    u4 table_length(Endian* endian) const { return endian->get(_table_length); }
+    void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); }
 
-  u4 locations_size(Endian* endian) const { return endian->get(_locations_size); }
-  void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); }
+    u4 locations_size(Endian* endian) const { return endian->get(_locations_size); }
+    void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); }
 
-  u4 strings_size(Endian* endian) const { return endian->get(_strings_size); }
-  void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); }
+    u4 strings_size(Endian* endian) const { return endian->get(_strings_size); }
+    void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); }
 };
 
-// Max path length limit independent of platform.  Windows max path is 1024,
-// other platforms use 4096.  The JCK fails several tests when 1024 is used.
+// Max path length limit independent of platform.    Windows max path is 1024,
+// other platforms use 4096.    The JCK fails several tests when 1024 is used.
 #define IMAGE_MAX_PATH 4096
 
 class ImageFileReader;
@@ -441,29 +442,29 @@
 // to share an open image.
 class ImageFileReaderTable {
 private:
-  const static u4 _growth = 8;   // Growth rate of the table
-  u4 _count;                     // Number of entries in the table
-  u4 _max;                       // Maximum number of entries allocated
-  ImageFileReader** _table;      // Growable array of entries
+    const static u4 _growth = 8; // Growth rate of the table
+    u4 _count;                   // Number of entries in the table
+    u4 _max;                     // Maximum number of entries allocated
+    ImageFileReader** _table;    // Growable array of entries
 
 public:
-  ImageFileReaderTable();
-  ~ImageFileReaderTable();
+    ImageFileReaderTable();
+    ~ImageFileReaderTable();
 
-  // Return the number of entries.
-  inline u4 count() { return _count; }
+    // Return the number of entries.
+    inline u4 count() { return _count; }
 
-  // Return the ith entry from the table.
-  inline ImageFileReader* get(u4 i) { return _table[i]; }
+    // Return the ith entry from the table.
+    inline ImageFileReader* get(u4 i) { return _table[i]; }
 
-  // Add a new image entry to the table.
-  void add(ImageFileReader* image);
+    // Add a new image entry to the table.
+    void add(ImageFileReader* image);
 
-  // Remove an image entry from the table.
-  void remove(ImageFileReader* image);
+    // Remove an image entry from the table.
+    void remove(ImageFileReader* image);
 
-  // Determine if image entry is in table.
-  bool contains(ImageFileReader* image);
+    // Determine if image entry is in table.
+    bool contains(ImageFileReader* image);
 };
 
 // Manage the image file.
@@ -473,176 +474,176 @@
 // index is then memory mapped to allow load on demand and sharing.  The
 // -XX:+MemoryMapImage flag determines if the entire file is loaded (server use.)
 // An image can be used by Hotspot and multiple reference points in the JDK, thus
-// it is desirable to share a reader.  To accomodate sharing, a share table is
+// it is desirable to share a reader.    To accomodate sharing, a share table is
 // defined (see ImageFileReaderTable in imageFile.cpp)  To track the number of
 // uses, ImageFileReader keeps a use count (_use).  Use is incremented when
-// 'opened' by reference point and decremented when 'closed'.  Use of zero
+// 'opened' by reference point and decremented when 'closed'.    Use of zero
 // leads the ImageFileReader to be actually closed and discarded.
 class ImageFileReader {
 private:
-  // Manage a number of image files such that an image can be shared across
-  // multiple uses (ex. loader.)
-  static ImageFileReaderTable _reader_table;
+    // Manage a number of image files such that an image can be shared across
+    // multiple uses (ex. loader.)
+    static ImageFileReaderTable _reader_table;
 
-  char* _name;         // Name of image
-  s4 _use;             // Use count
-  int _fd;             // File descriptor
-  Endian* _endian;     // Endian handler
-  u8 _file_size;       // File size in bytes
-  ImageHeader _header; // Image header
-  size_t _index_size;  // Total size of index
-  u1* _index_data;     // Raw index data
-  s4* _redirect_table; // Perfect hash redirect table
-  u4* _offsets_table;  // Location offset table
-  u1* _location_bytes; // Location attributes
-  u1* _string_bytes;   // String table
-  ImageModuleData *module_data;   // The ImageModuleData for this image
+    char* _name;         // Name of image
+    s4 _use;             // Use count
+    int _fd;             // File descriptor
+    Endian* _endian;     // Endian handler
+    u8 _file_size;       // File size in bytes
+    ImageHeader _header; // Image header
+    size_t _index_size;  // Total size of index
+    u1* _index_data;     // Raw index data
+    s4* _redirect_table; // Perfect hash redirect table
+    u4* _offsets_table;  // Location offset table
+    u1* _location_bytes; // Location attributes
+    u1* _string_bytes;   // String table
+    ImageModuleData *module_data;       // The ImageModuleData for this image
 
-  ImageFileReader(const char* name, bool big_endian);
-  ~ImageFileReader();
+    ImageFileReader(const char* name, bool big_endian);
+    ~ImageFileReader();
 
-  // Compute number of bytes in image file index.
-  inline size_t index_size() {
-    return sizeof(ImageHeader) +
-      table_length() * sizeof(u4) * 2 + locations_size() + strings_size();
-  }
+    // Compute number of bytes in image file index.
+    inline size_t index_size() {
+        return sizeof(ImageHeader) +
+            table_length() * sizeof(u4) * 2 + locations_size() + strings_size();
+    }
 
 public:
-  enum {
-    // Image file marker.
-    IMAGE_MAGIC = 0xCAFEDADA,
-    // Endian inverted Image file marker.
-    IMAGE_MAGIC_INVERT = 0xDADAFECA,
-    // Image file major version number.
-    MAJOR_VERSION = 1,
-    // Image file minor version number.
-    MINOR_VERSION = 0
-  };
+    enum {
+        // Image file marker.
+        IMAGE_MAGIC = 0xCAFEDADA,
+        // Endian inverted Image file marker.
+        IMAGE_MAGIC_INVERT = 0xDADAFECA,
+        // Image file major version number.
+        MAJOR_VERSION = 1,
+        // Image file minor version number.
+        MINOR_VERSION = 0
+    };
 
-  // Open an image file, reuse structure if file already open.
-  static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian());
+    // Open an image file, reuse structure if file already open.
+    static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian());
 
-  // Close an image file if the file is not in use elsewhere.
-  static void close(ImageFileReader *reader);
+    // Close an image file if the file is not in use elsewhere.
+    static void close(ImageFileReader *reader);
 
-  // Return an id for the specifed ImageFileReader.
-  static u8 readerToID(ImageFileReader *reader);
+    // Return an id for the specifed ImageFileReader.
+    static u8 readerToID(ImageFileReader *reader);
 
-  // Validate the image id.
-  static bool idCheck(u8 id);
+    // Validate the image id.
+    static bool idCheck(u8 id);
 
-  // Return an id for the specifed ImageFileReader.
-  static ImageFileReader* idToReader(u8 id);
+    // Return an id for the specifed ImageFileReader.
+    static ImageFileReader* idToReader(u8 id);
 
-  // Open image file for read access.
-  bool open();
+    // Open image file for read access.
+    bool open();
 
-  // Close image file.
-  void close();
+    // Close image file.
+    void close();
 
-  // Read directly from the file.
-  bool read_at(u1* data, u8 size, u8 offset) const;
+    // Read directly from the file.
+    bool read_at(u1* data, u8 size, u8 offset) const;
 
-  inline Endian* endian() const { return _endian; }
+    inline Endian* endian() const { return _endian; }
 
-  // Retrieve name of image file.
-  inline const char* name() const {
-    return _name;
-  }
+    // Retrieve name of image file.
+    inline const char* name() const {
+        return _name;
+    }
 
-  // Retrieve size of image file.
-  inline u8 file_size() const {
-    return _file_size;
-  }
+    // Retrieve size of image file.
+    inline u8 file_size() const {
+        return _file_size;
+    }
 
-  // Return first address of index data.
-  inline u1* get_index_address() const {
-    return _index_data;
-  }
+    // Return first address of index data.
+    inline u1* get_index_address() const {
+        return _index_data;
+    }
 
-  // Return first address of resource data.
-  inline u1* get_data_address() const {
-    return _index_data + _index_size;
-  }
+    // Return first address of resource data.
+    inline u1* get_data_address() const {
+        return _index_data + _index_size;
+    }
 
-  // Get the size of the index data.
-  size_t get_index_size() const {
-    return _index_size;
-  }
+    // Get the size of the index data.
+    size_t get_index_size() const {
+        return _index_size;
+    }
 
-  inline u4 table_length() const {
-    return _header.table_length(_endian);
-  }
+    inline u4 table_length() const {
+        return _header.table_length(_endian);
+    }
 
-  inline u4 locations_size() const {
-    return _header.locations_size(_endian);
-  }
+    inline u4 locations_size() const {
+        return _header.locations_size(_endian);
+    }
 
-  inline u4 strings_size()const  {
-    return _header.strings_size(_endian);
-  }
+    inline u4 strings_size()const    {
+        return _header.strings_size(_endian);
+    }
 
-  inline u4* offsets_table() const {
-    return _offsets_table;
-  }
+    inline u4* offsets_table() const {
+        return _offsets_table;
+    }
 
-  // Increment use count.
-  inline void inc_use() {
-    _use++;
-  }
+    // Increment use count.
+    inline void inc_use() {
+        _use++;
+    }
 
-  // Decrement use count.
-  inline bool dec_use() {
-    return --_use == 0;
-  }
+    // Decrement use count.
+    inline bool dec_use() {
+        return --_use == 0;
+    }
 
-  // Return a string table accessor.
-  inline const ImageStrings get_strings() const {
-    return ImageStrings(_string_bytes, _header.strings_size(_endian));
-  }
+    // Return a string table accessor.
+    inline const ImageStrings get_strings() const {
+        return ImageStrings(_string_bytes, _header.strings_size(_endian));
+    }
 
-  // Return location attribute stream at offset.
-  inline u1* get_location_offset_data(u4 offset) const {
-    assert((u4)offset < _header.locations_size(_endian) &&
-              "offset exceeds location attributes size");
-    return offset != 0 ? _location_bytes + offset : NULL;
-  }
+    // Return location attribute stream at offset.
+    inline u1* get_location_offset_data(u4 offset) const {
+        assert((u4)offset < _header.locations_size(_endian) &&
+                            "offset exceeds location attributes size");
+        return offset != 0 ? _location_bytes + offset : NULL;
+    }
 
-  // Return location attribute stream for location i.
-  inline u1* get_location_data(u4 index) const {
-    return get_location_offset_data(get_location_offset(index));
-  }
+    // Return location attribute stream for location i.
+    inline u1* get_location_data(u4 index) const {
+        return get_location_offset_data(get_location_offset(index));
+    }
 
-  // Return the location offset for index.
-  inline u4 get_location_offset(u4 index) const {
-    assert((u4)index < _header.table_length(_endian) &&
-              "index exceeds location count");
-    return _endian->get(_offsets_table[index]);
-  }
+    // Return the location offset for index.
+    inline u4 get_location_offset(u4 index) const {
+        assert((u4)index < _header.table_length(_endian) &&
+                            "index exceeds location count");
+        return _endian->get(_offsets_table[index]);
+    }
 
-  // Find the location attributes associated with the path.  Returns true if
-  // the location is found, false otherwise.
-  bool find_location(const char* path, ImageLocation& location) const;
+    // Find the location attributes associated with the path.    Returns true if
+    // the location is found, false otherwise.
+    bool find_location(const char* path, ImageLocation& location) const;
 
-  // Find the location index and size associated with the path.
-  // Returns the location index and size if the location is found,
-  // ImageFileReader::NOT_FOUND otherwise.
-  u4 find_location_index(const char* path, u8 *size) const;
+    // Find the location index and size associated with the path.
+    // Returns the location index and size if the location is found,
+    // ImageFileReader::NOT_FOUND otherwise.
+    u4 find_location_index(const char* path, u8 *size) const;
 
-  // Assemble the location path.
-  void location_path(ImageLocation& location, char* path, size_t max) const;
+    // Assemble the location path.
+    void location_path(ImageLocation& location, char* path, size_t max) const;
 
-  // Verify that a found location matches the supplied path.
-  bool verify_location(ImageLocation& location, const char* path) const;
+    // Verify that a found location matches the supplied path.
+    bool verify_location(ImageLocation& location, const char* path) const;
 
-  // Return the resource for the supplied location index.
-  void get_resource(u4 index, u1* uncompressed_data) const;
+    // Return the resource for the supplied location index.
+    void get_resource(u4 index, u1* uncompressed_data) const;
 
-  // Return the resource for the supplied path.
-  void get_resource(ImageLocation& location, u1* uncompressed_data) const;
+    // Return the resource for the supplied path.
+    void get_resource(ImageLocation& location, u1* uncompressed_data) const;
 
-  // Return the ImageModuleData for this image
-  ImageModuleData * get_image_module_data();
+    // Return the ImageModuleData for this image
+    ImageModuleData * get_image_module_data();
 
 };
 #endif // LIBJIMAGE_IMAGEFILE_HPP
--- a/jdk/src/java.base/share/native/libjimage/inttypes.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/inttypes.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef LIBJIMAGE_INTTYPES_HPP
--- a/jdk/src/java.base/share/native/libjimage/jimage.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/jimage.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -1,10 +1,12 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include <string.h>
@@ -97,7 +98,8 @@
  *
  *  Ex.
  *   jlong size;
- *   JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ *   JImageLocationRef location = (*JImageFindResource)(image,
+ *                                 "java.base", "9.0", "java/lang/String.class", &size);
  */
 extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* image,
         const char* module_name, const char* version, const char* name,
@@ -129,7 +131,8 @@
  *
  * Ex.
  *  jlong size;
- *  JImageLocationRef* location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ *   JImageLocationRef location = (*JImageFindResource)(image,
+ *                                 "java.base", "9.0", "java/lang/String.class", &size);
  *  char* buffer = new char[size];
  *  (*JImageGetResource)(image, location, buffer, size);
  */
@@ -148,7 +151,8 @@
  * required. All strings are utf-8, zero byte terminated.file.
  *
  * Ex.
- *   bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
+ *   bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
+ *                  const char* package, const char* name, const char* extension, void* arg) {
  *     if (strcmp(extension, “class”) == 0) {
  *       char path[JIMAGE_MAX_PATH];
  *       Thread* THREAD = Thread::current();
--- a/jdk/src/java.base/share/native/libjimage/jimage.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/jimage.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include "jni.h"
@@ -111,7 +112,8 @@
  *
  *  Ex.
  *   jlong size;
- *   JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ *   JImageLocationRef location = (*JImageFindResource)(image,
+ *                                "java.base", "9.0", "java/lang/String.class", &size);
  */
 extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
         const char* module_name, const char* version, const char* name,
@@ -132,7 +134,8 @@
  *
  * Ex.
  *  jlong size;
- *  JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ *  JImageLocationRef location = (*JImageFindResource)(image,
+ *                               "java.base", "9.0", "java/lang/String.class", &size);
  *  char* buffer = new char[size];
  *  (*JImageGetResource)(image, location, buffer, size);
  */
@@ -152,7 +155,8 @@
  * required. All strings are utf-8, zero byte terminated.file.
  *
  * Ex.
- *   bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
+ *   bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
+ *                  const char* package, const char* name, const char* extension, void* arg) {
  *     if (strcmp(extension, “class”) == 0) {
  *       char path[JIMAGE_MAX_PATH];
  *       Thread* THREAD = Thread::current();
--- a/jdk/src/java.base/share/native/libjimage/osSupport.hpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/share/native/libjimage/osSupport.hpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #ifndef LIBJIMAGE_OSSUPPORT_HPP
--- a/jdk/src/java.base/unix/native/libjimage/osSupport_unix.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/unix/native/libjimage/osSupport_unix.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,10 +21,8 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
--- a/jdk/src/java.base/windows/native/libjimage/osSupport_windows.cpp	Tue Sep 22 09:34:01 2015 +0800
+++ b/jdk/src/java.base/windows/native/libjimage/osSupport_windows.cpp	Tue Sep 22 12:47:40 2015 -0300
@@ -4,7 +4,9 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle 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
@@ -19,7 +21,6 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
- *
  */
 
 #include <windows.h>