src/share/vm/opto/parse3.cpp

Print this page




 391   }
 392 
 393   kill_dead_locals();
 394 
 395   // get the lengths from the stack (first dimension is on top)
 396   Node* length[MAX_DIMENSION+1];
 397   length[ndimensions] = NULL;  // terminating null for make_runtime_call
 398   int j;
 399   for (j = ndimensions-1; j >= 0 ; j--) length[j] = pop();
 400 
 401   // The original expression was of this form: new T[length0][length1]...
 402   // It is often the case that the lengths are small (except the last).
 403   // If that happens, use the fast 1-d creator a constant number of times.
 404   const jint expand_limit = MIN2((juint)MultiArrayExpandLimit, (juint)100);
 405   jint expand_count = 1;        // count of allocations in the expansion
 406   jint expand_fanout = 1;       // running total fanout
 407   for (j = 0; j < ndimensions-1; j++) {
 408     jint dim_con = find_int_con(length[j], -1);
 409     expand_fanout *= dim_con;
 410     expand_count  += expand_fanout; // count the level-J sub-arrays
 411     if (dim_con < 0
 412         || dim_con > expand_limit
 413         || expand_count > expand_limit) {
 414       expand_count = 0;
 415       break;
 416     }
 417   }
 418 
 419   // Can use multianewarray instead of [a]newarray if only one dimension,
 420   // or if all non-final dimensions are small constants.
 421   if (expand_count == 1 || (1 <= expand_count && expand_count <= expand_limit)) {
 422     Node* obj = expand_multianewarray(array_klass, &length[0], ndimensions);
 423     push(obj);
 424     return;
 425   }
 426 
 427   address fun = NULL;
 428   switch (ndimensions) {
 429   //case 1: Actually, there is no case 1.  It's handled by new_array.
 430   case 2: fun = OptoRuntime::multianewarray2_Java(); break;
 431   case 3: fun = OptoRuntime::multianewarray3_Java(); break;




 391   }
 392 
 393   kill_dead_locals();
 394 
 395   // get the lengths from the stack (first dimension is on top)
 396   Node* length[MAX_DIMENSION+1];
 397   length[ndimensions] = NULL;  // terminating null for make_runtime_call
 398   int j;
 399   for (j = ndimensions-1; j >= 0 ; j--) length[j] = pop();
 400 
 401   // The original expression was of this form: new T[length0][length1]...
 402   // It is often the case that the lengths are small (except the last).
 403   // If that happens, use the fast 1-d creator a constant number of times.
 404   const jint expand_limit = MIN2((juint)MultiArrayExpandLimit, (juint)100);
 405   jint expand_count = 1;        // count of allocations in the expansion
 406   jint expand_fanout = 1;       // running total fanout
 407   for (j = 0; j < ndimensions-1; j++) {
 408     jint dim_con = find_int_con(length[j], -1);
 409     expand_fanout *= dim_con;
 410     expand_count  += expand_fanout; // count the level-J sub-arrays
 411     if (dim_con <= 0
 412         || dim_con > expand_limit
 413         || expand_count > expand_limit) {
 414       expand_count = 0;
 415       break;
 416     }
 417   }
 418 
 419   // Can use multianewarray instead of [a]newarray if only one dimension,
 420   // or if all non-final dimensions are small constants.
 421   if (expand_count == 1 || (1 <= expand_count && expand_count <= expand_limit)) {
 422     Node* obj = expand_multianewarray(array_klass, &length[0], ndimensions);
 423     push(obj);
 424     return;
 425   }
 426 
 427   address fun = NULL;
 428   switch (ndimensions) {
 429   //case 1: Actually, there is no case 1.  It's handled by new_array.
 430   case 2: fun = OptoRuntime::multianewarray2_Java(); break;
 431   case 3: fun = OptoRuntime::multianewarray3_Java(); break;