hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 360 21d113ecbf6a
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// The ObjectHeap is an abstraction over all generations in the VM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// It gives access to all present objects and classes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
package sun.jvm.hotspot.oops;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
import sun.jvm.hotspot.debugger.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
import sun.jvm.hotspot.gc_interface.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
import sun.jvm.hotspot.memory.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
import sun.jvm.hotspot.types.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
import sun.jvm.hotspot.utilities.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
public class ObjectHeap {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  private OopHandle              symbolKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  private OopHandle              methodKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  private OopHandle              constMethodKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  private OopHandle              methodDataKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  private OopHandle              constantPoolKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  private OopHandle              constantPoolCacheKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  private OopHandle              klassKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  private OopHandle              instanceKlassKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  private OopHandle              typeArrayKlassKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  private OopHandle              objArrayKlassKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  private OopHandle              boolArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  private OopHandle              byteArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  private OopHandle              charArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  private OopHandle              intArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  private OopHandle              shortArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  private OopHandle              longArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  private OopHandle              singleArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  private OopHandle              doubleArrayKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  private OopHandle              arrayKlassKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  private OopHandle              compiledICHolderKlassHandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  private SymbolKlass            symbolKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  private MethodKlass            methodKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  private ConstMethodKlass       constMethodKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  private MethodDataKlass        methodDataKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  private ConstantPoolKlass      constantPoolKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  private ConstantPoolCacheKlass constantPoolCacheKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  private KlassKlass             klassKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  private InstanceKlassKlass     instanceKlassKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  private TypeArrayKlassKlass    typeArrayKlassKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  private ObjArrayKlassKlass     objArrayKlassKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  private TypeArrayKlass         boolArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  private TypeArrayKlass         byteArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  private TypeArrayKlass         charArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  private TypeArrayKlass         intArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  private TypeArrayKlass         shortArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  private TypeArrayKlass         longArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  private TypeArrayKlass         singleArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  private TypeArrayKlass         doubleArrayKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  private ArrayKlassKlass        arrayKlassKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  private CompiledICHolderKlass  compiledICHolderKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  public void initialize(TypeDataBase db) throws WrongTypeException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    // Lookup the roots in the object hierarchy.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    Type universeType = db.lookupType("Universe");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    symbolKlassHandle         = universeType.getOopField("_symbolKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    symbolKlassObj            = new SymbolKlass(symbolKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    methodKlassHandle         = universeType.getOopField("_methodKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    methodKlassObj            = new MethodKlass(methodKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    constMethodKlassHandle    = universeType.getOopField("_constMethodKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    constMethodKlassObj       = new ConstMethodKlass(constMethodKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    constantPoolKlassHandle   = universeType.getOopField("_constantPoolKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    constantPoolKlassObj      = new ConstantPoolKlass(constantPoolKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    constantPoolCacheKlassHandle = universeType.getOopField("_constantPoolCacheKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    constantPoolCacheKlassObj = new ConstantPoolCacheKlass(constantPoolCacheKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    klassKlassHandle          = universeType.getOopField("_klassKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    klassKlassObj             = new KlassKlass(klassKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    arrayKlassKlassHandle     = universeType.getOopField("_arrayKlassKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    arrayKlassKlassObj        = new ArrayKlassKlass(arrayKlassKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    instanceKlassKlassHandle  = universeType.getOopField("_instanceKlassKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    instanceKlassKlassObj     = new InstanceKlassKlass(instanceKlassKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    typeArrayKlassKlassHandle = universeType.getOopField("_typeArrayKlassKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    typeArrayKlassKlassObj    = new TypeArrayKlassKlass(typeArrayKlassKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    objArrayKlassKlassHandle  = universeType.getOopField("_objArrayKlassKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    objArrayKlassKlassObj     = new ObjArrayKlassKlass(objArrayKlassKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    boolArrayKlassHandle      = universeType.getOopField("_boolArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    boolArrayKlassObj         = new TypeArrayKlass(boolArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    byteArrayKlassHandle      = universeType.getOopField("_byteArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    byteArrayKlassObj         = new TypeArrayKlass(byteArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    charArrayKlassHandle      = universeType.getOopField("_charArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    charArrayKlassObj         = new TypeArrayKlass(charArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    intArrayKlassHandle       = universeType.getOopField("_intArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    intArrayKlassObj          = new TypeArrayKlass(intArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    shortArrayKlassHandle     = universeType.getOopField("_shortArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    shortArrayKlassObj        = new TypeArrayKlass(shortArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    longArrayKlassHandle      = universeType.getOopField("_longArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    longArrayKlassObj         = new TypeArrayKlass(longArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    singleArrayKlassHandle    = universeType.getOopField("_singleArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    singleArrayKlassObj       = new TypeArrayKlass(singleArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    doubleArrayKlassHandle    = universeType.getOopField("_doubleArrayKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    doubleArrayKlassObj       = new TypeArrayKlass(doubleArrayKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    if (!VM.getVM().isCore()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
      methodDataKlassHandle   = universeType.getOopField("_methodDataKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
      methodDataKlassObj      = new MethodDataKlass(methodDataKlassHandle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
      compiledICHolderKlassHandle = universeType.getOopField("_compiledICHolderKlassObj").getValue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
      compiledICHolderKlassObj= new CompiledICHolderKlass(compiledICHolderKlassHandle ,this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  public ObjectHeap(TypeDataBase db) throws WrongTypeException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    // Get commonly used sizes of basic types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    oopSize     = db.getOopSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    byteSize    = db.getJByteType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    charSize    = db.getJCharType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    booleanSize = db.getJBooleanType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    intSize     = db.getJIntType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    shortSize   = db.getJShortType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    longSize    = db.getJLongType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    floatSize   = db.getJFloatType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    doubleSize  = db.getJDoubleType().getSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    initialize(db);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  /** Comparison operation for oops, either or both of which may be null */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  public boolean equal(Oop o1, Oop o2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    if (o1 != null) return o1.equals(o2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    return (o2 == null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // Cached sizes of basic types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  private long oopSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  private long byteSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  private long charSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  private long booleanSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  private long intSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  private long shortSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  private long longSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  private long floatSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  private long doubleSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  public long getOopSize()     { return oopSize;     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  public long getByteSize()    { return byteSize;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  public long getCharSize()    { return charSize;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  public long getBooleanSize() { return booleanSize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  public long getIntSize()     { return intSize;     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  public long getShortSize()   { return shortSize;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  public long getLongSize()    { return longSize;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  public long getFloatSize()   { return floatSize;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  public long getDoubleSize()  { return doubleSize;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  // Accessors for well-known system classes (from Universe)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  public SymbolKlass            getSymbolKlassObj()            { return symbolKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  public MethodKlass            getMethodKlassObj()            { return methodKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  public ConstMethodKlass       getConstMethodKlassObj()       { return constMethodKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  public MethodDataKlass        getMethodDataKlassObj()        { return methodDataKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  public ConstantPoolKlass      getConstantPoolKlassObj()      { return constantPoolKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  public ConstantPoolCacheKlass getConstantPoolCacheKlassObj() { return constantPoolCacheKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  public KlassKlass             getKlassKlassObj()             { return klassKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  public ArrayKlassKlass        getArrayKlassKlassObj()        { return arrayKlassKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  public InstanceKlassKlass     getInstanceKlassKlassObj()     { return instanceKlassKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  public ObjArrayKlassKlass     getObjArrayKlassKlassObj()     { return objArrayKlassKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  public TypeArrayKlassKlass    getTypeArrayKlassKlassObj()    { return typeArrayKlassKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  public TypeArrayKlass         getBoolArrayKlassObj()         { return boolArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  public TypeArrayKlass         getByteArrayKlassObj()         { return byteArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  public TypeArrayKlass         getCharArrayKlassObj()         { return charArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  public TypeArrayKlass         getIntArrayKlassObj()          { return intArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  public TypeArrayKlass         getShortArrayKlassObj()        { return shortArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  public TypeArrayKlass         getLongArrayKlassObj()         { return longArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  public TypeArrayKlass         getSingleArrayKlassObj()       { return singleArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  public TypeArrayKlass         getDoubleArrayKlassObj()       { return doubleArrayKlassObj; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  public CompiledICHolderKlass  getCompiledICHolderKlassObj()  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
      Assert.that(!VM.getVM().isCore(), "must not be called for core build");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    return compiledICHolderKlassObj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  /** Takes a BasicType and returns the corresponding primitive array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      klass */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  public Klass typeArrayKlassObj(int t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    if (t == BasicType.getTBoolean()) return getBoolArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    if (t == BasicType.getTChar())    return getCharArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    if (t == BasicType.getTFloat())   return getSingleArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    if (t == BasicType.getTDouble())  return getDoubleArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    if (t == BasicType.getTByte())    return getByteArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    if (t == BasicType.getTShort())   return getShortArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    if (t == BasicType.getTInt())     return getIntArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    if (t == BasicType.getTLong())    return getLongArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    throw new RuntimeException("Illegal basic type " + t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  /** an interface to filter objects while walking heap */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  public static interface ObjectFilter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    public boolean canInclude(Oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  /** The base heap iteration mechanism */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  public void iterate(HeapVisitor visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    iterateLiveRegions(collectLiveRegions(), visitor, null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  /** iterate objects satisfying a specified ObjectFilter */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  public void iterate(HeapVisitor visitor, ObjectFilter of) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    iterateLiveRegions(collectLiveRegions(), visitor, of);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  /** iterate objects of given Klass. param 'includeSubtypes' tells whether to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
   *  include objects of subtypes or not */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  public void iterateObjectsOfKlass(HeapVisitor visitor, final Klass k, boolean includeSubtypes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
    if (includeSubtypes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
      if (k.isFinal()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
        // do the simpler "exact" klass loop
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        iterateExact(visitor, k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
        iterateSubtypes(visitor, k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
      // there can no object of abstract classes and interfaces
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
      if (!k.isAbstract() && !k.isInterface()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
        iterateExact(visitor, k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  /** iterate objects of given Klass (objects of subtypes included) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  public void iterateObjectsOfKlass(HeapVisitor visitor, final Klass k) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    iterateObjectsOfKlass(visitor, k, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  /** This routine can be used to iterate through the heap at an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
      extremely low level (stepping word-by-word) to provide the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
      ability to do very low-level debugging */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  public void iterateRaw(RawHeapVisitor visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
    List liveRegions = collectLiveRegions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
    // Summarize size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    long totalSize = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
    for (int i = 0; i < liveRegions.size(); i += 2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
      Address bottom = (Address) liveRegions.get(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
      Address top    = (Address) liveRegions.get(i+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
      totalSize += top.minus(bottom);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
    visitor.prologue(totalSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    for (int i = 0; i < liveRegions.size(); i += 2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
      Address bottom = (Address) liveRegions.get(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
      Address top    = (Address) liveRegions.get(i+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
      // Traverses the space from bottom to top
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      while (bottom.lessThan(top)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
        visitor.visitAddress(bottom);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
        bottom = bottom.addOffsetTo(VM.getVM().getAddressSize());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
    visitor.epilogue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  // Iterates through only the perm generation for the purpose of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  // finding static fields for liveness analysis
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  public void iteratePerm(HeapVisitor visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
    CollectedHeap heap = VM.getVM().getUniverse().heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
    List liveRegions = new ArrayList();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
    addPermGenLiveRegions(liveRegions, heap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    sortLiveRegions(liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
    iterateLiveRegions(liveRegions, visitor, null);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  // Creates an instance from the Oop hierarchy based based on the handle
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  public Oop newOop(OopHandle handle) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
    // The only known way to detect the right type of an oop is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
    // traversing the class chain until a well-known klass is recognized.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    // A more direct solution would require the klasses to expose
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    // the C++ vtbl structure.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
    // Handle the null reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    if (handle == null) return null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    // First check if handle is one of the root objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    if (handle.equals(methodKlassHandle))              return getMethodKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
    if (handle.equals(constMethodKlassHandle))         return getConstMethodKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    if (handle.equals(symbolKlassHandle))              return getSymbolKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
    if (handle.equals(constantPoolKlassHandle))        return getConstantPoolKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
    if (handle.equals(constantPoolCacheKlassHandle))   return getConstantPoolCacheKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
    if (handle.equals(instanceKlassKlassHandle))       return getInstanceKlassKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    if (handle.equals(objArrayKlassKlassHandle))       return getObjArrayKlassKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    if (handle.equals(klassKlassHandle))               return getKlassKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    if (handle.equals(arrayKlassKlassHandle))          return getArrayKlassKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    if (handle.equals(typeArrayKlassKlassHandle))      return getTypeArrayKlassKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    if (handle.equals(boolArrayKlassHandle))           return getBoolArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    if (handle.equals(byteArrayKlassHandle))           return getByteArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    if (handle.equals(charArrayKlassHandle))           return getCharArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    if (handle.equals(intArrayKlassHandle))            return getIntArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    if (handle.equals(shortArrayKlassHandle))          return getShortArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    if (handle.equals(longArrayKlassHandle))           return getLongArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
    if (handle.equals(singleArrayKlassHandle))         return getSingleArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
    if (handle.equals(doubleArrayKlassHandle))         return getDoubleArrayKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    if (!VM.getVM().isCore()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
      if (handle.equals(compiledICHolderKlassHandle))  return getCompiledICHolderKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
      if (handle.equals(methodDataKlassHandle))        return getMethodDataKlassObj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
    // Then check if obj.klass() is one of the root objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    OopHandle klass = Oop.getKlassForOopHandle(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    if (klass != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
      if (klass.equals(methodKlassHandle))              return new Method(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
      if (klass.equals(constMethodKlassHandle))         return new ConstMethod(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      if (klass.equals(symbolKlassHandle))              return new Symbol(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
      if (klass.equals(constantPoolKlassHandle))        return new ConstantPool(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
      if (klass.equals(constantPoolCacheKlassHandle))   return new ConstantPoolCache(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
      if (!VM.getVM().isCore()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
        if (klass.equals(compiledICHolderKlassHandle))  return new CompiledICHolder(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        if (klass.equals(methodDataKlassHandle))        return new MethodData(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
      if (klass.equals(instanceKlassKlassHandle))       return new InstanceKlass(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
      if (klass.equals(objArrayKlassKlassHandle))       return new ObjArrayKlass(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
      if (klass.equals(typeArrayKlassKlassHandle))      return new TypeArrayKlass(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
      // Lastly check if obj.klass().klass() is on of the root objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
      OopHandle klassKlass = Oop.getKlassForOopHandle(klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
      if (klassKlass != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        if (klassKlass.equals(instanceKlassKlassHandle))    return new Instance(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
        if (klassKlass.equals(objArrayKlassKlassHandle))    return new ObjArray(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
        if (klassKlass.equals(typeArrayKlassKlassHandle))   return new TypeArray(handle, this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    System.err.println("Unknown oop at " + handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    System.err.println("Oop's klass is " + klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    throw new UnknownOopException();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  // Print all objects in the object heap
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  public void print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    HeapPrinter printer = new HeapPrinter(System.out);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    iterate(printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  //---------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  // Internals only below this point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  private void iterateExact(HeapVisitor visitor, final Klass k) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    iterateLiveRegions(collectLiveRegions(), visitor, new ObjectFilter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
          public boolean canInclude(Oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
            Klass tk = obj.getKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
            // null Klass is seen sometimes!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
            return (tk != null && tk.equals(k));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
        });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  private void iterateSubtypes(HeapVisitor visitor, final Klass k) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    iterateLiveRegions(collectLiveRegions(), visitor, new ObjectFilter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
          public boolean canInclude(Oop obj) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
            Klass tk = obj.getKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
            // null Klass is seen sometimes!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
            return (tk != null && tk.isSubtypeOf(k));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
        });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  private void iterateLiveRegions(List liveRegions, HeapVisitor visitor, ObjectFilter of) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    // Summarize size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    long totalSize = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    for (int i = 0; i < liveRegions.size(); i += 2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
      Address bottom = (Address) liveRegions.get(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
      Address top    = (Address) liveRegions.get(i+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
      totalSize += top.minus(bottom);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    visitor.prologue(totalSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    CompactibleFreeListSpace cmsSpaceOld = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    CompactibleFreeListSpace cmsSpacePerm = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    CollectedHeap heap = VM.getVM().getUniverse().heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    if (heap instanceof GenCollectedHeap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
      GenCollectedHeap genHeap = (GenCollectedHeap) heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
      Generation genOld = genHeap.getGen(1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
      Generation genPerm = genHeap.permGen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
      if (genOld instanceof ConcurrentMarkSweepGeneration) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
          ConcurrentMarkSweepGeneration concGen = (ConcurrentMarkSweepGeneration)genOld;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
          cmsSpaceOld = concGen.cmsSpace();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
      if (genPerm instanceof ConcurrentMarkSweepGeneration) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
          ConcurrentMarkSweepGeneration concGen = (ConcurrentMarkSweepGeneration)genPerm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
          cmsSpacePerm = concGen.cmsSpace();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    for (int i = 0; i < liveRegions.size(); i += 2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
      Address bottom = (Address) liveRegions.get(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
      Address top    = (Address) liveRegions.get(i+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
      try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
        // Traverses the space from bottom to top
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
        OopHandle handle = bottom.addOffsetToAsOopHandle(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
        while (handle.lessThan(top)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
        Oop obj = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
          try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
            obj = newOop(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
          } catch (UnknownOopException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
          if (obj == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
             //Find the object size using Printezis bits and skip over
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
             System.err.println("Finding object size using Printezis bits and skipping over...");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
             long size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
             if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
                 size = cmsSpaceOld.collector().blockSizeUsingPrintezisBits(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
             } else if ((cmsSpacePerm != null) && cmsSpacePerm.contains(handle) ){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
                 size = cmsSpacePerm.collector().blockSizeUsingPrintezisBits(handle);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
             if (size <= 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
                //Either Printezis bits not set or handle is not in cms space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
                throw new UnknownOopException();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
             handle = handle.addOffsetToAsOopHandle(CompactibleFreeListSpace.adjustObjectSizeInBytes(size));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
             continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
          if (of == null || of.canInclude(obj)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
                  if (visitor.doObj(obj)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
                         // doObj() returns true to abort this loop.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
                          break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
                  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
          if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
               (cmsSpacePerm != null) && cmsSpacePerm.contains(handle) ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
              handle = handle.addOffsetToAsOopHandle(CompactibleFreeListSpace.adjustObjectSizeInBytes(obj.getObjectSize()) );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
          } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
              handle = handle.addOffsetToAsOopHandle(obj.getObjectSize());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
      catch (AddressException e) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
        // This is okay at the top of these regions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
      catch (UnknownOopException e) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
        // This is okay at the top of these regions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
    visitor.epilogue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  private void addPermGenLiveRegions(List output, CollectedHeap heap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
    LiveRegionsCollector lrc = new LiveRegionsCollector(output);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
    if (heap instanceof GenCollectedHeap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
       GenCollectedHeap genHeap = (GenCollectedHeap) heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
       Generation gen = genHeap.permGen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
       gen.spaceIterate(lrc, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
    } else if (heap instanceof ParallelScavengeHeap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
       ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
       PSPermGen permGen = psh.permGen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
       addLiveRegions(permGen.objectSpace().getLiveRegions(), output);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
       if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
          Assert.that(false, "Expecting GenCollectedHeap or ParallelScavengeHeap, but got " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
                             heap.getClass().getName());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  private void addLiveRegions(List input, List output) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
     for (Iterator itr = input.iterator(); itr.hasNext();) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
        MemRegion reg = (MemRegion) itr.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
        Address top = reg.end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
        Address bottom = reg.start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
        if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
           Assert.that(top != null, "top address in a live region should not be null");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
        if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
           Assert.that(bottom != null, "bottom address in a live region should not be null");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
        output.add(top);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
        output.add(bottom);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  private class LiveRegionsCollector implements SpaceClosure {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
     LiveRegionsCollector(List l) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
        liveRegions = l;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
     public void doSpace(Space s) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
        addLiveRegions(s.getLiveRegions(), liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
     private List liveRegions;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  // Returns a List<Address> where the addresses come in pairs. These
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
  // designate the live regions of the heap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
  private List collectLiveRegions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
    // We want to iterate through all live portions of the heap, but
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
    // do not want to abort the heap traversal prematurely if we find
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
    // a problem (like an allocated but uninitialized object at the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    // top of a generation). To do this we enumerate all generations'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
    // bottom and top regions, and factor in TLABs if necessary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
    // List<Address>. Addresses come in pairs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
    List liveRegions = new ArrayList();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
    LiveRegionsCollector lrc = new LiveRegionsCollector(liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
    CollectedHeap heap = VM.getVM().getUniverse().heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
    if (heap instanceof GenCollectedHeap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
       GenCollectedHeap genHeap = (GenCollectedHeap) heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
       // Run through all generations, obtaining bottom-top pairs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
       for (int i = 0; i < genHeap.nGens(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
         Generation gen = genHeap.getGen(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
         gen.spaceIterate(lrc, true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
    } else if (heap instanceof ParallelScavengeHeap) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
       ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
       PSYoungGen youngGen = psh.youngGen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
       // Add eden space
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
       addLiveRegions(youngGen.edenSpace().getLiveRegions(), liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
       // Add from-space but not to-space
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
       addLiveRegions(youngGen.fromSpace().getLiveRegions(), liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
       PSOldGen oldGen = psh.oldGen();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
       addLiveRegions(oldGen.objectSpace().getLiveRegions(), liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
       if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
          Assert.that(false, "Expecting GenCollectedHeap or ParallelScavengeHeap, but got " +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
                              heap.getClass().getName());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
    // handle perm generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
    addPermGenLiveRegions(liveRegions, heap);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
    // If UseTLAB is enabled, snip out regions associated with TLABs'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
    // dead regions. Note that TLABs can be present in any generation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
    // FIXME: consider adding fewer boundaries to live region list.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
    // Theoretically only need to stop at TLAB's top and resume at its
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
    // end.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
    if (VM.getVM().getUseTLAB()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
      for (JavaThread thread = VM.getVM().getThreads().first(); thread != null; thread = thread.next()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
        if (thread.isJavaThread()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
          ThreadLocalAllocBuffer tlab = thread.tlab();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
          if (tlab.start() != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
            if ((tlab.top() == null) || (tlab.end() == null)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
              System.err.print("Warning: skipping invalid TLAB for thread ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
              thread.printThreadIDOn(System.err);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
              System.err.println();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
            } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
              // Go from:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
              //  - below start() to start()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
              //  - start() to top()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
              //  - end() and above
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
              liveRegions.add(tlab.start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
              liveRegions.add(tlab.start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
              liveRegions.add(tlab.top());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
              liveRegions.add(tlab.end());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
    // Now sort live regions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
    sortLiveRegions(liveRegions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
    if (Assert.ASSERTS_ENABLED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
      Assert.that(liveRegions.size() % 2 == 0, "Must have even number of region boundaries");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
    return liveRegions;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  private void sortLiveRegions(List liveRegions) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    Collections.sort(liveRegions, new Comparator() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
        public int compare(Object o1, Object o2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
          Address a1 = (Address) o1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
          Address a2 = (Address) o2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
          if (AddressOps.lt(a1, a2)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
            return -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
          } else if (AddressOps.gt(a1, a2)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
            return 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
          return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
      });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
}