comparison src/share/vm/c1/c1_ValueType.hpp @ 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 1d7922586cf6
children 78bbf4d43a14
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 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.
25 #ifndef SHARE_VM_C1_C1_VALUETYPE_HPP 25 #ifndef SHARE_VM_C1_C1_VALUETYPE_HPP
26 #define SHARE_VM_C1_C1_VALUETYPE_HPP 26 #define SHARE_VM_C1_C1_VALUETYPE_HPP
27 27
28 #include "c1/c1_Compilation.hpp" 28 #include "c1/c1_Compilation.hpp"
29 #include "ci/ciConstant.hpp" 29 #include "ci/ciConstant.hpp"
30 #include "ci/ciMethodData.hpp"
30 31
31 // type hierarchy 32 // type hierarchy
32 class ValueType; 33 class ValueType;
33 class VoidType; 34 class VoidType;
34 class IntType; 35 class IntType;
44 class ObjectConstant; 45 class ObjectConstant;
45 class ArrayType; 46 class ArrayType;
46 class ArrayConstant; 47 class ArrayConstant;
47 class InstanceType; 48 class InstanceType;
48 class InstanceConstant; 49 class InstanceConstant;
50 class MetadataType;
49 class ClassType; 51 class ClassType;
50 class ClassConstant; 52 class ClassConstant;
53 class MethodType;
54 class MethodConstant;
55 class MethodDataType;
56 class MethodDataConstant;
51 class AddressType; 57 class AddressType;
52 class AddressConstant; 58 class AddressConstant;
53 class IllegalType; 59 class IllegalType;
54 60
55 61
80 longTag, 86 longTag,
81 floatTag, 87 floatTag,
82 doubleTag, 88 doubleTag,
83 objectTag, 89 objectTag,
84 addressTag, 90 addressTag,
91 metaDataTag,
85 number_of_legal_tags, 92 number_of_legal_tags,
86 // all other tags must follow afterwards 93 // all other tags must follow afterwards
87 voidTag = number_of_legal_tags, 94 voidTag = number_of_legal_tags,
88 illegalTag, 95 illegalTag,
89 number_of_tags 96 number_of_tags
121 bool is_double() { return tag() == doubleTag; } 128 bool is_double() { return tag() == doubleTag; }
122 bool is_object() { return as_ObjectType() != NULL; } 129 bool is_object() { return as_ObjectType() != NULL; }
123 bool is_array() { return as_ArrayType() != NULL; } 130 bool is_array() { return as_ArrayType() != NULL; }
124 bool is_instance() { return as_InstanceType() != NULL; } 131 bool is_instance() { return as_InstanceType() != NULL; }
125 bool is_class() { return as_ClassType() != NULL; } 132 bool is_class() { return as_ClassType() != NULL; }
133 bool is_method() { return as_MethodType() != NULL; }
134 bool is_method_data() { return as_MethodDataType() != NULL; }
126 bool is_address() { return as_AddressType() != NULL; } 135 bool is_address() { return as_AddressType() != NULL; }
127 bool is_illegal() { return tag() == illegalTag; } 136 bool is_illegal() { return tag() == illegalTag; }
128 137
129 bool is_int_kind() const { return tag() == intTag || tag() == longTag; } 138 bool is_int_kind() const { return tag() == intTag || tag() == longTag; }
130 bool is_float_kind() const { return tag() == floatTag || tag() == doubleTag; } 139 bool is_float_kind() const { return tag() == floatTag || tag() == doubleTag; }
141 virtual DoubleType* as_DoubleType() { return NULL; } 150 virtual DoubleType* as_DoubleType() { return NULL; }
142 virtual ObjectType* as_ObjectType() { return NULL; } 151 virtual ObjectType* as_ObjectType() { return NULL; }
143 virtual ArrayType* as_ArrayType() { return NULL; } 152 virtual ArrayType* as_ArrayType() { return NULL; }
144 virtual InstanceType* as_InstanceType() { return NULL; } 153 virtual InstanceType* as_InstanceType() { return NULL; }
145 virtual ClassType* as_ClassType() { return NULL; } 154 virtual ClassType* as_ClassType() { return NULL; }
155 virtual MetadataType* as_MetadataType() { return NULL; }
156 virtual MethodType* as_MethodType() { return NULL; }
157 virtual MethodDataType* as_MethodDataType() { return NULL; }
146 virtual AddressType* as_AddressType() { return NULL; } 158 virtual AddressType* as_AddressType() { return NULL; }
147 virtual IllegalType* as_IllegalType() { return NULL; } 159 virtual IllegalType* as_IllegalType() { return NULL; }
148 160
149 virtual IntConstant* as_IntConstant() { return NULL; } 161 virtual IntConstant* as_IntConstant() { return NULL; }
150 virtual LongConstant* as_LongConstant() { return NULL; } 162 virtual LongConstant* as_LongConstant() { return NULL; }
151 virtual FloatConstant* as_FloatConstant() { return NULL; } 163 virtual FloatConstant* as_FloatConstant() { return NULL; }
152 virtual DoubleConstant* as_DoubleConstant() { return NULL; } 164 virtual DoubleConstant* as_DoubleConstant() { return NULL; }
153 virtual ObjectConstant* as_ObjectConstant() { return NULL; } 165 virtual ObjectConstant* as_ObjectConstant() { return NULL; }
154 virtual InstanceConstant* as_InstanceConstant(){ return NULL; } 166 virtual InstanceConstant* as_InstanceConstant(){ return NULL; }
155 virtual ClassConstant* as_ClassConstant() { return NULL; } 167 virtual ClassConstant* as_ClassConstant() { return NULL; }
168 virtual MethodConstant* as_MethodConstant() { return NULL; }
169 virtual MethodDataConstant* as_MethodDataConstant() { return NULL; }
156 virtual ArrayConstant* as_ArrayConstant() { return NULL; } 170 virtual ArrayConstant* as_ArrayConstant() { return NULL; }
157 virtual AddressConstant* as_AddressConstant() { return NULL; } 171 virtual AddressConstant* as_AddressConstant() { return NULL; }
158 172
159 // type operations 173 // type operations
160 ValueType* meet(ValueType* y) const; 174 ValueType* meet(ValueType* y) const;
362 virtual ciObject* constant_value() const; 376 virtual ciObject* constant_value() const;
363 virtual ciType* exact_type() const; 377 virtual ciType* exact_type() const;
364 }; 378 };
365 379
366 380
367 class ClassType: public ObjectType { 381 class MetadataType: public ValueType {
382 public:
383 MetadataType(): ValueType(metaDataTag, 1) {}
384 virtual ValueType* base() const { return objectType; }
385 virtual const char tchar() const { return 'a'; }
386 virtual const char* name() const { return "object"; }
387 virtual MetadataType* as_MetadataType() { return this; }
388 bool is_loaded() const;
389 jobject encoding() const;
390 virtual ciMetadata* constant_value() const { ShouldNotReachHere(); return NULL; }
391 };
392
393
394 class ClassType: public MetadataType {
368 public: 395 public:
369 virtual ClassType* as_ClassType() { return this; } 396 virtual ClassType* as_ClassType() { return this; }
370 }; 397 };
371 398
372 399
379 406
380 ciInstanceKlass* value() const { return _value; } 407 ciInstanceKlass* value() const { return _value; }
381 408
382 virtual bool is_constant() const { return true; } 409 virtual bool is_constant() const { return true; }
383 virtual ClassConstant* as_ClassConstant() { return this; } 410 virtual ClassConstant* as_ClassConstant() { return this; }
384 virtual ciObject* constant_value() const; 411 virtual ciMetadata* constant_value() const { return _value; }
385 virtual ciType* exact_type() const; 412 virtual ciType* exact_type() const;
413 };
414
415
416 class MethodType: public MetadataType {
417 public:
418 virtual MethodType* as_MethodType() { return this; }
419 };
420
421
422 class MethodConstant: public MethodType {
423 private:
424 ciMethod* _value;
425
426 public:
427 MethodConstant(ciMethod* value) { _value = value; }
428
429 ciMethod* value() const { return _value; }
430
431 virtual bool is_constant() const { return true; }
432
433 virtual MethodConstant* as_MethodConstant() { return this; }
434 virtual ciMetadata* constant_value() const { return _value; }
435 };
436
437
438 class MethodDataType: public MetadataType {
439 public:
440 virtual MethodDataType* as_MethodDataType() { return this; }
441 };
442
443
444 class MethodDataConstant: public MethodDataType {
445 private:
446 ciMethodData* _value;
447
448 public:
449 MethodDataConstant(ciMethodData* value) { _value = value; }
450
451 ciMethodData* value() const { return _value; }
452
453 virtual bool is_constant() const { return true; }
454
455 virtual MethodDataConstant* as_MethodDataConstant() { return this; }
456 virtual ciMetadata* constant_value() const { return _value; }
386 }; 457 };
387 458
388 459
389 class AddressType: public ValueType { 460 class AddressType: public ValueType {
390 public: 461 public: