src/share/vm/c1/c1_Runtime1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/c1

src/share/vm/c1/c1_Runtime1.cpp

Print this page




1001         //    ..
1002         //    instr byte n-1
1003         //      n
1004         //    ....             <-- call destination
1005 
1006         address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset();
1007         unsigned char* byte_count = (unsigned char*) (stub_location - 1);
1008         unsigned char* byte_skip = (unsigned char*) (stub_location - 2);
1009         unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3);
1010         address copy_buff = stub_location - *byte_skip - *byte_count;
1011         address being_initialized_entry = stub_location - *being_initialized_entry_offset;
1012         if (TracePatching) {
1013           tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT "  (%s)", Bytecodes::name(code), bci,
1014                         p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
1015           nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
1016           assert(caller_code != NULL, "nmethod not found");
1017 
1018           // NOTE we use pc() not original_pc() because we already know they are
1019           // identical otherwise we'd have never entered this block of code
1020 
1021           OopMap* map = caller_code->oop_map_for_return_address(caller_frame.pc());
1022           assert(map != NULL, "null check");
1023           map->print();
1024           tty->cr();
1025 
1026           Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
1027         }
1028         // depending on the code below, do_patch says whether to copy the patch body back into the nmethod
1029         bool do_patch = true;
1030         if (stub_id == Runtime1::access_field_patching_id) {
1031           // The offset may not be correct if the class was not loaded at code generation time.
1032           // Set it now.
1033           NativeMovRegMem* n_move = nativeMovRegMem_at(copy_buff);
1034           assert(n_move->offset() == 0 || (n_move->offset() == 4 && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG)), "illegal offset for type");
1035           assert(patch_field_offset >= 0, "illegal offset");
1036           n_move->add_offset_in_bytes(patch_field_offset);
1037         } else if (load_klass_or_mirror_patch_id) {
1038           // If a getstatic or putstatic is referencing a klass which
1039           // isn't fully initialized, the patch body isn't copied into
1040           // place until initialization is complete.  In this case the
1041           // patch site is setup so that any threads besides the




1001         //    ..
1002         //    instr byte n-1
1003         //      n
1004         //    ....             <-- call destination
1005 
1006         address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset();
1007         unsigned char* byte_count = (unsigned char*) (stub_location - 1);
1008         unsigned char* byte_skip = (unsigned char*) (stub_location - 2);
1009         unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3);
1010         address copy_buff = stub_location - *byte_skip - *byte_count;
1011         address being_initialized_entry = stub_location - *being_initialized_entry_offset;
1012         if (TracePatching) {
1013           tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT "  (%s)", Bytecodes::name(code), bci,
1014                         p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
1015           nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
1016           assert(caller_code != NULL, "nmethod not found");
1017 
1018           // NOTE we use pc() not original_pc() because we already know they are
1019           // identical otherwise we'd have never entered this block of code
1020 
1021           const ImmutableOopMap* map = caller_code->oop_map_for_return_address(caller_frame.pc());
1022           assert(map != NULL, "null check");
1023           map->print();
1024           tty->cr();
1025 
1026           Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
1027         }
1028         // depending on the code below, do_patch says whether to copy the patch body back into the nmethod
1029         bool do_patch = true;
1030         if (stub_id == Runtime1::access_field_patching_id) {
1031           // The offset may not be correct if the class was not loaded at code generation time.
1032           // Set it now.
1033           NativeMovRegMem* n_move = nativeMovRegMem_at(copy_buff);
1034           assert(n_move->offset() == 0 || (n_move->offset() == 4 && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG)), "illegal offset for type");
1035           assert(patch_field_offset >= 0, "illegal offset");
1036           n_move->add_offset_in_bytes(patch_field_offset);
1037         } else if (load_klass_or_mirror_patch_id) {
1038           // If a getstatic or putstatic is referencing a klass which
1039           // isn't fully initialized, the patch body isn't copied into
1040           // place until initialization is complete.  In this case the
1041           // patch site is setup so that any threads besides the


src/share/vm/c1/c1_Runtime1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File