comparison src/share/vm/oops/methodDataOop.hpp @ 45:48a3fa21394b

6667615: (Escape Analysis) extend MDO to cache arguments escape state Summary: Use MDO to cache arguments escape state determined by the byte code escape analyzer. Reviewed-by: never
author kvn
date Tue, 11 Mar 2008 19:00:38 -0700
parents a61af66fc99e
children e1e86702e43e
comparison
equal deleted inserted replaced
44:52fed2ec0afb 45:48a3fa21394b
99 jump_data_tag, 99 jump_data_tag,
100 receiver_type_data_tag, 100 receiver_type_data_tag,
101 virtual_call_data_tag, 101 virtual_call_data_tag,
102 ret_data_tag, 102 ret_data_tag,
103 branch_data_tag, 103 branch_data_tag,
104 multi_branch_data_tag 104 multi_branch_data_tag,
105 arg_info_data_tag
105 }; 106 };
106 107
107 enum { 108 enum {
108 // The _struct._flags word is formatted as [trap_state:4 | flags:4]. 109 // The _struct._flags word is formatted as [trap_state:4 | flags:4].
109 // The trap state breaks down further as [recompile:1 | reason:3]. 110 // The trap state breaks down further as [recompile:1 | reason:3].
243 class RetData; 244 class RetData;
244 class JumpData; 245 class JumpData;
245 class BranchData; 246 class BranchData;
246 class ArrayData; 247 class ArrayData;
247 class MultiBranchData; 248 class MultiBranchData;
249 class ArgInfoData;
248 250
249 251
250 // ProfileData 252 // ProfileData
251 // 253 //
252 // A ProfileData object is created to refer to a section of profiling 254 // A ProfileData object is created to refer to a section of profiling
374 virtual bool is_VirtualCallData() { return false; } 376 virtual bool is_VirtualCallData() { return false; }
375 virtual bool is_RetData() { return false; } 377 virtual bool is_RetData() { return false; }
376 virtual bool is_BranchData() { return false; } 378 virtual bool is_BranchData() { return false; }
377 virtual bool is_ArrayData() { return false; } 379 virtual bool is_ArrayData() { return false; }
378 virtual bool is_MultiBranchData() { return false; } 380 virtual bool is_MultiBranchData() { return false; }
381 virtual bool is_ArgInfoData() { return false; }
382
379 383
380 BitData* as_BitData() { 384 BitData* as_BitData() {
381 assert(is_BitData(), "wrong type"); 385 assert(is_BitData(), "wrong type");
382 return is_BitData() ? (BitData*) this : NULL; 386 return is_BitData() ? (BitData*) this : NULL;
383 } 387 }
410 return is_ArrayData() ? (ArrayData*) this : NULL; 414 return is_ArrayData() ? (ArrayData*) this : NULL;
411 } 415 }
412 MultiBranchData* as_MultiBranchData() { 416 MultiBranchData* as_MultiBranchData() {
413 assert(is_MultiBranchData(), "wrong type"); 417 assert(is_MultiBranchData(), "wrong type");
414 return is_MultiBranchData() ? (MultiBranchData*)this : NULL; 418 return is_MultiBranchData() ? (MultiBranchData*)this : NULL;
419 }
420 ArgInfoData* as_ArgInfoData() {
421 assert(is_ArgInfoData(), "wrong type");
422 return is_ArgInfoData() ? (ArgInfoData*)this : NULL;
415 } 423 }
416 424
417 425
418 // Subclass specific initialization 426 // Subclass specific initialization
419 virtual void post_initialize(BytecodeStream* stream, methodDataOop mdo) {} 427 virtual void post_initialize(BytecodeStream* stream, methodDataOop mdo) {}
1039 return in_ByteSize(relative_displacement_off_set) * cell_size; 1047 return in_ByteSize(relative_displacement_off_set) * cell_size;
1040 } 1048 }
1041 1049
1042 // Specific initialization. 1050 // Specific initialization.
1043 void post_initialize(BytecodeStream* stream, methodDataOop mdo); 1051 void post_initialize(BytecodeStream* stream, methodDataOop mdo);
1052
1053 #ifndef PRODUCT
1054 void print_data_on(outputStream* st);
1055 #endif
1056 };
1057
1058 class ArgInfoData : public ArrayData {
1059
1060 public:
1061 ArgInfoData(DataLayout* layout) : ArrayData(layout) {
1062 assert(layout->tag() == DataLayout::arg_info_data_tag, "wrong type");
1063 }
1064
1065 virtual bool is_ArgInfoData() { return true; }
1066
1067
1068 int number_of_args() {
1069 return array_len();
1070 }
1071
1072 uint arg_modified(int arg) {
1073 return array_uint_at(arg);
1074 }
1075
1076 void set_arg_modified(int arg, uint val) {
1077 array_set_int_at(arg, val);
1078 }
1044 1079
1045 #ifndef PRODUCT 1080 #ifndef PRODUCT
1046 void print_data_on(outputStream* st); 1081 void print_data_on(outputStream* st);
1047 #endif 1082 #endif
1048 }; 1083 };
1181 int first_di() { return 0; } 1216 int first_di() { return 0; }
1182 1217
1183 // Find or create an extra ProfileData: 1218 // Find or create an extra ProfileData:
1184 ProfileData* bci_to_extra_data(int bci, bool create_if_missing); 1219 ProfileData* bci_to_extra_data(int bci, bool create_if_missing);
1185 1220
1221 // return the argument info cell
1222 ArgInfoData *arg_info();
1223
1186 public: 1224 public:
1187 static int header_size() { 1225 static int header_size() {
1188 return sizeof(methodDataOopDesc)/wordSize; 1226 return sizeof(methodDataOopDesc)/wordSize;
1189 } 1227 }
1190 1228
1220 1258
1221 intx eflags() { return _eflags; } 1259 intx eflags() { return _eflags; }
1222 intx arg_local() { return _arg_local; } 1260 intx arg_local() { return _arg_local; }
1223 intx arg_stack() { return _arg_stack; } 1261 intx arg_stack() { return _arg_stack; }
1224 intx arg_returned() { return _arg_returned; } 1262 intx arg_returned() { return _arg_returned; }
1263 uint arg_modified(int a) { ArgInfoData *aid = arg_info();
1264 assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
1265 return aid->arg_modified(a); }
1225 1266
1226 void set_eflags(intx v) { _eflags = v; } 1267 void set_eflags(intx v) { _eflags = v; }
1227 void set_arg_local(intx v) { _arg_local = v; } 1268 void set_arg_local(intx v) { _arg_local = v; }
1228 void set_arg_stack(intx v) { _arg_stack = v; } 1269 void set_arg_stack(intx v) { _arg_stack = v; }
1229 void set_arg_returned(intx v) { _arg_returned = v; } 1270 void set_arg_returned(intx v) { _arg_returned = v; }
1271 void set_arg_modified(int a, uint v) { ArgInfoData *aid = arg_info();
1272 assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
1273
1274 aid->set_arg_modified(a, v); }
1230 1275
1231 void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; } 1276 void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; }
1232 1277
1233 // Location and size of data area 1278 // Location and size of data area
1234 address data_base() const { 1279 address data_base() const {