13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "code/compiledIC.hpp"
29 #include "code/debugInfo.hpp"
30 #include "code/debugInfoRec.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "compiler/compilerDirectives.hpp"
33 #include "compiler/oopMap.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "opto/ad.hpp"
36 #include "opto/callnode.hpp"
37 #include "opto/cfgnode.hpp"
38 #include "opto/locknode.hpp"
39 #include "opto/machnode.hpp"
40 #include "opto/optoreg.hpp"
41 #include "opto/output.hpp"
42 #include "opto/regalloc.hpp"
43 #include "opto/runtime.hpp"
44 #include "opto/subnode.hpp"
45 #include "opto/type.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "utilities/xmlstream.hpp"
48
49 #ifndef PRODUCT
50 #define DEBUG_ARG(x) , x
51 #else
52 #define DEBUG_ARG(x)
1382
1383 // Save the offset for the listing
1384 #ifndef PRODUCT
1385 if (node_offsets && n->_idx < node_offset_limit)
1386 node_offsets[n->_idx] = cb->insts_size();
1387 #endif
1388
1389 // "Normal" instruction case
1390 DEBUG_ONLY( uint instr_offset = cb->insts_size(); )
1391 n->emit(*cb, _regalloc);
1392 current_offset = cb->insts_size();
1393
1394 // Above we only verified that there is enough space in the instruction section.
1395 // However, the instruction may emit stubs that cause code buffer expansion.
1396 // Bail out here if expansion failed due to a lack of code cache space.
1397 if (failing()) {
1398 return;
1399 }
1400
1401 #ifdef ASSERT
1402 if (n->size(_regalloc) < (current_offset-instr_offset)) {
1403 n->dump();
1404 assert(false, "wrong size of mach node");
1405 }
1406 #endif
1407 non_safepoints.observe_instruction(n, current_offset);
1408
1409 // mcall is last "call" that can be a safepoint
1410 // record it so we can see if a poll will directly follow it
1411 // in which case we'll need a pad to make the PcDesc sites unique
1412 // see 5010568. This can be slightly inaccurate but conservative
1413 // in the case that return address is not actually at current_offset.
1414 // This is a small price to pay.
1415
1416 if (is_mcall) {
1417 last_call_offset = current_offset;
1418 }
1419
1420 if (n->is_Mach() && n->as_Mach()->avoid_back_to_back(MachNode::AVOID_AFTER)) {
1421 // Avoid back to back some instructions.
1422 last_avoid_back_to_back_offset = current_offset;
1423 }
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "code/compiledIC.hpp"
29 #include "code/debugInfo.hpp"
30 #include "code/debugInfoRec.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "compiler/compilerDirectives.hpp"
33 #include "compiler/disassembler.hpp"
34 #include "compiler/oopMap.hpp"
35 #include "memory/allocation.inline.hpp"
36 #include "opto/ad.hpp"
37 #include "opto/callnode.hpp"
38 #include "opto/cfgnode.hpp"
39 #include "opto/locknode.hpp"
40 #include "opto/machnode.hpp"
41 #include "opto/optoreg.hpp"
42 #include "opto/output.hpp"
43 #include "opto/regalloc.hpp"
44 #include "opto/runtime.hpp"
45 #include "opto/subnode.hpp"
46 #include "opto/type.hpp"
47 #include "runtime/handles.inline.hpp"
48 #include "utilities/xmlstream.hpp"
49
50 #ifndef PRODUCT
51 #define DEBUG_ARG(x) , x
52 #else
53 #define DEBUG_ARG(x)
1383
1384 // Save the offset for the listing
1385 #ifndef PRODUCT
1386 if (node_offsets && n->_idx < node_offset_limit)
1387 node_offsets[n->_idx] = cb->insts_size();
1388 #endif
1389
1390 // "Normal" instruction case
1391 DEBUG_ONLY( uint instr_offset = cb->insts_size(); )
1392 n->emit(*cb, _regalloc);
1393 current_offset = cb->insts_size();
1394
1395 // Above we only verified that there is enough space in the instruction section.
1396 // However, the instruction may emit stubs that cause code buffer expansion.
1397 // Bail out here if expansion failed due to a lack of code cache space.
1398 if (failing()) {
1399 return;
1400 }
1401
1402 #ifdef ASSERT
1403 uint n_size = n->size(C->regalloc());
1404 if (n_size < (current_offset-instr_offset)) {
1405 MachNode* mach = n->as_Mach();
1406 n->dump();
1407 mach->dump_format(C->regalloc(), tty);
1408 tty->print_cr(" n_size (%d), current_offset (%d), instr_offset (%d)", n_size, current_offset, instr_offset);
1409 Disassembler::decode(cb->insts_begin() + instr_offset, cb->insts_begin() + current_offset + 1, tty);
1410 tty->print_cr(" ------------------- ");
1411 BufferBlob* blob = this->scratch_buffer_blob();
1412 address blob_begin = blob->content_begin();
1413 Disassembler::decode(blob_begin, blob_begin + n_size + 1, tty);
1414 assert(false, "wrong size of mach node");
1415 }
1416 #endif
1417 non_safepoints.observe_instruction(n, current_offset);
1418
1419 // mcall is last "call" that can be a safepoint
1420 // record it so we can see if a poll will directly follow it
1421 // in which case we'll need a pad to make the PcDesc sites unique
1422 // see 5010568. This can be slightly inaccurate but conservative
1423 // in the case that return address is not actually at current_offset.
1424 // This is a small price to pay.
1425
1426 if (is_mcall) {
1427 last_call_offset = current_offset;
1428 }
1429
1430 if (n->is_Mach() && n->as_Mach()->avoid_back_to_back(MachNode::AVOID_AFTER)) {
1431 // Avoid back to back some instructions.
1432 last_avoid_back_to_back_offset = current_offset;
1433 }
|