public static InsnList combineObjectArrays ( Variable destArrayVar , Variable firstArrayVar , Variable secondArrayVar ) { Validate . notNull ( destArrayVar ) ; Validate . notNull ( firstArrayVar ) ; Validate . notNull ( secondArrayVar ) ; Validate . isTrue ( destArrayVar . getType ( ) . equals ( Type . getType ( Object [ ] . class ) ) ) ; Validate . isTrue ( firstArrayVar . getType ( ) . equals ( Type . getType ( Object [ ] . class ) ) ) ; Validate . isTrue ( secondArrayVar . getType ( ) . equals ( Type . getType ( Object [ ] . class ) ) ) ; validateLocalIndicies ( destArrayVar . getIndex ( ) , firstArrayVar . getIndex ( ) , secondArrayVar . getIndex ( ) ) ; InsnList ret = merge ( // destArrayVar = new Object[firstArrayVar.length + secondArrayVar.length] createNewObjectArray ( addIntegers ( loadArrayLength ( loadVar ( firstArrayVar ) ) , loadArrayLength ( loadVar ( secondArrayVar ) ) ) ) , saveVar ( destArrayVar ) , // System.arrayCopy(firstArrayVar, 0, destArrayVar, 0, firstArrayVar.length) call ( SYSTEM_ARRAY_COPY_METHOD , loadVar ( firstArrayVar ) , loadIntConst ( 0 ) , loadVar ( destArrayVar ) , loadIntConst ( 0 ) , loadArrayLength ( loadVar ( firstArrayVar ) ) ) , // System.arrayCopy(secondArrayVar, 0, destArrayVar, firstArrayVar.length, secondArrayVar.length) call ( SYSTEM_ARRAY_COPY_METHOD , loadVar ( secondArrayVar ) , loadIntConst ( 0 ) , loadVar ( destArrayVar ) , loadArrayLength ( loadVar ( firstArrayVar ) ) , loadArrayLength ( loadVar ( secondArrayVar ) ) ) ) ; return ret ; }
Concatenates two object arrays together .