Mercurial > hg > truffle
comparison src/share/vm/opto/compile.cpp @ 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 | 5af51c882207 |
children | 137868b7aa6f |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
923 _stub_entry_point = rs->entry_point(); | 923 _stub_entry_point = rs->entry_point(); |
924 } | 924 } |
925 } | 925 } |
926 } | 926 } |
927 | 927 |
928 #ifndef PRODUCT | |
929 void print_opto_verbose_signature( const TypeFunc *j_sig, const char *stub_name ) { | |
930 if(PrintOpto && Verbose) { | |
931 tty->print("%s ", stub_name); j_sig->print_flattened(); tty->cr(); | |
932 } | |
933 } | |
934 #endif | |
935 | |
936 void Compile::print_codes() { | |
937 } | |
938 | |
939 //------------------------------Init------------------------------------------- | 928 //------------------------------Init------------------------------------------- |
940 // Prepare for a single compilation | 929 // Prepare for a single compilation |
941 void Compile::Init(int aliaslevel) { | 930 void Compile::Init(int aliaslevel) { |
942 _unique = 0; | 931 _unique = 0; |
943 _regalloc = NULL; | 932 _regalloc = NULL; |
961 // Now that you have a Root to point to, create the real TOP | 950 // Now that you have a Root to point to, create the real TOP |
962 set_cached_top_node( new (this, 1) ConNode(Type::TOP) ); | 951 set_cached_top_node( new (this, 1) ConNode(Type::TOP) ); |
963 set_recent_alloc(NULL, NULL); | 952 set_recent_alloc(NULL, NULL); |
964 | 953 |
965 // Create Debug Information Recorder to record scopes, oopmaps, etc. | 954 // Create Debug Information Recorder to record scopes, oopmaps, etc. |
966 env()->set_oop_recorder(new OopRecorder(comp_arena())); | 955 env()->set_oop_recorder(new OopRecorder(env()->arena())); |
967 env()->set_debug_info(new DebugInformationRecorder(env()->oop_recorder())); | 956 env()->set_debug_info(new DebugInformationRecorder(env()->oop_recorder())); |
968 env()->set_dependencies(new Dependencies(env())); | 957 env()->set_dependencies(new Dependencies(env())); |
969 | 958 |
970 _fixed_slots = 0; | 959 _fixed_slots = 0; |
971 set_has_split_ifs(false); | 960 set_has_split_ifs(false); |
1180 } else if( ta && _AliasLevel >= 2 ) { | 1169 } else if( ta && _AliasLevel >= 2 ) { |
1181 // For arrays indexed by constant indices, we flatten the alias | 1170 // For arrays indexed by constant indices, we flatten the alias |
1182 // space to include all of the array body. Only the header, klass | 1171 // space to include all of the array body. Only the header, klass |
1183 // and array length can be accessed un-aliased. | 1172 // and array length can be accessed un-aliased. |
1184 if( offset != Type::OffsetBot ) { | 1173 if( offset != Type::OffsetBot ) { |
1185 if( ta->const_oop() ) { // methodDataOop or methodOop | 1174 if( ta->const_oop() ) { // MethodData* or Method* |
1186 offset = Type::OffsetBot; // Flatten constant access into array body | 1175 offset = Type::OffsetBot; // Flatten constant access into array body |
1187 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),ta->ary(),ta->klass(),false,offset); | 1176 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),ta->ary(),ta->klass(),false,offset); |
1188 } else if( offset == arrayOopDesc::length_offset_in_bytes() ) { | 1177 } else if( offset == arrayOopDesc::length_offset_in_bytes() ) { |
1189 // range is OK as-is. | 1178 // range is OK as-is. |
1190 tj = ta = TypeAryPtr::RANGE; | 1179 tj = ta = TypeAryPtr::RANGE; |
3024 bool Compile::Constant::operator==(const Constant& other) { | 3013 bool Compile::Constant::operator==(const Constant& other) { |
3025 if (type() != other.type() ) return false; | 3014 if (type() != other.type() ) return false; |
3026 if (can_be_reused() != other.can_be_reused()) return false; | 3015 if (can_be_reused() != other.can_be_reused()) return false; |
3027 // For floating point values we compare the bit pattern. | 3016 // For floating point values we compare the bit pattern. |
3028 switch (type()) { | 3017 switch (type()) { |
3029 case T_FLOAT: return (_value.i == other._value.i); | 3018 case T_FLOAT: return (_v._value.i == other._v._value.i); |
3030 case T_LONG: | 3019 case T_LONG: |
3031 case T_DOUBLE: return (_value.j == other._value.j); | 3020 case T_DOUBLE: return (_v._value.j == other._v._value.j); |
3032 case T_OBJECT: | 3021 case T_OBJECT: |
3033 case T_ADDRESS: return (_value.l == other._value.l); | 3022 case T_METADATA: return (_v._metadata == other._v._metadata); |
3034 case T_VOID: return (_value.l == other._value.l); // jump-table entries | 3023 case T_ADDRESS: return (_v._value.l == other._v._value.l); |
3024 case T_VOID: return (_v._value.l == other._v._value.l); // jump-table entries | |
3035 default: ShouldNotReachHere(); | 3025 default: ShouldNotReachHere(); |
3036 } | 3026 } |
3037 return false; | 3027 return false; |
3038 } | 3028 } |
3039 | 3029 |
3040 static int type_to_size_in_bytes(BasicType t) { | 3030 static int type_to_size_in_bytes(BasicType t) { |
3041 switch (t) { | 3031 switch (t) { |
3042 case T_LONG: return sizeof(jlong ); | 3032 case T_LONG: return sizeof(jlong ); |
3043 case T_FLOAT: return sizeof(jfloat ); | 3033 case T_FLOAT: return sizeof(jfloat ); |
3044 case T_DOUBLE: return sizeof(jdouble); | 3034 case T_DOUBLE: return sizeof(jdouble); |
3035 case T_METADATA: return sizeof(Metadata*); | |
3045 // We use T_VOID as marker for jump-table entries (labels) which | 3036 // We use T_VOID as marker for jump-table entries (labels) which |
3046 // need an internal word relocation. | 3037 // need an internal word relocation. |
3047 case T_VOID: | 3038 case T_VOID: |
3048 case T_ADDRESS: | 3039 case T_ADDRESS: |
3049 case T_OBJECT: return sizeof(jobject); | 3040 case T_OBJECT: return sizeof(jobject); |
3133 address temp_addr = _masm.address_constant(dummy + i); | 3124 address temp_addr = _masm.address_constant(dummy + i); |
3134 assert(temp_addr, "consts section too small"); | 3125 assert(temp_addr, "consts section too small"); |
3135 } | 3126 } |
3136 break; | 3127 break; |
3137 } | 3128 } |
3129 case T_METADATA: { | |
3130 Metadata* obj = con.get_metadata(); | |
3131 int metadata_index = _masm.oop_recorder()->find_index(obj); | |
3132 constant_addr = _masm.address_constant((address) obj, metadata_Relocation::spec(metadata_index)); | |
3133 break; | |
3134 } | |
3138 default: ShouldNotReachHere(); | 3135 default: ShouldNotReachHere(); |
3139 } | 3136 } |
3140 assert(constant_addr, "consts section too small"); | 3137 assert(constant_addr, "consts section too small"); |
3141 assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset())); | 3138 assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset())); |
3142 } | 3139 } |
3162 } | 3159 } |
3163 | 3160 |
3164 Compile::Constant Compile::ConstantTable::add(MachConstantNode* n, BasicType type, jvalue value) { | 3161 Compile::Constant Compile::ConstantTable::add(MachConstantNode* n, BasicType type, jvalue value) { |
3165 Block* b = Compile::current()->cfg()->_bbs[n->_idx]; | 3162 Block* b = Compile::current()->cfg()->_bbs[n->_idx]; |
3166 Constant con(type, value, b->_freq); | 3163 Constant con(type, value, b->_freq); |
3164 add(con); | |
3165 return con; | |
3166 } | |
3167 | |
3168 Compile::Constant Compile::ConstantTable::add(Metadata* metadata) { | |
3169 Constant con(metadata); | |
3167 add(con); | 3170 add(con); |
3168 return con; | 3171 return con; |
3169 } | 3172 } |
3170 | 3173 |
3171 Compile::Constant Compile::ConstantTable::add(MachConstantNode* n, MachOper* oper) { | 3174 Compile::Constant Compile::ConstantTable::add(MachConstantNode* n, MachOper* oper) { |
3175 case T_LONG: value.j = oper->constantL(); break; | 3178 case T_LONG: value.j = oper->constantL(); break; |
3176 case T_FLOAT: value.f = oper->constantF(); break; | 3179 case T_FLOAT: value.f = oper->constantF(); break; |
3177 case T_DOUBLE: value.d = oper->constantD(); break; | 3180 case T_DOUBLE: value.d = oper->constantD(); break; |
3178 case T_OBJECT: | 3181 case T_OBJECT: |
3179 case T_ADDRESS: value.l = (jobject) oper->constant(); break; | 3182 case T_ADDRESS: value.l = (jobject) oper->constant(); break; |
3180 default: ShouldNotReachHere(); | 3183 case T_METADATA: return add((Metadata*)oper->constant()); break; |
3184 default: guarantee(false, err_msg_res("unhandled type: %s", type2name(type))); | |
3181 } | 3185 } |
3182 return add(n, type, value); | 3186 return add(n, type, value); |
3183 } | 3187 } |
3184 | 3188 |
3185 Compile::Constant Compile::ConstantTable::add_jump_table(MachConstantNode* n) { | 3189 Compile::Constant Compile::ConstantTable::add_jump_table(MachConstantNode* n) { |