comparison src/share/vm/c1/c1_LIRAssembler.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 89e0543e1737
children fc2c71045ada
comparison
equal deleted inserted replaced
1293:51db1e4b379d 1295:3cf667df43ef
1 /* 1 /*
2 * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2000-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.
299 compilation()->add_exception_handlers_for_pco(pc_offset, info->exception_handlers()); 299 compilation()->add_exception_handlers_for_pco(pc_offset, info->exception_handlers());
300 } 300 }
301 } 301 }
302 302
303 303
304 void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo) { 304 void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo, bool is_method_handle_invoke) {
305 flush_debug_info(pc_offset); 305 flush_debug_info(pc_offset);
306 cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset); 306 cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset, is_method_handle_invoke);
307 if (cinfo->exception_handlers() != NULL) { 307 if (cinfo->exception_handlers() != NULL) {
308 compilation()->add_exception_handlers_for_pco(pc_offset, cinfo->exception_handlers()); 308 compilation()->add_exception_handlers_for_pco(pc_offset, cinfo->exception_handlers());
309 } 309 }
310 } 310 }
311 311
411 411
412 412
413 void LIR_Assembler::emit_call(LIR_OpJavaCall* op) { 413 void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
414 verify_oop_map(op->info()); 414 verify_oop_map(op->info());
415 415
416 // JSR 292
417 // Preserve the SP over MethodHandle call sites.
418 if (op->is_method_handle_invoke()) {
419 preserve_SP();
420 }
421
416 if (os::is_MP()) { 422 if (os::is_MP()) {
417 // must align calls sites, otherwise they can't be updated atomically on MP hardware 423 // must align calls sites, otherwise they can't be updated atomically on MP hardware
418 align_call(op->code()); 424 align_call(op->code());
419 } 425 }
420 426
421 // emit the static call stub stuff out of line 427 // emit the static call stub stuff out of line
422 emit_static_call_stub(); 428 emit_static_call_stub();
423 429
424 switch (op->code()) { 430 switch (op->code()) {
425 case lir_static_call: 431 case lir_static_call:
426 call(op->addr(), relocInfo::static_call_type, op->info()); 432 call(op, relocInfo::static_call_type);
427 break; 433 break;
428 case lir_optvirtual_call: 434 case lir_optvirtual_call:
429 call(op->addr(), relocInfo::opt_virtual_call_type, op->info()); 435 case lir_dynamic_call:
436 call(op, relocInfo::opt_virtual_call_type);
430 break; 437 break;
431 case lir_icvirtual_call: 438 case lir_icvirtual_call:
432 ic_call(op->addr(), op->info()); 439 ic_call(op);
433 break; 440 break;
434 case lir_virtual_call: 441 case lir_virtual_call:
435 vtable_call(op->vtable_offset(), op->info()); 442 vtable_call(op);
436 break; 443 break;
437 default: ShouldNotReachHere(); 444 default: ShouldNotReachHere();
438 } 445 }
446
447 if (op->is_method_handle_invoke()) {
448 restore_SP();
449 }
450
439 #if defined(X86) && defined(TIERED) 451 #if defined(X86) && defined(TIERED)
440 // C2 leave fpu stack dirty clean it 452 // C2 leave fpu stack dirty clean it
441 if (UseSSE < 2) { 453 if (UseSSE < 2) {
442 int i; 454 int i;
443 for ( i = 1; i <= 7 ; i++ ) { 455 for ( i = 1; i <= 7 ; i++ ) {