1348 }
1349 set_result(result);
1350 return true;
1351 }
1352
1353 //--------------------------round_double_node--------------------------------
1354 // Round a double node if necessary.
1355 Node* LibraryCallKit::round_double_node(Node* n) {
1356 if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1357 n = _gvn.transform(new RoundDoubleNode(0, n));
1358 return n;
1359 }
1360
1361 //------------------------------inline_math-----------------------------------
1362 // public static double Math.abs(double)
1363 // public static double Math.sqrt(double)
1364 // public static double Math.log(double)
1365 // public static double Math.log10(double)
1366 bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
1367 Node* arg = round_double_node(argument(0));
1368 Node* n;
1369 switch (id) {
1370 case vmIntrinsics::_dabs: n = new AbsDNode( arg); break;
1371 case vmIntrinsics::_dsqrt: n = new SqrtDNode(C, control(), arg); break;
1372 case vmIntrinsics::_dlog: n = new LogDNode(C, control(), arg); break;
1373 case vmIntrinsics::_dlog10: n = new Log10DNode(C, control(), arg); break;
1374 default: fatal_unexpected_iid(id); break;
1375 }
1376 set_result(_gvn.transform(n));
1377 return true;
1378 }
1379
1380 //------------------------------inline_trig----------------------------------
1381 // Inline sin/cos/tan instructions, if possible. If rounding is required, do
1382 // argument reduction which will turn into a fast/slow diamond.
1383 bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) {
1384 Node* arg = round_double_node(argument(0));
1385 Node* n = NULL;
1386
1387 switch (id) {
1388 case vmIntrinsics::_dsin: n = new SinDNode(C, control(), arg); break;
2104 return basic_plus_adr(base, offset);
2105 }
2106 }
2107
2108 //--------------------------inline_number_methods-----------------------------
2109 // inline int Integer.numberOfLeadingZeros(int)
2110 // inline int Long.numberOfLeadingZeros(long)
2111 //
2112 // inline int Integer.numberOfTrailingZeros(int)
2113 // inline int Long.numberOfTrailingZeros(long)
2114 //
2115 // inline int Integer.bitCount(int)
2116 // inline int Long.bitCount(long)
2117 //
2118 // inline char Character.reverseBytes(char)
2119 // inline short Short.reverseBytes(short)
2120 // inline int Integer.reverseBytes(int)
2121 // inline long Long.reverseBytes(long)
2122 bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) {
2123 Node* arg = argument(0);
2124 Node* n;
2125 switch (id) {
2126 case vmIntrinsics::_numberOfLeadingZeros_i: n = new CountLeadingZerosINode( arg); break;
2127 case vmIntrinsics::_numberOfLeadingZeros_l: n = new CountLeadingZerosLNode( arg); break;
2128 case vmIntrinsics::_numberOfTrailingZeros_i: n = new CountTrailingZerosINode(arg); break;
2129 case vmIntrinsics::_numberOfTrailingZeros_l: n = new CountTrailingZerosLNode(arg); break;
2130 case vmIntrinsics::_bitCount_i: n = new PopCountINode( arg); break;
2131 case vmIntrinsics::_bitCount_l: n = new PopCountLNode( arg); break;
2132 case vmIntrinsics::_reverseBytes_c: n = new ReverseBytesUSNode(0, arg); break;
2133 case vmIntrinsics::_reverseBytes_s: n = new ReverseBytesSNode( 0, arg); break;
2134 case vmIntrinsics::_reverseBytes_i: n = new ReverseBytesINode( 0, arg); break;
2135 case vmIntrinsics::_reverseBytes_l: n = new ReverseBytesLNode( 0, arg); break;
2136 default: fatal_unexpected_iid(id); break;
2137 }
2138 set_result(_gvn.transform(n));
2139 return true;
2140 }
2141
2142 //----------------------------inline_unsafe_access----------------------------
2143
2144 const static BasicType T_ADDRESS_HOLDER = T_LONG;
4085 break;
4086 }
4087 }
4088
4089 #ifndef PRODUCT
4090 if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
4091 tty->print_cr(" Bailing out because caller depth exceeded inlining depth = %d", jvms()->depth());
4092 tty->print_cr(" JVM state at this point:");
4093 for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) {
4094 ciMethod* m = jvms()->of_depth(i)->method();
4095 tty->print_cr(" %d) %s.%s", n, m->holder()->name()->as_utf8(), m->name()->as_utf8());
4096 }
4097 }
4098 #endif
4099
4100 return false; // bail-out; let JVM_GetCallerClass do the work
4101 }
4102
4103 bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
4104 Node* arg = argument(0);
4105 Node* result;
4106
4107 switch (id) {
4108 case vmIntrinsics::_floatToRawIntBits: result = new MoveF2INode(arg); break;
4109 case vmIntrinsics::_intBitsToFloat: result = new MoveI2FNode(arg); break;
4110 case vmIntrinsics::_doubleToRawLongBits: result = new MoveD2LNode(arg); break;
4111 case vmIntrinsics::_longBitsToDouble: result = new MoveL2DNode(arg); break;
4112
4113 case vmIntrinsics::_doubleToLongBits: {
4114 // two paths (plus control) merge in a wood
4115 RegionNode *r = new RegionNode(3);
4116 Node *phi = new PhiNode(r, TypeLong::LONG);
4117
4118 Node *cmpisnan = _gvn.transform(new CmpDNode(arg, arg));
4119 // Build the boolean node
4120 Node *bolisnan = _gvn.transform(new BoolNode(cmpisnan, BoolTest::ne));
4121
4122 // Branch either way.
4123 // NaN case is less traveled, which makes all the difference.
4124 IfNode *ifisnan = create_and_xform_if(control(), bolisnan, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
4125 Node *opt_isnan = _gvn.transform(ifisnan);
|
1348 }
1349 set_result(result);
1350 return true;
1351 }
1352
1353 //--------------------------round_double_node--------------------------------
1354 // Round a double node if necessary.
1355 Node* LibraryCallKit::round_double_node(Node* n) {
1356 if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1)
1357 n = _gvn.transform(new RoundDoubleNode(0, n));
1358 return n;
1359 }
1360
1361 //------------------------------inline_math-----------------------------------
1362 // public static double Math.abs(double)
1363 // public static double Math.sqrt(double)
1364 // public static double Math.log(double)
1365 // public static double Math.log10(double)
1366 bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
1367 Node* arg = round_double_node(argument(0));
1368 Node* n = NULL;
1369 switch (id) {
1370 case vmIntrinsics::_dabs: n = new AbsDNode( arg); break;
1371 case vmIntrinsics::_dsqrt: n = new SqrtDNode(C, control(), arg); break;
1372 case vmIntrinsics::_dlog: n = new LogDNode(C, control(), arg); break;
1373 case vmIntrinsics::_dlog10: n = new Log10DNode(C, control(), arg); break;
1374 default: fatal_unexpected_iid(id); break;
1375 }
1376 set_result(_gvn.transform(n));
1377 return true;
1378 }
1379
1380 //------------------------------inline_trig----------------------------------
1381 // Inline sin/cos/tan instructions, if possible. If rounding is required, do
1382 // argument reduction which will turn into a fast/slow diamond.
1383 bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) {
1384 Node* arg = round_double_node(argument(0));
1385 Node* n = NULL;
1386
1387 switch (id) {
1388 case vmIntrinsics::_dsin: n = new SinDNode(C, control(), arg); break;
2104 return basic_plus_adr(base, offset);
2105 }
2106 }
2107
2108 //--------------------------inline_number_methods-----------------------------
2109 // inline int Integer.numberOfLeadingZeros(int)
2110 // inline int Long.numberOfLeadingZeros(long)
2111 //
2112 // inline int Integer.numberOfTrailingZeros(int)
2113 // inline int Long.numberOfTrailingZeros(long)
2114 //
2115 // inline int Integer.bitCount(int)
2116 // inline int Long.bitCount(long)
2117 //
2118 // inline char Character.reverseBytes(char)
2119 // inline short Short.reverseBytes(short)
2120 // inline int Integer.reverseBytes(int)
2121 // inline long Long.reverseBytes(long)
2122 bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) {
2123 Node* arg = argument(0);
2124 Node* n = NULL;
2125 switch (id) {
2126 case vmIntrinsics::_numberOfLeadingZeros_i: n = new CountLeadingZerosINode( arg); break;
2127 case vmIntrinsics::_numberOfLeadingZeros_l: n = new CountLeadingZerosLNode( arg); break;
2128 case vmIntrinsics::_numberOfTrailingZeros_i: n = new CountTrailingZerosINode(arg); break;
2129 case vmIntrinsics::_numberOfTrailingZeros_l: n = new CountTrailingZerosLNode(arg); break;
2130 case vmIntrinsics::_bitCount_i: n = new PopCountINode( arg); break;
2131 case vmIntrinsics::_bitCount_l: n = new PopCountLNode( arg); break;
2132 case vmIntrinsics::_reverseBytes_c: n = new ReverseBytesUSNode(0, arg); break;
2133 case vmIntrinsics::_reverseBytes_s: n = new ReverseBytesSNode( 0, arg); break;
2134 case vmIntrinsics::_reverseBytes_i: n = new ReverseBytesINode( 0, arg); break;
2135 case vmIntrinsics::_reverseBytes_l: n = new ReverseBytesLNode( 0, arg); break;
2136 default: fatal_unexpected_iid(id); break;
2137 }
2138 set_result(_gvn.transform(n));
2139 return true;
2140 }
2141
2142 //----------------------------inline_unsafe_access----------------------------
2143
2144 const static BasicType T_ADDRESS_HOLDER = T_LONG;
4085 break;
4086 }
4087 }
4088
4089 #ifndef PRODUCT
4090 if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
4091 tty->print_cr(" Bailing out because caller depth exceeded inlining depth = %d", jvms()->depth());
4092 tty->print_cr(" JVM state at this point:");
4093 for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) {
4094 ciMethod* m = jvms()->of_depth(i)->method();
4095 tty->print_cr(" %d) %s.%s", n, m->holder()->name()->as_utf8(), m->name()->as_utf8());
4096 }
4097 }
4098 #endif
4099
4100 return false; // bail-out; let JVM_GetCallerClass do the work
4101 }
4102
4103 bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
4104 Node* arg = argument(0);
4105 Node* result = NULL;
4106
4107 switch (id) {
4108 case vmIntrinsics::_floatToRawIntBits: result = new MoveF2INode(arg); break;
4109 case vmIntrinsics::_intBitsToFloat: result = new MoveI2FNode(arg); break;
4110 case vmIntrinsics::_doubleToRawLongBits: result = new MoveD2LNode(arg); break;
4111 case vmIntrinsics::_longBitsToDouble: result = new MoveL2DNode(arg); break;
4112
4113 case vmIntrinsics::_doubleToLongBits: {
4114 // two paths (plus control) merge in a wood
4115 RegionNode *r = new RegionNode(3);
4116 Node *phi = new PhiNode(r, TypeLong::LONG);
4117
4118 Node *cmpisnan = _gvn.transform(new CmpDNode(arg, arg));
4119 // Build the boolean node
4120 Node *bolisnan = _gvn.transform(new BoolNode(cmpisnan, BoolTest::ne));
4121
4122 // Branch either way.
4123 // NaN case is less traveled, which makes all the difference.
4124 IfNode *ifisnan = create_and_xform_if(control(), bolisnan, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
4125 Node *opt_isnan = _gvn.transform(ifisnan);
|