< prev index next >

src/hotspot/share/oops/generateOopMap.cpp

Print this page

 121       set(CellTypeState::bottom);
 122     } else if (is_reference_type(type)) {
 123       set(CellTypeState::ref);
 124     } else {
 125       assert(is_java_primitive(type), "");
 126       set(CellTypeState::value);
 127       if (is_double_word_type(type)) {
 128         set(CellTypeState::value);
 129       }
 130     }
 131   }
 132 
 133  public:
 134   ComputeCallStack(Symbol* signature) : SignatureIterator(signature) {};
 135 
 136   // Compute methods
 137   int compute_for_parameters(bool is_static, CellTypeState *effect) {
 138     _idx    = 0;
 139     _effect = effect;
 140 
 141     if (!is_static)
 142       effect[_idx++] = CellTypeState::ref;

 143 
 144     do_parameters_on(this);
 145 
 146     return length();
 147   };
 148 
 149   int compute_for_returntype(CellTypeState *effect) {
 150     _idx    = 0;
 151     _effect = effect;
 152     do_type(return_type(), true);
 153     set(CellTypeState::bottom);  // Always terminate with a bottom state, so ppush works
 154 
 155     return length();
 156   }
 157 };
 158 
 159 //=========================================================================================
 160 // ComputeEntryStack
 161 //
 162 // Specialization of SignatureIterator - in order to set up first stack frame

