CodeBlob::CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) : _name(name), _size(layout.size()), _header_size(layout.header_size()), _frame_complete_offset(frame_complete_offset), _data_offset(layout.data_offset()), _frame_size(frame_size), _strings(CodeStrings()), _caller_must_gc_arguments(caller_must_gc_arguments), _code_begin(layout.code_begin()), _code_end(layout.code_end()), _data_end(layout.data_end()), _relocation_begin(layout.relocation_begin()), _relocation_end(layout.relocation_end()), _content_begin(layout.content_begin()), _type(type) { assert(_size == round_to(_size, oopSize), "unaligned size"); assert(_header_size == round_to(_header_size, oopSize), "unaligned size"); assert(_data_offset <= _size, "codeBlob is too small"); assert(layout.code_end() == layout.content_end(), "must be the same - see code_end()"); set_oop_maps(oop_maps); #ifdef COMPILER1 // probably wrong for tiered assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); #endif // COMPILER1 }
// Creates a CodeBlob from a CodeBuffer. Sets up the size of the different regions, // and copy code and relocation info. CodeBlob::CodeBlob( const char* name, CodeBuffer* cb, int header_size, int size, int frame_complete, int frame_size, OopMapSet* oop_maps ) { assert(size == round_to(size, oopSize), "unaligned size"); assert(header_size == round_to(header_size, oopSize), "unaligned size"); _name = name; _size = size; _frame_complete_offset = frame_complete; _header_size = header_size; _relocation_size = round_to(cb->total_relocation_size(), oopSize); _content_offset = align_code_offset(header_size + _relocation_size); _code_offset = _content_offset + cb->total_offset_of(cb->insts()); _data_offset = _content_offset + round_to(cb->total_content_size(), oopSize); assert(_data_offset <= size, "codeBlob is too small"); cb->copy_code_and_locs_to(this); set_oop_maps(oop_maps); _frame_size = frame_size; #ifdef COMPILER1 // probably wrong for tiered assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); #endif // COMPILER1 }
// Creates a simple CodeBlob. Sets up the size of the different regions. CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) { assert(size == round_to(size, oopSize), "unaligned size"); assert(locs_size == round_to(locs_size, oopSize), "unaligned size"); assert(header_size == round_to(header_size, oopSize), "unaligned size"); assert(!UseRelocIndex, "no space allocated for reloc index yet"); // Note: If UseRelocIndex is enabled, there needs to be (at least) one // extra word for the relocation information, containing the reloc // index table length. Unfortunately, the reloc index table imple- // mentation is not easily understandable and thus it is not clear // what exactly the format is supposed to be. For now, we just turn // off the use of this table (gri 7/6/2000). _name = name; _size = size; _frame_complete_offset = frame_complete; _header_size = header_size; _relocation_size = locs_size; _instructions_offset = align_code_offset(header_size + locs_size); _data_offset = size; _oops_offset = size; _oops_length = 0; _frame_size = 0; set_oop_maps(NULL); }