< prev index next >

hotspot/src/share/vm/adlc/arena.cpp

Print this page




  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  *
  23  */
  24 
  25 #include "adlc.hpp"
  26 
  27 void* Chunk::operator new(size_t requested_size, size_t length) throw() {
  28   return CHeapObj::operator new(requested_size + length);
  29 }
  30 




  31 void  Chunk::operator delete(void* p, size_t length) {
  32   CHeapObj::operator delete(p);
  33 }
  34 
  35 Chunk::Chunk(size_t length) {
  36   _next = NULL;         // Chain on the linked list
  37   _len  = length;       // Save actual size
  38 }
  39 
  40 //------------------------------chop-------------------------------------------
  41 void Chunk::chop() {
  42   Chunk *k = this;
  43   while( k ) {
  44     Chunk *tmp = k->_next;
  45     // clear out this chunk (to detect allocation bugs)
  46     memset(k, 0xBAADBABE, k->_len);
  47     free(k);                    // Free chunk (was malloc'd)
  48     k = tmp;
  49   }
  50 }




  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  *
  23  */
  24 
  25 #include "adlc.hpp"
  26 
  27 void* Chunk::operator new(size_t requested_size, size_t length) throw() {
  28   return CHeapObj::operator new(requested_size + length);
  29 }
  30 
  31 void  Chunk::operator delete(void* p) {
  32         CHeapObj::operator delete(p);
  33 }
  34 
  35 void  Chunk::operator delete(void* p, size_t length) {
  36   CHeapObj::operator delete(p);
  37 }
  38 
  39 Chunk::Chunk(size_t length) {
  40   _next = NULL;         // Chain on the linked list
  41   _len  = length;       // Save actual size
  42 }
  43 
  44 //------------------------------chop-------------------------------------------
  45 void Chunk::chop() {
  46   Chunk *k = this;
  47   while( k ) {
  48     Chunk *tmp = k->_next;
  49     // clear out this chunk (to detect allocation bugs)
  50     memset(k, 0xBAADBABE, k->_len);
  51     free(k);                    // Free chunk (was malloc'd)
  52     k = tmp;
  53   }
  54 }


< prev index next >