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
1577
1578 case Bytecodes::_lreturn: do_return_monitor_check();
1579 ppop(vvCTS);
1580 break;
1581
1582 case Bytecodes::_dreturn: do_return_monitor_check();
1583 ppop(vvCTS);
1584 break;
1585
1586 case Bytecodes::_if_acmpeq:
1587 case Bytecodes::_if_acmpne: ppop(rrCTS); break;
1588
1589 case Bytecodes::_jsr: do_jsr(itr->dest()); break;
1590 case Bytecodes::_jsr_w: do_jsr(itr->dest_w()); break;
1591
1592 case Bytecodes::_getstatic: do_field(true, true, itr->get_index_u2(), itr->bci(), itr->code()); break;
1593 case Bytecodes::_putstatic: do_field(false, true, itr->get_index_u2(), itr->bci(), itr->code()); break;
1594 case Bytecodes::_getfield: do_field(true, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1595 case Bytecodes::_putfield: do_field(false, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1596
1597 case Bytecodes::_invokevirtual:
1598 case Bytecodes::_invokespecial: do_method(false, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1599 case Bytecodes::_invokestatic: do_method(true, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1600 case Bytecodes::_invokedynamic: do_method(true, false, itr->get_index_u4(), itr->bci(), itr->code()); break;
1601 case Bytecodes::_invokeinterface: do_method(false, true, itr->get_index_u2(), itr->bci(), itr->code()); break;
1602 case Bytecodes::_newarray:
1603 case Bytecodes::_anewarray: pp_new_ref(vCTS, itr->bci()); break;
1604 case Bytecodes::_checkcast: do_checkcast(); break;
1605 case Bytecodes::_arraylength:
1606 case Bytecodes::_instanceof: pp(rCTS, vCTS); break;
1607 case Bytecodes::_monitorenter: do_monitorenter(itr->bci()); break;
1608 case Bytecodes::_monitorexit: do_monitorexit(itr->bci()); break;
1609
1610 case Bytecodes::_athrow: // handled by do_exception_edge() BUT ...
1611 // vlh(apple): do_exception_edge() does not get
1612 // called if method has no exception handlers
1613 if ((!_has_exceptions) && (_monitor_top > 0)) {
1614 _monitor_safe = false;
1615 }
1616 break;
1617
1618 case Bytecodes::_areturn: do_return_monitor_check();
1619 ppop1(refCTS);
1620 break;
1621 case Bytecodes::_ifnull:
1926 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci, Bytecodes::Code bc) {
1927 // Dig up signature for field in constant pool
1928 ConstantPool* cp = method()->constants();
1929 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx, bc);
1930 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx);
1931 Symbol* signature = cp->symbol_at(signatureIdx);
1932
1933 CellTypeState temp[4];
1934 CellTypeState *eff = signature_to_effect(signature, bci, temp);
1935
1936 CellTypeState in[4];
1937 CellTypeState *out;
1938 int i = 0;
1939
1940 if (is_get) {
1941 out = eff;
1942 } else {
1943 out = epsilonCTS;
1944 i = copy_cts(in, eff);
1945 }
1946 if (!is_static) in[i++] = CellTypeState::ref;
1947 in[i] = CellTypeState::bottom;
1948 assert(i<=3, "sanity check");
1949 pp(in, out);
1950 }
1951
1952 void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci, Bytecodes::Code bc) {
1953 // Dig up signature for field in constant pool
1954 ConstantPool* cp = _method->constants();
1955 Symbol* signature = cp->signature_ref_at(idx, bc);
1956
1957 // Parse method signature
1958 CellTypeState out[4];
1959 CellTypeState in[MAXARGSIZE+1]; // Includes result
1960 ComputeCallStack cse(signature);
1961
1962 // Compute return type
1963 int res_length= cse.compute_for_returntype(out);
1964
1965 // Temporary hack.
1966 if (out[0].equal(CellTypeState::ref) && out[1].equal(CellTypeState::bottom)) {
1967 out[0] = CellTypeState::make_line_ref(bci);
1968 }
1969
1970 assert(res_length<=4, "max value should be vv");
1971
1972 // 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
1578
1579 case Bytecodes::_lreturn: do_return_monitor_check();
1580 ppop(vvCTS);
1581 break;
1582
1583 case Bytecodes::_dreturn: do_return_monitor_check();
1584 ppop(vvCTS);
1585 break;
1586
1587 case Bytecodes::_if_acmpeq:
1588 case Bytecodes::_if_acmpne: ppop(rrCTS); break;
1589
1590 case Bytecodes::_jsr: do_jsr(itr->dest()); break;
1591 case Bytecodes::_jsr_w: do_jsr(itr->dest_w()); break;
1592
1593 case Bytecodes::_getstatic: do_field(true, true, itr->get_index_u2(), itr->bci(), itr->code()); break;
1594 case Bytecodes::_putstatic: do_field(false, true, itr->get_index_u2(), itr->bci(), itr->code()); break;
1595 case Bytecodes::_getfield: do_field(true, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1596 case Bytecodes::_putfield: do_field(false, false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1597
1598 case Bytecodes::_invokeinterface:
1599 case Bytecodes::_invokevirtual:
1600 case Bytecodes::_invokespecial: do_method(false, itr->get_index_u2(), itr->bci(), itr->code()); break;
1601 case Bytecodes::_invokestatic: do_method(true , itr->get_index_u2(), itr->bci(), itr->code()); break;
1602 case Bytecodes::_invokedynamic: do_method(true , itr->get_index_u4(), itr->bci(), itr->code()); break;
1603 case Bytecodes::_newarray:
1604 case Bytecodes::_anewarray: pp_new_ref(vCTS, itr->bci()); break;
1605 case Bytecodes::_checkcast: do_checkcast(); break;
1606 case Bytecodes::_arraylength:
1607 case Bytecodes::_instanceof: pp(rCTS, vCTS); break;
1608 case Bytecodes::_monitorenter: do_monitorenter(itr->bci()); break;
1609 case Bytecodes::_monitorexit: do_monitorexit(itr->bci()); break;
1610
1611 case Bytecodes::_athrow: // handled by do_exception_edge() BUT ...
1612 // vlh(apple): do_exception_edge() does not get
1613 // called if method has no exception handlers
1614 if ((!_has_exceptions) && (_monitor_top > 0)) {
1615 _monitor_safe = false;
1616 }
1617 break;
1618
1619 case Bytecodes::_areturn: do_return_monitor_check();
1620 ppop1(refCTS);
1621 break;
1622 case Bytecodes::_ifnull:
1927 void GenerateOopMap::do_field(int is_get, int is_static, int idx, int bci, Bytecodes::Code bc) {
1928 // Dig up signature for field in constant pool
1929 ConstantPool* cp = method()->constants();
1930 int nameAndTypeIdx = cp->name_and_type_ref_index_at(idx, bc);
1931 int signatureIdx = cp->signature_ref_index_at(nameAndTypeIdx);
1932 Symbol* signature = cp->symbol_at(signatureIdx);
1933
1934 CellTypeState temp[4];
1935 CellTypeState *eff = signature_to_effect(signature, bci, temp);
1936
1937 CellTypeState in[4];
1938 CellTypeState *out;
1939 int i = 0;
1940
1941 if (is_get) {
1942 out = eff;
1943 } else {
1944 out = epsilonCTS;
1945 i = copy_cts(in, eff);
1946 }
1947 if (!is_static) {
1948 in[i++] = CellTypeState::ref;
1949 }
1950 in[i] = CellTypeState::bottom;
1951 assert(i<=3, "sanity check");
1952 pp(in, out);
1953 }
1954
1955 void GenerateOopMap::do_method(int is_static, int idx, int bci, Bytecodes::Code bc) {
1956 // Dig up signature for field in constant pool
1957 ConstantPool* cp = _method->constants();
1958 Symbol* signature = cp->signature_ref_at(idx, bc);
1959
1960 // Parse method signature
1961 CellTypeState out[4];
1962 CellTypeState in[MAXARGSIZE+1]; // Includes result
1963 ComputeCallStack cse(signature);
1964
1965 // Compute return type
1966 int res_length= cse.compute_for_returntype(out);
1967
1968 // Temporary hack.
1969 if (out[0].equal(CellTypeState::ref) && out[1].equal(CellTypeState::bottom)) {
1970 out[0] = CellTypeState::make_line_ref(bci);
1971 }
1972
1973 assert(res_length<=4, "max value should be vv");
1974
1975 // Compute arguments
|