Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/methodData.hpp @ 21559:be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 15:36:48 +0200 |
parents | a04dfbf81bc4 |
children | c28cb37b2e1d |
comparison
equal
deleted
inserted
replaced
21558:d563baeca9df | 21559:be896a1983c0 |
---|---|
541 enum { | 541 enum { |
542 // null_seen: | 542 // null_seen: |
543 // saw a null operand (cast/aastore/instanceof) | 543 // saw a null operand (cast/aastore/instanceof) |
544 null_seen_flag = DataLayout::first_flag + 0 | 544 null_seen_flag = DataLayout::first_flag + 0 |
545 | 545 |
546 #ifdef GRAAL | 546 #ifdef JVMCI |
547 // bytecode threw any exception | 547 // bytecode threw any exception |
548 , exception_seen_flag = null_seen_flag + 1 | 548 , exception_seen_flag = null_seen_flag + 1 |
549 #endif | 549 #endif |
550 }; | 550 }; |
551 enum { bit_cell_count = 0 }; // no additional data fields needed. | 551 enum { bit_cell_count = 0 }; // no additional data fields needed. |
568 // The null_seen flag bit is specially known to the interpreter. | 568 // The null_seen flag bit is specially known to the interpreter. |
569 // Consulting it allows the compiler to avoid setting up null_check traps. | 569 // Consulting it allows the compiler to avoid setting up null_check traps. |
570 bool null_seen() { return flag_at(null_seen_flag); } | 570 bool null_seen() { return flag_at(null_seen_flag); } |
571 void set_null_seen() { set_flag_at(null_seen_flag); } | 571 void set_null_seen() { set_flag_at(null_seen_flag); } |
572 | 572 |
573 #ifdef GRAAL | 573 #ifdef JVMCI |
574 // true if an exception was thrown at the specific BCI | 574 // true if an exception was thrown at the specific BCI |
575 bool exception_seen() { return flag_at(exception_seen_flag); } | 575 bool exception_seen() { return flag_at(exception_seen_flag); } |
576 void set_exception_seen() { set_flag_at(exception_seen_flag); } | 576 void set_exception_seen() { set_flag_at(exception_seen_flag); } |
577 #endif | 577 #endif |
578 | 578 |
1177 // that the check is reached, and a series of (Klass*, count) pairs | 1177 // that the check is reached, and a series of (Klass*, count) pairs |
1178 // which are used to store a type profile for the receiver of the check. | 1178 // which are used to store a type profile for the receiver of the check. |
1179 class ReceiverTypeData : public CounterData { | 1179 class ReceiverTypeData : public CounterData { |
1180 protected: | 1180 protected: |
1181 enum { | 1181 enum { |
1182 #ifdef GRAAL | 1182 #ifdef JVMCI |
1183 // Description of the different counters | 1183 // Description of the different counters |
1184 // ReceiverTypeData for instanceof/checkcast/aastore: | 1184 // ReceiverTypeData for instanceof/checkcast/aastore: |
1185 // C1/C2: count is incremented on type overflow and decremented for failed type checks | 1185 // C1/C2: count is incremented on type overflow and decremented for failed type checks |
1186 // Graal: count decremented for failed type checks and nonprofiled_count is incremented on type overflow | 1186 // JVMCI: count decremented for failed type checks and nonprofiled_count is incremented on type overflow |
1187 // TODO (chaeubl): in fact, Graal should also increment the count for failed type checks to mimic the C1/C2 behavior | 1187 // TODO (chaeubl): in fact, JVMCI should also increment the count for failed type checks to mimic the C1/C2 behavior |
1188 // VirtualCallData for invokevirtual/invokeinterface: | 1188 // VirtualCallData for invokevirtual/invokeinterface: |
1189 // C1/C2: count is incremented on type overflow | 1189 // C1/C2: count is incremented on type overflow |
1190 // Graal: count is incremented on type overflow, nonprofiled_count is incremented on method overflow | 1190 // JVMCI: count is incremented on type overflow, nonprofiled_count is incremented on method overflow |
1191 | 1191 |
1192 // Graal is interested in knowing the percentage of type checks involving a type not explicitly in the profile | 1192 // JVMCI is interested in knowing the percentage of type checks involving a type not explicitly in the profile |
1193 nonprofiled_count_off_set = counter_cell_count, | 1193 nonprofiled_count_off_set = counter_cell_count, |
1194 receiver0_offset, | 1194 receiver0_offset, |
1195 #else | 1195 #else |
1196 receiver0_offset = counter_cell_count, | 1196 receiver0_offset = counter_cell_count, |
1197 #endif | 1197 #endif |
1207 } | 1207 } |
1208 | 1208 |
1209 virtual bool is_ReceiverTypeData() const { return true; } | 1209 virtual bool is_ReceiverTypeData() const { return true; } |
1210 | 1210 |
1211 static int static_cell_count() { | 1211 static int static_cell_count() { |
1212 return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count GRAAL_ONLY(+ 1); | 1212 return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count JVMCI_ONLY(+ 1); |
1213 } | 1213 } |
1214 | 1214 |
1215 virtual int cell_count() const { | 1215 virtual int cell_count() const { |
1216 return static_cell_count(); | 1216 return static_cell_count(); |
1217 } | 1217 } |
1269 // We do sorting a profiling info (ciCallProfile) for compilation. | 1269 // We do sorting a profiling info (ciCallProfile) for compilation. |
1270 // | 1270 // |
1271 set_count(0); | 1271 set_count(0); |
1272 set_receiver(row, NULL); | 1272 set_receiver(row, NULL); |
1273 set_receiver_count(row, 0); | 1273 set_receiver_count(row, 0); |
1274 #ifdef GRAAL | 1274 #ifdef JVMCI |
1275 if (!this->is_VirtualCallData()) { | 1275 if (!this->is_VirtualCallData()) { |
1276 // if this is a ReceiverTypeData for Graal, the nonprofiled_count | 1276 // if this is a ReceiverTypeData for JVMCI, the nonprofiled_count |
1277 // must also be reset (see "Description of the different counters" above) | 1277 // must also be reset (see "Description of the different counters" above) |
1278 set_nonprofiled_count(0); | 1278 set_nonprofiled_count(0); |
1279 } | 1279 } |
1280 #endif | 1280 #endif |
1281 } | 1281 } |
1285 return cell_offset(receiver_cell_index(row)); | 1285 return cell_offset(receiver_cell_index(row)); |
1286 } | 1286 } |
1287 static ByteSize receiver_count_offset(uint row) { | 1287 static ByteSize receiver_count_offset(uint row) { |
1288 return cell_offset(receiver_count_cell_index(row)); | 1288 return cell_offset(receiver_count_cell_index(row)); |
1289 } | 1289 } |
1290 #ifdef GRAAL | 1290 #ifdef JVMCI |
1291 static ByteSize nonprofiled_receiver_count_offset() { | 1291 static ByteSize nonprofiled_receiver_count_offset() { |
1292 return cell_offset(nonprofiled_count_off_set); | 1292 return cell_offset(nonprofiled_count_off_set); |
1293 } | 1293 } |
1294 uint nonprofiled_count() const { | 1294 uint nonprofiled_count() const { |
1295 return uint_at(nonprofiled_count_off_set); | 1295 return uint_at(nonprofiled_count_off_set); |
1362 virtual bool is_VirtualCallData() const { return true; } | 1362 virtual bool is_VirtualCallData() const { return true; } |
1363 | 1363 |
1364 static int static_cell_count() { | 1364 static int static_cell_count() { |
1365 // At this point we could add more profile state, e.g., for arguments. | 1365 // At this point we could add more profile state, e.g., for arguments. |
1366 // But for now it's the same size as the base record type. | 1366 // But for now it's the same size as the base record type. |
1367 return ReceiverTypeData::static_cell_count() GRAAL_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count); | 1367 return ReceiverTypeData::static_cell_count() JVMCI_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count); |
1368 } | 1368 } |
1369 | 1369 |
1370 virtual int cell_count() const { | 1370 virtual int cell_count() const { |
1371 return static_cell_count(); | 1371 return static_cell_count(); |
1372 } | 1372 } |
1384 static DataLayout* advance(DataLayout* layout) { | 1384 static DataLayout* advance(DataLayout* layout) { |
1385 return (DataLayout*) (((address)layout) + (ssize_t)VirtualCallData::virtual_call_data_size_in_bytes()); | 1385 return (DataLayout*) (((address)layout) + (ssize_t)VirtualCallData::virtual_call_data_size_in_bytes()); |
1386 } | 1386 } |
1387 #endif // CC_INTERP | 1387 #endif // CC_INTERP |
1388 | 1388 |
1389 #ifdef GRAAL | 1389 #ifdef JVMCI |
1390 static ByteSize method_offset(uint row) { | 1390 static ByteSize method_offset(uint row) { |
1391 return cell_offset(method_cell_index(row)); | 1391 return cell_offset(method_cell_index(row)); |
1392 } | 1392 } |
1393 static ByteSize method_count_offset(uint row) { | 1393 static ByteSize method_count_offset(uint row) { |
1394 return cell_offset(method_count_cell_index(row)); | 1394 return cell_offset(method_count_cell_index(row)); |
1440 // Redefinition support | 1440 // Redefinition support |
1441 virtual void clean_weak_method_links(); | 1441 virtual void clean_weak_method_links(); |
1442 #endif | 1442 #endif |
1443 | 1443 |
1444 #ifndef PRODUCT | 1444 #ifndef PRODUCT |
1445 #ifdef GRAAL | 1445 #ifdef JVMCI |
1446 void print_method_data_on(outputStream* st) const; | 1446 void print_method_data_on(outputStream* st) const; |
1447 #endif | 1447 #endif |
1448 void print_data_on(outputStream* st, const char* extra = NULL) const; | 1448 void print_data_on(outputStream* st, const char* extra = NULL) const; |
1449 #endif | 1449 #endif |
1450 }; | 1450 }; |
2163 bool is_methodData() const volatile { return true; } | 2163 bool is_methodData() const volatile { return true; } |
2164 void initialize(); | 2164 void initialize(); |
2165 | 2165 |
2166 // Whole-method sticky bits and flags | 2166 // Whole-method sticky bits and flags |
2167 enum { | 2167 enum { |
2168 _trap_hist_limit = 20 GRAAL_ONLY(+5), // decoupled from Deoptimization::Reason_LIMIT | 2168 _trap_hist_limit = 20 JVMCI_ONLY(+5), // decoupled from Deoptimization::Reason_LIMIT |
2169 _trap_hist_mask = max_jubyte, | 2169 _trap_hist_mask = max_jubyte, |
2170 _extra_data_count = 4 // extra DataLayout headers, for trap history | 2170 _extra_data_count = 4 // extra DataLayout headers, for trap history |
2171 }; // Public flag values | 2171 }; // Public flag values |
2172 private: | 2172 private: |
2173 uint _nof_decompiles; // count of all nmethod removals | 2173 uint _nof_decompiles; // count of all nmethod removals |
2208 short _num_blocks; | 2208 short _num_blocks; |
2209 // Does this method contain anything worth profiling? | 2209 // Does this method contain anything worth profiling? |
2210 enum WouldProfile {unknown, no_profile, profile}; | 2210 enum WouldProfile {unknown, no_profile, profile}; |
2211 WouldProfile _would_profile; | 2211 WouldProfile _would_profile; |
2212 | 2212 |
2213 #ifdef GRAAL | 2213 #ifdef JVMCI |
2214 // Support for HotSpotMethodData.setCompiledIRSize(int) | 2214 // Support for HotSpotMethodData.setCompiledIRSize(int) |
2215 int _jvmci_ir_size; | 2215 int _jvmci_ir_size; |
2216 #endif | 2216 #endif |
2217 | 2217 |
2218 // Size of _data array in bytes. (Excludes header and extra_data fields.) | 2218 // Size of _data array in bytes. (Excludes header and extra_data fields.) |
2489 - (address)extra_data_base(); } | 2489 - (address)extra_data_base(); } |
2490 static DataLayout* next_extra(DataLayout* dp); | 2490 static DataLayout* next_extra(DataLayout* dp); |
2491 | 2491 |
2492 // Return (uint)-1 for overflow. | 2492 // Return (uint)-1 for overflow. |
2493 uint trap_count(int reason) const { | 2493 uint trap_count(int reason) const { |
2494 assert((uint)reason < GRAAL_ONLY(2*) _trap_hist_limit, "oob"); | 2494 assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); |
2495 return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1; | 2495 return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1; |
2496 } | 2496 } |
2497 // For loops: | 2497 // For loops: |
2498 static uint trap_reason_limit() { return _trap_hist_limit; } | 2498 static uint trap_reason_limit() { return _trap_hist_limit; } |
2499 static uint trap_count_limit() { return _trap_hist_mask; } | 2499 static uint trap_count_limit() { return _trap_hist_mask; } |
2500 uint inc_trap_count(int reason) { | 2500 uint inc_trap_count(int reason) { |
2501 // Count another trap, anywhere in this method. | 2501 // Count another trap, anywhere in this method. |
2502 assert(reason >= 0, "must be single trap"); | 2502 assert(reason >= 0, "must be single trap"); |
2503 assert((uint)reason < GRAAL_ONLY(2*) _trap_hist_limit, "oob"); | 2503 assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); |
2504 uint cnt1 = 1 + _trap_hist._array[reason]; | 2504 uint cnt1 = 1 + _trap_hist._array[reason]; |
2505 if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow... | 2505 if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow... |
2506 _trap_hist._array[reason] = cnt1; | 2506 _trap_hist._array[reason] = cnt1; |
2507 return cnt1; | 2507 return cnt1; |
2508 } else { | 2508 } else { |