Commit 92b08867 authored by Tom Zhao's avatar Tom Zhao
Browse files

xz1919: WIP investigating intel isa offset

parent b57b88f6
......@@ -31,6 +31,7 @@ import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import utils.NodeVisitor;
import utils.Utils.AssemblyArchitecture;
import utils.frontend.ParserErrorHandler;
public class Compiler {
......@@ -68,7 +69,11 @@ public class Compiler {
Node program;
// If the `--parse_only` flag is specified, then we do not run semantic analysis
if (!cmd_ops.contains("--parse_only")) {
SemanticChecker semanticChecker = new SemanticChecker();
AssemblyArchitecture arch = AssemblyArchitecture.ARMv6;
if (cmd_ops.contains("--intel")) {
arch = AssemblyArchitecture.Intelx86;
}
SemanticChecker semanticChecker = new SemanticChecker(arch);
program = semanticChecker.visitProgram(tree);
int optimise_cmd_index = cmd_ops.indexOf("--optimise");
......@@ -77,7 +82,7 @@ public class Compiler {
case "0":
break;
case "1":
NodeVisitor<Node> constPropOptimiser = new ConstantPropagation();
NodeVisitor<Node> constPropOptimiser = new ConstantPropagation(arch);
program = constPropOptimiser.visit(program);
break;
default:
......
......@@ -187,7 +187,7 @@ public class ARMInstructionGenerator extends InstructionGenerator<ARMInstruction
instructions.add(new Mov(r1, new Operand2(addrReg)));
instructions.add(new BL(CHECK_ARRAY_BOUND.toString()));
instructions.add(new Add(addrReg, addrReg, new Operand2(POINTER_SIZE)));
instructions.add(new Add(addrReg, addrReg, new Operand2(ARM_POINTER_SIZE)));
int elemSize = i < node.getDepth() - 1 ? 2 : node.getType().getSize() / 2;
instructions.add(new Add(addrReg, addrReg, new Operand2(indexReg, LSL, elemSize)));
......@@ -209,7 +209,7 @@ public class ARMInstructionGenerator extends InstructionGenerator<ARMInstruction
/* get the total number of bytes needed to allocate enough space for the array */
int size = node.getType() == null ? 0 : node.getContentSize() * node.getLength();
/* add 4 bytes to `size` to include the size of the array as the first byte */
size += POINTER_SIZE;
size += ARM_POINTER_SIZE;
/* load R0 with the number of bytes needed and malloc */
instructions.add(new LDR(r0, new ImmedAddress(size)));
......@@ -412,7 +412,7 @@ public class ARMInstructionGenerator extends InstructionGenerator<ARMInstruction
if (node.isFirst()) {
addrMode = new AddressingMode2(OFFSET, reg);
} else {
addrMode = new AddressingMode2(OFFSET, reg, POINTER_SIZE);
addrMode = new AddressingMode2(OFFSET, reg, ARM_POINTER_SIZE);
}
if (isLhs) {
......@@ -437,7 +437,7 @@ public class ARMInstructionGenerator extends InstructionGenerator<ARMInstruction
/* 1 malloc pair */
/* 1.1 move size of a pair in r0
* pair in heap is 2 pointers, so 8 byte */
instructions.add(new LDR(r0, new ImmedAddress(2 * POINTER_SIZE)));
instructions.add(new LDR(r0, new ImmedAddress(2 * ARM_POINTER_SIZE)));
/* 1.2 BL malloc and get pointer in general use register*/
instructions.add(new BL(MALLOC.toString()));
......
......@@ -3,6 +3,9 @@ package backend.intel;
import backend.Instruction;
import backend.InstructionGenerator;
import backend.arm.instructions.LDR;
import backend.arm.instructions.LDR.LdrMode;
import backend.arm.instructions.addressing.AddressingMode2;
import backend.intel.instructions.Call;
import backend.intel.instructions.Cmp;
import backend.intel.instructions.IntelInstruction;
......@@ -10,6 +13,7 @@ import backend.intel.instructions.Jmp;
import backend.intel.instructions.Label;
import backend.intel.instructions.Lea;
import backend.intel.instructions.Mov;
import backend.intel.instructions.Mov.IntelMovType;
import backend.intel.instructions.Pop;
import backend.intel.instructions.Push;
import backend.intel.instructions.Ret;
......@@ -69,12 +73,15 @@ import utils.backend.register.Register;
import utils.backend.register.intel.IntelConcreteRegister;
import utils.backend.register.intel.IntelConcreteRegisterAllocator;
import static backend.arm.instructions.LDR.LdrMode.LDRSB;
import static backend.arm.instructions.addressing.AddressingMode2.AddrMode2.OFFSET;
import static backend.arm.instructions.arithmeticLogic.ARMArithmeticLogic.armUnopAsm;
import static utils.Utils.BOOL_BASIC_TYPE;
import static utils.Utils.CHAR_ARRAY_TYPE;
import static utils.Utils.CHAR_BASIC_TYPE;
import static utils.Utils.FALSE;
import static utils.Utils.FUNC_HEADER;
import static utils.Utils.INTEL_POINTER_SIZE;
import static utils.Utils.INT_BASIC_TYPE;
import static utils.Utils.STRING_BASIC_TYPE;
import static utils.Utils.TRUE;
......@@ -98,12 +105,15 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
private final Map<Label, String> dataSection;
private final Map<String, Label> biDataSection;
private boolean isMain;
public IntelInstructionGenerator() {
branchLabelGenerator = new LabelGenerator<>(".L", Label.class);
dataLabelGenerator = new LabelGenerator<>(".LC", Label.class);
intelRegAllocator = new IntelConcreteRegisterAllocator();
dataSection = new LinkedHashMap<>();
biDataSection = new LinkedHashMap<>();
isMain = false;
}
@Override
......@@ -129,13 +139,20 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
instructions.add(new Mov(new IntelAddress(((IntegerNode) index).getVal()), indexReg));
}
int elemSize = i < node.getDepth() - 1 ? 2 : node.getType().getSize() / 2;
int elemSize = i < node.getDepth() - 1 ? 3 : node.getType().getSize() / 2;
instructions.add(new Sal(elemSize, IntelInstructionSize.Q, indexReg));
instructions.add(new Add(addrReg, indexReg));
instructions.add(new Add(indexReg, addrReg));
if (i < node.getDepth() - 1) instructions.add(new Mov(new IntelAddress(addrReg), addrReg));
/* free indexReg to make it available for the indexing of the next depth */
intelRegAllocator.free();
}
/* if is not lhs, load the array content to `reg` */
if (!isLhs) {
instructions.add(new Mov(new IntelAddress(addrReg), addrReg));
}
return null;
}
......@@ -154,14 +171,14 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
for (int i = 0; i < node.getLength(); i++) {
visit(node.getElem(i));
int indexOffset = i * node.getContentSize();
instructions.add(new Mov(intelRegAllocator.curr(), new IntelAddress(addrReg)));
instructions.add(new Add(indexOffset, IntelInstructionSize.Q, addrReg.withSize(IntelInstructionSize.L)));
int indexOffset = node.getContentSize() * i;
IntelConcreteRegister realAddr = intelRegAllocator.allocate();
instructions.add(new Lea(new IntelAddress(addrReg, indexOffset), realAddr));
instructions.add(new Mov(intelRegAllocator.last(), new IntelAddress(realAddr)));
intelRegAllocator.free();
intelRegAllocator.free();
}
intelRegAllocator.free();
return null;
}
......@@ -243,14 +260,14 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
+ (currSymbolTable.getParentSymbolTable() == null ? 0 : currSymbolTable.getParentSymbolTable().getSize());
System.out.println(offset);
/* TODO: add Intel move type */
/* if is lhs, then only put address in register */
if (isLhs) {
instructions.add(new Lea(new IntelAddress(rbp, -offset), intelRegAllocator.allocate()));
} else {
/* otherwise, put value in register */
instructions.add(new Mov(new IntelAddress(rbp, -offset), intelRegAllocator.allocate()));
Map<Integer, IntelMovType> m = Map.of(8, IntelMovType.MOV, 4, IntelMovType.MOV, 1, IntelMovType.MOVZBQ);
instructions.add(new Mov(new IntelAddress(rbp, -offset), intelRegAllocator.allocate(), m.get(identTypeSize)));
}
return null;
}
......@@ -295,7 +312,7 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
Unop operator = node.getOperator();
List<Instruction> insList = IntelArithmeticLogic.intelUnopAsm
.unopAssemble(reg, reg, operator, null);
.unopAssemble(reg, reg, operator, node.getExpr());
instructions.addAll(insList.stream().map(i -> (IntelInstruction) i).collect(Collectors.toList()));
return null;
......@@ -314,7 +331,7 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
int size = node.getLhs().getType().getSize();
IntelConcreteRegister reg = intelRegAllocator.last();
/* TODO: add intel mov type here */
instructions.add(new Mov(reg.withSize(intToIntelSize.get(size)), new IntelAddress(intelRegAllocator.curr())));
intelRegAllocator.free();
intelRegAllocator.free();
......@@ -325,6 +342,7 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
public Void visitDeclareNode(DeclareNode node) {
visit(node.getRhs());
int identTypeSize = node.getRhs().getType().getSize();
/* TODO: add intel move type here */
int offset = node.getScope().lookup(node.getIdentifier()).getStackOffset()
......@@ -465,6 +483,8 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
instructions.add(new Mov(new IntelAddress(0), rax));
instructions.add(new Call("printf@PLT"));
intelRegAllocator.free();
return null;
}
......@@ -512,6 +532,9 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
int temp = stackSize;
while (temp > 0) {
int realStackSize = temp / 1024 >= 1 ? 1024 : temp;
if (isMain) {
realStackSize = Math.max(16, realStackSize);
}
instructions.add(new Sub(realStackSize, IntelInstructionSize.Q, rsp));
temp = temp - realStackSize;
}
......@@ -523,7 +546,9 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
* set currentSymbolTable here, eliminate all other set symbol table in other statNode */
currSymbolTable = node.getScope();
for (StatNode elem : list) {
isMain = false;
visit(elem);
isMain = true;
}
currSymbolTable = currSymbolTable.getParentSymbolTable();
......@@ -534,6 +559,9 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
temp = stackSize;
while (temp > 0) {
int realStackSize = temp / 1024 >= 1 ? 1024 : temp;
if (isMain) {
realStackSize = Math.max(16, realStackSize);
}
instructions.add(new Add(realStackSize, IntelInstructionSize.Q, rsp));
temp = temp - realStackSize;
}
......@@ -552,7 +580,7 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
/* if we encountere a do-while loop, then do not add the conditional jump */
Label testLabel = branchLabelGenerator.getLabel().asIntelLabel();
if (!node.isDoWhile()) {
instructions.add(new Jmp(NULL, testLabel.assemble()));
instructions.add(new Jmp(NULL, testLabel.getName()));
}
/* 2 get a label, mark the start of the loop */
......@@ -560,8 +588,8 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
Label nextLabel = branchLabelGenerator.getLabel().asIntelLabel();
/* restore the last jump-to label after visiting the while-loop body */
Label lastBreakJumpToLabel = currBreakJumpToLabel.asIntelLabel();
Label lastContinueJumpToLabel = currContinueJumpToLabel.asIntelLabel();
Label lastBreakJumpToLabel = currBreakJumpToLabel == null ? null : currBreakJumpToLabel.asIntelLabel();
Label lastContinueJumpToLabel = currContinueJumpToLabel == null ? null : currContinueJumpToLabel.asIntelLabel();
currBreakJumpToLabel = nextLabel;
currContinueJumpToLabel = testLabel;
......@@ -580,11 +608,11 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
IntelConcreteRegister oneReg = intelRegAllocator.allocate();
instructions.add(new Mov(new IntelAddress(1), oneReg));
instructions.add(new Cmp(intelRegAllocator.curr().withSize(IntelInstructionSize.B), oneReg.withSize(IntelInstructionSize.B)));
instructions.add(new Cmp(intelRegAllocator.last().withSize(IntelInstructionSize.B), oneReg.withSize(IntelInstructionSize.B)));
intelRegAllocator.free();
/* 5 conditional branch jump to the start of loop */
instructions.add(new Jmp(E, startLabel.assemble()));
instructions.add(new Jmp(E, startLabel.getName()));
instructions.add(nextLabel);
......@@ -656,7 +684,9 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
instructions.add(new Mov(rsp, rbp));
/* 4 main body */
isMain = true;
visit(node.getBody());
isMain = false;
/* 5 set return value and return */
instructions.add(new Mov(new IntelAddress(0), rax.withSize(IntelInstructionSize.L)));
......
......@@ -2,33 +2,52 @@ package backend.intel.instructions;
import backend.common.MovInstruction;
import backend.common.address.Address;
import java.util.Locale;
import utils.Utils;
import utils.backend.register.Register;
import utils.backend.register.intel.IntelConcreteRegister;
public class Mov extends MovInstruction implements IntelInstruction {
public enum IntelMovType {
MOV, MOVZBQ, MOVZLQ
}
private final IntelMovType type;
public Mov(Register rs, Register rd, Address operand2) {
super(rs, rd, operand2);
this.type = IntelMovType.MOV;
}
public Mov(Address operand2, Register Rd) {
public Mov(Address operand2, Register Rd, IntelMovType type) {
super(Rd, operand2);
this.type = type;
}
public Mov(Address operand2, Register Rd) {
this(operand2, Rd, IntelMovType.MOV);
}
public Mov(Register Rs, Register Rd) {
super(Rs, Rd);
this.type = IntelMovType.MOV;
}
public Mov(Register Rs, Address operand2) {
super(operand2, Rs);
this.type = IntelMovType.MOV;
}
@Override
public String assemble() {
StringBuilder str = new StringBuilder();
str.append("mov");
boolean isNormalMov = type.equals(IntelMovType.MOV);
if (!isNormalMov) {
str.append(type.name().toLowerCase(Locale.ROOT));
}
String size = "";
StringBuilder everythingAfter = new StringBuilder();
......@@ -44,6 +63,6 @@ public class Mov extends MovInstruction implements IntelInstruction {
everythingAfter.append(rs).append(", ").append(operand2);
}
return str.append(size).append(" ").append(everythingAfter.toString()).toString();
return str.append(isNormalMov ? "mov" + size : "").append(" ").append(everythingAfter.toString()).toString();
}
}
......@@ -18,6 +18,7 @@ import backend.intel.instructions.Set.IntelSetType;
import backend.intel.instructions.address.IntelAddress;
import frontend.node.expr.ArrayNode;
import frontend.node.expr.BinopNode.Binop;
import frontend.node.expr.IdentNode;
import frontend.node.expr.UnopNode.Unop;
import java.util.HashMap;
import java.util.List;
......@@ -59,7 +60,8 @@ public abstract class IntelArithmeticLogic extends ArithmeticLogic implements In
int len = 0;
if (op.equals(Unop.LEN)) {
len = ((ArrayNode) expr).getLength();
IdentNode id = (IdentNode) expr;
len = ((ArrayNode) (id.getSymbol().getExprNode())).getLength();
}
Map<Unop, List<Instruction>> m = Map.of(
......
......@@ -67,8 +67,11 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
private StatNode currForLoopIncrementBreak;
private StatNode currForLoopIncrementContinue;
/* indicate the architecture */
private AssemblyArchitecture arch;
/* constructor of SemanticChecker */
public SemanticChecker() {
public SemanticChecker(AssemblyArchitecture arch) {
currSymbolTable = null;
globalStructTable = new HashMap<>();
globalFuncTable = new HashMap<>();
......@@ -80,6 +83,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
expectedFunctionReturn = null;
currForLoopIncrementBreak = null;
currForLoopIncrementContinue = null;
this.arch = arch;
}
@Override
......@@ -188,7 +192,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
/* initialise as -4 byte in order to leave space for PUSH {lr},
which takes up 4 bute on stack */
int tempStackAddr = -POINTER_SIZE;
int tempStackAddr = this.arch.equals(AssemblyArchitecture.ARMv6) ? -WORD_SIZE : -QUAD_SIZE;
List<IdentNode> params = funcNode.getParamList();
int paramNum = params.size();
......@@ -643,7 +647,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
public Node visitArray_liter(Array_literContext ctx) {
int length = ctx.expr().size();
if (length == 0) {
return new ArrayNode(null, new ArrayList<>(), length);
return new ArrayNode(null, new ArrayList<>(), length, this.arch);
}
ExprNode firstExpr = visit(ctx.expr(0)).asExprNode();
Type firstContentType = firstExpr.getType();
......@@ -654,7 +658,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
semanticError |= typeCheck(context, firstContentType, exprType);
list.add(expr);
}
return new ArrayNode(firstContentType, list, length);
return new ArrayNode(firstContentType, list, length, this.arch);
}
@Override
......@@ -670,7 +674,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
invalidRuleException(ctx, "visitArray_type");
return null;
}
return new TypeDeclareNode(new ArrayType(type.getType()));
return new TypeDeclareNode(new ArrayType(type.getType(), this.arch));
}
@Override
......@@ -687,7 +691,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
public Node visitNewPair(NewPairContext ctx) {
ExprNode fst = visit(ctx.expr(0)).asExprNode();
ExprNode snd = visit(ctx.expr(1)).asExprNode();
return new PairNode(fst, snd);
return new PairNode(fst, snd, this.arch);
}
@Override
......@@ -708,7 +712,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
elemNodes.add(node);
}
return new StructNode(elemNodes, struct.getOffsets(), struct.getSize(), name);
return new StructNode(elemNodes, struct.getOffsets(), struct.getSize(), name, this.arch);
}
@Override
......@@ -795,7 +799,7 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
/* pairExpr is basically 'null', extend 'null' to represent uninitialised struct */
@Override
public Node visitPairExpr(PairExprContext ctx) {
return (isStruct)? new StructNode() : new PairNode();
return (isStruct)? new StructNode() : new PairNode(this.arch);
}
@Override
......@@ -986,14 +990,14 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
@Override
public Node visitPairElemPairType(PairElemPairTypeContext ctx) {
return new TypeDeclareNode(new PairType());
return new TypeDeclareNode(new PairType(this.arch));
}
@Override
public Node visitPair_type(Pair_typeContext ctx) {
TypeDeclareNode leftChild = visit(ctx.pair_elem_type(0)).asTypeDeclareNode();
TypeDeclareNode rightChild = visit(ctx.pair_elem_type(1)).asTypeDeclareNode();
Type type = new PairType(leftChild.getType(), rightChild.getType());
Type type = new PairType(leftChild.getType(), rightChild.getType(), this.arch);
return new TypeDeclareNode(type);
}
......@@ -1006,6 +1010,6 @@ public class SemanticChecker extends WACCParserBaseVisitor<Node> {
if (!globalStructTable.containsKey(name)) {
symbolNotFound(ctx, name);
}
return new TypeDeclareNode(new StructType(name));
return new TypeDeclareNode(new StructType(name, this.arch));
}
}
......@@ -6,8 +6,6 @@ import frontend.type.Type;
import utils.NodeVisitor;
import java.util.List;
import static utils.Utils.POINTER_SIZE;
public class FuncNode implements Node {
/**
......
......@@ -5,6 +5,7 @@ import frontend.type.Type;
import utils.NodeVisitor;
import java.util.List;
import utils.Utils.AssemblyArchitecture;
public class ArrayNode extends ExprNode {
......@@ -18,10 +19,10 @@ public class ArrayNode extends ExprNode {
private int contentSize;
private List<ExprNode> content;
public ArrayNode(Type contentType, List<ExprNode> content, int length) {
public ArrayNode(Type contentType, List<ExprNode> content, int length, AssemblyArchitecture arch) {
this.content = content;
this.length = length;
this.type = new ArrayType(contentType);
this.type = new ArrayType(contentType, arch);
this.contentSize = contentType == null || content.isEmpty() ? 0 : content.get(0).getType().getSize();
this.weight = 2;
}
......
......@@ -2,6 +2,7 @@ package frontend.node.expr;
import frontend.type.PairType;
import utils.NodeVisitor;
import utils.Utils.AssemblyArchitecture;
public class PairNode extends ExprNode {
......@@ -20,17 +21,17 @@ public class PairNode extends ExprNode {
private ExprNode fst;
private ExprNode snd;
public PairNode(ExprNode fst, ExprNode snd) {
public PairNode(ExprNode fst, ExprNode snd, AssemblyArchitecture arch) {
this.fst = fst;
this.snd = snd;
this.type = new PairType(fst.type, snd.type);
this.type = new PairType(fst.type, snd.type, arch);
this.weight = 1;
}
public PairNode() {
public PairNode(AssemblyArchitecture arch) {
this.fst = null;
this.snd = null;
this.type = new PairType();
this.type = new PairType(arch);
this.weight = 1;
}
......
......@@ -4,6 +4,7 @@ import frontend.type.StructType;
import java.util.List;
import utils.NodeVisitor;
import utils.Utils;
import utils.Utils.AssemblyArchitecture;
public class StructNode extends ExprNode {
......@@ -16,13 +17,13 @@ public class StructNode extends ExprNode {
* the null means the inner struct element which is not initialised here */
private final boolean isInitialised;
public StructNode(List<ExprNode> elemValues, List<Integer> elemOffsets, int size, String name) {
public StructNode(List<ExprNode> elemValues, List<Integer> elemOffsets, int size, String name, AssemblyArchitecture arch) {
this.elemValues = elemValues;
this.elemOffsets = elemOffsets;
this.size = size;
this.name = name;
isInitialised = true;
type = new StructType(name);
type = new StructType(name, arch);
}
public StructNode() {
......
package frontend.type;
import static utils.Utils.ARM_POINTER_SIZE;
import static utils.Utils.BYTE_SIZE;
import static utils.Utils.POINTER_SIZE;
import static utils.Utils.INTEL_POINTER_SIZE;
import java.util.Objects;
import utils.Utils.AssemblyArchitecture;
public class ArrayType implements Type {
private final int ARRAY_HASH_CODE = 20;
private final Type contentType;
private final int depth;
private final AssemblyArchitecture arch;
public ArrayType(Type contentType) {
public ArrayType(Type contentType, AssemblyArchitecture arch) {
this.contentType = contentType;
Type subType = contentType;
......@@ -21,10 +24,11 @@ public class ArrayType implements Type {
depth++;
}
this.depth = depth;
this.arch = arch;
}
public ArrayType() {
this(null);
public ArrayType(AssemblyArchitecture arch) {
this(null, arch);
}
@Override
......@@ -65,7 +69,7 @@ public class ArrayType implements Type {
@Override
public int getSize() {
return POINTER_SIZE;
return arch.equals(AssemblyArchitecture.ARMv6) ? ARM_POINTER_SIZE : INTEL_POINTER_SIZE;
}
@Override
......@@ -80,7 +84,7 @@ public class ArrayType implements Type {
contentType.equalToType(new BasicType(BasicTypeEnum.CHAR))) {
hash += BYTE_SIZE;
} else {
hash += POINTER_SIZE;
hash += arch.equals(AssemblyArchitecture.ARMv6) ? ARM_POINTER_SIZE : INTEL_POINTER_SIZE;
}
return hash;