Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1/c1_GraphBuilder.cpp @ 1295:3cf667df43ef
6919934: JSR 292 needs to support x86 C1
Summary: This implements JSR 292 support for C1 x86.
Reviewed-by: never, jrose, kvn
author | twisti |
---|---|
date | Tue, 09 Mar 2010 20:16:19 +0100 |
parents | 323bd24c6520 |
children | 9f5b60a14736 |
comparison
equal
deleted
inserted
replaced
1293:51db1e4b379d | 1295:3cf667df43ef |
---|---|
1 /* | 1 /* |
2 * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1999-2010 Sun Microsystems, Inc. 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. |
1522 if (target->is_loaded() && !target->is_abstract() && | 1522 if (target->is_loaded() && !target->is_abstract() && |
1523 target->can_be_statically_bound() && code == Bytecodes::_invokevirtual) { | 1523 target->can_be_statically_bound() && code == Bytecodes::_invokevirtual) { |
1524 code = Bytecodes::_invokespecial; | 1524 code = Bytecodes::_invokespecial; |
1525 } | 1525 } |
1526 | 1526 |
1527 if (code == Bytecodes::_invokedynamic) { | |
1528 BAILOUT("invokedynamic NYI"); // FIXME | |
1529 return; | |
1530 } | |
1531 | |
1532 // NEEDS_CLEANUP | 1527 // NEEDS_CLEANUP |
1533 // I've added the target-is_loaded() test below but I don't really understand | 1528 // I've added the target-is_loaded() test below but I don't really understand |
1534 // how klass->is_loaded() can be true and yet target->is_loaded() is false. | 1529 // how klass->is_loaded() can be true and yet target->is_loaded() is false. |
1535 // this happened while running the JCK invokevirtual tests under doit. TKR | 1530 // this happened while running the JCK invokevirtual tests under doit. TKR |
1536 ciMethod* cha_monomorphic_target = NULL; | 1531 ciMethod* cha_monomorphic_target = NULL; |
1537 ciMethod* exact_target = NULL; | 1532 ciMethod* exact_target = NULL; |
1538 if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded()) { | 1533 if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded() && |
1534 !target->is_method_handle_invoke()) { | |
1539 Value receiver = NULL; | 1535 Value receiver = NULL; |
1540 ciInstanceKlass* receiver_klass = NULL; | 1536 ciInstanceKlass* receiver_klass = NULL; |
1541 bool type_is_exact = false; | 1537 bool type_is_exact = false; |
1542 // try to find a precise receiver type | 1538 // try to find a precise receiver type |
1543 if (will_link && !target->is_static()) { | 1539 if (will_link && !target->is_static()) { |
1679 // corrupting the graph. (We currently bail out with a non-empty | 1675 // corrupting the graph. (We currently bail out with a non-empty |
1680 // stack at a ret in these situations.) | 1676 // stack at a ret in these situations.) |
1681 CHECK_BAILOUT(); | 1677 CHECK_BAILOUT(); |
1682 | 1678 |
1683 // inlining not successful => standard invoke | 1679 // inlining not successful => standard invoke |
1684 bool is_static = code == Bytecodes::_invokestatic; | 1680 bool is_loaded = target->is_loaded(); |
1681 bool has_receiver = | |
1682 code == Bytecodes::_invokespecial || | |
1683 code == Bytecodes::_invokevirtual || | |
1684 code == Bytecodes::_invokeinterface; | |
1685 bool is_invokedynamic = code == Bytecodes::_invokedynamic; | |
1685 ValueType* result_type = as_ValueType(target->return_type()); | 1686 ValueType* result_type = as_ValueType(target->return_type()); |
1687 | |
1688 // We require the debug info to be the "state before" because | |
1689 // invokedynamics may deoptimize. | |
1690 ValueStack* state_before = is_invokedynamic ? state()->copy() : NULL; | |
1691 | |
1686 Values* args = state()->pop_arguments(target->arg_size_no_receiver()); | 1692 Values* args = state()->pop_arguments(target->arg_size_no_receiver()); |
1687 Value recv = is_static ? NULL : apop(); | 1693 Value recv = has_receiver ? apop() : NULL; |
1688 bool is_loaded = target->is_loaded(); | |
1689 int vtable_index = methodOopDesc::invalid_vtable_index; | 1694 int vtable_index = methodOopDesc::invalid_vtable_index; |
1690 | 1695 |
1691 #ifdef SPARC | 1696 #ifdef SPARC |
1692 // Currently only supported on Sparc. | 1697 // Currently only supported on Sparc. |
1693 // The UseInlineCaches only controls dispatch to invokevirtuals for | 1698 // The UseInlineCaches only controls dispatch to invokevirtuals for |
1721 target_klass = exact_target->holder(); | 1726 target_klass = exact_target->holder(); |
1722 } | 1727 } |
1723 profile_call(recv, target_klass); | 1728 profile_call(recv, target_klass); |
1724 } | 1729 } |
1725 | 1730 |
1726 Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target); | 1731 Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before); |
1727 // push result | 1732 // push result |
1728 append_split(result); | 1733 append_split(result); |
1729 | 1734 |
1730 if (result_type != voidType) { | 1735 if (result_type != voidType) { |
1731 if (method()->is_strict()) { | 1736 if (method()->is_strict()) { |
2860 | 2865 |
2861 // setup state for std entry | 2866 // setup state for std entry |
2862 _initial_state = state_at_entry(); | 2867 _initial_state = state_at_entry(); |
2863 start_block->merge(_initial_state); | 2868 start_block->merge(_initial_state); |
2864 | 2869 |
2865 BlockBegin* sync_handler = NULL; | 2870 // setup an exception handler to do the unlocking and/or |
2866 if (method()->is_synchronized() || _compilation->env()->dtrace_method_probes()) { | 2871 // notification and unwind the frame. |
2867 // setup an exception handler to do the unlocking and/or notification | 2872 BlockBegin* sync_handler = new BlockBegin(-1); |
2868 sync_handler = new BlockBegin(-1); | 2873 sync_handler->set(BlockBegin::exception_entry_flag); |
2869 sync_handler->set(BlockBegin::exception_entry_flag); | 2874 sync_handler->set(BlockBegin::is_on_work_list_flag); |
2870 sync_handler->set(BlockBegin::is_on_work_list_flag); | 2875 sync_handler->set(BlockBegin::default_exception_handler_flag); |
2871 sync_handler->set(BlockBegin::default_exception_handler_flag); | 2876 |
2872 | 2877 ciExceptionHandler* desc = new ciExceptionHandler(method()->holder(), 0, method()->code_size(), -1, 0); |
2873 ciExceptionHandler* desc = new ciExceptionHandler(method()->holder(), 0, method()->code_size(), -1, 0); | 2878 XHandler* h = new XHandler(desc); |
2874 XHandler* h = new XHandler(desc); | 2879 h->set_entry_block(sync_handler); |
2875 h->set_entry_block(sync_handler); | 2880 scope_data()->xhandlers()->append(h); |
2876 scope_data()->xhandlers()->append(h); | 2881 scope_data()->set_has_handler(); |
2877 scope_data()->set_has_handler(); | |
2878 } | |
2879 | 2882 |
2880 // complete graph | 2883 // complete graph |
2881 _vmap = new ValueMap(); | 2884 _vmap = new ValueMap(); |
2882 scope->compute_lock_stack_size(); | 2885 scope->compute_lock_stack_size(); |
2883 switch (scope->method()->intrinsic_id()) { | 2886 switch (scope->method()->intrinsic_id()) { |