57 */
58 @Opcode("ARRAY_EQUALS")
59 public final class SPARCArrayEqualsOp extends SPARCLIRInstruction {
60 public static final LIRInstructionClass<SPARCArrayEqualsOp> TYPE = LIRInstructionClass.create(SPARCArrayEqualsOp.class);
61 public static final SizeEstimate SIZE = SizeEstimate.create(32);
62
63 private final JavaKind kind;
64 private final int arrayBaseOffset;
65 private final int arrayIndexScale;
66
67 @Def({REG}) protected AllocatableValue resultValue;
68 @Alive({REG}) protected AllocatableValue array1Value;
69 @Alive({REG}) protected AllocatableValue array2Value;
70 @Alive({REG}) protected AllocatableValue lengthValue;
71 @Temp({REG}) protected AllocatableValue temp1;
72 @Temp({REG}) protected AllocatableValue temp2;
73 @Temp({REG}) protected AllocatableValue temp3;
74 @Temp({REG}) protected AllocatableValue temp4;
75 @Temp({REG}) protected AllocatableValue temp5;
76
77 public SPARCArrayEqualsOp(LIRGeneratorTool tool, JavaKind kind, AllocatableValue result, AllocatableValue array1, AllocatableValue array2, AllocatableValue length) {
78 super(TYPE, SIZE);
79
80 assert !kind.isNumericFloat() : "Float arrays comparison (bitwise_equal || both_NaN) isn't supported";
81 this.kind = kind;
82
83 this.arrayBaseOffset = tool.getProviders().getArrayOffsetProvider().arrayBaseOffset(kind);
84 this.arrayIndexScale = tool.getProviders().getArrayOffsetProvider().arrayScalingFactor(kind);
85
86 this.resultValue = result;
87 this.array1Value = array1;
88 this.array2Value = array2;
89 this.lengthValue = length;
90
91 // Allocate some temporaries.
92 this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
93 this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
94 this.temp3 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
95 this.temp4 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
96 this.temp5 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
97 }
98
99 @Override
100 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
101 Register result = asRegister(resultValue);
102 Register array1 = asRegister(temp1);
103 Register array2 = asRegister(temp2);
104 Register length = asRegister(temp3);
|
57 */
58 @Opcode("ARRAY_EQUALS")
59 public final class SPARCArrayEqualsOp extends SPARCLIRInstruction {
60 public static final LIRInstructionClass<SPARCArrayEqualsOp> TYPE = LIRInstructionClass.create(SPARCArrayEqualsOp.class);
61 public static final SizeEstimate SIZE = SizeEstimate.create(32);
62
63 private final JavaKind kind;
64 private final int arrayBaseOffset;
65 private final int arrayIndexScale;
66
67 @Def({REG}) protected AllocatableValue resultValue;
68 @Alive({REG}) protected AllocatableValue array1Value;
69 @Alive({REG}) protected AllocatableValue array2Value;
70 @Alive({REG}) protected AllocatableValue lengthValue;
71 @Temp({REG}) protected AllocatableValue temp1;
72 @Temp({REG}) protected AllocatableValue temp2;
73 @Temp({REG}) protected AllocatableValue temp3;
74 @Temp({REG}) protected AllocatableValue temp4;
75 @Temp({REG}) protected AllocatableValue temp5;
76
77 public SPARCArrayEqualsOp(LIRGeneratorTool tool, JavaKind kind, AllocatableValue result, AllocatableValue array1, AllocatableValue array2, AllocatableValue length, boolean directPointers) {
78 super(TYPE, SIZE);
79
80 assert !kind.isNumericFloat() : "Float arrays comparison (bitwise_equal || both_NaN) isn't supported";
81 this.kind = kind;
82
83 this.arrayBaseOffset = directPointers ? 0 : tool.getProviders().getMetaAccess().getArrayBaseOffset(kind);
84 this.arrayIndexScale = tool.getProviders().getMetaAccess().getArrayIndexScale(kind);
85
86 this.resultValue = result;
87 this.array1Value = array1;
88 this.array2Value = array2;
89 this.lengthValue = length;
90
91 // Allocate some temporaries.
92 this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
93 this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
94 this.temp3 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
95 this.temp4 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
96 this.temp5 = tool.newVariable(LIRKind.value(tool.target().arch.getWordKind()));
97 }
98
99 @Override
100 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
101 Register result = asRegister(resultValue);
102 Register array1 = asRegister(temp1);
103 Register array2 = asRegister(temp2);
104 Register length = asRegister(temp3);
|