1
1
/*
2
- * Copyright (c) 1997, 2019 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1997, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@ CodeBuffer::CodeBuffer(CodeBlob* blob) {
90
90
// Provide code buffer with meaningful name
91
91
initialize_misc (blob->name ());
92
92
initialize (blob->content_begin (), blob->content_size ());
93
- verify_section_allocation ();
93
+ debug_only ( verify_section_allocation ();)
94
94
}
95
95
96
96
void CodeBuffer::initialize (csize_t code_size, csize_t locs_size) {
@@ -117,7 +117,7 @@ void CodeBuffer::initialize(csize_t code_size, csize_t locs_size) {
117
117
_insts.initialize_locs (locs_size / sizeof (relocInfo));
118
118
}
119
119
120
- verify_section_allocation ();
120
+ debug_only ( verify_section_allocation ();)
121
121
}
122
122
123
123
@@ -494,7 +494,7 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
494
494
495
495
// Done calculating sections; did it come out to the right end?
496
496
assert (buf_offset == total_content_size (), " sanity" );
497
- dest->verify_section_allocation ();
497
+ debug_only ( dest->verify_section_allocation ();)
498
498
}
499
499
500
500
// Append an oop reference that keeps the class alive.
@@ -914,10 +914,10 @@ void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
914
914
915
915
// Zap the old code buffer contents, to avoid mistakenly using them.
916
916
debug_only (Copy::fill_to_bytes (bxp->_total_start , bxp->_total_size ,
917
- badCodeHeapFreeVal));
917
+ badCodeHeapFreeVal);)
918
918
919
919
// Make certain that the new sections are all snugly inside the new blob.
920
- verify_section_allocation ();
920
+ debug_only ( verify_section_allocation ();)
921
921
922
922
#ifndef PRODUCT
923
923
_decode_begin = NULL ; // sanity
@@ -949,24 +949,23 @@ void CodeBuffer::verify_section_allocation() {
949
949
if (tstart == badAddress) return ; // smashed by set_blob(NULL)
950
950
address tend = tstart + _total_size;
951
951
if (_blob != NULL ) {
952
-
953
952
guarantee (tstart >= _blob->content_begin (), " sanity" );
954
953
guarantee (tend <= _blob->content_end (), " sanity" );
955
954
}
956
955
// Verify disjointness.
957
956
for (int n = (int ) SECT_FIRST; n < (int ) SECT_LIMIT; n++) {
958
957
CodeSection* sect = code_section (n);
959
- if (!sect->is_allocated () || sect->is_empty ()) continue ;
960
- guarantee ((intptr_t )sect->start () % sect->alignment () == 0
961
- || sect->is_empty () || _blob == NULL ,
958
+ if (!sect->is_allocated () || sect->is_empty ()) {
959
+ continue ;
960
+ }
961
+ guarantee (_blob == nullptr || is_aligned (sect->start (), sect->alignment ()),
962
962
" start is aligned" );
963
- for (int m = ( int ) SECT_FIRST ; m < (int ) SECT_LIMIT; m++) {
963
+ for (int m = n + 1 ; m < (int ) SECT_LIMIT; m++) {
964
964
CodeSection* other = code_section (m);
965
- if (!other->is_allocated () || other == sect) continue ;
966
- guarantee (!other->contains (sect->start () ), " sanity" );
967
- // limit is an exclusive address and can be the start of another
968
- // section.
969
- guarantee (!other->contains (sect->limit () - 1 ), " sanity" );
965
+ if (!other->is_allocated () || other == sect) {
966
+ continue ;
967
+ }
968
+ guarantee (other->disjoint (sect), " sanity" );
970
969
}
971
970
guarantee (sect->end () <= tend, " sanity" );
972
971
guarantee (sect->end () <= sect->limit (), " sanity" );
0 commit comments