36
37 // This file contains the platform-independent parts
38 // of the interpreter and the interpreter generator.
39
40 //------------------------------------------------------------------------------------------------------------------------
41 // An InterpreterCodelet is a piece of interpreter code. All
42 // interpreter code is generated into little codelets which
43 // contain extra information for debugging and printing purposes.
44
45 class InterpreterCodelet: public Stub {
46 friend class VMStructs;
47 private:
48 int _size; // the size in bytes
49 const char* _description; // a description of the codelet, for debugging & printing
50 Bytecodes::Code _bytecode; // associated bytecode if any
51 DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output.
52
53 public:
54 // Initialization/finalization
55 void initialize(int size,
56 CodeStrings& strings) { _size = size; DEBUG_ONLY(_strings.assign(strings);) }
57 void finalize() { ShouldNotCallThis(); }
58
59 // General info/converters
60 int size() const { return _size; }
61 static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; }
62
63 // Code info
64 address code_begin() const { return (address)this + round_to(sizeof(InterpreterCodelet), CodeEntryAlignment); }
65 address code_end() const { return (address)this + size(); }
66
67 // Debugging
68 void verify();
69 void print_on(outputStream* st) const;
70 void print() const { print_on(tty); }
71
72 // Interpreter-specific initialization
73 void initialize(const char* description, Bytecodes::Code bytecode);
74
75 // Interpreter-specific attributes
76 int code_size() const { return code_end() - code_begin(); }
|
36
37 // This file contains the platform-independent parts
38 // of the interpreter and the interpreter generator.
39
40 //------------------------------------------------------------------------------------------------------------------------
41 // An InterpreterCodelet is a piece of interpreter code. All
42 // interpreter code is generated into little codelets which
43 // contain extra information for debugging and printing purposes.
44
45 class InterpreterCodelet: public Stub {
46 friend class VMStructs;
47 private:
48 int _size; // the size in bytes
49 const char* _description; // a description of the codelet, for debugging & printing
50 Bytecodes::Code _bytecode; // associated bytecode if any
51 DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output.
52
53 public:
54 // Initialization/finalization
55 void initialize(int size,
56 CodeStrings& strings) { _size = size;
57 DEBUG_ONLY(::new(&_strings) CodeStrings();)
58 DEBUG_ONLY(_strings.assign(strings);) }
59 void finalize() { ShouldNotCallThis(); }
60
61 // General info/converters
62 int size() const { return _size; }
63 static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; }
64
65 // Code info
66 address code_begin() const { return (address)this + round_to(sizeof(InterpreterCodelet), CodeEntryAlignment); }
67 address code_end() const { return (address)this + size(); }
68
69 // Debugging
70 void verify();
71 void print_on(outputStream* st) const;
72 void print() const { print_on(tty); }
73
74 // Interpreter-specific initialization
75 void initialize(const char* description, Bytecodes::Code bytecode);
76
77 // Interpreter-specific attributes
78 int code_size() const { return code_end() - code_begin(); }
|