Mercurial > hg > truffle
comparison src/cpu/x86/vm/templateTable_x86_32.cpp @ 10108:9500809ceead
Merge
author | jiangli |
---|---|
date | Thu, 18 Apr 2013 17:00:16 -0400 |
parents | aeaca88565e6 |
children | d13d7aba8c12 |
comparison
equal
deleted
inserted
replaced
10104:cbf8c8c25bbe | 10108:9500809ceead |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 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. |
1544 | 1544 |
1545 void TemplateTable::branch(bool is_jsr, bool is_wide) { | 1545 void TemplateTable::branch(bool is_jsr, bool is_wide) { |
1546 __ get_method(rcx); // ECX holds method | 1546 __ get_method(rcx); // ECX holds method |
1547 __ profile_taken_branch(rax,rbx); // EAX holds updated MDP, EBX holds bumped taken count | 1547 __ profile_taken_branch(rax,rbx); // EAX holds updated MDP, EBX holds bumped taken count |
1548 | 1548 |
1549 const ByteSize be_offset = Method::backedge_counter_offset() + InvocationCounter::counter_offset(); | 1549 const ByteSize be_offset = MethodCounters::backedge_counter_offset() + |
1550 const ByteSize inv_offset = Method::invocation_counter_offset() + InvocationCounter::counter_offset(); | 1550 InvocationCounter::counter_offset(); |
1551 const int method_offset = frame::interpreter_frame_method_offset * wordSize; | 1551 const ByteSize inv_offset = MethodCounters::invocation_counter_offset() + |
1552 InvocationCounter::counter_offset(); | |
1552 | 1553 |
1553 // Load up EDX with the branch displacement | 1554 // Load up EDX with the branch displacement |
1554 __ movl(rdx, at_bcp(1)); | 1555 __ movl(rdx, at_bcp(1)); |
1555 __ bswapl(rdx); | 1556 __ bswapl(rdx); |
1556 if (!is_wide) __ sarl(rdx, 16); | 1557 if (!is_wide) __ sarl(rdx, 16); |
1593 // rdx: target offset | 1594 // rdx: target offset |
1594 // rsi: target bcp | 1595 // rsi: target bcp |
1595 // rdi: locals pointer | 1596 // rdi: locals pointer |
1596 __ testl(rdx, rdx); // check if forward or backward branch | 1597 __ testl(rdx, rdx); // check if forward or backward branch |
1597 __ jcc(Assembler::positive, dispatch); // count only if backward branch | 1598 __ jcc(Assembler::positive, dispatch); // count only if backward branch |
1599 | |
1600 // check if MethodCounters exists | |
1601 Label has_counters; | |
1602 __ movptr(rax, Address(rcx, Method::method_counters_offset())); | |
1603 __ testptr(rax, rax); | |
1604 __ jcc(Assembler::notZero, has_counters); | |
1605 __ push(rdx); | |
1606 __ push(rcx); | |
1607 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters), | |
1608 rcx); | |
1609 __ pop(rcx); | |
1610 __ pop(rdx); | |
1611 __ movptr(rax, Address(rcx, Method::method_counters_offset())); | |
1612 __ testptr(rax, rax); | |
1613 __ jcc(Assembler::zero, dispatch); | |
1614 __ bind(has_counters); | |
1598 | 1615 |
1599 if (TieredCompilation) { | 1616 if (TieredCompilation) { |
1600 Label no_mdo; | 1617 Label no_mdo; |
1601 int increment = InvocationCounter::count_increment; | 1618 int increment = InvocationCounter::count_increment; |
1602 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift; | 1619 int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift; |
1611 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, | 1628 __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, |
1612 rax, false, Assembler::zero, &backedge_counter_overflow); | 1629 rax, false, Assembler::zero, &backedge_counter_overflow); |
1613 __ jmp(dispatch); | 1630 __ jmp(dispatch); |
1614 } | 1631 } |
1615 __ bind(no_mdo); | 1632 __ bind(no_mdo); |
1616 // Increment backedge counter in Method* | 1633 // Increment backedge counter in MethodCounters* |
1634 __ movptr(rcx, Address(rcx, Method::method_counters_offset())); | |
1617 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, | 1635 __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, |
1618 rax, false, Assembler::zero, &backedge_counter_overflow); | 1636 rax, false, Assembler::zero, &backedge_counter_overflow); |
1619 } else { | 1637 } else { |
1620 // increment counter | 1638 // increment counter |
1639 __ movptr(rcx, Address(rcx, Method::method_counters_offset())); | |
1621 __ movl(rax, Address(rcx, be_offset)); // load backedge counter | 1640 __ movl(rax, Address(rcx, be_offset)); // load backedge counter |
1622 __ incrementl(rax, InvocationCounter::count_increment); // increment counter | 1641 __ incrementl(rax, InvocationCounter::count_increment); // increment counter |
1623 __ movl(Address(rcx, be_offset), rax); // store counter | 1642 __ movl(Address(rcx, be_offset), rax); // store counter |
1624 | 1643 |
1625 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter | 1644 __ movl(rax, Address(rcx, inv_offset)); // load invocation counter |
1645 | |
1626 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits | 1646 __ andl(rax, InvocationCounter::count_mask_value); // and the status bits |
1627 __ addl(rax, Address(rcx, be_offset)); // add both counters | 1647 __ addl(rax, Address(rcx, be_offset)); // add both counters |
1628 | 1648 |
1629 if (ProfileInterpreter) { | 1649 if (ProfileInterpreter) { |
1630 // Test to see if we should create a method data oop | 1650 // Test to see if we should create a method data oop |