src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java
author jgeorge
Thu, 09 Nov 2017 12:12:32 +0530
changeset 47816 ac0af7750da9
parent 47216 71c04702a3d5
child 53814 eff915f3d3f2
permissions -rw-r--r--
8189798: SA cleanup - part 1 Summary: Avoid varible redefinitions in SA, modify SA varible names to match hotspot ones Reviewed-by: sspitsyn, coleenp, sballal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
47816
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3795
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
30769
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    25
package sun.jvm.hotspot.gc.cms;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
30769
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    27
import java.io.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    28
import java.util.*;
22886
e8b17e1f03ac 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 15735
diff changeset
    29
30769
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    30
import sun.jvm.hotspot.debugger.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    31
import sun.jvm.hotspot.gc.shared.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    32
import sun.jvm.hotspot.memory.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    33
import sun.jvm.hotspot.oops.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    34
import sun.jvm.hotspot.runtime.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    35
import sun.jvm.hotspot.types.*;
df60209aac9d 8080581: Align SA with new GC directory structure
pliden
parents: 22886
diff changeset
    36
import sun.jvm.hotspot.utilities.*;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
public class CompactibleFreeListSpace extends CompactibleSpace {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
   private static AddressField collectorField;
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    40
   private static AddressField indexedFreeListField;
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    41
   private static AddressField dictionaryField;
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    42
   private static long         smallLinearAllocBlockFieldOffset;
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    43
47816
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    44
   private int heapWordSize;     // 4 for 32bit, 8 for 64 bits
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    45
   private int IndexSetStart;    // for small indexed list
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    46
   private int IndexSetSize;
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    47
   private int IndexSetStride;
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    48
   private static long MinChunkSizeInBytes;
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    49
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
   static {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      VM.registerVMInitializedObserver(new Observer() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
         public void update(Observable o, Object data) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
            initialize(VM.getVM().getTypeDataBase());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      });
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
   private static synchronized void initialize(TypeDataBase db) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      long sizeofFreeChunk = db.lookupType("FreeChunk").getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
      VM vm = VM.getVM();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
     Type type = db.lookupType("CompactibleFreeListSpace");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
     collectorField = type.getAddressField("_collector");
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    64
     collectorField       = type.getAddressField("_collector");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    65
     dictionaryField      = type.getAddressField("_dictionary");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    66
     indexedFreeListField = type.getAddressField("_indexedFreeList[0]");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    67
     smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset();
47816
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    68
     MinChunkSizeInBytes = (type.getCIntegerField("_min_chunk_size_in_bytes")).getValue();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
   public CompactibleFreeListSpace(Address addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      super(addr);
5694
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 3795
diff changeset
    73
      VM vm = VM.getVM();
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 3795
diff changeset
    74
      heapWordSize   = vm.getHeapWordSize();
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 3795
diff changeset
    75
      IndexSetStart  = vm.getMinObjAlignmentInBytes() / heapWordSize;
1e0532a6abff 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 3795
diff changeset
    76
      IndexSetStride = IndexSetStart;
47816
ac0af7750da9 8189798: SA cleanup - part 1
jgeorge
parents: 47216
diff changeset
    77
      IndexSetSize   = vm.getIndexSetSize();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
   // Accessing block offset table
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
   public CMSCollector collector() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    return (CMSCollector) VMObjectFactory.newObject(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                                 CMSCollector.class,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                                 collectorField.getValue(addr));
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    85
   }
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    86
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    87
   public long free0() {
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    88
     return capacity() - used0();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    89
   }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
   public long used() {
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    92
     return capacity() - free();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    93
   }
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    94
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
    95
   public long used0() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
      List regions = getLiveRegions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      long usedSize = 0L;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      for (Iterator itr = regions.iterator(); itr.hasNext();) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
         MemRegion mr = (MemRegion) itr.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
         usedSize += mr.byteSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      return usedSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
   public long free() {
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   106
      // small chunks
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   107
      long size = 0;
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   108
      Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() );
22886
e8b17e1f03ac 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 15735
diff changeset
   109
      cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf());
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   110
      for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) {
22886
e8b17e1f03ac 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 15735
diff changeset
   111
         AdaptiveFreeList freeList = (AdaptiveFreeList) VMObjectFactory.newObject(AdaptiveFreeList.class, cur);
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   112
         size += i*freeList.count();
22886
e8b17e1f03ac 8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
sjohanss
parents: 15735
diff changeset
   113
         cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf());
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   114
      }
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   115
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   116
      // large block
