src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6961690 Cdiff src/share/vm/opto/compile.cpp

src/share/vm/opto/compile.cpp

Print this page
rev 1838 : 6961690: load oops from constant table on SPARC
Summary: oops should be loaded from the constant table of an nmethod instead of materializing them with a long code sequence.
Reviewed-by:

*** 23,32 **** --- 23,44 ---- */ #include "incls/_precompiled.incl" #include "incls/_compile.cpp.incl" + + // -------------------- Compile::mach_constant_base_node ----------------------- + // Constant table base node singleton. + MachConstantBaseNode* Compile::mach_constant_base_node() { + if (_mach_constant_base_node == NULL) { + _mach_constant_base_node = new (C) MachConstantBaseNode(); + _mach_constant_base_node->set_req(0, C->root()); + } + return _mach_constant_base_node; + } + + /// Support for intrinsics. // Return the index at which m must be inserted (or already exists). // The sort order is by the address of the ciMethod, with is_virtual as minor key. int Compile::intrinsic_insertion_index(ciMethod* m, bool is_virtual) {
*** 380,396 **** } #endif } ! void Compile::init_scratch_buffer_blob() { ! if( scratch_buffer_blob() != NULL ) return; // Construct a temporary CodeBuffer to have it construct a BufferBlob // Cache this BufferBlob for this compile. ResourceMark rm; ! int size = (MAX_inst_size + MAX_stubs_size + MAX_const_size); BufferBlob* blob = BufferBlob::create("Compile::scratch_buffer", size); // Record the buffer blob for next time. set_scratch_buffer_blob(blob); // Have we run out of code space? if (scratch_buffer_blob() == NULL) { --- 392,409 ---- } #endif } ! void Compile::init_scratch_buffer_blob(int const_size) { ! if (scratch_buffer_blob() != NULL) return; // Construct a temporary CodeBuffer to have it construct a BufferBlob // Cache this BufferBlob for this compile. ResourceMark rm; ! _scratch_const_size = const_size; ! int size = (MAX_inst_size + MAX_stubs_size + _scratch_const_size); BufferBlob* blob = BufferBlob::create("Compile::scratch_buffer", size); // Record the buffer blob for next time. set_scratch_buffer_blob(blob); // Have we run out of code space? if (scratch_buffer_blob() == NULL) {
*** 403,415 **** --- 416,438 ---- relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size; set_scratch_locs_memory(locs_buf); } + void Compile::clear_scratch_buffer_blob() { + assert(scratch_buffer_blob(), "no BufferBlob set"); + set_scratch_buffer_blob(NULL); + set_scratch_locs_memory(NULL); + } + + //-----------------------scratch_emit_size------------------------------------- // Helper function that computes size by emitting code uint Compile::scratch_emit_size(const Node* n) { + // Start scratch_emit_size section. + set_in_scratch_emit_size(true); + // Emit into a trash buffer and count bytes emitted. // This is a pretty expensive way to compute a size, // but it works well enough if seldom used. // All common fixed-size instructions are given a size // method by the AD file.
*** 424,440 **** relocInfo* locs_buf = scratch_locs_memory(); address blob_begin = blob->content_begin(); address blob_end = (address)locs_buf; assert(blob->content_contains(blob_end), "sanity"); CodeBuffer buf(blob_begin, blob_end - blob_begin); ! buf.initialize_consts_size(MAX_const_size); buf.initialize_stubs_size(MAX_stubs_size); assert(locs_buf != NULL, "sanity"); ! int lsize = MAX_locs_size / 2; ! buf.insts()->initialize_shared_locs(&locs_buf[0], lsize); ! buf.stubs()->initialize_shared_locs(&locs_buf[lsize], lsize); n->emit(buf, this->regalloc()); return buf.insts_size(); } // ============================================================================ --- 447,470 ---- relocInfo* locs_buf = scratch_locs_memory(); address blob_begin = blob->content_begin(); address blob_end = (address)locs_buf; assert(blob->content_contains(blob_end), "sanity"); CodeBuffer buf(blob_begin, blob_end - blob_begin); ! buf.initialize_consts_size(_scratch_const_size); buf.initialize_stubs_size(MAX_stubs_size); assert(locs_buf != NULL, "sanity"); ! int lsize = MAX_locs_size / 3; ! buf.consts()->initialize_shared_locs(&locs_buf[lsize * 0], lsize); ! buf.insts()->initialize_shared_locs( &locs_buf[lsize * 1], lsize); ! buf.stubs()->initialize_shared_locs( &locs_buf[lsize * 2], lsize); ! ! // Do the emission. n->emit(buf, this->regalloc()); + + // End scratch_emit_size section. + set_in_scratch_emit_size(false); + return buf.insts_size(); } // ============================================================================
*** 464,477 **** --- 494,510 ---- _failure_reason(NULL), _code_buffer("Compile::Fill_buffer"), _orig_pc_slot(0), _orig_pc_slot_offset_in_bytes(0), _has_method_handle_invokes(false), + _mach_constant_base_node(NULL), _node_bundling_limit(0), _node_bundling_base(NULL), _java_calls(0), _inner_loops(0), + _scratch_const_size(-1), + _in_scratch_emit_size(false), #ifndef PRODUCT _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")), _printer(IdealGraphPrinter::printer()), #endif _congraph(NULL) {
*** 731,740 **** --- 764,774 ---- _subsume_loads(true), _do_escape_analysis(false), _failure_reason(NULL), _code_buffer("Compile::Fill_buffer"), _has_method_handle_invokes(false), + _mach_constant_base_node(NULL), _node_bundling_limit(0), _node_bundling_base(NULL), _java_calls(0), _inner_loops(0), #ifndef PRODUCT
src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File