comparison agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents f6490a5f084a
children
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
22 * 22 *
23 */ 23 */
24 24
25 package sun.jvm.hotspot.memory; 25 package sun.jvm.hotspot.memory;
26 26
27 import java.io.PrintStream; 27 import java.io.*;
28 import java.util.ArrayList; 28 import java.util.*;
29 import java.util.Iterator; 29 import sun.jvm.hotspot.debugger.*;
30 import java.util.List; 30 import sun.jvm.hotspot.oops.*;
31 import java.util.Observable; 31 import sun.jvm.hotspot.runtime.*;
32 import java.util.Observer; 32 import sun.jvm.hotspot.types.*;
33 33 import sun.jvm.hotspot.utilities.*;
34 import sun.jvm.hotspot.debugger.Address;
35 import sun.jvm.hotspot.debugger.Debugger;
36 import sun.jvm.hotspot.oops.ObjectHeap;
37 import sun.jvm.hotspot.oops.Oop;
38 import sun.jvm.hotspot.runtime.VM;
39 import sun.jvm.hotspot.runtime.VMObjectFactory;
40 import sun.jvm.hotspot.types.AddressField;
41 import sun.jvm.hotspot.types.Type;
42 import sun.jvm.hotspot.types.TypeDataBase;
43 import sun.jvm.hotspot.utilities.Assert;
44 34
45 public class CompactibleFreeListSpace extends CompactibleSpace { 35 public class CompactibleFreeListSpace extends CompactibleSpace {
46 private static AddressField collectorField; 36 private static AddressField collectorField;
37
38 // for free size, three fields
39 // FreeBlockDictionary* _dictionary; // ptr to dictionary for large size blocks
40 // FreeList _indexedFreeList[IndexSetSize]; // indexed array for small size blocks
41 // LinearAllocBlock _smallLinearAllocBlock; // small linear alloc in TLAB
47 private static AddressField indexedFreeListField; 42 private static AddressField indexedFreeListField;
48 private static AddressField dictionaryField; 43 private static AddressField dictionaryField;
49 private static long smallLinearAllocBlockFieldOffset; 44 private static long smallLinearAllocBlockFieldOffset;
45 private static long indexedFreeListSizeOf;
50 46
51 private int heapWordSize; // 4 for 32bit, 8 for 64 bits 47 private int heapWordSize; // 4 for 32bit, 8 for 64 bits
52 private int IndexSetStart; // for small indexed list 48 private int IndexSetStart; // for small indexed list
53 private int IndexSetSize; 49 private int IndexSetSize;
54 private int IndexSetStride; 50 private int IndexSetStride;
111 107
112 public long free() { 108 public long free() {
113 // small chunks 109 // small chunks
114 long size = 0; 110 long size = 0;
115 Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() ); 111 Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() );
116 cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf()); 112 cur = cur.addOffsetTo(IndexSetStart*FreeList.sizeOf());
117 for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) { 113 for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) {
118 AdaptiveFreeList freeList = (AdaptiveFreeList) VMObjectFactory.newObject(AdaptiveFreeList.class, cur); 114 FreeList freeList = (FreeList) VMObjectFactory.newObject(FreeList.class, cur);
119 size += i*freeList.count(); 115 size += i*freeList.count();
120 cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf()); 116 cur= cur.addOffsetTo(IndexSetStride*FreeList.sizeOf());
121 } 117 }
122 118
123 // large block 119 // large block
124 AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class, 120 AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
125 dictionaryField.getValue(addr)); 121 dictionaryField.getValue(addr));