1.1 --- a/src/share/vm/oops/methodDataOop.cpp Tue Mar 11 11:25:13 2008 -0700 1.2 +++ b/src/share/vm/oops/methodDataOop.cpp Tue Mar 11 19:00:38 2008 -0700 1.3 @@ -32,7 +32,7 @@ 1.4 1.5 // Some types of data layouts need a length field. 1.6 bool DataLayout::needs_array_len(u1 tag) { 1.7 - return (tag == multi_branch_data_tag); 1.8 + return (tag == multi_branch_data_tag) || (tag == arg_info_data_tag); 1.9 } 1.10 1.11 // Perform generic initialization of the data. More specific 1.12 @@ -404,6 +404,17 @@ 1.13 } 1.14 #endif 1.15 1.16 +#ifndef PRODUCT 1.17 +void ArgInfoData::print_data_on(outputStream* st) { 1.18 + print_shared(st, "ArgInfoData"); 1.19 + int nargs = number_of_args(); 1.20 + for (int i = 0; i < nargs; i++) { 1.21 + st->print(" 0x%x", arg_modified(i)); 1.22 + } 1.23 + st->cr(); 1.24 +} 1.25 + 1.26 +#endif 1.27 // ================================================================== 1.28 // methodDataOop 1.29 // 1.30 @@ -508,6 +519,9 @@ 1.31 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count); 1.32 object_size += extra_data_count * DataLayout::compute_size_in_bytes(0); 1.33 1.34 + // Add a cell to record information about modified arguments. 1.35 + int arg_size = method->size_of_parameters(); 1.36 + object_size += DataLayout::compute_size_in_bytes(arg_size+1); 1.37 return object_size; 1.38 } 1.39 1.40 @@ -626,6 +640,8 @@ 1.41 return new BranchData(data_layout); 1.42 case DataLayout::multi_branch_data_tag: 1.43 return new MultiBranchData(data_layout); 1.44 + case DataLayout::arg_info_data_tag: 1.45 + return new ArgInfoData(data_layout); 1.46 }; 1.47 } 1.48 1.49 @@ -681,7 +697,17 @@ 1.50 1.51 // Add some extra DataLayout cells (at least one) to track stray traps. 1.52 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count); 1.53 - object_size += extra_data_count * DataLayout::compute_size_in_bytes(0); 1.54 + int extra_size = extra_data_count * DataLayout::compute_size_in_bytes(0); 1.55 + 1.56 + // Add a cell to record information about modified arguments. 1.57 + // Set up _args_modified array after traps cells so that 1.58 + // the code for traps cells works. 1.59 + DataLayout *dp = data_layout_at(data_size + extra_size); 1.60 + 1.61 + int arg_size = method->size_of_parameters(); 1.62 + dp->initialize(DataLayout::arg_info_data_tag, 0, arg_size+1); 1.63 + 1.64 + object_size += extra_size + DataLayout::compute_size_in_bytes(arg_size+1); 1.65 1.66 // Set an initial hint. Don't use set_hint_di() because 1.67 // first_di() may be out of bounds if data_size is 0. 1.68 @@ -764,6 +790,10 @@ 1.69 // No need for "OrderAccess::load_acquire" ops, 1.70 // since the data structure is monotonic. 1.71 if (dp->tag() == DataLayout::no_tag) break; 1.72 + if (dp->tag() == DataLayout::arg_info_data_tag) { 1.73 + dp = end; // ArgInfoData is at the end of extra data section. 1.74 + break; 1.75 + } 1.76 if (dp->bci() == bci) { 1.77 assert(dp->tag() == DataLayout::bit_data_tag, "sane"); 1.78 return new BitData(dp); 1.79 @@ -785,6 +815,16 @@ 1.80 return NULL; 1.81 } 1.82 1.83 +ArgInfoData *methodDataOopDesc::arg_info() { 1.84 + DataLayout* dp = extra_data_base(); 1.85 + DataLayout* end = extra_data_limit(); 1.86 + for (; dp < end; dp = next_extra(dp)) { 1.87 + if (dp->tag() == DataLayout::arg_info_data_tag) 1.88 + return new ArgInfoData(dp); 1.89 + } 1.90 + return NULL; 1.91 +} 1.92 + 1.93 #ifndef PRODUCT 1.94 void methodDataOopDesc::print_data_on(outputStream* st) { 1.95 ResourceMark rm; 1.96 @@ -794,15 +834,20 @@ 1.97 st->fill_to(6); 1.98 data->print_data_on(st); 1.99 } 1.100 + st->print_cr("--- Extra data:"); 1.101 DataLayout* dp = extra_data_base(); 1.102 DataLayout* end = extra_data_limit(); 1.103 for (; dp < end; dp = next_extra(dp)) { 1.104 // No need for "OrderAccess::load_acquire" ops, 1.105 // since the data structure is monotonic. 1.106 - if (dp->tag() == DataLayout::no_tag) break; 1.107 - if (dp == extra_data_base()) 1.108 - st->print_cr("--- Extra data:"); 1.109 - data = new BitData(dp); 1.110 + if (dp->tag() == DataLayout::no_tag) continue; 1.111 + if (dp->tag() == DataLayout::bit_data_tag) { 1.112 + data = new BitData(dp); 1.113 + } else { 1.114 + assert(dp->tag() == DataLayout::arg_info_data_tag, "must be BitData or ArgInfo"); 1.115 + data = new ArgInfoData(dp); 1.116 + dp = end; // ArgInfoData is at the end of extra data section. 1.117 + } 1.118 st->print("%d", dp_to_di(data->dp())); 1.119 st->fill_to(6); 1.120 data->print_data_on(st);