< prev index next >

test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java

Print this page
   1 /*
   2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  85                     long used = Long.parseLong(matcher.group(2));
  86                     long capacity = Long.parseLong(matcher.group(3));
  87                     long address = Long.parseLong(matcher.group(4), 16);
  88                     long unused = capacity - used;
  89                     if (unused < 0) {
  90                         throw new RuntimeException("Unused space (" + unused + ") less than 0");
  91                     }
  92                     if (unused > reserve_alignment) {
  93                         // [1] Check for unused space
  94                         throw new RuntimeException("Unused space (" + unused + ") must be smaller than Metaspace::reserve_alignment() (" +
  95                                                    reserve_alignment + ")");
  96                     }
  97                     if (last_region >= 0 && address != last_region) {
  98                         // [2] Check for no-gap
  99                         throw new RuntimeException("Region 0x" + address + " should have started at 0x" + Long.toString(last_region, 16));
 100                     }
 101                     last_region = address + capacity;
 102                 }
 103             }
 104         }
 105         if (checked.size() != 5) {
 106           throw new RuntimeException("Must have 5 consecutive, fully utilized regions");
 107         }
 108     }
 109 }
   1 /*
   2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  85                     long used = Long.parseLong(matcher.group(2));
  86                     long capacity = Long.parseLong(matcher.group(3));
  87                     long address = Long.parseLong(matcher.group(4), 16);
  88                     long unused = capacity - used;
  89                     if (unused < 0) {
  90                         throw new RuntimeException("Unused space (" + unused + ") less than 0");
  91                     }
  92                     if (unused > reserve_alignment) {
  93                         // [1] Check for unused space
  94                         throw new RuntimeException("Unused space (" + unused + ") must be smaller than Metaspace::reserve_alignment() (" +
  95                                                    reserve_alignment + ")");
  96                     }
  97                     if (last_region >= 0 && address != last_region) {
  98                         // [2] Check for no-gap
  99                         throw new RuntimeException("Region 0x" + address + " should have started at 0x" + Long.toString(last_region, 16));
 100                     }
 101                     last_region = address + capacity;
 102                 }
 103             }
 104         }
 105         if (checked.size() != 4) {
 106           throw new RuntimeException("Must have 5 consecutive, fully utilized regions");
 107         }
 108     }
 109 }
< prev index next >