1583 
1584     case Bytecodes::_lreturn:           do_return_monitor_check();
1585                                         ppop(vvCTS);
1586                                         break;
1587 
1588     case Bytecodes::_dreturn:           do_return_monitor_check();
1589                                         ppop(vvCTS);
1590                                         break;
1591 
1592     case Bytecodes::_if_acmpeq:
1593     case Bytecodes::_if_acmpne:         ppop(rrCTS);                 break;
1594 
1595     case Bytecodes::_jsr:               do_jsr(itr->dest());         break;
1596     case Bytecodes::_jsr_w:             do_jsr(itr->dest_w());       break;
1597 
1598     case Bytecodes::_getstatic:         do_field(true,   true,  itr->get_index_u2(), itr->bci(), itr->code()); break;
1599     case Bytecodes::_putstatic:         do_field(false,  true,  itr->get_index_u2(), itr->bci(), itr->code()); break;
1600     case Bytecodes::_getfield:          do_field(true,   false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1601     case Bytecodes::_putfield:          do_field(false,  false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1602 

1603     case Bytecodes::_invokevirtual:
1604     case Bytecodes::_invokespecial:     do_method(false, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1605     case Bytecodes::_invokestatic:      do_method(true,  false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1606     case Bytecodes::_invokedynamic:     do_method(true,  false, itr->get_index_u4(), itr->bci(), itr->code()); break;
1607     case Bytecodes::_invokeinterface:   do_method(false, true,  itr->get_index_u2(), itr->bci(), itr->code()); break;
1608     case Bytecodes::_newarray:
1609     case Bytecodes::_anewarray:         pp_new_ref(vCTS, itr->bci()); break;
1610     case Bytecodes::_checkcast:         do_checkcast(); break;
1611     case Bytecodes::_arraylength:
1612     case Bytecodes::_instanceof:        pp(rCTS, vCTS); break;
1613     case Bytecodes::_monitorenter:      do_monitorenter(itr->bci()); break;
1614     case Bytecodes::_monitorexit:       do_monitorexit(itr->bci()); break;
1615 
1616     case Bytecodes::_athrow:            // handled by do_exception_edge() BUT ...
1617                                         // vlh(apple): do_exception_edge() does not get
1618                                         // called if method has no exception handlers
1619                                         if ((!_has_exceptions) && (_monitor_top > 0)) {
1620                                           _monitor_safe = false;
1621                                         }
1622                                         break;
1623 
1624     case Bytecodes::_areturn:           do_return_monitor_check();
1625                                         ppop1(refCTS);
1626                                         break;

1627     case Bytecodes::_ifnull:
1628     case Bytecodes::_ifnonnull:         ppop1(refCTS); break;
1629     case Bytecodes::_multianewarray:    do_multianewarray(*(itr->bcp()+3), itr->bci()); break;
1630 
1631     case Bytecodes::_wide:              fatal("Iterator should skip this bytecode"); break;
1632     case Bytecodes::_ret:                                           break;
1633 
1634     // Java opcodes
1635     case Bytecodes::_lookupswitch:      ppop1(valCTS);             break;
1636 
1637     default:
1638          tty->print("unexpected opcode: %d\n", itr->code());
1639          ShouldNotReachHere();
1640     break;
1641   }
1642 }
1643 
1644 void GenerateOopMap::check_type(CellTypeState expected, CellTypeState actual) {
1645   if (!expected.equal_kind(actual)) {
1646     verify_error("wrong type on stack (found: %c expected: %c)", actual.to_char(), expected.to_char());

1932 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci, Bytecodes::Code bc) {
1933   // Dig up signature for field in constant pool
1934   ConstantPool* cp     = method()->constants();
1935   int nameAndTypeIdx     = cp->name_and_type_ref_index_at(idx, bc);
1936   int signatureIdx       = cp->signature_ref_index_at(nameAndTypeIdx);
1937   Symbol* signature      = cp->symbol_at(signatureIdx);
1938 
1939   CellTypeState temp[4];
1940   CellTypeState *eff  = signature_to_effect(signature, bci, temp);
1941 
1942   CellTypeState in[4];
1943   CellTypeState *out;
1944   int i =  0;
1945 
1946   if (is_get) {
1947     out = eff;
1948   } else {
1949     out = epsilonCTS;
1950     i   = copy_cts(in, eff);
1951   }
1952   if (!is_static) in[i++] = CellTypeState::ref;


1953   in[i] = CellTypeState::bottom;
1954   assert(i<=3, "sanity check");
1955   pp(in, out);
1956 }
1957 
1958 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci, Bytecodes::Code bc) {
1959  // Dig up signature for field in constant pool
1960   ConstantPool* cp  = _method->constants();
1961   Symbol* signature   = cp->signature_ref_at(idx, bc);
1962 
1963   // Parse method signature
1964   CellTypeState out[4];
1965   CellTypeState in[MAXARGSIZE+1];   // Includes result
1966   ComputeCallStack cse(signature);
1967 
1968   // Compute return type
1969   int res_length=  cse.compute_for_returntype(out);
1970 
1971   // Temporary hack.
1972   if (out[0].equal(CellTypeState::ref) && out[1].equal(CellTypeState::bottom)) {
1973     out[0] = CellTypeState::make_line_ref(bci);
1974   }
1975 
1976   assert(res_length<=4, "max value should be vv");
1977 
1978   // Compute arguments

 121       set(CellTypeState::bottom);
 122     } else if (is_reference_type(type)) {
 123       set(CellTypeState::ref);
 124     } else {
 125       assert(is_java_primitive(type), "");
 126       set(CellTypeState::value);
 127       if (is_double_word_type(type)) {
 128         set(CellTypeState::value);
 129       }
 130     }
 131   }
 132 
 133  public:
 134   ComputeCallStack(Symbol* signature) : SignatureIterator(signature) {};
 135 
 136   // Compute methods
 137   int compute_for_parameters(bool is_static, CellTypeState *effect) {
 138     _idx    = 0;
 139     _effect = effect;
 140 
 141     if (!is_static) {
 142       effect[_idx++] = CellTypeState::ref;
 143     }
 144 
 145     do_parameters_on(this);
 146 
 147     return length();
 148   };
 149 
 150   int compute_for_returntype(CellTypeState *effect) {
 151     _idx    = 0;
 152     _effect = effect;
 153     do_type(return_type(), true);
 154     set(CellTypeState::bottom);  // Always terminate with a bottom state, so ppush works
 155 
 156     return length();
 157   }
 158 };
 159 
 160 //=========================================================================================
 161 // ComputeEntryStack
 162 //
 163 // Specialization of SignatureIterator - in order to set up first stack frame

