comparison src/share/vm/c1/c1_LIRGenerator.cpp @ 10107:8df6ddda8090

Merge
author jiangli
date Mon, 15 Apr 2013 21:25:23 -0400
parents 8be1318fbe77 aeaca88565e6
children 2a9d97b57920
comparison
equal deleted inserted replaced
9149:c60f69931e1a 10107:8df6ddda8090
1 /* 1 /*
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 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.
3042 assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0"); 3042 assert(frequency == 0 || is_power_of_2(frequency + 1), "Frequency must be x^2 - 1 or 0");
3043 int level = _compilation->env()->comp_level(); 3043 int level = _compilation->env()->comp_level();
3044 assert(level > CompLevel_simple, "Shouldn't be here"); 3044 assert(level > CompLevel_simple, "Shouldn't be here");
3045 3045
3046 int offset = -1; 3046 int offset = -1;
3047 LIR_Opr counter_holder = new_register(T_METADATA); 3047 LIR_Opr counter_holder;
3048 LIR_Opr meth;
3049 if (level == CompLevel_limited_profile) { 3048 if (level == CompLevel_limited_profile) {
3050 offset = in_bytes(backedge ? Method::backedge_counter_offset() : 3049 address counters_adr = method->ensure_method_counters();
3051 Method::invocation_counter_offset()); 3050 counter_holder = new_pointer_register();
3052 __ metadata2reg(method->constant_encoding(), counter_holder); 3051 __ move(LIR_OprFact::intptrConst(counters_adr), counter_holder);
3053 meth = counter_holder; 3052 offset = in_bytes(backedge ? MethodCounters::backedge_counter_offset() :
3053 MethodCounters::invocation_counter_offset());
3054 } else if (level == CompLevel_full_profile) { 3054 } else if (level == CompLevel_full_profile) {
3055 counter_holder = new_register(T_METADATA);
3055 offset = in_bytes(backedge ? MethodData::backedge_counter_offset() : 3056 offset = in_bytes(backedge ? MethodData::backedge_counter_offset() :
3056 MethodData::invocation_counter_offset()); 3057 MethodData::invocation_counter_offset());
3057 ciMethodData* md = method->method_data_or_null(); 3058 ciMethodData* md = method->method_data_or_null();
3058 assert(md != NULL, "Sanity"); 3059 assert(md != NULL, "Sanity");
3059 __ metadata2reg(md->constant_encoding(), counter_holder); 3060 __ metadata2reg(md->constant_encoding(), counter_holder);
3060 meth = new_register(T_METADATA);
3061 __ metadata2reg(method->constant_encoding(), meth);
3062 } else { 3061 } else {
3063 ShouldNotReachHere(); 3062 ShouldNotReachHere();
3064 } 3063 }
3065 LIR_Address* counter = new LIR_Address(counter_holder, offset, T_INT); 3064 LIR_Address* counter = new LIR_Address(counter_holder, offset, T_INT);
3066 LIR_Opr result = new_register(T_INT); 3065 LIR_Opr result = new_register(T_INT);
3067 __ load(counter, result); 3066 __ load(counter, result);
3068 __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result); 3067 __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
3069 __ store(result, counter); 3068 __ store(result, counter);
3070 if (notify) { 3069 if (notify) {
3071 LIR_Opr mask = load_immediate(frequency << InvocationCounter::count_shift, T_INT); 3070 LIR_Opr mask = load_immediate(frequency << InvocationCounter::count_shift, T_INT);
3071 LIR_Opr meth = new_register(T_METADATA);
3072 __ metadata2reg(method->constant_encoding(), meth);
3072 __ logical_and(result, mask, result); 3073 __ logical_and(result, mask, result);
3073 __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0)); 3074 __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0));
3074 // The bci for info can point to cmp for if's we want the if bci 3075 // The bci for info can point to cmp for if's we want the if bci
3075 CodeStub* overflow = new CounterOverflowStub(info, bci, meth); 3076 CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
3076 __ branch(lir_cond_equal, T_INT, overflow); 3077 __ branch(lir_cond_equal, T_INT, overflow);