comparison src/cpu/x86/vm/templateTable_x86_64.cpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents c76b43ed5089 9500809ceead
children 096c224171c4
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
1 /* 1 /*
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
156 val != noreg /* tosca_live */, 156 val != noreg /* tosca_live */,
157 false /* expand_call */); 157 false /* expand_call */);
158 if (val == noreg) { 158 if (val == noreg) {
159 __ store_heap_oop_null(Address(rdx, 0)); 159 __ store_heap_oop_null(Address(rdx, 0));
160 } else { 160 } else {
161 // G1 barrier needs uncompressed oop for region cross check.
162 Register new_val = val;
163 if (UseCompressedOops) {
164 new_val = rbx;
165 __ movptr(new_val, val);
166 }
161 __ store_heap_oop(Address(rdx, 0), val); 167 __ store_heap_oop(Address(rdx, 0), val);
162 __ g1_write_barrier_post(rdx /* store_adr */, 168 __ g1_write_barrier_post(rdx /* store_adr */,
163 val /* new_val */, 169 new_val /* new_val */,
164 r15_thread /* thread */, 170 r15_thread /* thread */,
165 r8 /* tmp */, 171 r8 /* tmp */,
166 rbx /* tmp2 */); 172 rbx /* tmp2 */);
167 } 173 }
168
169 } 174 }
170 break; 175 break;
171 #endif // INCLUDE_ALL_GCS 176 #endif // INCLUDE_ALL_GCS
172 case BarrierSet::CardTableModRef: 177 case BarrierSet::CardTableModRef:
173 case BarrierSet::CardTableExtension: 178 case BarrierSet::CardTableExtension:
1562 void TemplateTable::branch(bool is_jsr, bool is_wide) { 1567 void TemplateTable::branch(bool is_jsr, bool is_wide) {
1563 __ get_method(rcx); // rcx holds method 1568 __ get_method(rcx); // rcx holds method
1564 __ profile_taken_branch(rax, rbx); // rax holds updated MDP, rbx 1569 __ profile_taken_branch(rax, rbx); // rax holds updated MDP, rbx
1565 // holds bumped taken count 1570 // holds bumped taken count
1566 1571
1567 const ByteSize be_offset = Method::backedge_counter_offset() + 1572 const ByteSize be_offset = MethodCounters::backedge_counter_offset() +
1568 InvocationCounter::counter_offset(); 1573 InvocationCounter::counter_offset();
1569 const ByteSize inv_offset = Method::invocation_counter_offset() + 1574 const ByteSize inv_offset = MethodCounters::invocation_counter_offset() +
1570 InvocationCounter::counter_offset(); 1575 InvocationCounter::counter_offset();
1571 const int method_offset = frame::interpreter_frame_method_offset * wordSize;
1572 1576
1573 // Load up edx with the branch displacement 1577 // Load up edx with the branch displacement
1574 __ movl(rdx, at_bcp(1)); 1578 __ movl(rdx, at_bcp(1));
1575 __ bswapl(rdx); 1579 __ bswapl(rdx);
1576 1580
1616 // rdx: target offset 1620 // rdx: target offset
1617 // r13: target bcp 1621 // r13: target bcp
1618 // r14: locals pointer 1622 // r14: locals pointer
1619 __ testl(rdx, rdx); // check if forward or backward branch 1623 __ testl(rdx, rdx); // check if forward or backward branch
1620 __ jcc(Assembler::positive, dispatch); // count only if backward branch 1624 __ jcc(Assembler::positive, dispatch); // count only if backward branch
1625
1626 // check if MethodCounters exists
1627 Label has_counters;
1628 __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1629 __ testptr(rax, rax);
1630 __ jcc(Assembler::notZero, has_counters);
1631 __ push(rdx);
1632 __ push(rcx);
1633 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters),
1634 rcx);
1635 __ pop(rcx);
1636 __ pop(rdx);
1637 __ movptr(rax, Address(rcx, Method::method_counters_offset()));
1638 __ jcc(Assembler::zero, dispatch);
1639 __ bind(has_counters);
1640
1621 if (TieredCompilation) { 1641 if (TieredCompilation) {
1622 Label no_mdo; 1642 Label no_mdo;
1623 int increment = InvocationCounter::count_increment; 1643 int increment = InvocationCounter::count_increment;
1624 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift; 1644 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
1625 if (ProfileInterpreter) { 1645 if (ProfileInterpreter) {
1633 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, 1653 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
1634 rax, false, Assembler::zero, &backedge_counter_overflow); 1654 rax, false, Assembler::zero, &backedge_counter_overflow);
1635 __ jmp(dispatch); 1655 __ jmp(dispatch);
1636 } 1656 }
1637 __ bind(no_mdo); 1657 __ bind(no_mdo);
1638 // Increment backedge counter in Method* 1658 // Increment backedge counter in MethodCounters*
1659 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1639 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, 1660 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
1640 rax, false, Assembler::zero, &backedge_counter_overflow); 1661 rax, false, Assembler::zero, &backedge_counter_overflow);
1641 } else { 1662 } else {
1642 // increment counter 1663 // increment counter
1664 __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
1643 __ movl(rax, Address(rcx, be_offset)); // load backedge counter 1665 __ movl(rax, Address(rcx, be_offset)); // load backedge counter
1644 __ incrementl(rax, InvocationCounter::count_increment); // increment counter 1666 __ incrementl(rax, InvocationCounter::count_increment); // increment counter
1645 __ movl(Address(rcx, be_offset), rax); // store counter 1667 __ movl(Address(rcx, be_offset), rax); // store counter
1646 1668
1647 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter 1669 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter
1670
1648 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits 1671 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits
1649 __ addl(rax, Address(rcx, be_offset)); // add both counters 1672 __ addl(rax, Address(rcx, be_offset)); // add both counters
1650 1673
1651 if (ProfileInterpreter) { 1674 if (ProfileInterpreter) {
1652 // Test to see if we should create a method data oop 1675 // Test to see if we should create a method data oop