mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
7006044: materialize cheap non-oop pointers on 64-bit SPARC
After 6961690 we load non-oop pointers for the constant table which could easily be materialized in a few instructions. Reviewed-by: never, kvn
This commit is contained in:
parent
a5f501c021
commit
0563626b3c
3 changed files with 82 additions and 39 deletions
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "asm/assembler.hpp"
|
||||
#include "assembler_sparc.inline.hpp"
|
||||
#include "gc_interface/collectedHeap.inline.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
|
@ -1327,37 +1328,38 @@ void MacroAssembler::patchable_sethi(const AddressLiteral& addrlit, Register d)
|
|||
}
|
||||
|
||||
|
||||
int MacroAssembler::size_of_sethi(address a, bool worst_case) {
|
||||
int MacroAssembler::insts_for_sethi(address a, bool worst_case) {
|
||||
#ifdef _LP64
|
||||
if (worst_case) return 7;
|
||||
intptr_t iaddr = (intptr_t)a;
|
||||
int hi32 = (int)(iaddr >> 32);
|
||||
int lo32 = (int)(iaddr);
|
||||
int inst_count;
|
||||
if (hi32 == 0 && lo32 >= 0)
|
||||
inst_count = 1;
|
||||
else if (hi32 == -1)
|
||||
inst_count = 2;
|
||||
if (worst_case) return 7;
|
||||
intptr_t iaddr = (intptr_t) a;
|
||||
int msb32 = (int) (iaddr >> 32);
|
||||
int lsb32 = (int) (iaddr);
|
||||
int count;
|
||||
if (msb32 == 0 && lsb32 >= 0)
|
||||
count = 1;
|
||||
else if (msb32 == -1)
|
||||
count = 2;
|
||||
else {
|
||||
inst_count = 2;
|
||||
if ( hi32 & 0x3ff )
|
||||
inst_count++;
|
||||
if ( lo32 & 0xFFFFFC00 ) {
|
||||
if( (lo32 >> 20) & 0xfff ) inst_count += 2;
|
||||
if( (lo32 >> 10) & 0x3ff ) inst_count += 2;
|
||||
count = 2;
|
||||
if (msb32 & 0x3ff)
|
||||
count++;
|
||||
if (lsb32 & 0xFFFFFC00 ) {
|
||||
if ((lsb32 >> 20) & 0xfff) count += 2;
|
||||
if ((lsb32 >> 10) & 0x3ff) count += 2;
|
||||
}
|
||||
}
|
||||
return BytesPerInstWord * inst_count;
|
||||
return count;
|
||||
#else
|
||||
return BytesPerInstWord;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int MacroAssembler::worst_case_size_of_set() {
|
||||
return size_of_sethi(NULL, true) + 1;
|
||||
int MacroAssembler::worst_case_insts_for_set() {
|
||||
return insts_for_sethi(NULL, true) + 1;
|
||||
}
|
||||
|
||||
|
||||
// Keep in sync with MacroAssembler::insts_for_internal_set
|
||||
void MacroAssembler::internal_set(const AddressLiteral& addrlit, Register d, bool ForceRelocatable) {
|
||||
intptr_t value = addrlit.value();
|
||||
|
||||
|
@ -1379,6 +1381,23 @@ void MacroAssembler::internal_set(const AddressLiteral& addrlit, Register d, boo
|
|||
}
|
||||
}
|
||||
|
||||
// Keep in sync with MacroAssembler::internal_set
|
||||
int MacroAssembler::insts_for_internal_set(intptr_t value) {
|
||||
// can optimize
|
||||
if (-4096 <= value && value <= 4095) {
|
||||
return 1;
|
||||
}
|
||||
if (inv_hi22(hi22(value)) == value) {
|
||||
return insts_for_sethi((address) value);
|
||||
}
|
||||
int count = insts_for_sethi((address) value);
|
||||
AddressLiteral al(value);
|
||||
if (al.low10() != 0) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void MacroAssembler::set(const AddressLiteral& al, Register d) {
|
||||
internal_set(al, d, false);
|
||||
}
|
||||
|
@ -1443,11 +1462,11 @@ void MacroAssembler::set64(jlong value, Register d, Register tmp) {
|
|||
}
|
||||
}
|
||||
|
||||
int MacroAssembler::size_of_set64(jlong value) {
|
||||
int MacroAssembler::insts_for_set64(jlong value) {
|
||||
v9_dep();
|
||||
|
||||
int hi = (int)(value >> 32);
|
||||
int lo = (int)(value & ~0);
|
||||
int hi = (int) (value >> 32);
|
||||
int lo = (int) (value & ~0);
|
||||
int count = 0;
|
||||
|
||||
// (Matcher::isSimpleConstant64 knows about the following optimizations.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue