< prev index next >

src/hotspot/share/oops/generateOopMap.cpp

Print this page

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

 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

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

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

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) in[i++] = CellTypeState::ref;


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

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

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

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

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