comparison src/cpu/sparc/vm/assembler_sparc.inline.hpp @ 2297:fe8ab1affd14

merge with jdk7-b138
author mcimadamore
date Thu, 14 Apr 2011 23:31:30 -0700
parents 2f644f85485d
children
comparison
equal deleted inserted replaced
13:3f9fbeb548f2 14:9973bf54ca8e
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, 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.
586 } 586 }
587 587
588 inline void MacroAssembler::jmp( Register s1, Register s2 ) { jmpl( s1, s2, G0 ); } 588 inline void MacroAssembler::jmp( Register s1, Register s2 ) { jmpl( s1, s2, G0 ); }
589 inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); } 589 inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); }
590 590
591 inline bool MacroAssembler::is_far_target(address d) {
592 return !is_in_wdisp30_range(d, CodeCache::low_bound()) || !is_in_wdisp30_range(d, CodeCache::high_bound());
593 }
594
591 // Call with a check to see if we need to deal with the added 595 // Call with a check to see if we need to deal with the added
592 // expense of relocation and if we overflow the displacement 596 // expense of relocation and if we overflow the displacement
593 // of the quick call instruction./ 597 // of the quick call instruction.
594 // Check to see if we have to deal with relocations
595 inline void MacroAssembler::call( address d, relocInfo::relocType rt ) { 598 inline void MacroAssembler::call( address d, relocInfo::relocType rt ) {
596 #ifdef _LP64 599 #ifdef _LP64
597 intptr_t disp; 600 intptr_t disp;
598 // NULL is ok because it will be relocated later. 601 // NULL is ok because it will be relocated later.
599 // Must change NULL to a reachable address in order to 602 // Must change NULL to a reachable address in order to
601 if ( d == NULL ) 604 if ( d == NULL )
602 d = pc(); 605 d = pc();
603 606
604 // Is this address within range of the call instruction? 607 // Is this address within range of the call instruction?
605 // If not, use the expensive instruction sequence 608 // If not, use the expensive instruction sequence
606 disp = (intptr_t)d - (intptr_t)pc(); 609 if (is_far_target(d)) {
607 if ( disp != (intptr_t)(int32_t)disp ) {
608 relocate(rt); 610 relocate(rt);
609 AddressLiteral dest(d); 611 AddressLiteral dest(d);
610 jumpl_to(dest, O7, O7); 612 jumpl_to(dest, O7, O7);
611 } 613 } else {
612 else { 614 Assembler::call(d, rt);
613 Assembler::call( d, rt );
614 } 615 }
615 #else 616 #else
616 Assembler::call( d, rt ); 617 Assembler::call( d, rt );
617 #endif 618 #endif
618 } 619 }