Skip to content

Commit 1a0f54c

Browse files
committed
RVM-134 : Make the fields register and type of RegisterOperand private.
1 parent 9a593ac commit 1a0f54c

File tree

6 files changed

+156
-158
lines changed

6 files changed

+156
-158
lines changed

rvm/src/org/jikesrvm/compilers/opt/Simple.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,20 @@ private static void sortCommutativeRegisterUses(IR ir) {
197197
RegisterOperand rop1 = Binary.getVal1(s).asRegister();
198198
RegisterOperand rop2 = Binary.getVal2(s).asRegister();
199199
// Simple SSA based test
200-
if (rop1.register.isSSA()) {
201-
if(rop2.register.isSSA()) {
200+
if (rop1.getRegister().isSSA()) {
201+
if(rop2.getRegister().isSSA()) {
202202
// ordering is arbitrary, ignore
203203
} else {
204204
// swap
205205
Binary.setVal1(s, rop2);
206206
Binary.setVal2(s, rop1);
207207
}
208-
} else if (rop2.register.isSSA()) {
208+
} else if (rop2.getRegister().isSSA()) {
209209
// already have prefered ordering
210210
} else {
211211
// neither registers are SSA so place registers used more on the RHS
212212
// (we don't have easy access to a count of the number of definitions)
213-
if (rop1.register.useCount > rop2.register.useCount) {
213+
if (rop1.getRegister().useCount > rop2.getRegister().useCount) {
214214
// swap
215215
Binary.setVal1(s, rop2);
216216
Binary.setVal2(s, rop1);

rvm/src/org/jikesrvm/compilers/opt/ir/operand/RegisterOperand.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ public final class RegisterOperand extends Operand {
3434

3535
/**
3636
* Register object that this operand uses.
37-
* TODO: make this field private, it is accessed via generated code
3837
*/
39-
public Register register;
38+
private Register register;
4039

4140
/**
4241
* Inferred data type of the contents of the register.
43-
* TODO: make this field private, it is accessed via generated code
4442
*/
45-
public TypeReference type;
43+
private TypeReference type;
4644

4745
/**
4846
* Optimizations can use it for different purposes, as long as they
@@ -160,7 +158,7 @@ public Operand copy() {
160158
* and/or scratchObject being copied
161159
*/
162160
public RegisterOperand copyRO() {
163-
RegisterOperand temp = new RegisterOperand(getRegister(), type);
161+
RegisterOperand temp = new RegisterOperand(register, type);
164162
temp.info = info;
165163
temp.flags = flags;
166164
temp.flags2 = flags2;
@@ -205,7 +203,7 @@ public RegisterOperand copyD2D() {
205203
*/
206204
@Override
207205
public boolean similar(Operand op) {
208-
return (op instanceof RegisterOperand) && (getRegister() == ((RegisterOperand) op).getRegister());
206+
return (op instanceof RegisterOperand) && (register == ((RegisterOperand) op).getRegister());
209207
}
210208

211209
/**
@@ -216,7 +214,7 @@ public boolean similar(Operand op) {
216214
*/
217215
public void copyType(RegisterOperand rhs) {
218216
this.flags = rhs.flags;
219-
this.setType(rhs.type); // setting type this way will force checking of precision
217+
this.setType(rhs.getType()); // setting type this way will force checking of precision
220218
}
221219

222220
@Override
@@ -450,7 +448,7 @@ public RegisterOperand getNext() {
450448
*/
451449
@Override
452450
public String toString() {
453-
String s = getRegister().toString();
451+
String s = register.toString();
454452
if (type != null) {
455453
if (type != TypeReference.VALIDATION_TYPE) {
456454
s = s + "(" + type.getName();
@@ -497,7 +495,7 @@ public void setType(TypeReference t) {
497495
* @param t the inferred data type of the contents of the register
498496
*/
499497
public void setPreciseType(TypeReference t) {
500-
type = t;
498+
setType(t);
501499
flags |= PRECISE_TYPE;
502500
if (VM.VerifyAssertions) verifyPreciseType();
503501
}

0 commit comments

Comments
 (0)