1 /*
2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
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.hpp"
27 #include "asm/assembler.inline.hpp"
28 
29 #include "assembler_sparc.hpp"
30 
code_fill_byte()31 int AbstractAssembler::code_fill_byte() {
32   return 0x00;                  // illegal instruction 0x00000000
33 }
34 
35 #ifdef VALIDATE_PIPELINE
36 /* Walk over the current code section and verify that there are no obvious
37  * pipeline hazards exposed in the code generated.
38  */
validate_no_pipeline_hazards()39 void Assembler::validate_no_pipeline_hazards() {
40   const CodeSection* csect = code_section();
41 
42   address addr0 = csect->start();
43   address addrN = csect->end();
44   uint32_t prev = 0;
45 
46   assert((addrN - addr0) % BytesPerInstWord == 0, "must be");
47 
48   for (address pc = addr0; pc != addrN; pc += BytesPerInstWord) {
49     uint32_t insn = *reinterpret_cast<uint32_t*>(pc);
50 
51     // 1. General case: No CTI immediately after other CTI
52     assert(!(is_cti(prev) && is_cti(insn)), "CTI-CTI not allowed.");
53 
54     // 2. Special case: No CTI immediately after/before RDPC
55     assert(!(is_cti(prev) && is_rdpc(insn)), "CTI-RDPC not allowed.");
56     assert(!(is_rdpc(prev) && is_cti(insn)), "RDPC-CTI not allowed.");
57 
58     prev = insn;
59   }
60 }
61 #endif
62