Instruction.java

1
// Copyright © 2004-2006 University of Helsinki, Department of Computer Science
2
// Copyright © 2012 various contributors
3
// This software is released under GNU Lesser General Public License 2.1.
4
// The license text is at http://www.gnu.org/licenses/lgpl-2.1.html
5
6
package fi.helsinki.cs.titokone;
7
8
/**
9
 *  Represents a compiled instruction. Basically just a wrapper to conveniently
10
 *  extract the instruction fields from the binary representation.
11
 * 
12
 *  TODO: At least RunInfo and MemoryInfo might have something in common with this class.
13
 */
14
public class Instruction {
15
16
    public Instruction(int binaryValue) {
17 1
        this.binaryValue = binaryValue;
18
    }
19
20
    private int binaryValue;
21
22
    public int getBinaryValue() {
23 1
        return binaryValue;
24
    }
25
26
    public int getOpcode() {
27 4
        return binaryValue >>> 24;
28
    }
29
30
    public int getRj() {
31 7
        return (binaryValue & 0xE00000) >>> 21;
32
    }
33
34
    public int getM() {
35 7
        return (binaryValue & 0x180000) >>> 19;
36
    }
37
38
    public int getRi() {
39 7
        return (binaryValue & 0x070000) >>> 16;
40
    }
41
42
    public int getAddr() {
43 4
        return (short) (binaryValue & 0xFFFF);
44
    }
45
    
46
    public String toColonString() {
47 17
        return getOpcode() + ":" + getRj() + ":" + getM() + ":" + getRi() + ":" + getAddr();
48
    }
49
}

Mutations

17

Removed assignment to member variable binaryValue : SURVIVED

23

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

27

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Replaced constant value of 24 with 25 : SURVIVED

Substituted 24 with 25 : SURVIVED

Replaced Unsigned Shift Right with Shift Left : SURVIVED

31

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Substituted 21 with 22 : SURVIVED

Replaced constant value of 14680064 with 14680065 : SURVIVED

Replaced Unsigned Shift Right with Shift Left : SURVIVED

Replaced bitwise AND with OR : SURVIVED

Replaced constant value of 21 with 22 : SURVIVED

Substituted 14680064 with 14680065 : SURVIVED

35

Replaced bitwise AND with OR : SURVIVED

Replaced constant value of 19 with 20 : SURVIVED

Substituted 19 with 20 : SURVIVED

Replaced constant value of 1572864 with 1572865 : SURVIVED

Substituted 1572864 with 1572865 : SURVIVED

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Replaced Unsigned Shift Right with Shift Left : SURVIVED

39

Replaced bitwise AND with OR : SURVIVED

Substituted 16 with 17 : SURVIVED

Replaced Unsigned Shift Right with Shift Left : SURVIVED

Replaced constant value of 458752 with 458753 : SURVIVED

Substituted 458752 with 458753 : SURVIVED

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Replaced constant value of 16 with 17 : SURVIVED

43

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

Substituted 65535 with 65536 : SURVIVED

Replaced constant value of 65535 with 65536 : SURVIVED

Replaced bitwise AND with OR : SURVIVED

47

removed call to fi/helsinki/cs/titokone/Instruction::getRj : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to fi/helsinki/cs/titokone/Instruction::getM : SURVIVED

removed call to fi/helsinki/cs/titokone/Instruction::getAddr : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to fi/helsinki/cs/titokone/Instruction::getRi : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to fi/helsinki/cs/titokone/Instruction::getOpcode : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

mutated return of Object value for fi/helsinki/cs/titokone/Instruction::toColonString to ( if (x != null) null else throw new RuntimeException ) : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to java/lang/StringBuilder::toString : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

Active mutators

Tests examined


Report generated by PIT 0.27