Mercurial > hg > graal-compiler
diff src/share/vm/opto/doCall.cpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | a3ecd773a7b9 |
children | bb33c6fdcf0d |
line wrap: on
line diff
--- a/src/share/vm/opto/doCall.cpp Mon Nov 12 18:11:17 2012 +0100 +++ b/src/share/vm/opto/doCall.cpp Mon Nov 12 23:14:12 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,6 @@ */ #include "precompiled.hpp" -#include "ci/ciCPCache.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciMethodHandle.hpp" #include "classfile/vmSymbols.hpp" @@ -41,11 +40,10 @@ #include "prims/nativeLookup.hpp" #include "runtime/sharedRuntime.hpp" -#ifndef PRODUCT void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { - if (TraceTypeProfile || PrintInlining || PrintOptoInlining) { + if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { if (!PrintInlining) { - if (!PrintOpto && !PrintCompilation) { + if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { method->print_short_name(); tty->cr(); } @@ -57,7 +55,6 @@ tty->cr(); } } -#endif CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, @@ -110,7 +107,17 @@ // intrinsics handle strict f.p. correctly. if (allow_inline && allow_intrinsics) { CallGenerator* cg = find_intrinsic(callee, call_is_virtual); - if (cg != NULL) return cg; + if (cg != NULL) { + if (cg->is_predicted()) { + // Code without intrinsic but, hopefully, inlined. + CallGenerator* inline_cg = this->call_generator(callee, + vtable_index, call_is_virtual, jvms, allow_inline, prof_factor, false); + if (inline_cg != NULL) { + cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg); + } + } + return cg; + } } // Do method handle calls. @@ -226,13 +233,13 @@ } if (miss_cg != NULL) { if (next_hit_cg != NULL) { - NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1))); + trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); // We don't need to record dependency on a receiver here and below. // Whenever we inline, the dependency is added by Parse::Parse(). miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); } if (miss_cg != NULL) { - NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); + trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); if (cg != NULL) return cg; } @@ -392,7 +399,7 @@ // Choose call strategy. bool call_is_virtual = is_virtual_or_interface; - int vtable_index = methodOopDesc::invalid_vtable_index; + int vtable_index = Method::invalid_vtable_index; ciMethod* callee = orig_callee; // Try to get the most accurate receiver type @@ -515,15 +522,15 @@ } else if (rt == T_INT || is_subword_type(rt)) { // FIXME: This logic should be factored out. if (ct == T_BOOLEAN) { - retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) ); + retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0x1)) ); } else if (ct == T_CHAR) { - retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) ); + retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) ); } else if (ct == T_BYTE) { - retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) ); - retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) ); + retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) ); + retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) ); } else if (ct == T_SHORT) { - retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) ); - retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) ); + retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) ); + retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) ); } else { assert(ct == T_INT, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct))); } @@ -533,13 +540,13 @@ const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { - Node* cast_obj = _gvn.transform(new (C, 2) CheckCastPPNode(control(), retnode, sig_type)); + Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type)); pop(); push(cast_obj); } } } else { - assert(ct == rt, err_msg_res("unexpected mismatch rt=%d, ct=%d", rt, ct)); + assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct)); // push a zero; it's better than getting an oop/int mismatch retnode = pop_node(rt); retnode = zerocon(ct); @@ -615,7 +622,7 @@ } int len = bcis->length(); - CatchNode *cn = new (C, 2) CatchNode(control(), i_o, len+1); + CatchNode *cn = new (C) CatchNode(control(), i_o, len+1); Node *catch_ = _gvn.transform(cn); // now branch with the exception state to each of the (potential) @@ -626,14 +633,14 @@ // Locals are just copied from before the call. // Get control from the CatchNode. int handler_bci = bcis->at(i); - Node* ctrl = _gvn.transform( new (C, 1) CatchProjNode(catch_, i+1,handler_bci)); + Node* ctrl = _gvn.transform( new (C) CatchProjNode(catch_, i+1,handler_bci)); // This handler cannot happen? if (ctrl == top()) continue; set_control(ctrl); // Create exception oop const TypeInstPtr* extype = extypes->at(i)->is_instptr(); - Node *ex_oop = _gvn.transform(new (C, 2) CreateExNode(extypes->at(i), ctrl, i_o)); + Node *ex_oop = _gvn.transform(new (C) CreateExNode(extypes->at(i), ctrl, i_o)); // Handle unloaded exception classes. if (saw_unloaded->contains(handler_bci)) { @@ -672,7 +679,7 @@ // The first CatchProj is for the normal return. // (Note: If this is a call to rethrow_Java, this node goes dead.) - set_control(_gvn.transform( new (C, 1) CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); + set_control(_gvn.transform( new (C) CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); } @@ -723,7 +730,7 @@ // I'm loading the class from, I can replace the LoadKlass with the // klass constant for the exception oop. if( ex_node->is_Phi() ) { - ex_klass_node = new (C, ex_node->req()) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); + ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); for( uint i = 1; i < ex_node->req(); i++ ) { Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); @@ -789,7 +796,7 @@ PreserveJVMState pjvms(this); const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr(); assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness"); - Node* ex_oop = _gvn.transform(new (C, 2) CheckCastPPNode(control(), ex_node, tinst)); + Node* ex_oop = _gvn.transform(new (C) CheckCastPPNode(control(), ex_node, tinst)); push_ex_oop(ex_oop); // Push exception oop for handler #ifndef PRODUCT if (PrintOpto && WizardMode) { @@ -836,9 +843,9 @@ if( at_method_entry ) { // bump invocation counter if top method (for statistics) if (CountCompiledCalls && depth() == 1) { - const TypeOopPtr* addr_type = TypeOopPtr::make_from_constant(method()); + const TypePtr* addr_type = TypeMetadataPtr::make(method()); Node* adr1 = makecon(addr_type); - Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(methodOopDesc::compiled_invocation_counter_offset())); + Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(Method::compiled_invocation_counter_offset())); increment_counter(adr2); } } else if (is_inline) {