Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | f6f3bb0ee072 |
children |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2012, 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. |
48 private String[] jvmLibNames; | 48 private String[] jvmLibNames; |
49 private static final int UNINITIALIZED_SIZE = -1; | 49 private static final int UNINITIALIZED_SIZE = -1; |
50 private static final int C_INT8_SIZE = 1; | 50 private static final int C_INT8_SIZE = 1; |
51 private static final int C_INT32_SIZE = 4; | 51 private static final int C_INT32_SIZE = 4; |
52 private static final int C_INT64_SIZE = 8; | 52 private static final int C_INT64_SIZE = 8; |
53 private static int pointerSize = UNINITIALIZED_SIZE; | |
53 | 54 |
54 private static final boolean DEBUG; | 55 private static final boolean DEBUG; |
55 static { | 56 static { |
56 DEBUG = System.getProperty("sun.jvm.hotspot.HotSpotTypeDataBase.DEBUG") | 57 DEBUG = System.getProperty("sun.jvm.hotspot.HotSpotTypeDataBase.DEBUG") |
57 != null; | 58 != null; |
183 boolean isIntegerType = (entryAddr.getCIntegerAt(typeEntryIsIntegerTypeOffset, C_INT32_SIZE, false) != 0); | 184 boolean isIntegerType = (entryAddr.getCIntegerAt(typeEntryIsIntegerTypeOffset, C_INT32_SIZE, false) != 0); |
184 boolean isUnsigned = (entryAddr.getCIntegerAt(typeEntryIsUnsignedOffset, C_INT32_SIZE, false) != 0); | 185 boolean isUnsigned = (entryAddr.getCIntegerAt(typeEntryIsUnsignedOffset, C_INT32_SIZE, false) != 0); |
185 long size = entryAddr.getCIntegerAt(typeEntrySizeOffset, C_INT64_SIZE, true); | 186 long size = entryAddr.getCIntegerAt(typeEntrySizeOffset, C_INT64_SIZE, true); |
186 | 187 |
187 createType(typeName, superclassName, isOopType, isIntegerType, isUnsigned, size); | 188 createType(typeName, superclassName, isOopType, isIntegerType, isUnsigned, size); |
189 if (pointerSize == UNINITIALIZED_SIZE && typeName.equals("void*")) { | |
190 pointerSize = (int)size; | |
191 } | |
188 } | 192 } |
189 | 193 |
190 entryAddr = entryAddr.addOffsetTo(typeEntryArrayStride); | 194 entryAddr = entryAddr.addOffsetTo(typeEntryArrayStride); |
191 } while (typeNameAddr != null); | 195 } while (typeNameAddr != null); |
192 } | 196 } |
676 targetType = createBasicType(targetTypeName, false, false, false); | 680 targetType = createBasicType(targetTypeName, false, false, false); |
677 } | 681 } |
678 } | 682 } |
679 } | 683 } |
680 result = new BasicPointerType(this, typeName, targetType); | 684 result = new BasicPointerType(this, typeName, targetType); |
681 result.setSize(UNINITIALIZED_SIZE); | 685 if (pointerSize == UNINITIALIZED_SIZE && !typeName.equals("void*")) { |
686 // void* must be declared early so that other pointer types can use that to set their size. | |
687 throw new InternalError("void* type hasn't been seen when parsing " + typeName); | |
688 } | |
689 result.setSize(pointerSize); | |
682 addType(result); | 690 addType(result); |
683 return result; | 691 return result; |
684 } | 692 } |
685 | 693 |
686 private boolean typeNameIsPointerType(String typeName) { | 694 private boolean typeNameIsPointerType(String typeName) { |
729 if (curType.getSize() != size) { | 737 if (curType.getSize() != size) { |
730 throw new RuntimeException("Error: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " + | 738 throw new RuntimeException("Error: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " + |
731 "had its size redefined (old was " + curType.getSize() + ", new is " + size + ")."); | 739 "had its size redefined (old was " + curType.getSize() + ", new is " + size + ")."); |
732 } | 740 } |
733 | 741 |
742 if (!typeNameIsPointerType(typeName)) { | |
734 System.err.println("Warning: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " + | 743 System.err.println("Warning: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " + |
735 "had its size declared as " + size + " twice. Continuing."); | 744 "had its size declared as " + size + " twice. Continuing."); |
745 } | |
736 } | 746 } |
737 | 747 |
738 } | 748 } |
739 | 749 |
740 /** "Virtual constructor" for fields based on type */ | 750 /** "Virtual constructor" for fields based on type */ |