< prev index next >

src/hotspot/share/opto/parse3.cpp

Print this page




 395   int ndimensions = iter().get_dimensions();
 396 
 397   // the m-dimensional array
 398   bool will_link;
 399   ciArrayKlass* array_klass = iter().get_klass(will_link)->as_array_klass();
 400   assert(will_link, "multianewarray: typeflow responsibility");
 401 
 402   // Note:  Array classes are always initialized; no is_initialized check.
 403 
 404   kill_dead_locals();
 405 
 406   // get the lengths from the stack (first dimension is on top)
 407   Node** length = NEW_RESOURCE_ARRAY(Node*, ndimensions + 1);
 408   length[ndimensions] = NULL;  // terminating null for make_runtime_call
 409   int j;
 410   for (j = ndimensions-1; j >= 0 ; j--) length[j] = pop();
 411 
 412   // The original expression was of this form: new T[length0][length1]...
 413   // It is often the case that the lengths are small (except the last).
 414   // If that happens, use the fast 1-d creator a constant number of times.
 415   const jint expand_limit = MIN2((jint)MultiArrayExpandLimit, 100);
 416   jint expand_count = 1;        // count of allocations in the expansion
 417   jint expand_fanout = 1;       // running total fanout
 418   for (j = 0; j < ndimensions-1; j++) {
 419     jint dim_con = find_int_con(length[j], -1);
 420     expand_fanout *= dim_con;
 421     expand_count  += expand_fanout; // count the level-J sub-arrays
 422     if (dim_con <= 0
 423         || dim_con > expand_limit
 424         || expand_count > expand_limit) {
 425       expand_count = 0;
 426       break;
 427     }
 428   }
 429 
 430   // Can use multianewarray instead of [a]newarray if only one dimension,
 431   // or if all non-final dimensions are small constants.
 432   if (ndimensions == 1 || (1 <= expand_count && expand_count <= expand_limit)) {
 433     Node* obj = NULL;
 434     // Set the original stack and the reexecute bit for the interpreter
 435     // to reexecute the multianewarray bytecode if deoptimization happens.
 436     // Do it unconditionally even for one dimension multianewarray.
 437     // Note: the reexecute bit will be set in GraphKit::add_safepoint_edges()




 395   int ndimensions = iter().get_dimensions();
 396 
 397   // the m-dimensional array
 398   bool will_link;
 399   ciArrayKlass* array_klass = iter().get_klass(will_link)->as_array_klass();
 400   assert(will_link, "multianewarray: typeflow responsibility");
 401 
 402   // Note:  Array classes are always initialized; no is_initialized check.
 403 
 404   kill_dead_locals();
 405 
 406   // get the lengths from the stack (first dimension is on top)
 407   Node** length = NEW_RESOURCE_ARRAY(Node*, ndimensions + 1);
 408   length[ndimensions] = NULL;  // terminating null for make_runtime_call
 409   int j;
 410   for (j = ndimensions-1; j >= 0 ; j--) length[j] = pop();
 411 
 412   // The original expression was of this form: new T[length0][length1]...
 413   // It is often the case that the lengths are small (except the last).
 414   // If that happens, use the fast 1-d creator a constant number of times.
 415   const int expand_limit = MIN2((int)MultiArrayExpandLimit, 100);
 416   int expand_count = 1;        // count of allocations in the expansion
 417   int expand_fanout = 1;       // running total fanout
 418   for (j = 0; j < ndimensions-1; j++) {
 419     jint dim_con = find_int_con(length[j], -1);
 420     expand_fanout *= dim_con;
 421     expand_count  += expand_fanout; // count the level-J sub-arrays
 422     if (dim_con <= 0
 423         || dim_con > expand_limit
 424         || expand_count > expand_limit) {
 425       expand_count = 0;
 426       break;
 427     }
 428   }
 429 
 430   // Can use multianewarray instead of [a]newarray if only one dimension,
 431   // or if all non-final dimensions are small constants.
 432   if (ndimensions == 1 || (1 <= expand_count && expand_count <= expand_limit)) {
 433     Node* obj = NULL;
 434     // Set the original stack and the reexecute bit for the interpreter
 435     // to reexecute the multianewarray bytecode if deoptimization happens.
 436     // Do it unconditionally even for one dimension multianewarray.
 437     // Note: the reexecute bit will be set in GraphKit::add_safepoint_edges()


< prev index next >