Mercurial > hg > truffle
comparison src/cpu/x86/vm/macroAssembler_x86.cpp @ 13000:209aa13ab8c0
8024927: Nashorn performance regression with CompressedOops
Summary: Allocate compressed class space at end of Java heap. For small heap sizes, without CDS, save some space so compressed classes can have the same favorable compression as oops
Reviewed-by: stefank, hseigel, goetz
author | coleenp |
---|---|
date | Fri, 25 Oct 2013 15:19:29 -0400 |
parents | 69944b868a32 |
children | be525e91f65b |
comparison
equal
deleted
inserted
replaced
12999:634715d59d9e | 13000:209aa13ab8c0 |
---|---|
5047 } | 5047 } |
5048 } | 5048 } |
5049 } | 5049 } |
5050 | 5050 |
5051 void MacroAssembler::encode_klass_not_null(Register r) { | 5051 void MacroAssembler::encode_klass_not_null(Register r) { |
5052 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); | 5052 if (Universe::narrow_klass_base() != NULL) { |
5053 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. | 5053 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. |
5054 assert(r != r12_heapbase, "Encoding a klass in r12"); | 5054 assert(r != r12_heapbase, "Encoding a klass in r12"); |
5055 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); | 5055 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); |
5056 subq(r, r12_heapbase); | 5056 subq(r, r12_heapbase); |
5057 } | |
5057 if (Universe::narrow_klass_shift() != 0) { | 5058 if (Universe::narrow_klass_shift() != 0) { |
5058 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); | 5059 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); |
5059 shrq(r, LogKlassAlignmentInBytes); | 5060 shrq(r, LogKlassAlignmentInBytes); |
5060 } | 5061 } |
5061 reinit_heapbase(); | 5062 if (Universe::narrow_klass_base() != NULL) { |
5063 reinit_heapbase(); | |
5064 } | |
5062 } | 5065 } |
5063 | 5066 |
5064 void MacroAssembler::encode_klass_not_null(Register dst, Register src) { | 5067 void MacroAssembler::encode_klass_not_null(Register dst, Register src) { |
5065 if (dst == src) { | 5068 if (dst == src) { |
5066 encode_klass_not_null(src); | 5069 encode_klass_not_null(src); |
5067 } else { | 5070 } else { |
5068 mov64(dst, (int64_t)Universe::narrow_klass_base()); | 5071 if (Universe::narrow_klass_base() != NULL) { |
5069 negq(dst); | 5072 mov64(dst, (int64_t)Universe::narrow_klass_base()); |
5070 addq(dst, src); | 5073 negq(dst); |
5074 addq(dst, src); | |
5075 } else { | |
5076 movptr(dst, src); | |
5077 } | |
5071 if (Universe::narrow_klass_shift() != 0) { | 5078 if (Universe::narrow_klass_shift() != 0) { |
5072 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); | 5079 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); |
5073 shrq(dst, LogKlassAlignmentInBytes); | 5080 shrq(dst, LogKlassAlignmentInBytes); |
5074 } | 5081 } |
5075 } | 5082 } |
5079 // generated by decode_klass_not_null(register r) and reinit_heapbase(), | 5086 // generated by decode_klass_not_null(register r) and reinit_heapbase(), |
5080 // when (Universe::heap() != NULL). Hence, if the instructions they | 5087 // when (Universe::heap() != NULL). Hence, if the instructions they |
5081 // generate change, then this method needs to be updated. | 5088 // generate change, then this method needs to be updated. |
5082 int MacroAssembler::instr_size_for_decode_klass_not_null() { | 5089 int MacroAssembler::instr_size_for_decode_klass_not_null() { |
5083 assert (UseCompressedClassPointers, "only for compressed klass ptrs"); | 5090 assert (UseCompressedClassPointers, "only for compressed klass ptrs"); |
5084 // mov64 + addq + shlq? + mov64 (for reinit_heapbase()). | 5091 if (Universe::narrow_klass_base() != NULL) { |
5085 return (Universe::narrow_klass_shift() == 0 ? 20 : 24); | 5092 // mov64 + addq + shlq? + mov64 (for reinit_heapbase()). |
5093 return (Universe::narrow_klass_shift() == 0 ? 20 : 24); | |
5094 } else { | |
5095 // longest load decode klass function, mov64, leaq | |
5096 return 16; | |
5097 } | |
5086 } | 5098 } |
5087 | 5099 |
5088 // !!! If the instructions that get generated here change then function | 5100 // !!! If the instructions that get generated here change then function |
5089 // instr_size_for_decode_klass_not_null() needs to get updated. | 5101 // instr_size_for_decode_klass_not_null() needs to get updated. |
5090 void MacroAssembler::decode_klass_not_null(Register r) { | 5102 void MacroAssembler::decode_klass_not_null(Register r) { |
5091 // Note: it will change flags | 5103 // Note: it will change flags |
5092 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); | |
5093 assert (UseCompressedClassPointers, "should only be used for compressed headers"); | 5104 assert (UseCompressedClassPointers, "should only be used for compressed headers"); |
5094 assert(r != r12_heapbase, "Decoding a klass in r12"); | 5105 assert(r != r12_heapbase, "Decoding a klass in r12"); |
5095 // Cannot assert, unverified entry point counts instructions (see .ad file) | 5106 // Cannot assert, unverified entry point counts instructions (see .ad file) |
5096 // vtableStubs also counts instructions in pd_code_size_limit. | 5107 // vtableStubs also counts instructions in pd_code_size_limit. |
5097 // Also do not verify_oop as this is called by verify_oop. | 5108 // Also do not verify_oop as this is called by verify_oop. |
5098 if (Universe::narrow_klass_shift() != 0) { | 5109 if (Universe::narrow_klass_shift() != 0) { |
5099 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); | 5110 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); |
5100 shlq(r, LogKlassAlignmentInBytes); | 5111 shlq(r, LogKlassAlignmentInBytes); |
5101 } | 5112 } |
5102 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. | 5113 // Use r12 as a scratch register in which to temporarily load the narrow_klass_base. |
5103 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); | 5114 if (Universe::narrow_klass_base() != NULL) { |
5104 addq(r, r12_heapbase); | 5115 mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); |
5105 reinit_heapbase(); | 5116 addq(r, r12_heapbase); |
5117 reinit_heapbase(); | |
5118 } | |
5106 } | 5119 } |
5107 | 5120 |
5108 void MacroAssembler::decode_klass_not_null(Register dst, Register src) { | 5121 void MacroAssembler::decode_klass_not_null(Register dst, Register src) { |
5109 // Note: it will change flags | 5122 // Note: it will change flags |
5110 assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); | |
5111 assert (UseCompressedClassPointers, "should only be used for compressed headers"); | 5123 assert (UseCompressedClassPointers, "should only be used for compressed headers"); |
5112 if (dst == src) { | 5124 if (dst == src) { |
5113 decode_klass_not_null(dst); | 5125 decode_klass_not_null(dst); |
5114 } else { | 5126 } else { |
5115 // Cannot assert, unverified entry point counts instructions (see .ad file) | 5127 // Cannot assert, unverified entry point counts instructions (see .ad file) |
5116 // vtableStubs also counts instructions in pd_code_size_limit. | 5128 // vtableStubs also counts instructions in pd_code_size_limit. |
5117 // Also do not verify_oop as this is called by verify_oop. | 5129 // Also do not verify_oop as this is called by verify_oop. |
5118 | |
5119 mov64(dst, (int64_t)Universe::narrow_klass_base()); | 5130 mov64(dst, (int64_t)Universe::narrow_klass_base()); |
5120 if (Universe::narrow_klass_shift() != 0) { | 5131 if (Universe::narrow_klass_shift() != 0) { |
5121 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); | 5132 assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); |
5122 assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?"); | 5133 assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?"); |
5123 leaq(dst, Address(dst, src, Address::times_8, 0)); | 5134 leaq(dst, Address(dst, src, Address::times_8, 0)); |