Skip to content

Commit dd2f1c4

Browse files
committed
compiler errors fix
1 parent 156db03 commit dd2f1c4

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

src/hotspot/share/code/compressedStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CompressedStream : public ResourceObj {
5656
bool inclusive_end = false) {
5757
// This is only useful for assertions, since not all streams
5858
// have known limit pointers.
59-
return (limit == 0 || (position >= 0 &&
59+
return (limit == 0 || ( // ## error: comparison of unsigned expression >= 0 is always true
6060
(inclusive_end
6161
? position <= limit
6262
: position < limit)));

src/hotspot/share/utilities/unsigned5.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ void ZeroSuppressingU5::ZSReader<ARR,OFF,GET>::reset() {
101101

102102

103103
template<typename ARR, typename OFF, typename SET>
104-
void ZSWriter<ARR,OFF,SET>::setup(ARR array, OFF limit) {
104+
// ## error: invalid use of incomplete type 'class ZeroSuppressingU5::ZSWriter<ARR, OFF, SET>'
105+
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::setup(ARR array, OFF limit) {
105106
_sticky_passthrough = false;
106107
_w.setup(array, limit);
107108
reset();
108109
}
109110

110111
template<typename ARR, typename OFF, typename SET>
111-
void ZSWriter<ARR,OFF,SET>::reset() {
112+
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::reset() {
112113
_w.reset();
113114
_suppressed_zeroes = 0;
114115
_zero_mask_length = 0;
@@ -121,20 +122,19 @@ void ZSWriter<ARR,OFF,SET>::reset() {
121122
}
122123

123124
template<typename ARR, typename OFF, typename SET>
124-
void ZSWriter<ARR,OFF,SET>::grow_array(ARR array, OFF limit) {
125+
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::grow_array(ARR array, OFF limit) {
125126
_w.grow_array(array, limit);
126127
}
127128

128129
template<typename ARR, typename OFF, typename SET>
129-
void ZSWriter<ARR,OFF,SET>::accept_end_byte() {
130+
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::accept_end_byte() {
130131
commit(false, false);
131132
_w.accept_end_byte();
132133
set_clean_or_passthrough();
133134
}
134135

135136
template<typename ARR, typename OFF, typename SET>
136-
137-
OFF ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
137+
OFF ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
138138
ARR arr = array();
139139
OFF pos = start;
140140
int rem = count;
@@ -153,7 +153,7 @@ OFF ZSWriter<ARR,OFF,SET>::advance_position(OFF start, int count) {
153153
int ZSWriter_extra_sanity_checks = 1000;
154154

155155
template<typename ARR, typename OFF, typename SET>
156-
bool ZSWriter<ARR,OFF,SET>::sanity_checks() {
156+
bool ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::sanity_checks() {
157157
const int zmlen = _zero_mask_length;
158158
const int bklen = _block_length;
159159
if (is_passthrough()) {
@@ -190,7 +190,7 @@ bool ZSWriter<ARR,OFF,SET>::sanity_checks() {
190190
}
191191

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

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

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

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

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

430430
template<typename ARR, typename OFF, typename SET>
431-
void ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
431+
void ZeroSuppressingU5::ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
432432
assert(!have_zero_mask(), "");
433433
assert(have_current_block(), "");
434434
assert(sanity_checks(), "");
@@ -462,7 +462,7 @@ void ZSWriter<ARR,OFF,SET>::emit_block_command(bool use_indefinite_length) {
462462
}
463463

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

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

500500
template<typename ARR, typename OFF, typename GET>
501-
void ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
501+
void ZeroSuppressingU5::ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
502502
UNSIGNED5::Reader<ARR,OFF,GET> r(_r.array(), _r.limit());
503503
OFF pos = _r.position();
504504
st->print("CR");
@@ -568,7 +568,7 @@ void ZSReader<ARR,OFF,GET>::print_on(outputStream* st) {
568568
}
569569

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

881881
PRAGMA_DIAG_POP
882882

883-
// Explicit instantiation for supported types.
884-
template void UNSIGNED5::Reader<char*,int>::
885-
print_on(outputStream* st, int count, const char* left, const char* right);
886-
template void UNSIGNED5::Reader<u1*,int>::
887-
print_on(outputStream* st, int count, const char* left, const char* right);
888-
template void UNSIGNED5::Reader<address,size_t>::
889-
print_on(outputStream* st, int count, const char* left, const char* right);
883+
// ## error: duplicate explicit instantiation

src/hotspot/share/utilities/unsigned5.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class UNSIGNED5 : AllStatic {
224224
// This is a simple linear formula over integers.
225225
// This works because H is an exact power of 2.
226226
int log2i_max = flg_L + (len - 1) * lg_H;
227-
assert(log2i_max == log2i(max_encoded_in_length(len)), "");
227+
// ## error: call to non-'constexpr' function
228228
return log2i_max;
229229
}
230230

@@ -542,7 +542,10 @@ class UNSIGNED5 : AllStatic {
542542
assert(_position <= limit, "");
543543
_limit = limit;
544544
if (_array != array) {
545-
memcpy(array, _array, _position);
545+
// ## error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'class Array<unsigned char>' with no trivial copy-assignment
546+
for (int i = 0; i < (int)_position; i++) {
547+
SET()(array, i, SET()(_array, i));
548+
}
546549
_array = array;
547550
}
548551
}
@@ -1165,7 +1168,8 @@ class ZeroSuppressingU5 : AllStatic {
11651168
return cmd >> BLOCK_TAG_WIDTH;
11661169
}
11671170
static uint32_t encode_block_count(uint32_t count) {
1168-
assert(count >= 0 && count <= MAX_BLOCK_COUNT, "");
1171+
// ## error: comparison of unsigned expression >= 0 is always true
1172+
assert(count <= MAX_BLOCK_COUNT, "");
11691173
int cmd = count << BLOCK_TAG_WIDTH;
11701174
assert(decode_block_count(cmd) == count, "");
11711175
return cmd;

0 commit comments

Comments
 (0)