Returns the appropriate new-array rop for the given type. The result is a shared instance. @param arrayType non-null; array type of array being created @return non-null; an appropriate instance
(TypeBearer arrayType)
| 1840 | * @return {@code non-null;} an appropriate instance |
| 1841 | */ |
| 1842 | public static Rop opNewArray(TypeBearer arrayType) { |
| 1843 | Type type = arrayType.getType(); |
| 1844 | Type elementType = type.getComponentType(); |
| 1845 | |
| 1846 | switch (elementType.getBasicType()) { |
| 1847 | case Type.BT_INT: return NEW_ARRAY_INT; |
| 1848 | case Type.BT_LONG: return NEW_ARRAY_LONG; |
| 1849 | case Type.BT_FLOAT: return NEW_ARRAY_FLOAT; |
| 1850 | case Type.BT_DOUBLE: return NEW_ARRAY_DOUBLE; |
| 1851 | case Type.BT_BOOLEAN: return NEW_ARRAY_BOOLEAN; |
| 1852 | case Type.BT_BYTE: return NEW_ARRAY_BYTE; |
| 1853 | case Type.BT_CHAR: return NEW_ARRAY_CHAR; |
| 1854 | case Type.BT_SHORT: return NEW_ARRAY_SHORT; |
| 1855 | case Type.BT_OBJECT: { |
| 1856 | return new Rop(RegOps.NEW_ARRAY, type, StdTypeList.INT, |
| 1857 | Exceptions.LIST_Error_NegativeArraySizeException, |
| 1858 | "new-array-object"); |
| 1859 | } |
| 1860 | } |
| 1861 | |
| 1862 | return throwBadType(type); |
| 1863 | } |
| 1864 | |
| 1865 | /** |
| 1866 | * Returns the appropriate {@code filled-new-array} rop for the given |
no test coverage detected