@@ -185,18 +185,12 @@ fn verify_no_overlap_chunked(spec_1: &SideMetadataSpec, spec_2: &SideMetadataSpe
185185/// * `g_specs`: the slice of global specifications to be checked
186186///
187187fn verify_global_specs ( g_specs : & [ SideMetadataSpec ] ) -> Result < ( ) > {
188- let v = verify_global_specs_total_size ( g_specs) ;
189- if v. is_err ( ) {
190- return v;
191- }
188+ verify_global_specs_total_size ( g_specs) ?;
192189
193190 for spec_1 in g_specs {
194191 for spec_2 in g_specs {
195192 if spec_1 != spec_2 {
196- let v = verify_no_overlap_contiguous ( spec_1, spec_2) ;
197- if v. is_err ( ) {
198- return v;
199- }
193+ verify_no_overlap_contiguous ( spec_1, spec_2) ?;
200194 }
201195 }
202196 }
@@ -245,21 +239,15 @@ impl SideMetadataSanity {
245239 fn verify_local_specs ( & self ) -> Result < ( ) > {
246240 let local_specs = self . get_all_specs ( false ) ;
247241
248- let v = verify_local_specs_size ( & local_specs) ;
249- if v. is_err ( ) {
250- return v;
251- }
242+ verify_local_specs_size ( & local_specs) ?;
252243
253244 for spec_1 in & local_specs {
254245 for spec_2 in & local_specs {
255246 if spec_1 != spec_2 {
256247 #[ cfg( target_pointer_width = "64" ) ]
257- let v = verify_no_overlap_contiguous ( spec_1, spec_2) ;
248+ verify_no_overlap_contiguous ( spec_1, spec_2) ? ;
258249 #[ cfg( target_pointer_width = "32" ) ]
259- let v = verify_no_overlap_chunked ( spec_1, spec_2) ;
260- if v. is_err ( ) {
261- return v;
262- }
250+ verify_no_overlap_chunked ( spec_1, spec_2) ?;
263251 }
264252 }
265253 }
@@ -306,12 +294,11 @@ impl SideMetadataSanity {
306294
307295 for spec in & metadata_context. global {
308296 // Make sure all input global specs are actually global
309- if !spec. is_global {
310- panic ! (
311- "Policy-specific spec {:#?} detected in the global specs: {:#?}" ,
312- spec, metadata_context. global
313- ) ;
314- }
297+ assert ! (
298+ spec. is_global,
299+ "Policy-specific spec {:#?} detected in the global specs: {:#?}" ,
300+ spec, metadata_context. global
301+ ) ;
315302 // On the first call to the function, initialise the content sanity map, and
316303 // on the future calls, checks the global metadata specs have not changed
317304 if first_call {
@@ -337,12 +324,11 @@ impl SideMetadataSanity {
337324
338325 for spec in & metadata_context. local {
339326 // Make sure all input local specs are actually local
340- if spec. is_global {
341- panic ! (
342- "Global spec {:#?} detected in the policy-specific specs: {:#?}" ,
343- spec, metadata_context. local
344- ) ;
345- }
327+ assert ! (
328+ !spec. is_global,
329+ "Global spec {:#?} detected in the policy-specific specs: {:#?}" ,
330+ spec, metadata_context. local
331+ ) ;
346332 // The first call from each policy inserts the relevant (spec, hashmap) pair.
347333 // Future calls only check that the metadata specs have not changed.
348334 // This should work with multi mmtk instances, because the local side metadata specs are assumed to be constant per policy.
@@ -408,9 +394,13 @@ fn verify_metadata_address_bound(spec: &SideMetadataSpec, data_addr: Address) {
408394 unreachable ! ( )
409395 }
410396 } ;
411- if metadata_addr >= metadata_addr_bound {
412- panic ! ( "We try access metadata address for address {} of spec {} that is not within the bound {}." , data_addr, spec. name, metadata_addr_bound) ;
413- }
397+ assert ! (
398+ metadata_addr < metadata_addr_bound,
399+ "We try access metadata address for address {} of spec {} that is not within the bound {}." ,
400+ data_addr,
401+ spec. name,
402+ metadata_addr_bound
403+ ) ;
414404}
415405
416406/// Commits a side metadata bulk zero operation.
0 commit comments