8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "compiler/compileLog.hpp"
29 #include "oops/objArrayKlass.hpp"
30 #include "opto/addnode.hpp"
31 #include "opto/callGenerator.hpp"
32 #include "opto/cfgnode.hpp"
33 #include "opto/idealKit.hpp"
34 #include "opto/mulnode.hpp"
35 #include "opto/parse.hpp"
36 #include "opto/runtime.hpp"
37 #include "opto/subnode.hpp"
38 #include "prims/nativeLookup.hpp"
39 #include "runtime/sharedRuntime.hpp"
40
41 class LibraryIntrinsic : public InlineCallGenerator {
42 // Extend the set of intrinsics known to the runtime:
43 public:
44 private:
45 bool _is_virtual;
46 vmIntrinsics::ID _intrinsic_id;
47
371
372 //----------------------register_library_intrinsics-----------------------
373 // Initialize this file's data structures, for each Compile instance.
374 void Compile::register_library_intrinsics() {
375 // Nothing to do here.
376 }
377
378 JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
379 LibraryCallKit kit(jvms, this);
380 Compile* C = kit.C;
381 int nodes = C->unique();
382 #ifndef PRODUCT
383 if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) {
384 char buf[1000];
385 const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
386 tty->print_cr("Intrinsic %s", str);
387 }
388 #endif
389 if (kit.try_to_inline()) {
390 if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
391 tty->print("Inlining intrinsic %s%s at bci:%d in",
392 vmIntrinsics::name_at(intrinsic_id()),
393 (is_virtual() ? " (virtual)" : ""), kit.bci());
394 kit.caller()->print_short_name(tty);
395 tty->print_cr(" (%d bytes)", kit.caller()->code_size());
396 }
397 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
398 if (C->log()) {
399 C->log()->elem("intrinsic id='%s'%s nodes='%d'",
400 vmIntrinsics::name_at(intrinsic_id()),
401 (is_virtual() ? " virtual='1'" : ""),
402 C->unique() - nodes);
403 }
404 return kit.transfer_exceptions_into_jvms();
405 }
406
407 if (PrintIntrinsics) {
408 tty->print("Did not inline intrinsic %s%s at bci:%d in",
409 vmIntrinsics::name_at(intrinsic_id()),
410 (is_virtual() ? " (virtual)" : ""), kit.bci());
411 kit.caller()->print_short_name(tty);
412 tty->print_cr(" (%d bytes)", kit.caller()->code_size());
413 }
414 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
415 return NULL;
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "compiler/compileLog.hpp"
30 #include "oops/objArrayKlass.hpp"
31 #include "opto/addnode.hpp"
32 #include "opto/callGenerator.hpp"
33 #include "opto/cfgnode.hpp"
34 #include "opto/idealKit.hpp"
35 #include "opto/mulnode.hpp"
36 #include "opto/parse.hpp"
37 #include "opto/runtime.hpp"
38 #include "opto/subnode.hpp"
39 #include "prims/nativeLookup.hpp"
40 #include "runtime/sharedRuntime.hpp"
41
42 class LibraryIntrinsic : public InlineCallGenerator {
43 // Extend the set of intrinsics known to the runtime:
44 public:
45 private:
46 bool _is_virtual;
47 vmIntrinsics::ID _intrinsic_id;
48
372
373 //----------------------register_library_intrinsics-----------------------
374 // Initialize this file's data structures, for each Compile instance.
375 void Compile::register_library_intrinsics() {
376 // Nothing to do here.
377 }
378
379 JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
380 LibraryCallKit kit(jvms, this);
381 Compile* C = kit.C;
382 int nodes = C->unique();
383 #ifndef PRODUCT
384 if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) {
385 char buf[1000];
386 const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
387 tty->print_cr("Intrinsic %s", str);
388 }
389 #endif
390 if (kit.try_to_inline()) {
391 if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
392 CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
393 }
394 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
395 if (C->log()) {
396 C->log()->elem("intrinsic id='%s'%s nodes='%d'",
397 vmIntrinsics::name_at(intrinsic_id()),
398 (is_virtual() ? " virtual='1'" : ""),
399 C->unique() - nodes);
400 }
401 return kit.transfer_exceptions_into_jvms();
402 }
403
404 if (PrintIntrinsics) {
405 tty->print("Did not inline intrinsic %s%s at bci:%d in",
406 vmIntrinsics::name_at(intrinsic_id()),
407 (is_virtual() ? " (virtual)" : ""), kit.bci());
408 kit.caller()->print_short_name(tty);
409 tty->print_cr(" (%d bytes)", kit.caller()->code_size());
410 }
411 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
412 return NULL;
|