@@ -3706,7 +3706,7 @@ bool Compile::final_graph_reshaping() {
37063706// 'fall-thru' path, so expected kids is 1 less.
37073707if (n->is_PCTable () && n->in (0 ) && n->in (0 )->in (0 )) {
37083708if (n->in (0 )->in (0 )->is_Call ()) {
3709- CallNode* call = n->in (0 )->in (0 )->as_Call ();
3709+ CallNode * call = n->in (0 )->in (0 )->as_Call ();
37103710if (call->entry_point () ==OptoRuntime::rethrow_stub ()) {
37113711 required_outcnt--;// Rethrow always has 1 less kid
37123712 }else if (call->req () > TypeFunc::Parms &&
@@ -3715,25 +3715,22 @@ bool Compile::final_graph_reshaping() {
37153715// detected that the virtual call will always result in a null
37163716// pointer exception. The fall-through projection of this CatchNode
37173717// will not be populated.
3718- Node* arg0 = call->in (TypeFunc::Parms);
3718+ Node * arg0 = call->in (TypeFunc::Parms);
37193719if (arg0->is_Type () &&
37203720 arg0->as_Type ()->type ()->higher_equal (TypePtr::NULL_PTR)) {
37213721 required_outcnt--;
37223722 }
3723- }else if (call->entry_point () ==OptoRuntime::new_array_Java () ||
3724- call->entry_point () ==OptoRuntime::new_array_nozero_Java ()) {
3725- // Check for illegal array length. In such case, the optimizer has
3723+ }else if (call->entry_point () ==OptoRuntime::new_array_Java () &&
3724+ call->req () > TypeFunc::Parms+1 &&
3725+ call->is_CallStaticJava ()) {
3726+ // Check for negative array length. In such case, the optimizer has
37263727// detected that the allocation attempt will always result in an
37273728// exception. There is no fall-through projection of this CatchNode .
3728- assert (call->is_CallStaticJava ()," static call expected" );
3729- assert (call->req () == call->jvms ()->endoff () +1 ," missing extra input" );
3730- Node* valid_length_test = call->in (call->req ()-1 );
3731- call->del_req (call->req ()-1 );
3732- if (valid_length_test->find_int_con (1 ) ==0 ) {
3729+ Node *arg1 = call->in (TypeFunc::Parms+1 );
3730+ if (arg1->is_Type () &&
3731+ arg1->as_Type ()->type ()->join (TypeInt::POS)->empty ()) {
37333732 required_outcnt--;
37343733 }
3735- assert (n->outcnt () == required_outcnt," malformed control flow" );
3736- continue ;
37373734 }
37383735 }
37393736 }
@@ -3742,14 +3739,6 @@ bool Compile::final_graph_reshaping() {
37423739record_method_not_compilable (" malformed control flow" );
37433740return true ;// Not all targets reachable!
37443741 }
3745- }else if (n->is_PCTable () && n->in (0 ) && n->in (0 )->in (0 ) && n->in (0 )->in (0 )->is_Call ()) {
3746- CallNode* call = n->in (0 )->in (0 )->as_Call ();
3747- if (call->entry_point () ==OptoRuntime::new_array_Java () ||
3748- call->entry_point () ==OptoRuntime::new_array_nozero_Java ()) {
3749- assert (call->is_CallStaticJava ()," static call expected" );
3750- assert (call->req () == call->jvms ()->endoff () +1 ," missing extra input" );
3751- call->del_req (call->req ()-1 );// valid length test useless now
3752- }
37533742 }
37543743// Check that I actually visited all kids. Unreached kids
37553744// must be infinite loops.