comparison src/cpu/sparc/vm/templateInterpreter_sparc.cpp @ 10105:aeaca88565e6

8010862: The Method counter fields used for profiling can be allocated lazily. Summary: Allocate the method's profiling related metadata until they are needed. Reviewed-by: coleenp, roland
author jiangli
date Tue, 09 Apr 2013 17:17:41 -0400
parents 0094485b46c7
children 603ca7e51354
comparison
equal deleted inserted replaced
9055:dcdeb150988c 10105:aeaca88565e6
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.
290 // 290 //
291 // Lmethod: method 291 // Lmethod: method
292 // ??: invocation counter 292 // ??: invocation counter
293 // 293 //
294 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { 294 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) {
295 // Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not. 295 // Note: In tiered we increment either counters in MethodCounters* or in
296 // MDO depending if we're profiling or not.
297 const Register Rcounters = G3_scratch;
298 Label done;
299
296 if (TieredCompilation) { 300 if (TieredCompilation) {
297 const int increment = InvocationCounter::count_increment; 301 const int increment = InvocationCounter::count_increment;
298 const int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift; 302 const int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
299 Label no_mdo, done; 303 Label no_mdo;
300 if (ProfileInterpreter) { 304 if (ProfileInterpreter) {
301 // If no method data exists, go to profile_continue. 305 // If no method data exists, go to profile_continue.
302 __ ld_ptr(Lmethod, Method::method_data_offset(), G4_scratch); 306 __ ld_ptr(Lmethod, Method::method_data_offset(), G4_scratch);
303 __ br_null_short(G4_scratch, Assembler::pn, no_mdo); 307 __ br_null_short(G4_scratch, Assembler::pn, no_mdo);
304 // Increment counter 308 // Increment counter
309 G3_scratch, Lscratch, 313 G3_scratch, Lscratch,
310 Assembler::zero, overflow); 314 Assembler::zero, overflow);
311 __ ba_short(done); 315 __ ba_short(done);
312 } 316 }
313 317
314 // Increment counter in Method* 318 // Increment counter in MethodCounters*
315 __ bind(no_mdo); 319 __ bind(no_mdo);
316 Address invocation_counter(Lmethod, 320 Address invocation_counter(Rcounters,
317 in_bytes(Method::invocation_counter_offset()) + 321 in_bytes(MethodCounters::invocation_counter_offset()) +
318 in_bytes(InvocationCounter::counter_offset())); 322 in_bytes(InvocationCounter::counter_offset()));
323 __ get_method_counters(Lmethod, Rcounters, done);
319 __ increment_mask_and_jump(invocation_counter, increment, mask, 324 __ increment_mask_and_jump(invocation_counter, increment, mask,
320 G3_scratch, Lscratch, 325 G4_scratch, Lscratch,
321 Assembler::zero, overflow); 326 Assembler::zero, overflow);
322 __ bind(done); 327 __ bind(done);
323 } else { 328 } else {
324 // Update standard invocation counters 329 // Update standard invocation counters
325 __ increment_invocation_counter(O0, G3_scratch); 330 __ get_method_counters(Lmethod, Rcounters, done);
326 if (ProfileInterpreter) { // %%% Merge this into MethodData* 331 __ increment_invocation_counter(Rcounters, O0, G4_scratch);
327 Address interpreter_invocation_counter(Lmethod,in_bytes(Method::interpreter_invocation_counter_offset())); 332 if (ProfileInterpreter) {
328 __ ld(interpreter_invocation_counter, G3_scratch); 333 Address interpreter_invocation_counter(Rcounters,
329 __ inc(G3_scratch); 334 in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
330 __ st(G3_scratch, interpreter_invocation_counter); 335 __ ld(interpreter_invocation_counter, G4_scratch);
336 __ inc(G4_scratch);
337 __ st(G4_scratch, interpreter_invocation_counter);
331 } 338 }
332 339
333 if (ProfileInterpreter && profile_method != NULL) { 340 if (ProfileInterpreter && profile_method != NULL) {
334 // Test to see if we should create a method data oop 341 // Test to see if we should create a method data oop
335 AddressLiteral profile_limit((address)&InvocationCounter::InterpreterProfileLimit); 342 AddressLiteral profile_limit((address)&InvocationCounter::InterpreterProfileLimit);
343 AddressLiteral invocation_limit((address)&InvocationCounter::InterpreterInvocationLimit); 350 AddressLiteral invocation_limit((address)&InvocationCounter::InterpreterInvocationLimit);
344 __ load_contents(invocation_limit, G3_scratch); 351 __ load_contents(invocation_limit, G3_scratch);
345 __ cmp(O0, G3_scratch); 352 __ cmp(O0, G3_scratch);
346 __ br(Assembler::greaterEqualUnsigned, false, Assembler::pn, *overflow); // Far distance 353 __ br(Assembler::greaterEqualUnsigned, false, Assembler::pn, *overflow); // Far distance
347 __ delayed()->nop(); 354 __ delayed()->nop();
355 __ bind(done);
348 } 356 }
349 357
350 } 358 }
351 359
352 // Allocate monitor and lock method (asm interpreter) 360 // Allocate monitor and lock method (asm interpreter)