< prev index next >

src/java.base/share/native/libjimage/imageFile.hpp

Print this page
@@ -230,22 +230,38 @@
  //      represented differently.
  //  - Package strings include trailing slash and extensions include prefix period.
  //
  class ImageLocation {
  public:
+     // See also src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java
      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_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_COMPRESSED,           // In-image byte size of the compressed resource
+         ATTRIBUTE_UNCOMPRESSED,         // In-memory byte size of the uncompressed resource
+         ATTRIBUTE_PREVIEW_FLAGS,        // Flags relating to preview mode resources.
          ATTRIBUTE_COUNT                 // Number of attribute kinds
      };
  
+     // Flag masks for the ATTRIBUTE_PREVIEW_FLAGS attribute. Defined so
+     // that zero is the overwhelmingly common case for normal resources.
+     // See also src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java
+     enum {
+         // Set on a "normal" (non-preview) location if a preview version of
+         // it exists in the same module.
+         FLAGS_HAS_PREVIEW_VERSION = 0x1,
+         // Set on all preview locations in "/modules/xxx/META-INF/preview/..."
+         FLAGS_IS_PREVIEW_VERSION = 0x2,
+         // Set on a preview location if no normal (non-preview) version of
+         // it exists in the same module.
+         FLAGS_IS_PREVIEW_ONLY = 0x4
+     };
+ 
  private:
      // Values of inflated attributes.
      u8 _attributes[ATTRIBUTE_COUNT];
  
      // Return the attribute value number of bytes.

@@ -298,10 +314,15 @@
  
      // 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 flags from the ATTRIBUTE_PREVIEW_FLAGS attribute.
+     inline u4 get_preview_flags() const {
+         return (u4) get_attribute(ATTRIBUTE_PREVIEW_FLAGS);
+     }
  };
  
  // Image file header, starting at offset 0.
  class ImageHeader {
  private:

@@ -392,10 +413,11 @@
  // uses, ImageFileReader keeps a use count (_use).  Use is incremented when
  // 'opened' by reference point and decremented when 'closed'.    Use of zero
  // leads the ImageFileReader to be actually closed and discarded.
  class ImageFileReader {
  friend class ImageFileReaderTable;
+ friend class PackageFlags;
  private:
      // Manage a number of image files such that an image can be shared across
      // multiple uses (ex. loader.)
      static ImageFileReaderTable _reader_table;
  

@@ -431,11 +453,11 @@
          // 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
+         MINOR_VERSION = 1
      };
  
      // Locate an image if file already open.
      static ImageFileReader* find_image(const char* name);
  
< prev index next >