8183001: Various inlining improvements

Reviewed-by: iklam, mikael, ehelin, stefank
This commit is contained in:
Claes Redestad 2017-06-29 14:22:42 +02:00
parent 7225e6008d
commit 22cd78c6fb
7 changed files with 50 additions and 54 deletions

View File

@ -127,41 +127,6 @@ void test_compressed_stream(int trace);
bool test_compressed_stream_enabled = false;
#endif
// This encoding, called UNSIGNED5, is taken from J2SE Pack200.
// It assumes that most values have lots of leading zeroes.
// Very small values, in the range [0..191], code in one byte.
// Any 32-bit value (including negatives) can be coded, in
// up to five bytes. The grammar is:
// low_byte = [0..191]
// high_byte = [192..255]
// any_byte = low_byte | high_byte
// coding = low_byte
// | high_byte low_byte
// | high_byte high_byte low_byte
// | high_byte high_byte high_byte low_byte
// | high_byte high_byte high_byte high_byte any_byte
// Each high_byte contributes six bits of payload.
// The encoding is one-to-one (except for integer overflow)
// and easy to parse and unparse.
jint CompressedReadStream::read_int_mb(jint b0) {
int pos = position() - 1;
u_char* buf = buffer() + pos;
assert(buf[0] == b0 && b0 >= L, "correctly called");
jint sum = b0;
// must collect more bytes: b[1]...b[4]
int lg_H_i = lg_H;
for (int i = 0; ; ) {
jint b_i = buf[++i]; // b_i = read(); ++i;
sum += b_i << lg_H_i; // sum += b[i]*(64**i)
if (b_i < L || i == MAX_i) {
set_position(pos+i+1);
return sum;
}
lg_H_i += lg_H;
}
}
void CompressedWriteStream::write_int_mb(jint value) {
debug_only(int pos1 = position());
juint sum = value;

View File

@ -66,7 +66,40 @@ class CompressedReadStream : public CompressedStream {
private:
inline u_char read() { return _buffer[_position++]; }
jint read_int_mb(jint b0); // UNSIGNED5 coding, 2-5 byte cases
// This encoding, called UNSIGNED5, is taken from J2SE Pack200.
// It assumes that most values have lots of leading zeroes.
// Very small values, in the range [0..191], code in one byte.
// Any 32-bit value (including negatives) can be coded, in
// up to five bytes. The grammar is:
// low_byte = [0..191]
// high_byte = [192..255]
// any_byte = low_byte | high_byte
// coding = low_byte
// | high_byte low_byte
// | high_byte high_byte low_byte
// | high_byte high_byte high_byte low_byte
// | high_byte high_byte high_byte high_byte any_byte
// Each high_byte contributes six bits of payload.
// The encoding is one-to-one (except for integer overflow)
// and easy to parse and unparse.
jint read_int_mb(jint b0) {
int pos = position() - 1;
u_char* buf = buffer() + pos;
assert(buf[0] == b0 && b0 >= L, "correctly called");
jint sum = b0;
// must collect more bytes: b[1]...b[4]
int lg_H_i = lg_H;
for (int i = 0; ; ) {
jint b_i = buf[++i]; // b_i = read(); ++i;
sum += b_i << lg_H_i; // sum += b[i]*(64**i)
if (b_i < L || i == MAX_i) {
set_position(pos+i+1);
return sum;
}
lg_H_i += lg_H;
}
}
public:
CompressedReadStream(u_char* buffer, int position = 0)

View File

@ -1219,11 +1219,6 @@ bool MetaspaceShared::is_in_shared_region(const void* p, int idx) {
return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_region(p, idx);
}
bool MetaspaceShared::is_string_region(int idx) {
return (idx >= MetaspaceShared::first_string &&
idx < MetaspaceShared::first_string + MetaspaceShared::max_strings);
}
void MetaspaceShared::print_shared_spaces() {
if (UseSharedSpaces) {
FileMapInfo::current_info()->print_shared_spaces();

View File

@ -172,7 +172,10 @@ class MetaspaceShared : AllStatic {
// Return true if given address is in the shared region corresponding to the idx
static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
static bool is_string_region(int idx) NOT_CDS_RETURN_(false);
static bool is_string_region(int idx) {
CDS_ONLY(return (idx >= first_string && idx < first_string + max_strings));
NOT_CDS(return false);
}
static intptr_t* allocate_cpp_vtable_clones(intptr_t* top, intptr_t* end);
static intptr_t* clone_cpp_vtables(intptr_t* p);

View File

@ -1074,16 +1074,6 @@ oop frame::retrieve_receiver(RegisterMap* reg_map) {
}
oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
if(reg->is_reg()) {
// If it is passed in a register, it got spilled in the stub frame.
return (oop *)reg_map->location(reg);
} else {
int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
}
}
BasicLock* frame::get_native_monitor() {
nmethod* nm = (nmethod*)_cb;
assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),

View File

@ -387,8 +387,8 @@ class frame VALUE_OBJ_CLASS_SPEC {
// Add annotated descriptions of memory locations belonging to this frame to values
void describe(FrameValues& values, int frame_no);
// Conversion from an VMReg to physical stack location
oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
// Conversion from a VMReg to physical stack location
oop* oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const;
// Oops-do's
void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);

View File

@ -53,4 +53,14 @@ inline bool frame::is_first_frame() const {
return is_entry_frame() && entry_frame_is_first();
}
inline oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
if(reg->is_reg()) {
// If it is passed in a register, it got spilled in the stub frame.
return (oop *)reg_map->location(reg);
} else {
int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
}
}
#endif // SHARE_VM_RUNTIME_FRAME_INLINE_HPP