1584 
1585     case Bytecodes::_lreturn:           do_return_monitor_check();
1586                                         ppop(vvCTS);
1587                                         break;
1588 
1589     case Bytecodes::_dreturn:           do_return_monitor_check();
1590                                         ppop(vvCTS);
1591                                         break;
1592 
1593     case Bytecodes::_if_acmpeq:
1594     case Bytecodes::_if_acmpne:         ppop(rrCTS);                 break;
1595 
1596     case Bytecodes::_jsr:               do_jsr(itr->dest());         break;
1597     case Bytecodes::_jsr_w:             do_jsr(itr->dest_w());       break;
1598 
1599     case Bytecodes::_getstatic:         do_field(true,   true,  itr->get_index_u2(), itr->bci(), itr->code()); break;
1600     case Bytecodes::_putstatic:         do_field(false,  true,  itr->get_index_u2(), itr->bci(), itr->code()); break;
1601     case Bytecodes::_getfield:          do_field(true,   false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1602     case Bytecodes::_putfield:          do_field(false,  false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1603 
1604     case Bytecodes::_invokeinterface:
1605     case Bytecodes::_invokevirtual:
1606     case Bytecodes::_invokespecial:     do_method(false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1607     case Bytecodes::_invokestatic:      do_method(true , itr->get_index_u2(), itr->bci(), itr->code()); break;
1608     case Bytecodes::_invokedynamic:     do_method(true , itr->get_index_u4(), itr->bci(), itr->code()); break;

1609     case Bytecodes::_newarray:
1610     case Bytecodes::_anewarray:         pp_new_ref(vCTS, itr->bci()); break;
1611     case Bytecodes::_checkcast:         do_checkcast(); break;
1612     case Bytecodes::_arraylength:
1613     case Bytecodes::_instanceof:        pp(rCTS, vCTS); break;
1614     case Bytecodes::_monitorenter:      do_monitorenter(itr->bci()); break;
1615     case Bytecodes::_monitorexit:       do_monitorexit(itr->bci()); break;
1616 
1617     case Bytecodes::_athrow:            // handled by do_exception_edge() BUT ...
1618                                         // vlh(apple): do_exception_edge() does not get
1619                                         // called if method has no exception handlers
1620                                         if ((!_has_exceptions) && (_monitor_top > 0)) {
1621                                           _monitor_safe = false;
1622                                         }
1623                                         break;
1624 
1625     case Bytecodes::_areturn:           do_return_monitor_check();
1626                                         ppop1(refCTS);
1627                                         break;
1628 
1629     case Bytecodes::_ifnull:
1630     case Bytecodes::_ifnonnull:         ppop1(refCTS); break;
1631     case Bytecodes::_multianewarray:    do_multianewarray(*(itr->bcp()+3), itr->bci()); break;
1632 
1633     case Bytecodes::_wide:              fatal("Iterator should skip this bytecode"); break;
1634     case Bytecodes::_ret:                                           break;
1635 
1636     // Java opcodes
1637     case Bytecodes::_lookupswitch:      ppop1(valCTS);             break;
1638 
1639     default:
1640          tty->print("unexpected opcode: %d\n", itr->code());
1641          ShouldNotReachHere();
1642     break;
1643   }
1644 }
1645 
1646 void GenerateOopMap::check_type(CellTypeState expected, CellTypeState actual) {
1647   if (!expected.equal_kind(actual)) {
1648     verify_error("wrong type on stack (found: %c expected: %c)", actual.to_char(), expected.to_char());

1934 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci, Bytecodes::Code bc) {
1935   // Dig up signature for field in constant pool
1936   ConstantPool* cp     = method()->constants();
1937   int nameAndTypeIdx     = cp->name_and_type_ref_index_at(idx, bc);
1938   int signatureIdx       = cp->signature_ref_index_at(nameAndTypeIdx);
1939   Symbol* signature      = cp->symbol_at(signatureIdx);
1940 
1941   CellTypeState temp[4];
1942   CellTypeState *eff  = signature_to_effect(signature, bci, temp);
1943 
1944   CellTypeState in[4];
1945   CellTypeState *out;
1946   int i =  0;
1947 
1948   if (is_get) {
1949     out = eff;
1950   } else {
1951     out = epsilonCTS;
1952     i   = copy_cts(in, eff);
1953   }
1954   if (!is_static) {
1955     in[i++] = CellTypeState::ref;
1956   }
1957   in[i] = CellTypeState::bottom;
1958   assert(i<=3, "sanity check");
1959   pp(in, out);
1960 }
1961 
1962 void GenerateOopMap::do_method(int is_static, int idx, int bci, Bytecodes::Code bc) {
1963  // Dig up signature for field in constant pool
1964   ConstantPool* cp  = _method->constants();
1965   Symbol* signature   = cp->signature_ref_at(idx, bc);
1966 
1967   // Parse method signature
1968   CellTypeState out[4];
1969   CellTypeState in[MAXARGSIZE+1];   // Includes result
1970   ComputeCallStack cse(signature);
1971 
1972   // Compute return type
1973   int res_length=  cse.compute_for_returntype(out);
1974 
1975   // Temporary hack.
1976   if (out[0].equal(CellTypeState::ref) && out[1].equal(CellTypeState::bottom)) {
1977     out[0] = CellTypeState::make_line_ref(bci);
1978   }
1979 
1980   assert(res_length<=4, "max value should be vv");
1981 
1982   // Compute arguments
< prev index next >