# HG changeset patch # User Lukas Stadler # Date 1283386418 25200 # Node ID b61a43cd12559b281b73f826a41e11122400b874 # Parent c01535d7fcc6ba07571d508c1ed61683cf3ed0aa sourcecode formatting diff -r c01535d7fcc6 -r b61a43cd1255 c1x4hotspotsrc/hotspot/.project --- a/c1x4hotspotsrc/hotspot/.project Wed Sep 01 16:43:47 2010 -0700 +++ b/c1x4hotspotsrc/hotspot/.project Wed Sep 01 17:13:38 2010 -0700 @@ -96,11 +96,6 @@ PARENT-2-PROJECT_LOC/build/linux/linux_amd64_compiler1/generated - jvmg - 2 - build/linux/linux_amd64_compiler1/jvmg - - os 2 PARENT-2-PROJECT_LOC/src/os/linux diff -r c01535d7fcc6 -r b61a43cd1255 c1x4hotspotsrc/hotspot/.settings/org.eclipse.cdt.core.prefs --- a/c1x4hotspotsrc/hotspot/.settings/org.eclipse.cdt.core.prefs Wed Sep 01 16:43:47 2010 -0700 +++ b/c1x4hotspotsrc/hotspot/.settings/org.eclipse.cdt.core.prefs Wed Sep 01 17:13:38 2010 -0700 @@ -1,4 +1,4 @@ -#Wed Sep 01 16:30:28 PDT 2010 +#Wed Sep 01 16:57:34 PDT 2010 eclipse.preferences.version=1 org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80 @@ -144,7 +144,7 @@ org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=true org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.cdt.core.formatter.lineSplit=140 +org.eclipse.cdt.core.formatter.lineSplit=160 org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.cdt.core.formatter.tabulation.char=space diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_CodeInstaller.cpp --- a/src/share/vm/c1x/c1x_CodeInstaller.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -22,15 +22,15 @@ * */ - # include "incls/_precompiled.incl" # include "incls/_c1x_CodeInstaller.cpp.incl" #define C1X_REGISTER_COUNT 32 +// convert c1x register indices (as used in oop maps) to hotspot registers VMReg get_hotspot_reg(jint c1x_reg) { Register cpu_registers[] = { rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15 }; - XMMRegister xmm_registers[] = { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 }; + XMMRegister xmm_registers[] = { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 }; if (c1x_reg < 16) { return cpu_registers[c1x_reg]->as_VMReg(); @@ -38,16 +38,16 @@ assert(c1x_reg < C1X_REGISTER_COUNT, "invalid register number"); return xmm_registers[c1x_reg - 16]->as_VMReg(); } - } +// creates a hotspot oop map out of the byte arrays provided by CiDebugInfo static OopMap* create_oop_map(jint frame_size, jint parameter_count, oop debug_info) { OopMap* map = new OopMap(frame_size, parameter_count); - arrayOop register_map = (arrayOop)CiDebugInfo::registerRefMap(debug_info); - arrayOop frame_map = (arrayOop)CiDebugInfo::frameRefMap(debug_info); + arrayOop register_map = (arrayOop) CiDebugInfo::registerRefMap(debug_info); + arrayOop frame_map = (arrayOop) CiDebugInfo::frameRefMap(debug_info); - for (jint i=0; ibase(T_BYTE))[i / 8]; + for (jint i = 0; i < C1X_REGISTER_COUNT; i++) { + unsigned char byte = ((unsigned char*) register_map->base(T_BYTE))[i / 8]; bool is_oop = (byte & (1 << (i % 8))) != 0; VMReg reg = get_hotspot_reg(i); if (is_oop) { @@ -57,8 +57,8 @@ } } - for (jint i=0; ibase(T_BYTE))[i / 8]; + for (jint i = 0; i < frame_size; i++) { + unsigned char byte = ((unsigned char*) frame_map->base(T_BYTE))[i / 8]; bool is_oop = (byte & (1 << (i % 8))) != 0; VMReg reg = VMRegImpl::stack2reg(i); if (is_oop) { @@ -72,6 +72,7 @@ return map; } +// TODO: finish this - c1x doesn't provide any scope values at the moment static ScopeValue* get_hotspot_value(oop value) { fatal("not implemented"); if (value->is_a(CiRegisterValue::klass())) { @@ -85,7 +86,6 @@ } } - // constructor used to create a method CodeInstaller::CodeInstaller(oop target_method) { VM_ENTRY_MARK; @@ -100,7 +100,7 @@ _offsets.set_value(CodeOffsets::Deopt, 0); methodOop method = VmIds::get(HotSpotMethodResolved::vmId(_hotspot_method)); - ciMethod *ciMethodObject = (ciMethod *)_env->get_object(method); + ciMethod *ciMethodObject = (ciMethod *) _env->get_object(method); _parameter_count = method->size_of_parameters(); // (very) conservative estimate: each site needs a relocation @@ -108,20 +108,10 @@ initialize_buffer(buffer); process_exception_handlers(); { - ThreadToNativeFromVM t((JavaThread*)THREAD); - _env->register_method(ciMethodObject, - -1, - &_offsets, - 0, - &buffer, - (_frame_size / HeapWordSize) + 2, // conversion to words, need to add two slots for ret address and frame pointer - _debug_recorder->_oopmaps, - &_exception_handler_table, - &_implicit_exception_table, - C1XCompiler::instance(), - _env->comp_level(), - false, - false); + int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer + ThreadToNativeFromVM t((JavaThread*) THREAD); + _env->register_method(ciMethodObject, -1, &_offsets, 0, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, + &_implicit_exception_table, C1XCompiler::instance(), _env->comp_level(), false, false); } } @@ -138,8 +128,8 @@ initialize_buffer(buffer); const char* cname = java_lang_String::as_utf8_string(_name); - BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created - IF_TRACE_C1X_3 Disassembler::decode((CodeBlob*)blob); + BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created + IF_TRACE_C1X_3 Disassembler::decode((CodeBlob*) blob); id = VmIds::addStub(blob->instructions_begin()); } @@ -147,10 +137,10 @@ _citarget_method = HotSpotTargetMethod::targetMethod(target_method); _hotspot_method = HotSpotTargetMethod::method(target_method); _name = HotSpotTargetMethod::name(target_method); - _sites = (arrayOop)HotSpotTargetMethod::sites(target_method); - _exception_handlers = (arrayOop)HotSpotTargetMethod::exceptionHandlers(target_method); + _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); + _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method); - _code = (arrayOop)CiTargetMethod::targetCode(_citarget_method); + _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method); _code_size = CiTargetMethod::targetCodeSize(_citarget_method); _frame_size = CiTargetMethod::frameSize(_citarget_method); @@ -182,8 +172,8 @@ memcpy(_instructions->start(), _code->base(T_BYTE), _code_size); _instructions->set_end(_instructions->start() + _code_size); - oop* sites = (oop*)_sites->base(T_OBJECT); - for (int i=0; i<_sites->length(); i++) { + oop* sites = (oop*) _sites->base(T_OBJECT); + for (int i = 0; i < _sites->length(); i++) { oop site = sites[i]; jint pc_offset = CiTargetMethod_Site::pcOffset(site); @@ -208,17 +198,17 @@ void CodeInstaller::process_exception_handlers() { // allocate some arrays for use by the collection code. const int num_handlers = 5; - GrowableArray* bcis = new GrowableArray(num_handlers); - GrowableArray* scope_depths = new GrowableArray(num_handlers); - GrowableArray* pcos = new GrowableArray(num_handlers); + GrowableArray* bcis = new GrowableArray (num_handlers); + GrowableArray* scope_depths = new GrowableArray (num_handlers); + GrowableArray* pcos = new GrowableArray (num_handlers); if (_exception_handlers != NULL) { - oop* exception_handlers = (oop*)_exception_handlers->base(T_OBJECT); - for (int i=0; i<_exception_handlers->length(); i++) { + oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); + for (int i = 0; i < _exception_handlers->length(); i++) { jint pc_offset = CiTargetMethod_Site::pcOffset(exception_handlers[i]); int start = i; - while ((i + 1)<_exception_handlers->length() && CiTargetMethod_Site::pcOffset(exception_handlers[i + 1]) == pc_offset) - i ++; + while ((i + 1) < _exception_handlers->length() && CiTargetMethod_Site::pcOffset(exception_handlers[i + 1]) == pc_offset) + i++; // empty the arrays bcis->trunc_to(0); @@ -256,23 +246,22 @@ pcos->append(handler_offset); // stop processing once we hit a catch any -// if (handler->is_catch_all()) { -// assert(i == handlers->length() - 1, "catch all must be last handler"); -// } + // if (handler->is_catch_all()) { + // assert(i == handlers->length() - 1, "catch all must be last handler"); + // } } _exception_handler_table.add_subtable(pc_offset, bcis, scope_depths, pcos); } } - } -void CodeInstaller::record_frame(jint pc_offset, oop code_pos, oop frame) { +void CodeInstaller::record_scope(jint pc_offset, oop code_pos, oop frame) { oop caller_pos = CiCodePos::caller(code_pos); if (caller_pos != NULL) { oop caller_frame = CiDebugInfo_Frame::caller(frame); - record_frame(pc_offset, caller_pos, caller_frame); + record_scope(pc_offset, caller_pos, caller_frame); } else { assert(frame == NULL || CiDebugInfo_Frame::caller(frame) == NULL, "unexpected layout - mismatching nesting of Frame and CiCodePos"); } @@ -282,24 +271,24 @@ oop hotspot_method = CiCodePos::method(code_pos); assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotMethodResolved::klass()), "unexpected hotspot method"); methodOop method = VmIds::get(HotSpotMethodResolved::vmId(hotspot_method)); - ciMethod *cimethod = (ciMethod *)_env->get_object(method); + ciMethod *cimethod = (ciMethod *) _env->get_object(method); jint bci = CiCodePos::bci(code_pos); if (frame != NULL) { jint local_count = CiDebugInfo_Frame::numLocals(frame); jint expression_count = CiDebugInfo_Frame::numStack(frame); jint monitor_count = CiDebugInfo_Frame::numLocks(frame); - arrayOop values = (arrayOop)CiDebugInfo_Frame::values(frame); + arrayOop values = (arrayOop) CiDebugInfo_Frame::values(frame); assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length"); assert(monitor_count == 0, "monitors not supported"); - GrowableArray* locals = new GrowableArray(); - GrowableArray* expressions = new GrowableArray(); - GrowableArray* monitors = new GrowableArray(); + GrowableArray* locals = new GrowableArray (); + GrowableArray* expressions = new GrowableArray (); + GrowableArray* monitors = new GrowableArray (); - for (jint i=0; ilength(); i++) { - ScopeValue* value = get_hotspot_value(((oop*)values->base(T_OBJECT))[i]); + for (jint i = 0; i < values->length(); i++) { + ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i]); if (i < local_count) { locals->append(value); @@ -320,18 +309,17 @@ } } - void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) { oop debug_info = CiTargetMethod_Safepoint::debugInfo(site); assert(debug_info != NULL, "debug info expected"); -// address instruction = _instructions->start() + pc_offset; -// jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); + // address instruction = _instructions->start() + pc_offset; + // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); _debug_recorder->add_safepoint(pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); oop code_pos = CiDebugInfo::codePos(debug_info); oop frame = CiDebugInfo::frame(debug_info); - record_frame(pc_offset, code_pos, frame); + record_scope(pc_offset, code_pos, frame); _debug_recorder->end_safepoint(pc_offset); } @@ -343,8 +331,8 @@ oop global_stub = CiTargetMethod_Call::globalStubID(site); oop debug_info = CiTargetMethod_Call::debugInfo(site); - arrayOop stack_map = (arrayOop)CiTargetMethod_Call::stackMap(site); - arrayOop register_map = (arrayOop)CiTargetMethod_Call::registerMap(site); + arrayOop stack_map = (arrayOop) CiTargetMethod_Call::stackMap(site); + arrayOop register_map = (arrayOop) CiTargetMethod_Call::registerMap(site); assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (symbol ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); @@ -355,7 +343,7 @@ _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); oop code_pos = CiDebugInfo::codePos(debug_info); oop frame = CiDebugInfo::frame(debug_info); - record_frame(next_pc_offset, code_pos, frame); + record_scope(next_pc_offset, code_pos, frame); } if (runtime_call != NULL) { @@ -386,13 +374,12 @@ assert(debug_info != NULL, "debug info expected"); methodOop method = NULL; - if (hotspot_method->is_a(HotSpotMethodResolved::klass())) - method = VmIds::get(HotSpotMethodResolved::vmId(hotspot_method)); + if (hotspot_method->is_a(HotSpotMethodResolved::klass())) method = VmIds::get(HotSpotMethodResolved::vmId(hotspot_method)); assert(debug_info != NULL, "debug info expected"); TRACE_C1X_3("method call"); - switch(_next_call_type) { + switch (_next_call_type) { case MARK_INVOKEVIRTUAL: case MARK_INVOKEINTERFACE: { assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); @@ -417,7 +404,7 @@ } case MARK_INVOKE_INVALID: default: - ShouldNotReachHere(); + fatal("invalid _next_call_type value") break; } } @@ -433,13 +420,14 @@ address instruction = _instructions->start() + pc_offset; - switch(CiKind::typeChar(kind)) { + switch (CiKind::typeChar(kind)) { case 'z': case 'b': case 's': case 'c': case 'i': - fatal("int-sized values not expected in DataPatch"); + fatal("int-sized values not expected in DataPatch") + ; break; case 'f': case 'l': @@ -448,14 +436,14 @@ address next_instruction = Assembler::locate_next_instruction(instruction); // we don't care if this is a long/double/etc., the primitive field contains the right bits address dest = _constants->end(); - *(jlong*)dest = CiConstant::primitive(constant); + *(jlong*) dest = CiConstant::primitive(constant); _constants->set_end(dest + BytesPerLong); long disp = dest - next_instruction; assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); - *((jint*)operand) = (jint)disp; + *((jint*) operand) = (jint) disp; - _instructions->relocate(instruction, section_word_Relocation::spec((address)dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); + _instructions->relocate(instruction, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); TRACE_C1X_3("relocating (Float/Long/Double) at %016x/%016x", instruction, operand); break; } @@ -464,7 +452,7 @@ oop obj = CiConstant::object(constant); if (obj->is_a(HotSpotTypeResolved::klass())) { - *((jobject*)operand) = JNIHandles::make_local(VmIds::get(HotSpotTypeResolved::vmId(obj))); + *((jobject*) operand) = JNIHandles::make_local(VmIds::get(HotSpotTypeResolved::vmId(obj))); _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); TRACE_C1X_3("relocating (HotSpotType) at %016x/%016x", instruction, operand); } else { @@ -476,9 +464,9 @@ address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); if (id == VmIds::DUMMY_CONSTANT) { - *((jobject*)operand) = (jobject)Universe::non_oop_word(); + *((jobject*) operand) = (jobject) Universe::non_oop_word(); } else { - *((jobject*)operand) = JNIHandles::make_local(VmIds::get(id)); + *((jobject*) operand) = JNIHandles::make_local(VmIds::get(id)); } _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); TRACE_C1X_3("relocating (oop constant) at %016x/%016x", instruction, operand); @@ -486,14 +474,14 @@ break; } default: - fatal("unexpected CiKind in DataPatch"); + fatal("unexpected CiKind in DataPatch") break; } } void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) { oop id_obj = CiTargetMethod_Mark::id(site); - arrayOop references = (arrayOop)CiTargetMethod_Mark::references(site); + arrayOop references = (arrayOop) CiTargetMethod_Mark::references(site); if (id_obj != NULL) { assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected"); @@ -519,7 +507,7 @@ break; case MARK_STATIC_CALL_STUB: { assert(references->length() == 1, "static call stub needs one reference"); - oop ref = ((oop*)references->base(T_OBJECT))[0]; + oop ref = ((oop*) references->base(T_OBJECT))[0]; address call_pc = _instructions->start() + CiTargetMethod_Site::pcOffset(ref); _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc)); break; @@ -529,7 +517,7 @@ case MARK_INVOKESTATIC: case MARK_INVOKESPECIAL: case MARK_INVOKEVIRTUAL: - _next_call_type = (MarkId)id; + _next_call_type = (MarkId) id; _invoke_mark_pc = instruction; break; case MARK_IMPLICIT_NULL: @@ -543,8 +531,8 @@ assert(*byte_skip == 5, "unexpected byte_skip"); assert(references->length() == 2, "MARK_KLASS_PATCHING needs 2 references"); - oop ref1 = ((oop*)references->base(T_OBJECT))[0]; - oop ref2 = ((oop*)references->base(T_OBJECT))[1]; + oop ref1 = ((oop*) references->base(T_OBJECT))[0]; + oop ref2 = ((oop*) references->base(T_OBJECT))[1]; int i_byte_count = CiTargetMethod_Site::pcOffset(ref2) - CiTargetMethod_Site::pcOffset(ref1); assert(i_byte_count == (unsigned char)i_byte_count, "invalid offset"); *byte_count = i_byte_count; @@ -555,85 +543,14 @@ case MARK_DUMMY_OOP_RELOCATION: { _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); - RelocIterator iter(_instructions, (address)instruction, (address)(instruction + 1)); + RelocIterator iter(_instructions, (address) instruction, (address) (instruction + 1)); relocInfo::change_reloc_info_for_address(&iter, (address) instruction, relocInfo::oop_type, relocInfo::none); break; } default: - ShouldNotReachHere(); + ShouldNotReachHere() break; } } } - - -/* - if (_relocation_count > 0) { - jint* relocation_offsets = (jint*)((arrayOop)JNIHandles::resolve(_relocation_offsets))->base(T_INT); - oop* relocation_objects = (oop*)((arrayOop)JNIHandles::resolve(_relocation_data))->base(T_OBJECT); - - for (int i = 0; i < _relocation_count; i++) { - address inst = (address)instructions->start() + relocation_offsets[i]; - u_char inst_byte = *inst; - oop obj = relocation_objects[i]; - assert(obj != NULL, "NULL oop needn't be patched"); - - if (obj->is_a(SystemDictionary::HotSpotProxy_klass())) { - jlong id = com_sun_hotspot_c1x_HotSpotProxy::get_id(obj); - switch (id & VmIds::TYPE_MASK) { - case VmIds::CONSTANT: { - address operand = Assembler::locate_operand(inst, Assembler::imm_operand); - - *((jobject*)operand) = JNIHandles::make_local(VmIds::get(id)); - instructions->relocate(inst, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); - tty->print_cr("relocating (HotSpotType) %02x at %016x/%016x", inst_byte, inst, operand); - break; - } - case VmIds::STUB: { - address operand = Assembler::locate_operand(inst, Assembler::call32_operand); - - long dest = (long)VmIds::getStub(id); - long disp = dest - (long)(operand + 4); - assert(disp == (int) disp, "disp doesn't fit in 32 bits"); - *((int*)operand) = (int)disp; - - instructions->relocate(inst, runtime_call_Relocation::spec(), Assembler::call32_operand); - tty->print_cr("relocating (Long) %02x at %016x/%016x", inst_byte, inst, operand); - break; - } - } - } else if (java_lang_boxing_object::is_instance(obj)) { - address operand = Assembler::locate_operand(inst, Assembler::disp32_operand); - long dest = (long)constants->end(); - if (java_lang_boxing_object::is_instance(obj, T_LONG)) { - // tty->print("relocate: %l\n", obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG))); - *(jlong*)constants->end() = obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); - } else if (java_lang_boxing_object::is_instance(obj, T_DOUBLE)) { - // tty->print("relocate: %f\n", obj->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); - *(jdouble*)constants->end() = obj->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE)); - } else if (java_lang_boxing_object::is_instance(obj, T_FLOAT)) { - // tty->print("relocate: %f\n", obj->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); - *(jfloat*)constants->end() = obj->float_field(java_lang_boxing_object::value_offset_in_bytes(T_FLOAT)); - } - constants->set_end(constants->end() + 8); - - long disp = dest - (long)(operand + 4); - assert(disp == (int) disp, "disp doesn't fit in 32 bits"); - *((int*)operand) = (int)disp; - - instructions->relocate(inst, section_word_Relocation::spec((address)dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); - tty->print_cr("relocating (Long/Double) %02x at %016x/%016x", inst_byte, inst, operand); - } else if (obj->is_a(_types.HotSpotTypeResolved)) { - address operand = Assembler::locate_operand(inst, Assembler::imm_operand); - - *((jobject*)operand) = JNIHandles::make_local(VmIds::get(obj->obj_field(_types.HotSpotTypeResolved_klassOop))); - instructions->relocate(inst, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); - tty->print_cr("relocating (HotSpotType) %02x at %016x/%016x", inst_byte, inst, operand); - } else { - tty->print_cr("unknown relocation type"); - obj->print(); - } - } - }*/ - diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_CodeInstaller.hpp --- a/src/share/vm/c1x/c1x_CodeInstaller.hpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_CodeInstaller.hpp Wed Sep 01 17:13:38 2010 -0700 @@ -89,7 +89,7 @@ void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site); void site_Mark(CodeBuffer& buffer, jint pc_offset, oop site); - void record_frame(jint pc_offset, oop code_pos, oop frame); + void record_scope(jint pc_offset, oop code_pos, oop frame); void process_exception_handlers(); diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_Compiler.cpp --- a/src/share/vm/c1x/c1x_Compiler.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_Compiler.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -22,32 +22,28 @@ * */ - # include "incls/_precompiled.incl" # include "incls/_c1x_Compiler.cpp.incl" C1XCompiler* C1XCompiler::_instance = NULL; - C1XCompiler::C1XCompiler() { _initialized = false; assert(_instance == NULL, "only one instance allowed"); _instance = this; } - - // Initialization void C1XCompiler::initialize() { if (_initialized) return; _initialized = true; TRACE_C1X_1("C1XCompiler::initialize"); - JNIEnv *env = ((JavaThread *)Thread::current())->jni_environment(); + JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntriesNative"); assert(klass != NULL, "c1x VMEntries class not found"); - env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count() ); - + env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); + check_pending_exception("Could not register natives"); c1x_compute_offsets(); @@ -56,7 +52,6 @@ // Compilation entry point for methods void C1XCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { initialize(); - VM_ENTRY_MARK; ResourceMark rm; HandleMark hm; @@ -64,7 +59,7 @@ VmIds::initializeObjects(); CompilerThread::current()->set_compiling(true); - methodOop method = (methodOop)target->get_oop(); + methodOop method = (methodOop) target->get_oop(); VMExits::compileMethod(VmIds::add(method), VmIds::toString(method->name(), THREAD), entry_bci); CompilerThread::current()->set_compiling(false); @@ -79,13 +74,13 @@ oop C1XCompiler::get_RiType(ciType *type, klassOop accessor, TRAPS) { if (type->is_loaded()) { if (type->is_primitive_type()) { - return VMExits::createRiTypePrimitive((int)type->basic_type(), THREAD); + return VMExits::createRiTypePrimitive((int) type->basic_type(), THREAD); } - KlassHandle klass = (klassOop)type->get_oop(); + KlassHandle klass = (klassOop) type->get_oop(); Handle name = VmIds::toString(klass->name(), THREAD); return createHotSpotTypeResolved(klass, name, CHECK_NULL); } else { - symbolOop name = ((ciKlass *)type)->name()->get_symbolOop(); + symbolOop name = ((ciKlass *) type)->name()->get_symbolOop(); return VMExits::createRiTypeUnresolved(VmIds::toString(name, THREAD), VmIds::add(accessor), THREAD); } } @@ -100,7 +95,6 @@ return VMExits::createRiField(field_holder, field_name, field_type, offset, THREAD); } - oop C1XCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL); oop obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL); @@ -128,5 +122,3 @@ return obj; } - - diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_TargetMethod.cpp --- a/src/share/vm/c1x/c1x_TargetMethod.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_TargetMethod.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -22,7 +22,6 @@ * */ - # include "incls/_precompiled.incl" # include "incls/_c1x_TargetMethod.cpp.incl" diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_VMEntries.cpp --- a/src/share/vm/c1x/c1x_VMEntries.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_VMEntries.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -22,19 +22,15 @@ * */ - # include "incls/_precompiled.incl" # include "incls/_c1x_VMEntries.cpp.incl" - - - // public byte[] RiMethod_code(long vmId); JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) { methodOop method = VmIds::get(vmId); int code_size = method->code_size(); jbyteArray result = env->NewByteArray(code_size); - env->SetByteArrayRegion(result, 0, code_size, (const jbyte *)method->code_base()); + env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); return result; } @@ -80,7 +76,7 @@ instanceKlass::cast(HotSpotExceptionHandler::klass())->initialize(CHECK_NULL); objArrayHandle array = oopFactory::new_objArray(SystemDictionary::RiExceptionHandler_klass(), handler_count, CHECK_NULL); - for (int i=0; iallocate_instance(CHECK_NULL); @@ -94,7 +90,7 @@ HotSpotExceptionHandler::set_catchClass(entry, NULL); } else { constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); - ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(method->method_holder()); + ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(method->method_holder()); bool is_accessible = false; ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, catch_class_index, is_accessible, loading_klass); oop catch_class = C1XCompiler::get_RiType(klass, method->method_holder(), CHECK_NULL); @@ -104,7 +100,7 @@ array->obj_at_put(i, entry()); } - return (jobjectArray)JNIHandles::make_local(array()); + return (jobjectArray) JNIHandles::make_local(array()); } // public RiType RiSignature_lookupType(String returnType, long accessingClassVmId); @@ -116,21 +112,21 @@ oop result; if (nameSymbol == vmSymbols::int_signature()) { - result = VMExits::createRiTypePrimitive((int)T_INT, THREAD); + result = VMExits::createRiTypePrimitive((int) T_INT, THREAD); } else if (nameSymbol == vmSymbols::long_signature()) { - result = VMExits::createRiTypePrimitive((int)T_LONG, THREAD); + result = VMExits::createRiTypePrimitive((int) T_LONG, THREAD); } else if (nameSymbol == vmSymbols::bool_signature()) { - result = VMExits::createRiTypePrimitive((int)T_BOOLEAN, THREAD); + result = VMExits::createRiTypePrimitive((int) T_BOOLEAN, THREAD); } else if (nameSymbol == vmSymbols::char_signature()) { - result = VMExits::createRiTypePrimitive((int)T_CHAR, THREAD); + result = VMExits::createRiTypePrimitive((int) T_CHAR, THREAD); } else if (nameSymbol == vmSymbols::short_signature()) { - result = VMExits::createRiTypePrimitive((int)T_SHORT, THREAD); + result = VMExits::createRiTypePrimitive((int) T_SHORT, THREAD); } else if (nameSymbol == vmSymbols::byte_signature()) { - result = VMExits::createRiTypePrimitive((int)T_BYTE, THREAD); + result = VMExits::createRiTypePrimitive((int) T_BYTE, THREAD); } else if (nameSymbol == vmSymbols::double_signature()) { - result = VMExits::createRiTypePrimitive((int)T_DOUBLE, THREAD); + result = VMExits::createRiTypePrimitive((int) T_DOUBLE, THREAD); } else if (nameSymbol == vmSymbols::float_signature()) { - result = VMExits::createRiTypePrimitive((int)T_FLOAT, THREAD); + result = VMExits::createRiTypePrimitive((int) T_FLOAT, THREAD); } else { Handle classloader; Handle protectionDomain; @@ -181,7 +177,7 @@ result = VMExits::createCiConstantObject(VmIds::add(string), CHECK_0); } else if (tag.is_klass() || tag.is_unresolved_klass()) { bool ignore; - ciInstanceKlass* accessor = (ciInstanceKlass*)ciEnv::current()->get_object(cp->pool_holder()); + ciInstanceKlass* accessor = (ciInstanceKlass*) ciEnv::current()->get_object(cp->pool_holder()); ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor); result = C1XCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL); } else if (tag.is_object()) { @@ -201,16 +197,16 @@ constantPoolHandle cp = VmIds::get(vmId); - Bytecodes::Code bc = (Bytecodes::Code)(((int)byteCode) & 0xFF); - ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); + Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); + ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass); if (cimethod->is_loaded()) { - methodOop method = (methodOop)cimethod->get_oop(); + methodOop method = (methodOop) cimethod->get_oop(); Handle name = VmIds::toString(method->name(), CHECK_NULL); return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add(method), name, THREAD)); } else { - Handle name = VmIds::toString((symbolOop)cimethod->name()->get_oop(), CHECK_NULL); - Handle signature = VmIds::toString((symbolOop)cimethod->signature()->as_symbol()->get_oop(), CHECK_NULL); + Handle name = VmIds::toString((symbolOop) cimethod->name()->get_oop(), CHECK_NULL); + Handle signature = VmIds::toString((symbolOop) cimethod->signature()->as_symbol()->get_oop(), CHECK_NULL); Handle holder = C1XCompiler::get_RiType(cimethod->holder(), cp->klass(), THREAD); return JNIHandles::make_local(THREAD, VMExits::createRiMethodUnresolved(name, signature, holder, THREAD)); } @@ -228,7 +224,7 @@ constantPoolOop cp = VmIds::get(vmId); - ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); + ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); bool is_accessible = false; ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass); return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD)); @@ -240,7 +236,7 @@ constantPoolOop cp = VmIds::get(vmId); - ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); + ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); return JNIHandles::make_local(THREAD, C1XCompiler::get_RiField(field, THREAD)); } diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_VMExits.cpp --- a/src/share/vm/c1x/c1x_VMExits.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_VMExits.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -26,11 +26,11 @@ # include "incls/_c1x_VMExits.cpp.incl" // these are *local* handles, and they need to be cleared before compileMethod returns -KlassHandle VMExits::_vmExitsKlass; -Handle VMExits::_vmExitsObject; +KlassHandle VMExits::_vmExitsKlass; +Handle VMExits::_vmExitsObject; // this is a *global* handle -jobject VMExits::_vmExitsPermObject; +jobject VMExits::_vmExitsPermObject; KlassHandle &VMExits::vmExitsKlass() { if (_vmExitsKlass.is_null()) { @@ -50,7 +50,7 @@ JavaCallArguments args; JavaCalls::call_static(&result, compiler_klass(), vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current()); check_pending_exception("Couldn't get VMExits"); - oop res = (oop)result.get_jobject(); + oop res = (oop) result.get_jobject(); _vmExitsPermObject = JNIHandles::make_global(res); } _vmExitsObject = JNIHandles::resolve(_vmExitsPermObject); @@ -84,7 +84,7 @@ args.push_oop(name); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodResolved_name(), vmSymbols::createRiMethodResolved_signature(), &args, THREAD); check_pending_exception("Error while calling createRiMethodResolved"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS) { @@ -97,7 +97,7 @@ args.push_oop(holder); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodUnresolved_name(), vmSymbols::createRiMethodUnresolved_signature(), &args, THREAD); check_pending_exception("Error while calling createRiMethodUnresolved"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiField(Handle holder, Handle name, Handle type, int index, TRAPS) { @@ -113,7 +113,7 @@ args.push_int(index); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiField_name(), vmSymbols::createRiField_signature(), &args, THREAD); check_pending_exception("Error while calling createRiField"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiType(jlong vmId, Handle name, TRAPS) { @@ -125,7 +125,7 @@ args.push_oop(name); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiType_name(), vmSymbols::createRiType_signature(), &args, THREAD); check_pending_exception("Error while calling createRiType"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiTypePrimitive(int basic_type, TRAPS) { @@ -135,7 +135,7 @@ args.push_int(basic_type); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypePrimitive_name(), vmSymbols::createRiTypePrimitive_signature(), &args, THREAD); check_pending_exception("Error while calling createRiTypePrimitive"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiTypeUnresolved(Handle name, jlong accessingClassVmId, TRAPS) { @@ -147,7 +147,7 @@ args.push_long(accessingClassVmId); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypeUnresolved_name(), vmSymbols::createRiTypeUnresolved_signature(), &args, THREAD); check_pending_exception("Error while calling createRiTypeUnresolved"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiConstantPool(jlong vmId, TRAPS) { @@ -157,7 +157,7 @@ args.push_long(vmId); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiConstantPool_name(), vmSymbols::createRiConstantPool_signature(), &args, THREAD); check_pending_exception("Error while calling createRiConstantPool"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createRiSignature(Handle name, TRAPS) { @@ -168,7 +168,7 @@ args.push_oop(name); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiSignature_name(), vmSymbols::createRiSignature_signature(), &args, THREAD); check_pending_exception("Error while calling createRiSignature"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createCiConstantInt(jint value, TRAPS) { @@ -178,7 +178,7 @@ args.push_int(value); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantInt_name(), vmSymbols::createCiConstantInt_signature(), &args, THREAD); check_pending_exception("Error while calling createCiConstantInt"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } @@ -189,7 +189,7 @@ args.push_long(value); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantLong_name(), vmSymbols::createCiConstantLong_signature(), &args, THREAD); check_pending_exception("Error while calling createCiConstantFloat"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } @@ -200,7 +200,7 @@ args.push_float(value); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantFloat_name(), vmSymbols::createCiConstantFloat_signature(), &args, THREAD); check_pending_exception("Error while calling createCiConstantFloat"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } @@ -211,7 +211,7 @@ args.push_double(value); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantDouble_name(), vmSymbols::createCiConstantDouble_signature(), &args, THREAD); check_pending_exception("Error while calling createCiConstantDouble"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } oop VMExits::createCiConstantObject(jlong vmId, TRAPS) { @@ -221,5 +221,5 @@ args.push_long(vmId); JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantObject_name(), vmSymbols::createCiConstantLong_signature(), &args, THREAD); check_pending_exception("Error while calling createCiConstantObject"); - return (oop)result.get_jobject(); + return (oop) result.get_jobject(); } diff -r c01535d7fcc6 -r b61a43cd1255 src/share/vm/c1x/c1x_VmIds.cpp --- a/src/share/vm/c1x/c1x_VmIds.cpp Wed Sep 01 16:43:47 2010 -0700 +++ b/src/share/vm/c1x/c1x_VmIds.cpp Wed Sep 01 17:13:38 2010 -0700 @@ -33,14 +33,14 @@ void VmIds::initializeObjects() { if (_stubs == NULL) { assert(_localHandles == NULL, "inconsistent state"); - _stubs = new(ResourceObj::C_HEAP) GrowableArray
(64, true); - _localHandles = new(ResourceObj::C_HEAP) GrowableArray(64, true); + _stubs = new (ResourceObj::C_HEAP) GrowableArray
(64, true); + _localHandles = new (ResourceObj::C_HEAP) GrowableArray (64, true); } assert(_localHandles->length() == 0, "invalid state"); } void VmIds::cleanupLocalObjects() { - for (int i=0; i<_localHandles->length(); i++) { + for (int i = 0; i < _localHandles->length(); i++) { JNIHandles::destroy_global(_localHandles->at(i)); } _localHandles->clear(); @@ -54,7 +54,7 @@ jlong VmIds::add(Handle obj, CompilerObjectType type) { assert(!obj.is_null(), "cannot add NULL handle"); int idx = -1; - for (int i=0; i<_localHandles->length(); i++) + for (int i = 0; i < _localHandles->length(); i++) if (JNIHandles::resolve_non_null(_localHandles->at(i)) == obj()) { idx = i; break;