Skip to content

Commit

Permalink
compiler errors fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bulasevich committed Feb 9, 2024
1 parent 156db03 commit dd2f1c4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/code/compressedStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CompressedStream : public ResourceObj {
bool inclusive_end = false) {
// This is only useful for assertions, since not all streams
// have known limit pointers.
return (limit == 0 || (position >= 0 &&
return (limit == 0 || ( // ## error: comparison of unsigned expression >= 0 is always true
(inclusive_end
? position <= limit
: position < limit)));
Expand Down
42 changes: 18 additions & 24 deletions src/hotspot/share/utilities/unsigned5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ void ZeroSuppressingU5::ZSReader<ARR,OFF,GET>::reset() {


template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::setup(ARR array, OFF limit) {
// ## error: invalid use of incomplete type 'class ZeroSuppressingU5::ZSWriter<ARR, OFF, SET>'
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::setup(ARR array, OFF limit) {
_sticky_passthrough = false;
_w.setup(array, limit);
reset();
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::reset() {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::reset() {
_w.reset();
_suppressed_zeroes = 0;
_zero_mask_length = 0;
Expand All @@ -121,20 +122,19 @@ void ZSWriter<ARR,OFF,SET>::reset() {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::grow_array(ARR array, OFF limit) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::grow_array(ARR array, OFF limit) {
_w.grow_array(array, limit);
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::accept_end_byte() {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::accept_end_byte() {
commit(false, false);
_w.accept_end_byte();
set_clean_or_passthrough();
}

template<typename ARR, typename OFF, typename SET>

OFF ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
OFF ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
ARR arr = array();
OFF pos = start;
int rem = count;
Expand All @@ -153,7 +153,7 @@ OFF ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
int ZSWriter_extra_sanity_checks = 1000;

template<typename ARR, typename OFF, typename SET>
bool ZSWriter<ARR,OFF,SET>::sanity_checks() {
bool ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::sanity_checks() {
const int zmlen = _zero_mask_length;
const int bklen = _block_length;
if (is_passthrough()) {
Expand Down Expand Up @@ -190,7 +190,7 @@ bool ZSWriter<ARR,OFF,SET>::sanity_checks() {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::digest_multiple_uints(OFF start_pos, int count) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::digest_multiple_uints(OFF start_pos, int count) {
assert(count >= 1 && count <= 3, "");
uint32_t zm = 0;
OFF pos = start_pos;
Expand All @@ -210,7 +210,7 @@ void ZSWriter<ARR,OFF,SET>::digest_multiple_uints(OFF start_pos, int count) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::digest_uint_mask(uint32_t more_zm, int more_zm_len, OFF start_pos) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::digest_uint_mask(uint32_t more_zm, int more_zm_len, OFF start_pos) {
if (is_passthrough()) {
return; // no more compression, but it's OK to keep accumulating
}
Expand Down Expand Up @@ -252,7 +252,7 @@ void ZSWriter<ARR,OFF,SET>::digest_uint_mask(uint32_t more_zm, int more_zm_len,
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::expand_current_block(int trim) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::expand_current_block(int trim) {
// current block (middle area) takes leading items from zero mask area
assert(trim > 0 && trim <= _zero_mask_length, "");
assert(have_zero_mask(), "");
Expand All @@ -268,7 +268,7 @@ void ZSWriter<ARR,OFF,SET>::expand_current_block(int trim) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::drain_zero_mask(int target_zero_mask_length) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::drain_zero_mask(int target_zero_mask_length) {
// Drain the zero mask area until it is at most the target size.
const int zml = _zero_mask_length;
if (zml <= target_zero_mask_length) return;
Expand Down Expand Up @@ -316,7 +316,7 @@ void ZSWriter<ARR,OFF,SET>::drain_zero_mask(int target_zero_mask_length) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::do_compression(uint32_t best_zm) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::do_compression(uint32_t best_zm) {
// Act on the chosen zero mask.
assert(best_zm != 0, ""); // must have something to compress
assert((best_zm & _zero_mask) == best_zm, "subset mask");
Expand Down Expand Up @@ -428,7 +428,7 @@ void ZSWriter<ARR,OFF,SET>::do_compression(uint32_t best_zm) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
assert(!have_zero_mask(), "");
assert(have_current_block(), "");
assert(sanity_checks(), "");
Expand Down Expand Up @@ -462,7 +462,7 @@ void ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::emit_zero_mask_command(uint32_t best_zm) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::emit_zero_mask_command(uint32_t best_zm) {
assert(is_clean(), "");
assert(sanity_checks(), "");
// Emit the zero mask command, including its buffered payload data.
Expand All @@ -471,7 +471,7 @@ void ZSWriter<ARR,OFF,SET>::emit_zero_mask_command(uint32_t best_zm) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::commit(bool require_clean,
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::commit(bool require_clean,
bool require_passthrough) {
assert(!require_clean || !require_passthrough, ""); // not both
if (is_passthrough()) { // already passing through uncompressed
Expand All @@ -498,7 +498,7 @@ void ZSWriter<ARR,OFF,SET>::commit(bool require_clean,
}

template<typename ARR, typename OFF, typename GET>
void ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
void ZeroSuppressingU5::ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
UNSIGNED5::Reader<ARR,OFF,GET> r(_r.array(), _r.limit());
OFF pos = _r.position();
st->print("CR");
Expand Down Expand Up @@ -568,7 +568,7 @@ void ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
}

template<typename ARR, typename OFF, typename SET>
void ZSWriter<ARR,OFF,SET>::print_on(outputStream* st) {
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::print_on(outputStream* st) {
ZSReader<ARR,OFF,SET> r(_w.array(), _w.position());
if (is_passthrough()) r.set_passthrough();
st->print("CW[");
Expand Down Expand Up @@ -880,10 +880,4 @@ print_on(outputStream* st, int count,

PRAGMA_DIAG_POP

// Explicit instantiation for supported types.
template void UNSIGNED5::Reader<char*,int>::
print_on(outputStream* st, int count, const char* left, const char* right);
template void UNSIGNED5::Reader<u1*,int>::
print_on(outputStream* st, int count, const char* left, const char* right);
template void UNSIGNED5::Reader<address,size_t>::
print_on(outputStream* st, int count, const char* left, const char* right);
// ## error: duplicate explicit instantiation
10 changes: 7 additions & 3 deletions src/hotspot/share/utilities/unsigned5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class UNSIGNED5 : AllStatic {
// This is a simple linear formula over integers.
// This works because H is an exact power of 2.
int log2i_max = flg_L + (len - 1) * lg_H;
assert(log2i_max == log2i(max_encoded_in_length(len)), "");
// ## error: call to non-'constexpr' function
return log2i_max;
}

Expand Down Expand Up @@ -542,7 +542,10 @@ class UNSIGNED5 : AllStatic {
assert(_position <= limit, "");
_limit = limit;
if (_array != array) {
memcpy(array, _array, _position);
// ## error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'class Array<unsigned char>' with no trivial copy-assignment
for (int i = 0; i < (int)_position; i++) {
SET()(array, i, SET()(_array, i));
}
_array = array;
}
}
Expand Down Expand Up @@ -1165,7 +1168,8 @@ class ZeroSuppressingU5 : AllStatic {
return cmd >> BLOCK_TAG_WIDTH;
}
static uint32_t encode_block_count(uint32_t count) {
assert(count >= 0 && count <= MAX_BLOCK_COUNT, "");
// ## error: comparison of unsigned expression >= 0 is always true
assert(count <= MAX_BLOCK_COUNT, "");
int cmd = count << BLOCK_TAG_WIDTH;
assert(decode_block_count(cmd) == count, "");
return cmd;
Expand Down

0 comments on commit dd2f1c4

Please sign in to comment.