Returns the appropriate filled-new-array rop for the given type. The result may be a shared instance. @param arrayType non-null; type of array being created @param count count >= 0; number of elements that the array should have @return non-null; an appropriate instan
(TypeBearer arrayType, int count)
| 1871 | * @return {@code non-null;} an appropriate instance |
| 1872 | */ |
| 1873 | public static Rop opFilledNewArray(TypeBearer arrayType, int count) { |
| 1874 | Type type = arrayType.getType(); |
| 1875 | Type elementType = type.getComponentType(); |
| 1876 | |
| 1877 | if (elementType.isCategory2()) { |
| 1878 | return throwBadType(arrayType); |
| 1879 | } |
| 1880 | |
| 1881 | if (count < 0) { |
| 1882 | throw new IllegalArgumentException("count < 0"); |
| 1883 | } |
| 1884 | |
| 1885 | StdTypeList sourceTypes = new StdTypeList(count); |
| 1886 | |
| 1887 | for (int i = 0; i < count; i++) { |
| 1888 | sourceTypes.set(i, elementType); |
| 1889 | } |
| 1890 | |
| 1891 | // Note: The resulting rop is considered call-like. |
| 1892 | return new Rop(RegOps.FILLED_NEW_ARRAY, |
| 1893 | sourceTypes, |
| 1894 | Exceptions.LIST_Error); |
| 1895 | } |
| 1896 | |
| 1897 | /** |
| 1898 | * Returns the appropriate {@code get-field} rop for the given |
no test coverage detected