src/share/vm/oops/generateOopMap.cpp

changeset 2462
8012aa3ccede
parent 2314
f95d63e2154a
child 2497
3582bf76420e
equal deleted inserted replaced
2450:34d64ad817f4 2462:8012aa3ccede
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
533 break; 533 break;
534 case Bytecodes::_goto_w: 534 case Bytecodes::_goto_w:
535 (*jmpFct)(this, bcs->dest_w(), data); 535 (*jmpFct)(this, bcs->dest_w(), data);
536 break; 536 break;
537 case Bytecodes::_tableswitch: 537 case Bytecodes::_tableswitch:
538 { Bytecode_tableswitch *tableswitch = Bytecode_tableswitch_at(bcs->bcp()); 538 { Bytecode_tableswitch tableswitch(method(), bcs->bcp());
539 int len = tableswitch->length(); 539 int len = tableswitch.length();
540 540
541 (*jmpFct)(this, bci + tableswitch->default_offset(), data); /* Default. jump address */ 541 (*jmpFct)(this, bci + tableswitch.default_offset(), data); /* Default. jump address */
542 while (--len >= 0) { 542 while (--len >= 0) {
543 (*jmpFct)(this, bci + tableswitch->dest_offset_at(len), data); 543 (*jmpFct)(this, bci + tableswitch.dest_offset_at(len), data);
544 } 544 }
545 break; 545 break;
546 } 546 }
547 547
548 case Bytecodes::_lookupswitch: 548 case Bytecodes::_lookupswitch:
549 { Bytecode_lookupswitch *lookupswitch = Bytecode_lookupswitch_at(bcs->bcp()); 549 { Bytecode_lookupswitch lookupswitch(method(), bcs->bcp());
550 int npairs = lookupswitch->number_of_pairs(); 550 int npairs = lookupswitch.number_of_pairs();
551 (*jmpFct)(this, bci + lookupswitch->default_offset(), data); /* Default. */ 551 (*jmpFct)(this, bci + lookupswitch.default_offset(), data); /* Default. */
552 while(--npairs >= 0) { 552 while(--npairs >= 0) {
553 LookupswitchPair *pair = lookupswitch->pair_at(npairs); 553 LookupswitchPair pair = lookupswitch.pair_at(npairs);
554 (*jmpFct)(this, bci + pair->offset(), data); 554 (*jmpFct)(this, bci + pair.offset(), data);
555 } 555 }
556 break; 556 break;
557 } 557 }
558 case Bytecodes::_jsr: 558 case Bytecodes::_jsr:
559 assert(bcs->is_wide()==false, "sanity check"); 559 assert(bcs->is_wide()==false, "sanity check");
975 bb->_state = basicBlockState + blockNum * _state_len; 975 bb->_state = basicBlockState + blockNum * _state_len;
976 976
977 #ifdef ASSERT 977 #ifdef ASSERT
978 if (blockNum + 1 < bbNo) { 978 if (blockNum + 1 < bbNo) {
979 address bcp = _method->bcp_from(bb->_end_bci); 979 address bcp = _method->bcp_from(bb->_end_bci);
980 int bc_len = Bytecodes::java_length_at(bcp); 980 int bc_len = Bytecodes::java_length_at(_method(), bcp);
981 assert(bb->_end_bci + bc_len == bb[1]._bci, "unmatched bci info in basicblock"); 981 assert(bb->_end_bci + bc_len == bb[1]._bci, "unmatched bci info in basicblock");
982 } 982 }
983 #endif 983 #endif
984 } 984 }
985 #ifdef ASSERT 985 #ifdef ASSERT
986 { BasicBlock *bb = &_basic_blocks[bbNo-1]; 986 { BasicBlock *bb = &_basic_blocks[bbNo-1];
987 address bcp = _method->bcp_from(bb->_end_bci); 987 address bcp = _method->bcp_from(bb->_end_bci);
988 int bc_len = Bytecodes::java_length_at(bcp); 988 int bc_len = Bytecodes::java_length_at(_method(), bcp);
989 assert(bb->_end_bci + bc_len == _method->code_size(), "wrong end bci"); 989 assert(bb->_end_bci + bc_len == _method->code_size(), "wrong end bci");
990 } 990 }
991 #endif 991 #endif
992 992
993 // Mark all alive blocks 993 // Mark all alive blocks
1835 } 1835 }
1836 1836
1837 1837
1838 1838
1839 void GenerateOopMap::do_ldc(int bci) { 1839 void GenerateOopMap::do_ldc(int bci) {
1840 Bytecode_loadconstant* ldc = Bytecode_loadconstant_at(method(), bci); 1840 Bytecode_loadconstant ldc(method(), bci);
1841 constantPoolOop cp = method()->constants(); 1841 constantPoolOop cp = method()->constants();
1842 BasicType bt = ldc->result_type(); 1842 BasicType bt = ldc.result_type();
1843 CellTypeState cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS; 1843 CellTypeState cts = (bt == T_OBJECT) ? CellTypeState::make_line_ref(bci) : valCTS;
1844 // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry). 1844 // Make sure bt==T_OBJECT is the same as old code (is_pointer_entry).
1845 // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries, 1845 // Note that CONSTANT_MethodHandle entries are u2 index pairs, not pointer-entries,
1846 // and they are processed by _fast_aldc and the CP cache. 1846 // and they are processed by _fast_aldc and the CP cache.
1847 assert((ldc->has_cache_index() || cp->is_pointer_entry(ldc->pool_index())) 1847 assert((ldc.has_cache_index() || cp->is_pointer_entry(ldc.pool_index()))
1848 ? (bt == T_OBJECT) : true, "expected object type"); 1848 ? (bt == T_OBJECT) : true, "expected object type");
1849 ppush1(cts); 1849 ppush1(cts);
1850 } 1850 }
1851 1851
1852 void GenerateOopMap::do_multianewarray(int dims, int bci) { 1852 void GenerateOopMap::do_multianewarray(int dims, int bci) {
2341 // bcN : either _aload or _astore 2341 // bcN : either _aload or _astore
2342 // bc0 : either _aload_0 or _astore_0 2342 // bc0 : either _aload_0 or _astore_0
2343 bool GenerateOopMap::rewrite_load_or_store(BytecodeStream *bcs, Bytecodes::Code bcN, Bytecodes::Code bc0, unsigned int varNo) { 2343 bool GenerateOopMap::rewrite_load_or_store(BytecodeStream *bcs, Bytecodes::Code bcN, Bytecodes::Code bc0, unsigned int varNo) {
2344 assert(bcN == Bytecodes::_astore || bcN == Bytecodes::_aload, "wrong argument (bcN)"); 2344 assert(bcN == Bytecodes::_astore || bcN == Bytecodes::_aload, "wrong argument (bcN)");
2345 assert(bc0 == Bytecodes::_astore_0 || bc0 == Bytecodes::_aload_0, "wrong argument (bc0)"); 2345 assert(bc0 == Bytecodes::_astore_0 || bc0 == Bytecodes::_aload_0, "wrong argument (bc0)");
2346 int ilen = Bytecodes::length_at(bcs->bcp()); 2346 int ilen = Bytecodes::length_at(_method(), bcs->bcp());
2347 int newIlen; 2347 int newIlen;
2348 2348
2349 if (ilen == 4) { 2349 if (ilen == 4) {
2350 // Original instruction was wide; keep it wide for simplicity 2350 // Original instruction was wide; keep it wide for simplicity
2351 newIlen = 4; 2351 newIlen = 4;

mercurial