src/cpu/x86/vm/c1_LIRAssembler_x86.cpp

changeset 1651
7f8790caccb0
parent 1648
6deeaebad47a
parent 1641
87684f1a88b5
child 1692
7b4415a18c8a
     1.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Feb 02 11:08:17 2010 -0700
     1.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Feb 04 15:50:59 2010 -0800
     1.3 @@ -418,13 +418,12 @@
     1.4  }
     1.5  
     1.6  
     1.7 -void LIR_Assembler::emit_exception_handler() {
     1.8 +int LIR_Assembler::emit_exception_handler() {
     1.9    // if the last instruction is a call (typically to do a throw which
    1.10    // is coming at the end after block reordering) the return address
    1.11    // must still point into the code area in order to avoid assertion
    1.12    // failures when searching for the corresponding bci => add a nop
    1.13    // (was bug 5/14/1999 - gri)
    1.14 -
    1.15    __ nop();
    1.16  
    1.17    // generate code for exception handler
    1.18 @@ -432,13 +431,10 @@
    1.19    if (handler_base == NULL) {
    1.20      // not enough space left for the handler
    1.21      bailout("exception handler overflow");
    1.22 -    return;
    1.23 +    return -1;
    1.24    }
    1.25 -#ifdef ASSERT
    1.26 +
    1.27    int offset = code_offset();
    1.28 -#endif // ASSERT
    1.29 -
    1.30 -  compilation()->offsets()->set_value(CodeOffsets::Exceptions, code_offset());
    1.31  
    1.32    // if the method does not have an exception handler, then there is
    1.33    // no reason to search for one
    1.34 @@ -474,19 +470,19 @@
    1.35    // unwind activation and forward exception to caller
    1.36    // rax,: exception
    1.37    __ jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));
    1.38 -
    1.39    assert(code_offset() - offset <= exception_handler_size, "overflow");
    1.40 -
    1.41    __ end_a_stub();
    1.42 +
    1.43 +  return offset;
    1.44  }
    1.45  
    1.46 -void LIR_Assembler::emit_deopt_handler() {
    1.47 +
    1.48 +int LIR_Assembler::emit_deopt_handler() {
    1.49    // if the last instruction is a call (typically to do a throw which
    1.50    // is coming at the end after block reordering) the return address
    1.51    // must still point into the code area in order to avoid assertion
    1.52    // failures when searching for the corresponding bci => add a nop
    1.53    // (was bug 5/14/1999 - gri)
    1.54 -
    1.55    __ nop();
    1.56  
    1.57    // generate code for exception handler
    1.58 @@ -494,23 +490,17 @@
    1.59    if (handler_base == NULL) {
    1.60      // not enough space left for the handler
    1.61      bailout("deopt handler overflow");
    1.62 -    return;
    1.63 +    return -1;
    1.64    }
    1.65 -#ifdef ASSERT
    1.66 +
    1.67    int offset = code_offset();
    1.68 -#endif // ASSERT
    1.69 -
    1.70 -  compilation()->offsets()->set_value(CodeOffsets::Deopt, code_offset());
    1.71 -
    1.72    InternalAddress here(__ pc());
    1.73    __ pushptr(here.addr());
    1.74 -
    1.75    __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
    1.76 -
    1.77    assert(code_offset() - offset <= deopt_handler_size, "overflow");
    1.78 -
    1.79    __ end_a_stub();
    1.80  
    1.81 +  return offset;
    1.82  }
    1.83  
    1.84  
    1.85 @@ -3219,7 +3209,6 @@
    1.86    Register mdo  = op->mdo()->as_register();
    1.87    __ movoop(mdo, md->constant_encoding());
    1.88    Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset()));
    1.89 -  __ addl(counter_addr, DataLayout::counter_increment);
    1.90    Bytecodes::Code bc = method->java_code_at_bci(bci);
    1.91    // Perform additional virtual call profiling for invokevirtual and
    1.92    // invokeinterface bytecodes
    1.93 @@ -3286,14 +3275,18 @@
    1.94          __ jcc(Assembler::notEqual, next_test);
    1.95          __ movptr(recv_addr, recv);
    1.96          __ movl(Address(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i))), DataLayout::counter_increment);
    1.97 -        if (i < (VirtualCallData::row_limit() - 1)) {
    1.98 -          __ jmp(update_done);
    1.99 -        }
   1.100 +        __ jmp(update_done);
   1.101          __ bind(next_test);
   1.102        }
   1.103 +      // Receiver did not match any saved receiver and there is no empty row for it.
   1.104 +      // Increment total counter to indicate polimorphic case.
   1.105 +      __ addl(counter_addr, DataLayout::counter_increment);
   1.106  
   1.107        __ bind(update_done);
   1.108      }
   1.109 +  } else {
   1.110 +    // Static call
   1.111 +    __ addl(counter_addr, DataLayout::counter_increment);
   1.112    }
   1.113  }
   1.114  

mercurial