< prev index next >

src/hotspot/share/classfile/sharedPathsMiscInfo.hpp

Print this page

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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.

@@ -33,12 +33,10 @@
 // classpath. The JAR files that exist are stored in the list ClassLoader::_first_append_entry.
 // However, we need to store other "misc" information for run-time checking, such as
 //
 // + The values of Arguments::get_sysclasspath() used during dumping.
 //
-// + The meta-index file(s) used during dumping (incl modification time and size)
-//
 // + The class path elements specified during dumping but did not exist --
 //   these elements must also be specified at run time, and they also must not
 //   exist at run time.
 //
 // These misc items are stored in a linear buffer in SharedPathsMiscInfo.

@@ -51,10 +49,12 @@
 // The SharedPathsMiscInfo class is used for both creating the the information (during
 // dumping time) and validation (at run time). Different constructors are used in the
 // two situations. See below.
 
 class SharedPathsMiscInfo : public CHeapObj<mtClass> {
+private:
+  int   _app_offset;
 protected:
   char* _buf_start;
   char* _cur_ptr;
   char* _end_ptr;
   int   _buf_size;

@@ -65,20 +65,21 @@
   void write(const void* ptr, size_t size);
   bool read(void* ptr, size_t size);
 
 protected:
   static bool fail(const char* msg, const char* name = NULL);
-  virtual bool check(jint type, const char* path);
+  bool check(jint type, const char* path);
 
 public:
   enum {
     INITIAL_BUF_SIZE = 128
   };
   // This constructor is used when creating the misc information (during dump)
   SharedPathsMiscInfo();
   // This constructor is used when validating the misc info (during run time)
   SharedPathsMiscInfo(char *buff, int size) {
+    _app_offset = 0;
     _cur_ptr = _buf_start = buff;
     _end_ptr = _buf_start + size;
     _buf_size = size;
     _allocated = false;
   }

@@ -120,22 +121,26 @@
 
   // reading --
 
   enum {
     BOOT      = 1,
-    NON_EXIST = 2
+    NON_EXIST = 2,
+    APP       = 5,
+    MODULE    = 6
   };
 
-  virtual const char* type_name(int type) {
+  const char* type_name(int type) {
     switch (type) {
     case BOOT:      return "BOOT";
     case NON_EXIST: return "NON_EXIST";
+    case APP:       return "APP";
+    case MODULE:    return "MODULE";
     default:        ShouldNotReachHere(); return "?";
     }
   }
 
-  virtual void print_path(outputStream* os, int type, const char* path);
+  void print_path(outputStream* os, int type, const char* path);
 
   bool check();
   bool read_jint(jint *ptr) {
     return read(ptr, sizeof(jint));
   }

@@ -143,8 +148,21 @@
     return read(ptr, sizeof(long));
   }
   bool read_time(time_t *ptr) {
     return read(ptr, sizeof(time_t));
   }
+
+  void add_app_classpath(const char* path) {
+    add_path(path, APP);
+  }
+
+  void record_app_offset() {
+    _app_offset = get_used_bytes();
+  }
+  void pop_app() {
+    _cur_ptr = _buf_start + _app_offset;
+    write_jint(0);
+  }
+
 };
 
 #endif // SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
< prev index next >