1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)callGenerator.cpp 1.49 07/08/07 15:24:21 JVM"
3 #endif
4 /*
5 * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
450
451 Node* exact_receiver = receiver; // will get updated in place...
452 Node* slow_ctl = kit.type_check_receiver(receiver,
453 _predicted_receiver, _hit_prob,
454 &exact_receiver);
455
456 SafePointNode* slow_map = NULL;
457 JVMState* slow_jvms;
458 { PreserveJVMState pjvms(&kit);
459 kit.set_control(slow_ctl);
460 if (!kit.stopped()) {
461 slow_jvms = _if_missed->generate(kit.sync_jvms());
462 assert(slow_jvms != NULL, "miss path must not fail to generate");
463 kit.add_exception_states_from(slow_jvms);
464 kit.set_map(slow_jvms->map());
465 if (!kit.stopped())
466 slow_map = kit.stop();
467 }
468 }
469
470 // fall through if the instance exactly matches the desired type
471 kit.replace_in_map(receiver, exact_receiver);
472
473 // Make the hot call:
474 JVMState* new_jvms = _if_hit->generate(kit.sync_jvms());
475 if (new_jvms == NULL) {
476 // Inline failed, so make a direct call.
477 assert(_if_hit->is_inline(), "must have been a failed inline");
478 CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method());
479 new_jvms = cg->generate(kit.sync_jvms());
480 }
481 kit.add_exception_states_from(new_jvms);
482 kit.set_jvms(new_jvms);
483
484 // Need to merge slow and fast?
485 if (slow_map == NULL) {
486 // The fast path is the only path remaining.
487 return kit.transfer_exceptions_into_jvms();
488 }
489
|
1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)callGenerator.cpp 1.49 07/08/07 15:24:21 JVM"
3 #endif
4 /*
5 * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
450
451 Node* exact_receiver = receiver; // will get updated in place...
452 Node* slow_ctl = kit.type_check_receiver(receiver,
453 _predicted_receiver, _hit_prob,
454 &exact_receiver);
455
456 SafePointNode* slow_map = NULL;
457 JVMState* slow_jvms;
458 { PreserveJVMState pjvms(&kit);
459 kit.set_control(slow_ctl);
460 if (!kit.stopped()) {
461 slow_jvms = _if_missed->generate(kit.sync_jvms());
462 assert(slow_jvms != NULL, "miss path must not fail to generate");
463 kit.add_exception_states_from(slow_jvms);
464 kit.set_map(slow_jvms->map());
465 if (!kit.stopped())
466 slow_map = kit.stop();
467 }
468 }
469
470 if (kit.stopped()) {
471 // Instance exactly does not matches the desired type.
472 kit.set_jvms(slow_jvms);
473 return kit.transfer_exceptions_into_jvms();
474 }
475
476 // fall through if the instance exactly matches the desired type
477 kit.replace_in_map(receiver, exact_receiver);
478
479 // Make the hot call:
480 JVMState* new_jvms = _if_hit->generate(kit.sync_jvms());
481 if (new_jvms == NULL) {
482 // Inline failed, so make a direct call.
483 assert(_if_hit->is_inline(), "must have been a failed inline");
484 CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method());
485 new_jvms = cg->generate(kit.sync_jvms());
486 }
487 kit.add_exception_states_from(new_jvms);
488 kit.set_jvms(new_jvms);
489
490 // Need to merge slow and fast?
491 if (slow_map == NULL) {
492 // The fast path is the only path remaining.
493 return kit.transfer_exceptions_into_jvms();
494 }
495
|