comparison src/share/vm/runtime/fieldType.hpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents f95d63e2154a
children 1d1603768966
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
24 24
25 #ifndef SHARE_VM_RUNTIME_FIELDTYPE_HPP 25 #ifndef SHARE_VM_RUNTIME_FIELDTYPE_HPP
26 #define SHARE_VM_RUNTIME_FIELDTYPE_HPP 26 #define SHARE_VM_RUNTIME_FIELDTYPE_HPP
27 27
28 #include "memory/allocation.hpp" 28 #include "memory/allocation.hpp"
29 #include "oops/symbolOop.hpp" 29 #include "oops/symbol.hpp"
30 30
31 // Note: FieldType should be based on the SignatureIterator (or vice versa). 31 // Note: FieldType should be based on the SignatureIterator (or vice versa).
32 // In any case, this structure should be re-thought at some point. 32 // In any case, this structure should be re-thought at some point.
33 33
34 // A FieldType is used to determine the type of a field from a signature string. 34 // A FieldType is used to determine the type of a field from a signature string.
35 35
36 // Information returned by get_array_info, which is scoped to decrement
37 // reference count if a Symbol is created in the case of T_OBJECT
38 class FieldArrayInfo : public StackObj {
39 friend class FieldType; // field type can set these fields.
40 int _dimension;
41 Symbol* _object_key;
42 public:
43 int dimension() { return _dimension; }
44 Symbol* object_key() { return _object_key; }
45 // basic constructor
46 FieldArrayInfo() : _dimension(0), _object_key(NULL) {}
47 // destructor decrements object key's refcount if created
48 ~FieldArrayInfo() { if (_object_key != NULL) _object_key->decrement_refcount(); }
49 };
50
51
36 class FieldType: public AllStatic { 52 class FieldType: public AllStatic {
37 private: 53 private:
38 static void skip_optional_size(symbolOop signature, int* index); 54 static void skip_optional_size(Symbol* signature, int* index);
39 static bool is_valid_array_signature(symbolOop signature); 55 static bool is_valid_array_signature(Symbol* signature);
40 public: 56 public:
41 57
42 // Return basic type 58 // Return basic type
43 static BasicType basic_type(symbolOop signature); 59 static BasicType basic_type(Symbol* signature);
44 60
45 // Testing 61 // Testing
46 static bool is_array(symbolOop signature) { return signature->utf8_length() > 1 && signature->byte_at(0) == '[' && is_valid_array_signature(signature); } 62 static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->byte_at(0) == '[' && is_valid_array_signature(signature); }
47 63
48 static bool is_obj(symbolOop signature) { 64 static bool is_obj(Symbol* signature) {
49 int sig_length = signature->utf8_length(); 65 int sig_length = signature->utf8_length();
50 // Must start with 'L' and end with ';' 66 // Must start with 'L' and end with ';'
51 return (sig_length >= 2 && 67 return (sig_length >= 2 &&
52 (signature->byte_at(0) == 'L') && 68 (signature->byte_at(0) == 'L') &&
53 (signature->byte_at(sig_length - 1) == ';')); 69 (signature->byte_at(sig_length - 1) == ';'));
54 } 70 }
55 71
56 // Parse field and extract array information. Works for T_ARRAY only. 72 // Parse field and extract array information. Works for T_ARRAY only.
57 static BasicType get_array_info(symbolOop signature, jint* dimension, symbolOop *object_key, TRAPS); 73 static BasicType get_array_info(Symbol* signature, FieldArrayInfo& ai, TRAPS);
58 }; 74 };
59 75
60 #endif // SHARE_VM_RUNTIME_FIELDTYPE_HPP 76 #endif // SHARE_VM_RUNTIME_FIELDTYPE_HPP