--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Tue Jan 11 20:26:13 2011 -0800
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Wed Jan 12 18:33:25 2011 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -823,15 +823,23 @@
};
// test if x is within signed immediate range for nbits
- static bool is_simm(int x, int nbits) { return -( 1 << nbits-1 ) <= x && x < ( 1 << nbits-1 ); }
+ static bool is_simm(intptr_t x, int nbits) { return -( intptr_t(1) << nbits-1 ) <= x && x < ( intptr_t(1) << nbits-1 ); }
// test if -4096 <= x <= 4095
- static bool is_simm13(int x) { return is_simm(x, 13); }
+ static bool is_simm13(intptr_t x) { return is_simm(x, 13); }
+
+ static bool is_in_wdisp_range(address a, address b, int nbits) {
+ intptr_t d = intptr_t(b) - intptr_t(a);
+ return is_simm(d, nbits + 2);
+ }
// test if label is in simm16 range in words (wdisp16).
bool is_in_wdisp16_range(Label& L) {
- intptr_t d = intptr_t(pc()) - intptr_t(target(L));
- return is_simm(d, 18);
+ return is_in_wdisp_range(target(L), pc(), 16);
+ }
+ // test if the distance between two addresses fits in simm30 range in words
+ static bool is_in_wdisp30_range(address a, address b) {
+ return is_in_wdisp_range(a, b, 30);
}
enum ASIs { // page 72, v9
@@ -1843,6 +1851,8 @@
inline void jmp( Register s1, Register s2 );
inline void jmp( Register s1, int simm13a, RelocationHolder const& rspec = RelocationHolder() );
+ // Check if the call target is out of wdisp30 range (relative to the code cache)
+ static inline bool is_far_target(address d);
inline void call( address d, relocInfo::relocType rt = relocInfo::runtime_call_type );
inline void call( Label& L, relocInfo::relocType rt = relocInfo::runtime_call_type );
inline void callr( Register s1, Register s2 );