< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




1974       for (cmpn = 0; cmpn < NCMPS; cmpn++)
1975         if (cmps[cmpn] == cmp)  break;
1976       if (cmpn == NCMPS)  continue;
1977       BoolTest::mask btest = bol->as_Bool()->_test._test;
1978       if (ifproj->is_IfFalse())  btest = BoolTest(btest).negate();
1979       if (cmp->in(1) == ykey)    btest = BoolTest(btest).commute();
1980       // At this point, we know that 'x btest y' is true.
1981       switch (btest) {
1982       case BoolTest::eq:
1983         // They are proven equal, so we can collapse the min/max.
1984         // Either value is the answer.  Choose the simpler.
1985         if (is_simple_name(yvalue) && !is_simple_name(xvalue))
1986           return yvalue;
1987         return xvalue;
1988       case BoolTest::lt:          // x < y
1989       case BoolTest::le:          // x <= y
1990         return (want_max ? yvalue : xvalue);
1991       case BoolTest::gt:          // x > y
1992       case BoolTest::ge:          // x >= y
1993         return (want_max ? xvalue : yvalue);


1994       }
1995     }
1996   }
1997 
1998   // We failed to find a dominating test.
1999   // Let's pick a test that might GVN with prior tests.
2000   Node*          best_bol   = NULL;
2001   BoolTest::mask best_btest = BoolTest::illegal;
2002   for (cmpn = 0; cmpn < NCMPS; cmpn++) {
2003     Node* cmp = cmps[cmpn];
2004     if (cmp == NULL)  continue;
2005     for (DUIterator_Fast jmax, j = cmp->fast_outs(jmax); j < jmax; j++) {
2006       Node* bol = cmp->fast_out(j);
2007       if (!bol->is_Bool())  continue;
2008       BoolTest::mask btest = bol->as_Bool()->_test._test;
2009       if (btest == BoolTest::eq || btest == BoolTest::ne)  continue;
2010       if (cmp->in(1) == ykey)   btest = BoolTest(btest).commute();
2011       if (bol->outcnt() > (best_bol == NULL ? 0 : best_bol->outcnt())) {
2012         best_bol   = bol->as_Bool();
2013         best_btest = btest;


2607         fatal("unexpected type %d: %s", type, type2name(type));
2608         break;
2609       }
2610     }
2611     // The load node has the control of the preceding MemBarCPUOrder.  All
2612     // following nodes will have the control of the MemBarCPUOrder inserted at
2613     // the end of this method.  So, pushing the load onto the stack at a later
2614     // point is fine.
2615     set_result(p);
2616   } else {
2617     // place effect of store into memory
2618     switch (type) {
2619     case T_DOUBLE:
2620       val = dstore_rounding(val);
2621       break;
2622     case T_ADDRESS:
2623       // Repackage the long as a pointer.
2624       val = ConvL2X(val);
2625       val = _gvn.transform(new CastX2PNode(val));
2626       break;


2627     }
2628 
2629     if (type == T_OBJECT) {
2630       store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
2631     } else {
2632       store_to_memory(control(), adr, val, type, adr_type, mo, requires_atomic_access, unaligned, mismatched);
2633     }
2634   }
2635 
2636   switch(kind) {
2637     case Relaxed:
2638     case Opaque:
2639     case Release:
2640       break;
2641     case Acquire:
2642     case Volatile:
2643       if (!is_store) {
2644         insert_mem_bar(Op_MemBarAcquire);
2645       } else {
2646         if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {


6166   Node *adr = basic_plus_adr(fromObj, fromObj, offset);
6167 
6168   return adr;
6169 }
6170 
6171 //------------------------------inline_aescrypt_Block-----------------------
6172 bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) {
6173   address stubAddr = NULL;
6174   const char *stubName;
6175   assert(UseAES, "need AES instruction support");
6176 
6177   switch(id) {
6178   case vmIntrinsics::_aescrypt_encryptBlock:
6179     stubAddr = StubRoutines::aescrypt_encryptBlock();
6180     stubName = "aescrypt_encryptBlock";
6181     break;
6182   case vmIntrinsics::_aescrypt_decryptBlock:
6183     stubAddr = StubRoutines::aescrypt_decryptBlock();
6184     stubName = "aescrypt_decryptBlock";
6185     break;


6186   }
6187   if (stubAddr == NULL) return false;
6188 
6189   Node* aescrypt_object = argument(0);
6190   Node* src             = argument(1);
6191   Node* src_offset      = argument(2);
6192   Node* dest            = argument(3);
6193   Node* dest_offset     = argument(4);
6194 
6195   // (1) src and dest are arrays.
6196   const Type* src_type = src->Value(&_gvn);
6197   const Type* dest_type = dest->Value(&_gvn);
6198   const TypeAryPtr* top_src = src_type->isa_aryptr();
6199   const TypeAryPtr* top_dest = dest_type->isa_aryptr();
6200   assert (top_src  != NULL && top_src->klass()  != NULL &&  top_dest != NULL && top_dest->klass() != NULL, "args are strange");
6201 
6202   // for the quick and dirty code we will skip all the checks.
6203   // we are just trying to get the call to be generated.
6204   Node* src_start  = src;
6205   Node* dest_start = dest;


6233 
6234   return true;
6235 }
6236 
6237 //------------------------------inline_cipherBlockChaining_AESCrypt-----------------------
6238 bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) {
6239   address stubAddr = NULL;
6240   const char *stubName = NULL;
6241 
6242   assert(UseAES, "need AES instruction support");
6243 
6244   switch(id) {
6245   case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
6246     stubAddr = StubRoutines::cipherBlockChaining_encryptAESCrypt();
6247     stubName = "cipherBlockChaining_encryptAESCrypt";
6248     break;
6249   case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
6250     stubAddr = StubRoutines::cipherBlockChaining_decryptAESCrypt();
6251     stubName = "cipherBlockChaining_decryptAESCrypt";
6252     break;


6253   }
6254   if (stubAddr == NULL) return false;
6255 
6256   Node* cipherBlockChaining_object = argument(0);
6257   Node* src                        = argument(1);
6258   Node* src_offset                 = argument(2);
6259   Node* len                        = argument(3);
6260   Node* dest                       = argument(4);
6261   Node* dest_offset                = argument(5);
6262 
6263   // (1) src and dest are arrays.
6264   const Type* src_type = src->Value(&_gvn);
6265   const Type* dest_type = dest->Value(&_gvn);
6266   const TypeAryPtr* top_src = src_type->isa_aryptr();
6267   const TypeAryPtr* top_dest = dest_type->isa_aryptr();
6268   assert (top_src  != NULL && top_src->klass()  != NULL
6269           &&  top_dest != NULL && top_dest->klass() != NULL, "args are strange");
6270 
6271   // checks are the responsibility of the caller
6272   Node* src_start  = src;




1974       for (cmpn = 0; cmpn < NCMPS; cmpn++)
1975         if (cmps[cmpn] == cmp)  break;
1976       if (cmpn == NCMPS)  continue;
1977       BoolTest::mask btest = bol->as_Bool()->_test._test;
1978       if (ifproj->is_IfFalse())  btest = BoolTest(btest).negate();
1979       if (cmp->in(1) == ykey)    btest = BoolTest(btest).commute();
1980       // At this point, we know that 'x btest y' is true.
1981       switch (btest) {
1982       case BoolTest::eq:
1983         // They are proven equal, so we can collapse the min/max.
1984         // Either value is the answer.  Choose the simpler.
1985         if (is_simple_name(yvalue) && !is_simple_name(xvalue))
1986           return yvalue;
1987         return xvalue;
1988       case BoolTest::lt:          // x < y
1989       case BoolTest::le:          // x <= y
1990         return (want_max ? yvalue : xvalue);
1991       case BoolTest::gt:          // x > y
1992       case BoolTest::ge:          // x >= y
1993         return (want_max ? xvalue : yvalue);
1994       default:
1995         break;
1996       }
1997     }
1998   }
1999 
2000   // We failed to find a dominating test.
2001   // Let's pick a test that might GVN with prior tests.
2002   Node*          best_bol   = NULL;
2003   BoolTest::mask best_btest = BoolTest::illegal;
2004   for (cmpn = 0; cmpn < NCMPS; cmpn++) {
2005     Node* cmp = cmps[cmpn];
2006     if (cmp == NULL)  continue;
2007     for (DUIterator_Fast jmax, j = cmp->fast_outs(jmax); j < jmax; j++) {
2008       Node* bol = cmp->fast_out(j);
2009       if (!bol->is_Bool())  continue;
2010       BoolTest::mask btest = bol->as_Bool()->_test._test;
2011       if (btest == BoolTest::eq || btest == BoolTest::ne)  continue;
2012       if (cmp->in(1) == ykey)   btest = BoolTest(btest).commute();
2013       if (bol->outcnt() > (best_bol == NULL ? 0 : best_bol->outcnt())) {
2014         best_bol   = bol->as_Bool();
2015         best_btest = btest;


2609         fatal("unexpected type %d: %s", type, type2name(type));
2610         break;
2611       }
2612     }
2613     // The load node has the control of the preceding MemBarCPUOrder.  All
2614     // following nodes will have the control of the MemBarCPUOrder inserted at
2615     // the end of this method.  So, pushing the load onto the stack at a later
2616     // point is fine.
2617     set_result(p);
2618   } else {
2619     // place effect of store into memory
2620     switch (type) {
2621     case T_DOUBLE:
2622       val = dstore_rounding(val);
2623       break;
2624     case T_ADDRESS:
2625       // Repackage the long as a pointer.
2626       val = ConvL2X(val);
2627       val = _gvn.transform(new CastX2PNode(val));
2628       break;
2629     default:
2630       break;
2631     }
2632 
2633     if (type == T_OBJECT) {
2634       store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
2635     } else {
2636       store_to_memory(control(), adr, val, type, adr_type, mo, requires_atomic_access, unaligned, mismatched);
2637     }
2638   }
2639 
2640   switch(kind) {
2641     case Relaxed:
2642     case Opaque:
2643     case Release:
2644       break;
2645     case Acquire:
2646     case Volatile:
2647       if (!is_store) {
2648         insert_mem_bar(Op_MemBarAcquire);
2649       } else {
2650         if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {


6170   Node *adr = basic_plus_adr(fromObj, fromObj, offset);
6171 
6172   return adr;
6173 }
6174 
6175 //------------------------------inline_aescrypt_Block-----------------------
6176 bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) {
6177   address stubAddr = NULL;
6178   const char *stubName;
6179   assert(UseAES, "need AES instruction support");
6180 
6181   switch(id) {
6182   case vmIntrinsics::_aescrypt_encryptBlock:
6183     stubAddr = StubRoutines::aescrypt_encryptBlock();
6184     stubName = "aescrypt_encryptBlock";
6185     break;
6186   case vmIntrinsics::_aescrypt_decryptBlock:
6187     stubAddr = StubRoutines::aescrypt_decryptBlock();
6188     stubName = "aescrypt_decryptBlock";
6189     break;
6190   default:
6191     break;
6192   }
6193   if (stubAddr == NULL) return false;
6194 
6195   Node* aescrypt_object = argument(0);
6196   Node* src             = argument(1);
6197   Node* src_offset      = argument(2);
6198   Node* dest            = argument(3);
6199   Node* dest_offset     = argument(4);
6200 
6201   // (1) src and dest are arrays.
6202   const Type* src_type = src->Value(&_gvn);
6203   const Type* dest_type = dest->Value(&_gvn);
6204   const TypeAryPtr* top_src = src_type->isa_aryptr();
6205   const TypeAryPtr* top_dest = dest_type->isa_aryptr();
6206   assert (top_src  != NULL && top_src->klass()  != NULL &&  top_dest != NULL && top_dest->klass() != NULL, "args are strange");
6207 
6208   // for the quick and dirty code we will skip all the checks.
6209   // we are just trying to get the call to be generated.
6210   Node* src_start  = src;
6211   Node* dest_start = dest;


6239 
6240   return true;
6241 }
6242 
6243 //------------------------------inline_cipherBlockChaining_AESCrypt-----------------------
6244 bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) {
6245   address stubAddr = NULL;
6246   const char *stubName = NULL;
6247 
6248   assert(UseAES, "need AES instruction support");
6249 
6250   switch(id) {
6251   case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
6252     stubAddr = StubRoutines::cipherBlockChaining_encryptAESCrypt();
6253     stubName = "cipherBlockChaining_encryptAESCrypt";
6254     break;
6255   case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
6256     stubAddr = StubRoutines::cipherBlockChaining_decryptAESCrypt();
6257     stubName = "cipherBlockChaining_decryptAESCrypt";
6258     break;
6259   default:
6260     break;
6261   }
6262   if (stubAddr == NULL) return false;
6263 
6264   Node* cipherBlockChaining_object = argument(0);
6265   Node* src                        = argument(1);
6266   Node* src_offset                 = argument(2);
6267   Node* len                        = argument(3);
6268   Node* dest                       = argument(4);
6269   Node* dest_offset                = argument(5);
6270 
6271   // (1) src and dest are arrays.
6272   const Type* src_type = src->Value(&_gvn);
6273   const Type* dest_type = dest->Value(&_gvn);
6274   const TypeAryPtr* top_src = src_type->isa_aryptr();
6275   const TypeAryPtr* top_dest = dest_type->isa_aryptr();
6276   assert (top_src  != NULL && top_src->klass()  != NULL
6277           &&  top_dest != NULL && top_dest->klass() != NULL, "args are strange");
6278 
6279   // checks are the responsibility of the caller
6280   Node* src_start  = src;


< prev index next >