comparison src/share/vm/c1/c1_LIR.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 6759698e3140
children 8a02ca5e5576
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.
83 LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal(); 83 LIR_Opr LIR_OprFact::illegalOpr = LIR_OprFact::illegal();
84 84
85 LIR_Opr LIR_OprFact::value_type(ValueType* type) { 85 LIR_Opr LIR_OprFact::value_type(ValueType* type) {
86 ValueTag tag = type->tag(); 86 ValueTag tag = type->tag();
87 switch (tag) { 87 switch (tag) {
88 case objectTag : { 88 case metaDataTag : {
89 ClassConstant* c = type->as_ClassConstant(); 89 ClassConstant* c = type->as_ClassConstant();
90 if (c != NULL && !c->value()->is_loaded()) { 90 if (c != NULL && !c->value()->is_loaded()) {
91 return LIR_OprFact::oopConst(NULL); 91 return LIR_OprFact::metadataConst(NULL);
92 } else { 92 } else {
93 return LIR_OprFact::metadataConst(c->value()->constant_encoding());
94 }
95 }
96 case objectTag : {
93 return LIR_OprFact::oopConst(type->as_ObjectType()->encoding()); 97 return LIR_OprFact::oopConst(type->as_ObjectType()->encoding());
94 } 98 }
95 }
96 case addressTag: return LIR_OprFact::addressConst(type->as_AddressConstant()->value()); 99 case addressTag: return LIR_OprFact::addressConst(type->as_AddressConstant()->value());
97 case intTag : return LIR_OprFact::intConst(type->as_IntConstant()->value()); 100 case intTag : return LIR_OprFact::intConst(type->as_IntConstant()->value());
98 case floatTag : return LIR_OprFact::floatConst(type->as_FloatConstant()->value()); 101 case floatTag : return LIR_OprFact::floatConst(type->as_FloatConstant()->value());
99 case longTag : return LIR_OprFact::longConst(type->as_LongConstant()->value()); 102 case longTag : return LIR_OprFact::longConst(type->as_LongConstant()->value());
100 case doubleTag : return LIR_OprFact::doubleConst(type->as_DoubleConstant()->value()); 103 case doubleTag : return LIR_OprFact::doubleConst(type->as_DoubleConstant()->value());
146 // be handled by the back-end or will be rejected if not. 149 // be handled by the back-end or will be rejected if not.
147 #endif 150 #endif
148 #ifdef _LP64 151 #ifdef _LP64
149 assert(base()->is_cpu_register(), "wrong base operand"); 152 assert(base()->is_cpu_register(), "wrong base operand");
150 assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand"); 153 assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
151 assert(base()->type() == T_OBJECT || base()->type() == T_LONG, 154 assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
152 "wrong type for addresses"); 155 "wrong type for addresses");
153 #else 156 #else
154 assert(base()->is_single_cpu(), "wrong base operand"); 157 assert(base()->is_single_cpu(), "wrong base operand");
155 assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand"); 158 assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
156 assert(base()->type() == T_OBJECT || base()->type() == T_INT, 159 assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
157 "wrong type for addresses"); 160 "wrong type for addresses");
158 #endif 161 #endif
159 } 162 }
160 #endif 163 #endif
161 164
174 case T_SHORT: 177 case T_SHORT:
175 case T_INT: 178 case T_INT:
176 case T_LONG: 179 case T_LONG:
177 case T_OBJECT: 180 case T_OBJECT:
178 case T_ADDRESS: 181 case T_ADDRESS:
182 case T_METADATA:
179 case T_VOID: 183 case T_VOID:
180 return ::type2char(t); 184 return ::type2char(t);
181 185
182 case T_ILLEGAL: 186 case T_ILLEGAL:
183 return '?'; 187 return '?';
217 case T_BYTE: 221 case T_BYTE:
218 case T_SHORT: 222 case T_SHORT:
219 case T_INT: 223 case T_INT:
220 case T_ADDRESS: 224 case T_ADDRESS:
221 case T_OBJECT: 225 case T_OBJECT:
226 case T_METADATA:
222 case T_ARRAY: 227 case T_ARRAY:
223 assert((kind_field() == cpu_register || kind_field() == stack_value) && 228 assert((kind_field() == cpu_register || kind_field() == stack_value) &&
224 size_field() == single_size, "must match"); 229 size_field() == single_size, "must match");
225 break; 230 break;
226 231
1162 1167
1163 void LIR_List::oop2reg_patch(jobject o, LIR_Opr reg, CodeEmitInfo* info) { 1168 void LIR_List::oop2reg_patch(jobject o, LIR_Opr reg, CodeEmitInfo* info) {
1164 append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o), reg, T_OBJECT, lir_patch_normal, info)); 1169 append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o), reg, T_OBJECT, lir_patch_normal, info));
1165 } 1170 }
1166 1171
1172 void LIR_List::klass2reg_patch(Metadata* o, LIR_Opr reg, CodeEmitInfo* info) {
1173 append(new LIR_Op1(lir_move, LIR_OprFact::metadataConst(o), reg, T_METADATA, lir_patch_normal, info));
1174 }
1167 1175
1168 void LIR_List::load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info, LIR_PatchCode patch_code) { 1176 void LIR_List::load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info, LIR_PatchCode patch_code) {
1169 append(new LIR_Op1( 1177 append(new LIR_Op1(
1170 lir_move, 1178 lir_move,
1171 LIR_OprFact::address(addr), 1179 LIR_OprFact::address(addr),
1541 case T_INT: out->print("int:%d", as_jint()); break; 1549 case T_INT: out->print("int:%d", as_jint()); break;
1542 case T_LONG: out->print("lng:%lld", as_jlong()); break; 1550 case T_LONG: out->print("lng:%lld", as_jlong()); break;
1543 case T_FLOAT: out->print("flt:%f", as_jfloat()); break; 1551 case T_FLOAT: out->print("flt:%f", as_jfloat()); break;
1544 case T_DOUBLE: out->print("dbl:%f", as_jdouble()); break; 1552 case T_DOUBLE: out->print("dbl:%f", as_jdouble()); break;
1545 case T_OBJECT: out->print("obj:0x%x", as_jobject()); break; 1553 case T_OBJECT: out->print("obj:0x%x", as_jobject()); break;
1554 case T_METADATA: out->print("metadata:0x%x", as_metadata());break;
1546 default: out->print("%3d:0x%x",type(), as_jdouble()); break; 1555 default: out->print("%3d:0x%x",type(), as_jdouble()); break;
1547 } 1556 }
1548 } 1557 }
1549 1558
1550 // LIR_Address 1559 // LIR_Address