hotspot/src/share/vm/classfile/sharedClassUtil.hpp
author alanb
Thu, 17 Mar 2016 19:04:01 +0000
changeset 36508 5f9eee6b383b
parent 26135 82b516c550f7
child 46746 ea379ebb9447
permissions -rw-r--r--
8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, harold.seigel@oracle.com, lois.foltan@oracle.com, calvin.cheung@oracle.com, christian.tornqvist@oracle.com, erik.joelsson@oracle.com, george.triantafillou@oracle.com, igor.ignatyev@oracle.com, ioi.lam@oracle.com, james.laskey@oracle.com, jean-francois.denise@oracle.com, jiangli.zhou@oracle.com, markus.gronlund@oracle.com, serguei.spitsyn@oracle.com, staffan.larsen@oracle.com, sundararajan.athijegannathan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     1
/*
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     4
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     8
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    13
 * accompanied this code).
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    14
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    18
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    21
 * questions.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    22
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    23
 */
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    24
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    25
#ifndef SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    26
#define SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    27
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    28
#include "classfile/sharedPathsMiscInfo.hpp"
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    29
#include "memory/filemap.hpp"
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    30
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    31
class SharedClassUtil : AllStatic {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    32
public:
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    33
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    34
  static SharedPathsMiscInfo* allocate_shared_paths_misc_info() {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    35
    return new SharedPathsMiscInfo();
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    36
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    37
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    38
  static SharedPathsMiscInfo* allocate_shared_paths_misc_info(char* buf, int size) {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    39
    return new SharedPathsMiscInfo(buf, size);
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    40
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    41
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    42
  static FileMapInfo::FileMapHeader* allocate_file_map_header() {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    43
    return new FileMapInfo::FileMapHeader();
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    44
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    45
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    46
  static size_t file_map_header_size() {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    47
    return sizeof(FileMapInfo::FileMapHeader);
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    48
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    49
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    50
  static size_t shared_class_path_entry_size() {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    51
    return sizeof(SharedClassPathEntry);
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    52
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    53
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    54
  static void update_shared_classpath(ClassPathEntry *cpe,
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    55
                                      SharedClassPathEntry* ent,
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    56
                                      time_t timestamp,
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    57
                                      long filesize, TRAPS) {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    58
    ent->_timestamp = timestamp;
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    59
    ent->_filesize  = filesize;
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    60
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    61
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    62
  static void initialize(TRAPS) {}
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    63
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    64
  inline static bool is_shared_boot_class(Klass* klass) {
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    65
    return (klass->_shared_class_path_index >= 0);
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    66
  }
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    67
};
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    68
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    69
#endif // SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP