hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCV9MembarInstruction.java
changeset 13905 12e9215f3daa
parent 13904 173d83d9c9d7
parent 13903 eebf638312d2
child 13907 52873e4bbeaa
equal deleted inserted replaced
13904:173d83d9c9d7 13905:12e9215f3daa
     1 /*
       
     2  * Copyright (c) 2002, 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 package sun.jvm.hotspot.asm.sparc;
       
    26 
       
    27 import sun.jvm.hotspot.asm.SymbolFinder;
       
    28 import java.util.Vector;
       
    29 
       
    30 public class SPARCV9MembarInstruction extends SPARCInstruction
       
    31                   implements SPARCV9Instruction {
       
    32     final private int mmask;
       
    33     final private int cmask;
       
    34     final private String description;
       
    35 
       
    36     public SPARCV9MembarInstruction(int mmask, int cmask) {
       
    37         super("membar");
       
    38         this.mmask = mmask & 0xF;
       
    39         this.cmask = cmask & 0x7;
       
    40         description = initDescription();
       
    41     }
       
    42 
       
    43     private String initDescription() {
       
    44         StringBuffer buf = new StringBuffer();
       
    45         buf.append(getName());
       
    46         buf.append(spaces);
       
    47 
       
    48         Vector masks = new Vector();
       
    49         if ((mmask & 0x1) != 0)
       
    50             masks.add("#LoadLoad");
       
    51         if ((mmask & 0x2) != 0)
       
    52             masks.add("#StoreLoad");
       
    53         if ((mmask & 0x4) != 0)
       
    54             masks.add("#LoadStore");
       
    55         if ((mmask & 0x8) != 0)
       
    56             masks.add("#StoreStore");
       
    57 
       
    58         if ((cmask & 0x1) != 0)
       
    59             masks.add("#Lookaside");
       
    60         if ((cmask & 0x2) != 0)
       
    61             masks.add("#MemIssue");
       
    62         if ((cmask & 0x4) != 0)
       
    63             masks.add("#Sync");
       
    64 
       
    65         // add all masks
       
    66         Object[] tempMasks = masks.toArray();
       
    67         for (int i=0; i < tempMasks.length - 1; i++) {
       
    68             buf.append((String)tempMasks[i]);
       
    69             buf.append("| ");
       
    70         }
       
    71         buf.append((String)tempMasks[tempMasks.length - 1]);
       
    72 
       
    73         return buf.toString();
       
    74     }
       
    75 
       
    76     public int getMMask() {
       
    77         return mmask;
       
    78     }
       
    79 
       
    80     public int getCMask() {
       
    81         return cmask;
       
    82     }
       
    83 
       
    84     public String asString(long currentPc, SymbolFinder symFinder) {
       
    85         return description;
       
    86     }
       
    87 }