1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)bytecodeInterpreter.cpp 1.31 07/08/29 13:42:24 JVM"
3 #endif
4 /*
5 * Copyright 2002-2007 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 *
504 /* 0x88 */ &&opc_l2i, &&opc_l2f,&&opc_l2d, &&opc_f2i,
505 /* 0x8C */ &&opc_f2l, &&opc_f2d,&&opc_d2i, &&opc_d2l,
506
507 /* 0x90 */ &&opc_d2f, &&opc_i2b, &&opc_i2c, &&opc_i2s,
508 /* 0x94 */ &&opc_lcmp, &&opc_fcmpl,&&opc_fcmpg,&&opc_dcmpl,
509 /* 0x98 */ &&opc_dcmpg,&&opc_ifeq, &&opc_ifne, &&opc_iflt,
510 /* 0x9C */ &&opc_ifge, &&opc_ifgt, &&opc_ifle, &&opc_if_icmpeq,
511
512 /* 0xA0 */ &&opc_if_icmpne,&&opc_if_icmplt,&&opc_if_icmpge, &&opc_if_icmpgt,
513 /* 0xA4 */ &&opc_if_icmple,&&opc_if_acmpeq,&&opc_if_acmpne, &&opc_goto,
514 /* 0xA8 */ &&opc_jsr, &&opc_ret, &&opc_tableswitch,&&opc_lookupswitch,
515 /* 0xAC */ &&opc_ireturn, &&opc_lreturn, &&opc_freturn, &&opc_dreturn,
516
517 /* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic,
518 /* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial,
519 /* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,NULL, &&opc_new,
520 /* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow,
521
522 /* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit,
523 /* 0xC4 */ &&opc_wide, &&opc_multianewarray, &&opc_ifnull, &&opc_ifnonnull,
524 /* 0xC8 */ &&opc_goto_w, &&opc_jsr_w, &&opc_breakpoint, &&opc_fast_igetfield,
525 /* 0xCC */ &&opc_fastagetfield,&&opc_fast_aload_0, &&opc_fast_iaccess_0, &&opc__fast_aaccess_0,
526
527 /* 0xD0 */ &&opc_fast_linearswitch, &&opc_fast_binaryswitch, &&opc_return_register_finalizer, &&opc_default,
528 /* 0xD4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
529 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
530 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
531
532 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
533 /* 0xE4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
534 /* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
535 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
536
537 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
538 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
539 /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
540 /* 0xFC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default
541 };
542 register uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0];
543 #endif /* USELABELS */
544
545 #ifdef ASSERT
546 // this will trigger a VERIFY_OOP on entry
547 if (istate->msg() != initialize && ! METHOD->is_static()) {
548 oop rcvr = LOCALS_OBJECT(0);
549 }
550 #endif
551 // #define HACK
552 #ifdef HACK
553 bool interesting = false;
1917 if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) {
1918 goto retry;
1919 }
1920 result = (oop) compare_to;
1921 }
1922 }
1923 if (result != NULL) {
1924 // Initialize object (if nonzero size and need) and then the header
1925 if (need_zero ) {
1926 HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize;
1927 obj_size -= sizeof(oopDesc) / oopSize;
1928 if (obj_size > 0 ) {
1929 memset(to_zero, 0, obj_size * HeapWordSize);
1930 }
1931 }
1932 if (UseBiasedLocking) {
1933 result->set_mark(ik->prototype_header());
1934 } else {
1935 result->set_mark(markOopDesc::prototype());
1936 }
1937 result->set_klass(k_entry);
1938 SET_STACK_OBJECT(result, 0);
1939 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1940 }
1941 }
1942 }
1943 // Slow case allocation
1944 CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
1945 handle_exception);
1946 SET_STACK_OBJECT(THREAD->vm_result(), 0);
1947 THREAD->set_vm_result(NULL);
1948 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1949 }
1950 CASE(_anewarray): {
1951 u2 index = Bytes::get_Java_u2(pc+1);
1952 jint size = STACK_INT(-1);
1953 CALL_VM(InterpreterRuntime::anewarray(THREAD, METHOD->constants(), index, size),
1954 handle_exception);
1955 SET_STACK_OBJECT(THREAD->vm_result(), -1);
1956 THREAD->set_vm_result(NULL);
|
1 /*
2 * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
501 /* 0x88 */ &&opc_l2i, &&opc_l2f,&&opc_l2d, &&opc_f2i,
502 /* 0x8C */ &&opc_f2l, &&opc_f2d,&&opc_d2i, &&opc_d2l,
503
504 /* 0x90 */ &&opc_d2f, &&opc_i2b, &&opc_i2c, &&opc_i2s,
505 /* 0x94 */ &&opc_lcmp, &&opc_fcmpl,&&opc_fcmpg,&&opc_dcmpl,
506 /* 0x98 */ &&opc_dcmpg,&&opc_ifeq, &&opc_ifne, &&opc_iflt,
507 /* 0x9C */ &&opc_ifge, &&opc_ifgt, &&opc_ifle, &&opc_if_icmpeq,
508
509 /* 0xA0 */ &&opc_if_icmpne,&&opc_if_icmplt,&&opc_if_icmpge, &&opc_if_icmpgt,
510 /* 0xA4 */ &&opc_if_icmple,&&opc_if_acmpeq,&&opc_if_acmpne, &&opc_goto,
511 /* 0xA8 */ &&opc_jsr, &&opc_ret, &&opc_tableswitch,&&opc_lookupswitch,
512 /* 0xAC */ &&opc_ireturn, &&opc_lreturn, &&opc_freturn, &&opc_dreturn,
513
514 /* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic,
515 /* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial,
516 /* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,NULL, &&opc_new,
517 /* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow,
518
519 /* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit,
520 /* 0xC4 */ &&opc_wide, &&opc_multianewarray, &&opc_ifnull, &&opc_ifnonnull,
521 /* 0xC8 */ &&opc_goto_w, &&opc_jsr_w, &&opc_breakpoint, &&opc_default,
522 /* 0xCC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
523
524 /* 0xD0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
525 /* 0xD4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
526 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
527 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
528
529 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
530 /* 0xE4 */ &&opc_default, &&opc_return_register_finalizer, &&opc_default, &&opc_default,
531 /* 0xE8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
532 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
533
534 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
535 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
536 /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default,
537 /* 0xFC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default
538 };
539 register uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0];
540 #endif /* USELABELS */
541
542 #ifdef ASSERT
543 // this will trigger a VERIFY_OOP on entry
544 if (istate->msg() != initialize && ! METHOD->is_static()) {
545 oop rcvr = LOCALS_OBJECT(0);
546 }
547 #endif
548 // #define HACK
549 #ifdef HACK
550 bool interesting = false;
1914 if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) {
1915 goto retry;
1916 }
1917 result = (oop) compare_to;
1918 }
1919 }
1920 if (result != NULL) {
1921 // Initialize object (if nonzero size and need) and then the header
1922 if (need_zero ) {
1923 HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize;
1924 obj_size -= sizeof(oopDesc) / oopSize;
1925 if (obj_size > 0 ) {
1926 memset(to_zero, 0, obj_size * HeapWordSize);
1927 }
1928 }
1929 if (UseBiasedLocking) {
1930 result->set_mark(ik->prototype_header());
1931 } else {
1932 result->set_mark(markOopDesc::prototype());
1933 }
1934 result->set_klass_gap(0);
1935 result->set_klass(k_entry);
1936 SET_STACK_OBJECT(result, 0);
1937 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1938 }
1939 }
1940 }
1941 // Slow case allocation
1942 CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
1943 handle_exception);
1944 SET_STACK_OBJECT(THREAD->vm_result(), 0);
1945 THREAD->set_vm_result(NULL);
1946 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1947 }
1948 CASE(_anewarray): {
1949 u2 index = Bytes::get_Java_u2(pc+1);
1950 jint size = STACK_INT(-1);
1951 CALL_VM(InterpreterRuntime::anewarray(THREAD, METHOD->constants(), index, size),
1952 handle_exception);
1953 SET_STACK_OBJECT(THREAD->vm_result(), -1);
1954 THREAD->set_vm_result(NULL);
|