15431
570c5062ab8a 8005278: Serviceability Agent: jmap -heap and jstack -m fail
minqi
parents: 13728
diff changeset
   117
      AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   118
                                                                                   dictionaryField.getValue(addr));
15431
570c5062ab8a 8005278: Serviceability Agent: jmap -heap and jstack -m fail
minqi
parents: 13728
diff changeset
   119
      size += aflbd.size();
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   120
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   121
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   122
      // linear block in TLAB
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   123
      LinearAllocBlock lab = (LinearAllocBlock) VMObjectFactory.newObject(LinearAllocBlock.class,
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   124
                                                                          addr.addOffsetTo(smallLinearAllocBlockFieldOffset));
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   125
      size += lab.word_size();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   126
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   127
      return size*heapWordSize;
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   128
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
   public void printOn(PrintStream tty) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      tty.print("free-list-space");
578
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   132
      tty.print("[ " + bottom() + " , " + end() + " ) ");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   133
      long cap = capacity();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   134
      long used_size = used();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   135
      long free_size = free();
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   136
      int  used_perc = (int)((double)used_size/cap*100);
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   137
      tty.print("space capacity = " + cap + " used(" + used_perc + "%)= " + used_size + " ");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   138
      tty.print("free= " + free_size );
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   139
      tty.print("\n");
862a85ed20db 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 1
diff changeset
   140
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
   public Address skipBlockSizeUsingPrintezisBits(Address pos) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
       CMSCollector collector = collector();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
       long size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
       Address addr = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
       if (collector != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
         size = collector.blockSizeUsingPrintezisBits(pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
         if (size >= 3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
           addr = pos.addOffsetTo(adjustObjectSizeInBytes(size));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
       return addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
   public List/*<MemRegion>*/ getLiveRegions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
      List res = new ArrayList(); // List<MemRegion>
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
      VM vm = VM.getVM();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
      Debugger dbg = vm.getDebugger();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
      ObjectHeap heap = vm.getObjectHeap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
      Address cur = bottom();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
      Address regionStart = cur;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
      Address limit = end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      final long addressSize = vm.getAddressSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
      for (; cur.lessThan(limit);) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7662
diff changeset
   168
         Address k = cur.getAddressAt(addressSize);
613
2aa2b913106c 6687581: Make CMS work with compressed oops
coleenp
parents: 1
diff changeset
   169
         if (FreeChunk.indicatesFreeChunk(cur)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
            if (! cur.equals(regionStart)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
               res.add(new MemRegion(regionStart, cur));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
            FreeChunk fc = (FreeChunk) VMObjectFactory.newObject(FreeChunk.class, cur);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
            long chunkSize = fc.size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
            if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
               Assert.that(chunkSize > 0, "invalid FreeChunk size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
            // note that fc.size() gives chunk size in heap words
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
            cur = cur.addOffsetTo(chunkSize * addressSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
            regionStart = cur;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7662
diff changeset
   181
         } else if (k != null) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
            Oop obj = heap.newOop(cur.addOffsetToAsOopHandle(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
            long objectSize = obj.getObjectSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
            cur = cur.addOffsetTo(adjustObjectSizeInBytes(objectSize));
3604
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   185
         } else {
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   186
            // FIXME: need to do a better job here.
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   187
            // can I use bitMap here?
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   188
            //Find the object size using Printezis bits and skip over
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   189
            long size = collector().blockSizeUsingPrintezisBits(cur);
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   190
            if (size == -1) {
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   191
              break;
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   192
            }
30fbd94d4963 6868051: (SA) FreeChunk support for compressed oops is broken
never
parents: 670
diff changeset
   193
            cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
   //-- Internals only below this point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
   // Unlike corresponding VM code, we operate on byte size rather than
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
   // HeapWord size for convenience.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
   public static long adjustObjectSizeInBytes(long sizeInBytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      return Oop.alignObjectSize(Math.max(sizeInBytes, MinChunkSizeInBytes));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
}