34
35
36 /**
37 * Bytecode Assembler
38 *
39 * These classes are used to synthesize code for creating new methods from
40 * within the VM. This is only a partial implementation of an assembler;
41 * only the bytecodes that are needed by clients are implemented at this time.
42 * This is used during default method analysis to create overpass methods
43 * and add them to a call during parsing. Other uses (such as creating
44 * bridges) may come later. Any missing bytecodes can be implemented on an
45 * as-need basis.
46 */
47
48 class BytecodeBuffer : public GrowableArray<u1> {
49 public:
50 BytecodeBuffer() : GrowableArray<u1>(20) {}
51 };
52
53 // Entries in a yet-to-be-created constant pool. Limited types for now.
54 class BytecodeCPEntry VALUE_OBJ_CLASS_SPEC {
55 public:
56 enum tag {
57 ERROR_TAG,
58 UTF8,
59 KLASS,
60 STRING,
61 NAME_AND_TYPE,
62 METHODREF
63 };
64
65 u1 _tag;
66 union {
67 Symbol* utf8;
68 u2 klass;
69 u2 string;
70 struct {
71 u2 name_index;
72 u2 type_index;
73 } name_and_type;
74 struct {
|
34
35
36 /**
37 * Bytecode Assembler
38 *
39 * These classes are used to synthesize code for creating new methods from
40 * within the VM. This is only a partial implementation of an assembler;
41 * only the bytecodes that are needed by clients are implemented at this time.
42 * This is used during default method analysis to create overpass methods
43 * and add them to a call during parsing. Other uses (such as creating
44 * bridges) may come later. Any missing bytecodes can be implemented on an
45 * as-need basis.
46 */
47
48 class BytecodeBuffer : public GrowableArray<u1> {
49 public:
50 BytecodeBuffer() : GrowableArray<u1>(20) {}
51 };
52
53 // Entries in a yet-to-be-created constant pool. Limited types for now.
54 class BytecodeCPEntry {
55 public:
56 enum tag {
57 ERROR_TAG,
58 UTF8,
59 KLASS,
60 STRING,
61 NAME_AND_TYPE,
62 METHODREF
63 };
64
65 u1 _tag;
66 union {
67 Symbol* utf8;
68 u2 klass;
69 u2 string;
70 struct {
71 u2 name_index;
72 u2 type_index;
73 } name_and_type;
74 struct {
|