/* * Copyright (c) 2015, 2022, 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. * * 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * 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. *
*/
class CDSIndyInfo {
GrowableArray<constchar*>* _items; public:
CDSIndyInfo() : _items(NULL) {} void add_item(constchar* item) { if (_items == NULL) {
_items = new GrowableArray<constchar*>(9);
}
assert(_items != NULL, "sanity");
_items->append(item);
} void add_ref_kind(int ref_kind) { switch (ref_kind) { case JVM_REF_getField : _items->append("REF_getField"); break; case JVM_REF_getStatic : _items->append("REF_getStatic"); break; case JVM_REF_putField : _items->append("REF_putField"); break; case JVM_REF_putStatic : _items->append("REF_putStatic"); break; case JVM_REF_invokeVirtual : _items->append("REF_invokeVirtual"); break; case JVM_REF_invokeStatic : _items->append("REF_invokeStatic"); break; case JVM_REF_invokeSpecial : _items->append("REF_invokeSpecial"); break; case JVM_REF_newInvokeSpecial : _items->append("REF_newInvokeSpecial"); break; case JVM_REF_invokeInterface : _items->append("REF_invokeInterface"); break; default : ShouldNotReachHere();
}
}
GrowableArray<constchar*>* items() { return _items;
}
};
class ClassListParser : public StackObj { public: enum ParseMode {
_parse_all,
_parse_lambda_forms_invokers_only,
};
private: // Must be C_HEAP allocated -- we don't want nested resource allocations. typedef ResizeableResourceHashtable<int, InstanceKlass*,
AnyObj::C_HEAP, mtClassShared> ID2KlassTable;
enum {
_unspecified = -999,
// Max number of bytes allowed per line in the classlist. // Theoretically Java class names could be 65535 bytes in length. Also, an input line // could have a very long path name up to JVM_MAXPATHLEN bytes in length. In reality, // 4K bytes is more than enough.
_max_allowed_line_len = 4096,
_line_buf_extra = 10, // for detecting input too long
_line_buf_size = _max_allowed_line_len + _line_buf_extra
};
// Use a small initial size in debug build to test resizing logic staticconstint INITIAL_TABLE_SIZE = DEBUG_ONLY(17) NOT_DEBUG(1987); staticconstint MAX_TABLE_SIZE = 61333; staticvolatile Thread* _parsing_thread; // the thread that created _instance static ClassListParser* _instance; // the singleton. constchar* _classlist_file;
FILE* _file;
ID2KlassTable _id2klass_table;
// The following field contains information from the *current* line being // parsed. char _line[_line_buf_size]; // The buffer that holds the current line. Some characters in // the buffer may be overwritten by '\0' during parsing. int _line_len; // Original length of the input line. int _line_no; // Line number for current line being parsed constchar* _class_name;
GrowableArray<constchar*>* _indy_items; // items related to invoke dynamic for archiving lambda proxy classes int _id; int _super;
GrowableArray<int>* _interfaces; bool _interfaces_specified; constchar* _source; bool _lambda_form_line;
ParseMode _parse_mode;
public: staticint parse_classlist(constchar* classlist_path, ParseMode parse_mode, TRAPS) {
ClassListParser parser(classlist_path, parse_mode); return parser.parse(THREAD); // returns the number of classes loaded.
}
staticbool is_parsing_thread(); static ClassListParser* instance() {
assert(is_parsing_thread(), "call this only in the thread that created ClassListParsing::_instance");
assert(_instance != NULL, "must be"); return _instance;
}
// Look up the super or interface of the current class being loaded // (in this->load_current_class()).
InstanceKlass* lookup_super_for_current_class(Symbol* super_name);
InstanceKlass* lookup_interface_for_current_class(Symbol* interface_name);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.