1472N/A * or visit www.oracle.com if you need additional information or have any
1879N/A#include "precompiled.hpp"
1879N/A#include "c1/c1_Compilation.hpp"
1879N/A#include "c1/c1_FrameMap.hpp"
1879N/A#include "c1/c1_Instruction.hpp"
1879N/A#include "c1/c1_LIRAssembler.hpp"
1879N/A#include "c1/c1_LIRGenerator.hpp"
1879N/A#include "c1/c1_ValueStack.hpp"
1879N/A#include "ci/ciArrayKlass.hpp"
1879N/A#include "ci/ciCPCache.hpp"
1879N/A#include "ci/ciInstance.hpp"
1879N/A#include "runtime/sharedRuntime.hpp"
1879N/A#include "runtime/stubRoutines.hpp"
1879N/A#include "utilities/bitMap.inline.hpp"
1879N/A#include "gc_implementation/g1/heapRegion.hpp"
0N/A assert(value()->operand()->is_illegal() || value()->operand()->is_constant(), "operand should never change");
0N/A if (PrintIRWithLIR) {
0N/A if (LIRTraceExecution &&
0N/A if (PrintIRWithLIR) {
0N/A assert(instr->operand() != LIR_OprFact::illegalOpr || instr->as_Constant() != NULL, "this root has not yet been visited");
0N/A // assert(instr->use_count() > 0 || instr->as_Phi() != NULL, "leaf instruction must have a use");
0N/ACodeEmitInfo* LIRGenerator::state_for(Instruction* x, ValueStack* state, bool ignore_xhandler) {
1739N/A assert(s->stack_size() == 0 && s->locals_size() == 0 && (s->locks_size() == 0 || s->locks_size() == 1), "state must be empty");
2959N/A assert(x->as_MonitorEnter() || x->as_ProfileInvoke(), "only other cases are MonitorEnter and ProfileInvoke");
0N/Avoid LIRGenerator::nio_range_check(LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
0N/A cmp_mem_int(lir_cond_belowEqual, buffer, java_nio_Buffer::limit_offset(), index->as_jint(), info);
0N/Avoid LIRGenerator::arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp_op, CodeEmitInfo* info) {
0N/A if (is_strictfp) {
0N/A if (is_power_of_2(c)) {
0N/A did_strength_reduce = true;
0N/A if (!did_strength_reduce) {
0N/A if (is_strictfp) {
0N/A default: ShouldNotReachHere();
0N/Avoid LIRGenerator::arithmetic_op_int(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp) {
0N/Avoid LIRGenerator::arithmetic_op_long(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
0N/Avoid LIRGenerator::arithmetic_op_fpu(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp) {
0N/Avoid LIRGenerator::shift_op(Bytecodes::Code code, LIR_Opr result_op, LIR_Opr value, LIR_Opr count, LIR_Opr tmp) {
0N/A default: ShouldNotReachHere();
0N/Avoid LIRGenerator::logic_op (Bytecodes::Code code, LIR_Opr result_op, LIR_Opr left_op, LIR_Opr right_op) {
0N/A default: ShouldNotReachHere();
0N/Avoid LIRGenerator::monitor_enter(LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info) {
0N/A if (!GenerateSynchronizationCode) return;
0N/A // for handling NullPointerException, use debug info representing just the lock stack before this monitorenter
1601N/Avoid LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, LIR_Opr scratch, int monitor_no) {
0N/A if (!GenerateSynchronizationCode) return;
0N/Avoid LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) {
0N/A Runtime1::StubID stub_id = klass->is_initialized() ? Runtime1::fast_new_instance_id : Runtime1::fast_new_instance_init_check_id;
0N/A CodeStub* slow_path = new NewInstanceStub(klass_reg, dst, klass, info, Runtime1::new_instance_id);
2293N/A src_objarray = (src_exact_type && src_exact_type->is_obj_array_klass()) || (src_declared_type && src_declared_type->is_obj_array_klass());
2293N/A dst_objarray = (dst_exact_type && dst_exact_type->is_obj_array_klass()) || (dst_declared_type && dst_declared_type->is_obj_array_klass());
2293N/A if (!src_objarray)
2293N/A if (!dst_objarray)
2293N/A if (!x->arg_needs_null_check(0))
2293N/A if (((arrayOopDesc::base_offset_in_bytes(t) + s_offs * element_size) % HeapWordSize == 0) &&
3966N/A err_msg_res("size mismatch: t=%s, value->type()=%s", type2name(t), type2name(value->type())));
1703N/A int t = taken_count_offset;
0N/A LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT);
0N/A assert(block()->is_set(BlockBegin::exception_entry_flag), "ExceptionObject only allowed in exception handler block");
1909N/A __ move_wide(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT),
0N/A// Code for a constant is generated lazily unless the constant is frequently used and can't be inlined.
0N/A call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), voidType, NULL);
0N/A set_no_result(x);
2346N/A if (x->needs_null_check()) {
3802N/A if (x->needs_null_check()) {
0N/A if (x->needs_null_check()) {
0N/A __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), result, info);
3042N/A __ move_wide(new LIR_Address(result, in_bytes(Klass::java_mirror_offset()), T_OBJECT), result);
1909N/A __ move_wide(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_OBJECT), reg);
0N/A set_no_result(x);
342N/Avoid LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
342N/A if (TwoOperandLIRForm ) {
342N/A assert(sizeof(*((CardTableModRefBS*)_bs)->byte_map_base) == sizeof(jbyte), "adjust this code");
1601N/A __ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
1601N/A LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
0N/A if (TwoOperandLIRForm) {
0N/A// Comment copied form templateTable_i486.cpp
0N/A// JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of
0N/A if (needs_patching) {
0N/A } else if (x->needs_null_check()) {
0N/A set_no_result(x);
0N/A if (x->needs_null_check() &&
0N/A (needs_patching ||
0N/A if (needs_patching) {
0N/A if (needs_patching) {
0N/A } else if (x->needs_null_check()) {
0N/A if (x->needs_null_check() &&
0N/A (needs_patching ||
0N/A if (needs_patching) {
0N/A//------------------------java.nio.Buffer.checkIndex------------------------
0N/A// int java.nio.Buffer.checkIndex(int)
0N/A if (GenerateRangeChecks) {
0N/A cmp_mem_int(lir_cond_belowEqual, buf.result(), java_nio_Buffer::limit_offset(), index.result()->as_jint(), info);
0N/A if (x->needs_null_check()) {
0N/A __ load(new LIR_Address(array.result(), arrayOopDesc::length_offset_in_bytes(), T_INT), reg, info, lir_patch_none);
0N/A if (use_length) {
0N/A if (needs_range_check) {
0N/A if (x->needs_null_check()) {
0N/A LIR_Address* array_addr = emit_array_address(array.result(), index.result(), x->elt_type(), false);
0N/A if (use_length) {
0N/A set_no_result(x);
0N/A if (PrintC1Statistics) {
0N/A type_is_exact = false;
0N/A if (GenerateCompilerNullChecks &&
1739N/A __ null_check(exception_opr, new CodeEmitInfo(info, x->state()->copy(ValueStack::ExceptionState, x->state()->bci())));
0N/A assert(input_opr->is_single_fpu() || input_opr->is_double_fpu(), "input should be floating-point value");
0N/A set_no_result(x);
0N/A if (log2_scale != 0) {
2346N/A // We can skip generating/checking the remaining guards and
3965N/A gen_pre_barrier = false;
2346N/A gen_offset_check = false;
3965N/A gen_pre_barrier = false;
3965N/A if (gen_pre_barrier) {
3965N/A gen_pre_barrier = false;
2346N/A gen_source_check = false;
3965N/A gen_type_check = false;
3965N/A gen_pre_barrier = false;
3965N/A if (gen_pre_barrier) {
2346N/A if (gen_offset_check) {
3965N/A if (gen_source_check) {
3965N/A if (gen_type_check) {
3965N/A __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), src_klass);
3965N/A LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(instanceKlass::reference_type_offset()), T_BYTE);
0N/A set_no_result(x);
0N/A set_no_result(x);
0N/A do_UnsafePrefetch(x, false);
0N/A do_UnsafePrefetch(x, true);
0N/Avoid LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux) {
0N/A set_no_result(x);
0N/A if (x->is_safepoint()) {
0N/A if (UseTableRanges) {
0N/A set_no_result(x);
0N/A if (x->is_safepoint()) {
0N/A if (UseTableRanges) {
0N/A set_no_result(x);
0N/A if (x->is_safepoint()) {
1703N/A if (x->should_profile()) {
1601N/A#ifndef __SOFTFP__
0N/A call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), voidType, NULL);
1739N/A CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, SynchronizationEntryBCI), NULL);
1745N/A CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, SynchronizationEntryBCI), NULL);
0N/Avoid LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) {
0N/A if (x->has_receiver()) {
0N/A if (x->has_receiver()) {
0N/A for (int i = 0; i < x->number_of_arguments(); i++) {
0N/A return argument_items;
0N/A if (x->has_receiver()) {
0N/A assert(receiver->is_illegal() || receiver->is_equal(LIR_Assembler::receiverOpr()), "must match");
3932N/A if (is_method_handle_invoke) {
0N/A } else if (x->vtable_index() < 0) {
0N/A int entry_offset = instanceKlass::vtable_start_offset() + x->vtable_index() * vtableEntry::size();
3932N/A if (is_method_handle_invoke) {
0N/A assert(ttag == addressTag || ttag == intTag || ttag == objectTag || ttag == longTag, "cannot handle others");
1977N/A __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
3677N/A#ifdef TRACE_HAVE_INTRINSICS
3677N/A __ move(new LIR_Address(thread, in_bytes(JavaThread::osthread_offset()), osthread->type()), osthread);
3677N/A __ move(new LIR_Address(osthread, in_bytes(OSThread::thread_id_offset()), T_INT), rlock_result(x));
3677N/A __ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_OBJECT), klass, info);
0N/A do_FPIntrinsics(x);
3677N/A#ifdef TRACE_HAVE_INTRINSICS
0N/A // java.nio.Buffer.checkIndex
0N/A default: ShouldNotReachHere(); break;
3932N/A __ profile_call(x->method(), x->bci_of_invoke(), x->callee(), mdo, recv, tmp, x->known_holder());
2800N/A increment_event_counter_impl(info, x->inlinee(), (1 << Tier23InlineeNotifyFreqLog) - 1, InvocationEntryBci, false, true);
1703N/A // Increment the appropriate invocation/backedge counter and notify the runtime.
1703N/A increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
2051N/A if (x->pass_thread()) {
2051N/A for (int i = 0; i < x->number_of_arguments(); i++) {
2051N/A set_no_result(x);
0N/ALIR_Opr LIRGenerator::call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info) {
0N/ALIR_Opr LIRGenerator::call_runtime(Value arg1, Value arg2, address entry, ValueType* result_type, CodeEmitInfo* info) {
3560N/A default : ShouldNotReachHere(); break;