comparison agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java @ 2376:c7f3d0b4570f

7017732: move static fields into Class to prepare for perm gen removal Reviewed-by: kvn, coleenp, twisti, stefank
author never
date Fri, 18 Mar 2011 16:00:34 -0700
parents c18cbe5936b8
children 63997f575155
comparison
equal deleted inserted replaced
2375:d673ef06fe96 2376:c7f3d0b4570f
1 /* 1 /*
2 * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
272 private static void initClassFields() { 272 private static void initClassFields() {
273 if (hcKlassField == null) { 273 if (hcKlassField == null) {
274 // hc_klass is a HotSpot magic field and hence we can't 274 // hc_klass is a HotSpot magic field and hence we can't
275 // find it from InstanceKlass for java.lang.Class. 275 // find it from InstanceKlass for java.lang.Class.
276 TypeDataBase db = VM.getVM().getTypeDataBase(); 276 TypeDataBase db = VM.getVM().getTypeDataBase();
277 int hcKlassOffset = (int) Instance.getHeaderSize(); 277 int hcKlassOffset = (int) db.lookupType("java_lang_Class").getCIntegerField("klass_offset").getValue();
278 try {
279 hcKlassOffset += (db.lookupIntConstant("java_lang_Class::hc_klass_offset").intValue() *
280 VM.getVM().getHeapOopSize());
281 } catch (RuntimeException re) {
282 // ignore, currently java_lang_Class::hc_klass_offset is zero
283 }
284 if (VM.getVM().isCompressedOopsEnabled()) { 278 if (VM.getVM().isCompressedOopsEnabled()) {
285 hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); 279 hcKlassField = new NarrowOopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
286 } else { 280 } else {
287 hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true); 281 hcKlassField = new OopField(new NamedFieldIdentifier("hc_klass"), hcKlassOffset, true);
288 } 282 }