1.1 --- a/src/cpu/sparc/vm/assembler_sparc.hpp Tue Jan 11 20:26:13 2011 -0800 1.2 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp Wed Jan 12 18:33:25 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -823,15 +823,23 @@ 1.11 }; 1.12 1.13 // test if x is within signed immediate range for nbits 1.14 - static bool is_simm(int x, int nbits) { return -( 1 << nbits-1 ) <= x && x < ( 1 << nbits-1 ); } 1.15 + static bool is_simm(intptr_t x, int nbits) { return -( intptr_t(1) << nbits-1 ) <= x && x < ( intptr_t(1) << nbits-1 ); } 1.16 1.17 // test if -4096 <= x <= 4095 1.18 - static bool is_simm13(int x) { return is_simm(x, 13); } 1.19 + static bool is_simm13(intptr_t x) { return is_simm(x, 13); } 1.20 + 1.21 + static bool is_in_wdisp_range(address a, address b, int nbits) { 1.22 + intptr_t d = intptr_t(b) - intptr_t(a); 1.23 + return is_simm(d, nbits + 2); 1.24 + } 1.25 1.26 // test if label is in simm16 range in words (wdisp16). 1.27 bool is_in_wdisp16_range(Label& L) { 1.28 - intptr_t d = intptr_t(pc()) - intptr_t(target(L)); 1.29 - return is_simm(d, 18); 1.30 + return is_in_wdisp_range(target(L), pc(), 16); 1.31 + } 1.32 + // test if the distance between two addresses fits in simm30 range in words 1.33 + static bool is_in_wdisp30_range(address a, address b) { 1.34 + return is_in_wdisp_range(a, b, 30); 1.35 } 1.36 1.37 enum ASIs { // page 72, v9 1.38 @@ -1843,6 +1851,8 @@ 1.39 inline void jmp( Register s1, Register s2 ); 1.40 inline void jmp( Register s1, int simm13a, RelocationHolder const& rspec = RelocationHolder() ); 1.41 1.42 + // Check if the call target is out of wdisp30 range (relative to the code cache) 1.43 + static inline bool is_far_target(address d); 1.44 inline void call( address d, relocInfo::relocType rt = relocInfo::runtime_call_type ); 1.45 inline void call( Label& L, relocInfo::relocType rt = relocInfo::runtime_call_type ); 1.46 inline void callr( Register s1, Register s2 );