/** * @return the number of registers required for this <code>TypeListItem</code> */ public int getRegisterCount() { int wordCount = 0; for (TypeIdItem typeIdItem: typeList) { wordCount += typeIdItem.getRegisterCount(); } return wordCount; }
public static RegisterType getWideRegisterTypeForTypeIdItem(TypeIdItem typeIdItem, boolean firstRegister) { if (typeIdItem.getRegisterCount() == 1) { throw new RuntimeException("Cannot use this method for non-wide register type: " + typeIdItem.getTypeDescriptor()); } switch (typeIdItem.getTypeDescriptor().charAt(0)) { case 'J': if (firstRegister) { return getRegisterType(Category.LongLo, null); } else { return getRegisterType(Category.LongHi, null); } case 'D': if (firstRegister) { return getRegisterType(Category.DoubleLo, null); } else { return getRegisterType(Category.DoubleHi, null); } default: throw new RuntimeException("Invalid type: " + typeIdItem.getTypeDescriptor()); } }
private static RegisterType[] getParameterTypes(TypeListItem typeListItem, int parameterRegisterCount) { assert typeListItem != null; assert parameterRegisterCount == typeListItem.getRegisterCount(); RegisterType[] registerTypes = new RegisterType[parameterRegisterCount]; int registerNum = 0; for (TypeIdItem type: typeListItem.getTypes()) { if (type.getRegisterCount() == 2) { registerTypes[registerNum++] = RegisterType.getWideRegisterTypeForTypeIdItem(type, true); registerTypes[registerNum++] = RegisterType.getWideRegisterTypeForTypeIdItem(type, false); } else { registerTypes[registerNum++] = RegisterType.getRegisterTypeForTypeIdItem(type); } } return registerTypes; }
/** * @return the number of registers required for this <code>TypeListItem</code> */ public int getRegisterCount() { int wordCount = 0; for (TypeIdItem typeIdItem: typeList) { wordCount += typeIdItem.getRegisterCount(); } return wordCount; }
public static RegisterType getWideRegisterTypeForTypeIdItem(TypeIdItem typeIdItem, boolean firstRegister) { if (typeIdItem.getRegisterCount() == 1) { throw new RuntimeException("Cannot use this method for non-wide register type: " + typeIdItem.getTypeDescriptor()); } switch (typeIdItem.getTypeDescriptor().charAt(0)) { case 'J': if (firstRegister) { return getRegisterType(Category.LongLo, null); } else { return getRegisterType(Category.LongHi, null); } case 'D': if (firstRegister) { return getRegisterType(Category.DoubleLo, null); } else { return getRegisterType(Category.DoubleHi, null); } default: throw new RuntimeException("Invalid type: " + typeIdItem.getTypeDescriptor()); } }
private static RegisterType[] getParameterTypes(TypeListItem typeListItem, int parameterRegisterCount) { assert typeListItem != null; assert parameterRegisterCount == typeListItem.getRegisterCount(); RegisterType[] registerTypes = new RegisterType[parameterRegisterCount]; int registerNum = 0; for (TypeIdItem type: typeListItem.getTypes()) { if (type.getRegisterCount() == 2) { registerTypes[registerNum++] = RegisterType.getWideRegisterTypeForTypeIdItem(type, true); registerTypes[registerNum++] = RegisterType.getWideRegisterTypeForTypeIdItem(type, false); } else { registerTypes[registerNum++] = RegisterType.getRegisterTypeForTypeIdItem(type); } } return registerTypes; }