Mercurial > hg > truffle
comparison src/share/vm/c1/c1_Runtime1.cpp @ 2181:d25d4ca69222
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Wed, 16 Feb 2011 13:47:20 +0100 |
parents | 06f017f7daa7 e4fee0bdaa85 |
children | 0654ee04b214 |
comparison
equal
deleted
inserted
replaced
2108:50b45e2d9725 | 2181:d25d4ca69222 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
344 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id)) | 344 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id)) |
345 tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id); | 345 tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id); |
346 JRT_END | 346 JRT_END |
347 | 347 |
348 | 348 |
349 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread)) | 349 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj)) |
350 THROW(vmSymbolHandles::java_lang_ArrayStoreException()); | 350 ResourceMark rm(thread); |
351 const char* klass_name = Klass::cast(obj->klass())->external_name(); | |
352 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name); | |
351 JRT_END | 353 JRT_END |
352 | 354 |
353 | 355 |
354 JRT_ENTRY(void, Runtime1::post_jvmti_exception_throw(JavaThread* thread)) | 356 JRT_ENTRY(void, Runtime1::post_jvmti_exception_throw(JavaThread* thread)) |
355 if (JvmtiExport::can_post_on_exceptions()) { | 357 if (JvmtiExport::can_post_on_exceptions()) { |
374 CompLevel level = (CompLevel)nm->comp_level(); | 376 CompLevel level = (CompLevel)nm->comp_level(); |
375 int bci = InvocationEntryBci; | 377 int bci = InvocationEntryBci; |
376 if (branch_bci != InvocationEntryBci) { | 378 if (branch_bci != InvocationEntryBci) { |
377 // Compute desination bci | 379 // Compute desination bci |
378 address pc = method()->code_base() + branch_bci; | 380 address pc = method()->code_base() + branch_bci; |
379 Bytecodes::Code branch = Bytecodes::code_at(pc, method()); | 381 Bytecodes::Code branch = Bytecodes::code_at(method(), pc); |
380 int offset = 0; | 382 int offset = 0; |
381 switch (branch) { | 383 switch (branch) { |
382 case Bytecodes::_if_icmplt: case Bytecodes::_iflt: | 384 case Bytecodes::_if_icmplt: case Bytecodes::_iflt: |
383 case Bytecodes::_if_icmpgt: case Bytecodes::_ifgt: | 385 case Bytecodes::_if_icmpgt: case Bytecodes::_ifgt: |
384 case Bytecodes::_if_icmple: case Bytecodes::_ifle: | 386 case Bytecodes::_if_icmple: case Bytecodes::_ifle: |
697 } | 699 } |
698 JRT_END | 700 JRT_END |
699 | 701 |
700 | 702 |
701 static klassOop resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { | 703 static klassOop resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { |
702 Bytecode_field* field_access = Bytecode_field_at(caller, bci); | 704 Bytecode_field field_access(caller, bci); |
703 // This can be static or non-static field access | 705 // This can be static or non-static field access |
704 Bytecodes::Code code = field_access->code(); | 706 Bytecodes::Code code = field_access.code(); |
705 | 707 |
706 // We must load class, initialize class and resolvethe field | 708 // We must load class, initialize class and resolvethe field |
707 FieldAccessInfo result; // initialize class if needed | 709 FieldAccessInfo result; // initialize class if needed |
708 constantPoolHandle constants(THREAD, caller->constants()); | 710 constantPoolHandle constants(THREAD, caller->constants()); |
709 LinkResolver::resolve_field(result, constants, field_access->index(), Bytecodes::java_code(code), false, CHECK_NULL); | 711 LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK_NULL); |
710 return result.klass()(); | 712 return result.klass()(); |
711 } | 713 } |
712 | 714 |
713 | 715 |
714 // | 716 // |
805 | 807 |
806 int bci = vfst.bci(); | 808 int bci = vfst.bci(); |
807 | 809 |
808 Events::log("patch_code @ " INTPTR_FORMAT , caller_frame.pc()); | 810 Events::log("patch_code @ " INTPTR_FORMAT , caller_frame.pc()); |
809 | 811 |
810 Bytecodes::Code code = Bytecode_at(caller_method->bcp_from(bci))->java_code(); | 812 Bytecodes::Code code = caller_method()->java_code_at(bci); |
811 | 813 |
812 #ifndef PRODUCT | 814 #ifndef PRODUCT |
813 // this is used by assertions in the access_field_patching_id | 815 // this is used by assertions in the access_field_patching_id |
814 BasicType patch_field_type = T_ILLEGAL; | 816 BasicType patch_field_type = T_ILLEGAL; |
815 #endif // PRODUCT | 817 #endif // PRODUCT |
817 int patch_field_offset = -1; | 819 int patch_field_offset = -1; |
818 KlassHandle init_klass(THREAD, klassOop(NULL)); // klass needed by access_field_patching code | 820 KlassHandle init_klass(THREAD, klassOop(NULL)); // klass needed by access_field_patching code |
819 Handle load_klass(THREAD, NULL); // oop needed by load_klass_patching code | 821 Handle load_klass(THREAD, NULL); // oop needed by load_klass_patching code |
820 if (stub_id == Runtime1::access_field_patching_id) { | 822 if (stub_id == Runtime1::access_field_patching_id) { |
821 | 823 |
822 Bytecode_field* field_access = Bytecode_field_at(caller_method, bci); | 824 Bytecode_field field_access(caller_method, bci); |
823 FieldAccessInfo result; // initialize class if needed | 825 FieldAccessInfo result; // initialize class if needed |
824 Bytecodes::Code code = field_access->code(); | 826 Bytecodes::Code code = field_access.code(); |
825 constantPoolHandle constants(THREAD, caller_method->constants()); | 827 constantPoolHandle constants(THREAD, caller_method->constants()); |
826 LinkResolver::resolve_field(result, constants, field_access->index(), Bytecodes::java_code(code), false, CHECK); | 828 LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK); |
827 patch_field_offset = result.field_offset(); | 829 patch_field_offset = result.field_offset(); |
828 | 830 |
829 // If we're patching a field which is volatile then at compile it | 831 // If we're patching a field which is volatile then at compile it |
830 // must not have been know to be volatile, so the generated code | 832 // must not have been know to be volatile, so the generated code |
831 // isn't correct for a volatile reference. The nmethod has to be | 833 // isn't correct for a volatile reference. The nmethod has to be |
849 init_klass = KlassHandle(THREAD, klass); | 851 init_klass = KlassHandle(THREAD, klass); |
850 k = klass; | 852 k = klass; |
851 } | 853 } |
852 break; | 854 break; |
853 case Bytecodes::_new: | 855 case Bytecodes::_new: |
854 { Bytecode_new* bnew = Bytecode_new_at(caller_method->bcp_from(bci)); | 856 { Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci)); |
855 k = caller_method->constants()->klass_at(bnew->index(), CHECK); | 857 k = caller_method->constants()->klass_at(bnew.index(), CHECK); |
856 } | 858 } |
857 break; | 859 break; |
858 case Bytecodes::_multianewarray: | 860 case Bytecodes::_multianewarray: |
859 { Bytecode_multianewarray* mna = Bytecode_multianewarray_at(caller_method->bcp_from(bci)); | 861 { Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci)); |
860 k = caller_method->constants()->klass_at(mna->index(), CHECK); | 862 k = caller_method->constants()->klass_at(mna.index(), CHECK); |
861 } | 863 } |
862 break; | 864 break; |
863 case Bytecodes::_instanceof: | 865 case Bytecodes::_instanceof: |
864 { Bytecode_instanceof* io = Bytecode_instanceof_at(caller_method->bcp_from(bci)); | 866 { Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci)); |
865 k = caller_method->constants()->klass_at(io->index(), CHECK); | 867 k = caller_method->constants()->klass_at(io.index(), CHECK); |
866 } | 868 } |
867 break; | 869 break; |
868 case Bytecodes::_checkcast: | 870 case Bytecodes::_checkcast: |
869 { Bytecode_checkcast* cc = Bytecode_checkcast_at(caller_method->bcp_from(bci)); | 871 { Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci)); |
870 k = caller_method->constants()->klass_at(cc->index(), CHECK); | 872 k = caller_method->constants()->klass_at(cc.index(), CHECK); |
871 } | 873 } |
872 break; | 874 break; |
873 case Bytecodes::_anewarray: | 875 case Bytecodes::_anewarray: |
874 { Bytecode_anewarray* anew = Bytecode_anewarray_at(caller_method->bcp_from(bci)); | 876 { Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci)); |
875 klassOop ek = caller_method->constants()->klass_at(anew->index(), CHECK); | 877 klassOop ek = caller_method->constants()->klass_at(anew.index(), CHECK); |
876 k = Klass::cast(ek)->array_klass(CHECK); | 878 k = Klass::cast(ek)->array_klass(CHECK); |
877 } | 879 } |
878 break; | 880 break; |
879 case Bytecodes::_ldc: | 881 case Bytecodes::_ldc: |
880 case Bytecodes::_ldc_w: | 882 case Bytecodes::_ldc_w: |
881 { | 883 { |
882 Bytecode_loadconstant* cc = Bytecode_loadconstant_at(caller_method, bci); | 884 Bytecode_loadconstant cc(caller_method, bci); |
883 k = cc->resolve_constant(CHECK); | 885 k = cc.resolve_constant(CHECK); |
884 assert(k != NULL && !k->is_klass(), "must be class mirror or other Java constant"); | 886 assert(k != NULL && !k->is_klass(), "must be class mirror or other Java constant"); |
885 } | 887 } |
886 break; | 888 break; |
887 default: | 889 default: |
888 tty->print_cr("Unhandled bytecode: %d stub_id=%d caller=%s bci=%d pc=%d", code, stub_id, caller_method->name()->as_C_string(), bci, caller_frame.pc()); | 890 tty->print_cr("Unhandled bytecode: %d stub_id=%d caller=%s bci=%d pc=%d", code, stub_id, caller_method->name()->as_C_string(), bci, caller_frame.pc()); |