136
137 void GraphKit::verify_map() const {
138 if (map() == NULL) return; // null map is OK
139 assert(map()->req() <= jvms()->endoff(), "no extra garbage on map");
140 assert(!map()->has_exceptions(), "call add_exception_states_from 1st");
141 assert(!is_hidden_merge(control()), "call use_exception_state, not set_map");
142 }
143
144 void GraphKit::verify_exception_state(SafePointNode* ex_map) {
145 assert(ex_map->next_exception() == NULL, "not already part of a chain");
146 assert(has_saved_ex_oop(ex_map), "every exception state has an ex_oop");
147 }
148 #endif
149
150 //---------------------------stop_and_kill_map---------------------------------
151 // Set _map to NULL, signalling a stop to further bytecode execution.
152 // First smash the current map's control to a constant, to mark it dead.
153 void GraphKit::stop_and_kill_map() {
154 SafePointNode* dead_map = stop();
155 if (dead_map != NULL) {
156 dead_map->disconnect_inputs(NULL); // Mark the map as killed.
157 assert(dead_map->is_killed(), "must be so marked");
158 }
159 }
160
161
162 //--------------------------------stopped--------------------------------------
163 // Tell if _map is NULL, or control is top.
164 bool GraphKit::stopped() {
165 if (map() == NULL) return true;
166 else if (control() == top()) return true;
167 else return false;
168 }
169
170
171 //-----------------------------has_ex_handler----------------------------------
172 // Tell if this method or any caller method has exception handlers.
173 bool GraphKit::has_ex_handler() {
174 for (JVMState* jvmsp = jvms(); jvmsp != NULL; jvmsp = jvmsp->caller()) {
175 if (jvmsp->has_method() && jvmsp->method()->has_exception_handlers()) {
176 return true;
1794 }
1795 } else {
1796 GraphKit ekit(ejvms);
1797
1798 // Load my combined exception state into the kit, with all phis transformed:
1799 SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states();
1800
1801 Node* ex_oop = ekit.use_exception_state(ex_map);
1802
1803 C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
1804 C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory());
1805 C->gvn_replace_by(callprojs.catchall_ioproj, ekit.i_o());
1806
1807 // Replace the old exception object with the newly created one
1808 if (callprojs.exobj != NULL) {
1809 C->gvn_replace_by(callprojs.exobj, ex_oop);
1810 }
1811 }
1812
1813 // Disconnect the call from the graph
1814 call->disconnect_inputs(NULL);
1815 C->gvn_replace_by(call, C->top());
1816
1817 // Clean up any MergeMems that feed other MergeMems since the
1818 // optimizer doesn't like that.
1819 if (final_mem->is_MergeMem()) {
1820 Node_List wl;
1821 for (SimpleDUIterator i(final_mem); i.has_next(); i.next()) {
1822 Node* m = i.get();
1823 if (m->is_MergeMem() && !wl.contains(m)) {
1824 wl.push(m);
1825 }
1826 }
1827 while (wl.size() > 0) {
1828 _gvn.transform(wl.pop());
1829 }
1830 }
1831 }
1832
1833
1834 //------------------------------increment_counter------------------------------
|
136
137 void GraphKit::verify_map() const {
138 if (map() == NULL) return; // null map is OK
139 assert(map()->req() <= jvms()->endoff(), "no extra garbage on map");
140 assert(!map()->has_exceptions(), "call add_exception_states_from 1st");
141 assert(!is_hidden_merge(control()), "call use_exception_state, not set_map");
142 }
143
144 void GraphKit::verify_exception_state(SafePointNode* ex_map) {
145 assert(ex_map->next_exception() == NULL, "not already part of a chain");
146 assert(has_saved_ex_oop(ex_map), "every exception state has an ex_oop");
147 }
148 #endif
149
150 //---------------------------stop_and_kill_map---------------------------------
151 // Set _map to NULL, signalling a stop to further bytecode execution.
152 // First smash the current map's control to a constant, to mark it dead.
153 void GraphKit::stop_and_kill_map() {
154 SafePointNode* dead_map = stop();
155 if (dead_map != NULL) {
156 dead_map->disconnect_inputs(NULL, C); // Mark the map as killed.
157 assert(dead_map->is_killed(), "must be so marked");
158 }
159 }
160
161
162 //--------------------------------stopped--------------------------------------
163 // Tell if _map is NULL, or control is top.
164 bool GraphKit::stopped() {
165 if (map() == NULL) return true;
166 else if (control() == top()) return true;
167 else return false;
168 }
169
170
171 //-----------------------------has_ex_handler----------------------------------
172 // Tell if this method or any caller method has exception handlers.
173 bool GraphKit::has_ex_handler() {
174 for (JVMState* jvmsp = jvms(); jvmsp != NULL; jvmsp = jvmsp->caller()) {
175 if (jvmsp->has_method() && jvmsp->method()->has_exception_handlers()) {
176 return true;
1794 }
1795 } else {
1796 GraphKit ekit(ejvms);
1797
1798 // Load my combined exception state into the kit, with all phis transformed:
1799 SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states();
1800
1801 Node* ex_oop = ekit.use_exception_state(ex_map);
1802
1803 C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
1804 C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory());
1805 C->gvn_replace_by(callprojs.catchall_ioproj, ekit.i_o());
1806
1807 // Replace the old exception object with the newly created one
1808 if (callprojs.exobj != NULL) {
1809 C->gvn_replace_by(callprojs.exobj, ex_oop);
1810 }
1811 }
1812
1813 // Disconnect the call from the graph
1814 call->disconnect_inputs(NULL, C);
1815 C->gvn_replace_by(call, C->top());
1816
1817 // Clean up any MergeMems that feed other MergeMems since the
1818 // optimizer doesn't like that.
1819 if (final_mem->is_MergeMem()) {
1820 Node_List wl;
1821 for (SimpleDUIterator i(final_mem); i.has_next(); i.next()) {
1822 Node* m = i.get();
1823 if (m->is_MergeMem() && !wl.contains(m)) {
1824 wl.push(m);
1825 }
1826 }
1827 while (wl.size() > 0) {
1828 _gvn.transform(wl.pop());
1829 }
1830 }
1831 }
1832
1833
1834 //------------------------------increment_counter------------------------------
|