60 // - data space
61 class DeoptimizationBlob;
62
63 class CodeBlob VALUE_OBJ_CLASS_SPEC {
64
65 friend class VMStructs;
66
67 private:
68 const char* _name;
69 int _size; // total size of CodeBlob in bytes
70 int _header_size; // size of header (depends on subclass)
71 int _relocation_size; // size of relocation
72 int _content_offset; // offset to where content region begins (this includes consts, insts, stubs)
73 int _code_offset; // offset to where instructions region begins (this includes insts, stubs)
74 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have
75 // not finished setting up their frame. Beware of pc's in
76 // that range. There is a similar range(s) on returns
77 // which we don't detect.
78 int _data_offset; // offset to where data region begins
79 int _frame_size; // size of stack frame
80 OopMapSet* _oop_maps; // OopMap for this CodeBlob
81 CodeStrings _strings;
82
83 public:
84 // Returns the space needed for CodeBlob
85 static unsigned int allocation_size(CodeBuffer* cb, int header_size);
86 static unsigned int align_code_offset(int offset);
87
88 // Creation
89 // a) simple CodeBlob
90 // frame_complete is the offset from the beginning of the instructions
91 // to where the frame setup (from stackwalk viewpoint) is complete.
92 CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size);
93
94 // b) full CodeBlob
95 CodeBlob(
96 const char* name,
97 CodeBuffer* cb,
98 int header_size,
99 int size,
100 int frame_complete,
154 bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
155 bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); }
156 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); }
157 bool contains(address addr) const { return content_contains(addr); }
158 bool is_frame_complete_at(address addr) const { return code_contains(addr) &&
159 addr >= code_begin() + _frame_complete_offset; }
160
161 // CodeCache support: really only used by the nmethods, but in order to get
162 // asserts and certain bookkeeping to work in the CodeCache they are defined
163 // virtual here.
164 virtual bool is_zombie() const { return false; }
165 virtual bool is_locked_by_vm() const { return false; }
166
167 virtual bool is_unloaded() const { return false; }
168 virtual bool is_not_entrant() const { return false; }
169
170 // GC support
171 virtual bool is_alive() const = 0;
172
173 // OopMap for frame
174 OopMapSet* oop_maps() const { return _oop_maps; }
175 void set_oop_maps(OopMapSet* p);
176 OopMap* oop_map_for_return_address(address return_address);
177 virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); }
178
179 // Frame support
180 int frame_size() const { return _frame_size; }
181 void set_frame_size(int size) { _frame_size = size; }
182
183 // Returns true, if the next frame is responsible for GC'ing oops passed as arguments
184 virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; }
185
186 // Naming
187 const char* name() const { return _name; }
188 void set_name(const char* name) { _name = name; }
189
190 // Debugging
191 virtual void verify();
192 void print() const { print_on(tty); }
193 virtual void print_on(outputStream* st) const;
194 virtual void print_value_on(outputStream* st) const;
195
196 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
|
60 // - data space
61 class DeoptimizationBlob;
62
63 class CodeBlob VALUE_OBJ_CLASS_SPEC {
64
65 friend class VMStructs;
66
67 private:
68 const char* _name;
69 int _size; // total size of CodeBlob in bytes
70 int _header_size; // size of header (depends on subclass)
71 int _relocation_size; // size of relocation
72 int _content_offset; // offset to where content region begins (this includes consts, insts, stubs)
73 int _code_offset; // offset to where instructions region begins (this includes insts, stubs)
74 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have
75 // not finished setting up their frame. Beware of pc's in
76 // that range. There is a similar range(s) on returns
77 // which we don't detect.
78 int _data_offset; // offset to where data region begins
79 int _frame_size; // size of stack frame
80 ImmutableOopMapSet* _oop_maps; // OopMap for this CodeBlob
81 CodeStrings _strings;
82
83 public:
84 // Returns the space needed for CodeBlob
85 static unsigned int allocation_size(CodeBuffer* cb, int header_size);
86 static unsigned int align_code_offset(int offset);
87
88 // Creation
89 // a) simple CodeBlob
90 // frame_complete is the offset from the beginning of the instructions
91 // to where the frame setup (from stackwalk viewpoint) is complete.
92 CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size);
93
94 // b) full CodeBlob
95 CodeBlob(
96 const char* name,
97 CodeBuffer* cb,
98 int header_size,
99 int size,
100 int frame_complete,
154 bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
155 bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); }
156 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); }
157 bool contains(address addr) const { return content_contains(addr); }
158 bool is_frame_complete_at(address addr) const { return code_contains(addr) &&
159 addr >= code_begin() + _frame_complete_offset; }
160
161 // CodeCache support: really only used by the nmethods, but in order to get
162 // asserts and certain bookkeeping to work in the CodeCache they are defined
163 // virtual here.
164 virtual bool is_zombie() const { return false; }
165 virtual bool is_locked_by_vm() const { return false; }
166
167 virtual bool is_unloaded() const { return false; }
168 virtual bool is_not_entrant() const { return false; }
169
170 // GC support
171 virtual bool is_alive() const = 0;
172
173 // OopMap for frame
174 ImmutableOopMapSet* oop_maps() const { return _oop_maps; }
175 void set_oop_maps(OopMapSet* p);
176 const ImmutableOopMap* oop_map_for_return_address(address return_address);
177 virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); }
178
179 // Frame support
180 int frame_size() const { return _frame_size; }
181 void set_frame_size(int size) { _frame_size = size; }
182
183 // Returns true, if the next frame is responsible for GC'ing oops passed as arguments
184 virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; }
185
186 // Naming
187 const char* name() const { return _name; }
188 void set_name(const char* name) { _name = name; }
189
190 // Debugging
191 virtual void verify();
192 void print() const { print_on(tty); }
193 virtual void print_on(outputStream* st) const;
194 virtual void print_value_on(outputStream* st) const;
195
196 // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
|