8240204: Optimize package handling for archived classes

ClassLoader::add_package just sets classpath_index to PackageEntry, moved the code to InstanceKlass. Also avoid calling check_prohibited_package since CDS does not archive prohibited classe in set_package.

Reviewed-by: hseigel, lfoltan, redestad, iklam
This commit is contained in:
Yumin Qi 2020-04-20 16:36:15 -07:00
parent 8da1ee7833
commit 7b8c373494
6 changed files with 34 additions and 45 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -258,15 +258,6 @@ class ClassLoader: AllStatic {
bool is_boot_append,
bool from_class_path_attr, TRAPS);
// If the package for InstanceKlass is in the boot loader's package entry
// table then add_package() sets the classpath_index field so that
// get_system_package() will know to return a non-null value for the
// package's location. And, so that the package will be added to the list of
// packages returned by get_system_packages().
// For packages whose classes are loaded from the boot loader class path, the
// classpath_index indicates which entry on the boot loader class path.
static bool add_package(const InstanceKlass* ik, s2 classpath_index, TRAPS);
// Canonicalizes path names, so strcmp will work properly. This is mainly
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);