/* * Copyright (c) 2012, 2021, 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. *
*/
/** * Bytecode Assembler * * These classes are used to synthesize code for creating new methods from * within the VM. This is only a partial implementation of an assembler; * only the bytecodes that are needed by clients are implemented at this time. * This is used during default method analysis to create overpass methods * and add them to a call during parsing. Other uses (such as creating * bridges) may come later. Any missing bytecodes can be implemented on an * as-need basis.
*/
class BytecodeBuffer : public GrowableArray<u1> { public:
BytecodeBuffer() : GrowableArray<u1>(20) {}
};
// Entries in a yet-to-be-created constant pool. Limited types for now. class BytecodeCPEntry { public: enum tag {
ERROR_TAG,
UTF8,
KLASS,
STRING,
NAME_AND_TYPE,
METHODREF
};
u1 _tag; union {
Symbol* utf8;
u2 klass;
u2 string; struct {
u2 name_index;
u2 type_index;
} name_and_type; struct {
u2 class_index;
u2 name_and_type_index;
} methodref;
uintptr_t hash;
} _u;
// Partial bytecode assembler - only what we need for creating // overpass methods for default methods is implemented class BytecodeAssembler : StackObj { private:
BytecodeBuffer* _code;
BytecodeConstantPool* _cp;
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 ist noch experimentell.