private void convertArray(Type from, Type to) {
            // Generate code to do a runtime conversion of an array.
            // This involves creating a new array and populating it with
            // converted elements from the original array.
            //
            // <from type>[] originalArray = stackVar;
            // int length = originalArray.length;
            // push (new <to type>[length]);
            // for (length--; length >= 0; length--) {
            //     dup; // dup the new array
            //     load local (length);
            //     store to array (convert (originalArray[length]));
            // }

            Type fromElement;
            Type toElement;

            try {
                fromElement = from.getArrayElementType();
                toElement = to.getArrayElementType();
            }
            catch (IntrospectionException e) {
                throw new RuntimeException(e.toString());
            }

            TypeDesc originalType = makeDesc(from);

            LocalVariable originalArray =
                mBuilder.createLocalVariable("originalArray", originalType);

            LocalVariable length =
                mBuilder.createLocalVariable("length", TypeDesc.INT);

            mBuilder.storeLocal(originalArray);

            Label endLabel;
            if (from.isNonNull()) {
                endLabel = null;
            }
            else {
                // If source array could be null, test it first.
                mBuilder.loadLocal(originalArray);
                Label startLabel = mBuilder.createLabel();
                mBuilder.ifNullBranch(startLabel, false);
                mBuilder.loadConstant(null);
                endLabel = mBuilder.createLabel();
                mBuilder.branch(endLabel);
                startLabel.setLocation();
            }

            mBuilder.loadLocal(originalArray);
            mBuilder.arrayLength();
            mBuilder.storeLocal(length);
            mBuilder.loadLocal(length);
            mBuilder.newObject(makeDesc(to));
            Label testLabel = mBuilder.createLabel();
            mBuilder.branch(testLabel);
            Label loopLabel = mBuilder.createLabel().setLocation();
            mBuilder.dup();
            mBuilder.loadLocal(length);
            typeConvertBegin(fromElement, toElement, false);
            mBuilder.loadLocal(originalArray);
            mBuilder.loadLocal(length);
            mBuilder.loadFromArray(makeDesc(fromElement));
            typeConvertEnd(fromElement, toElement, false);
            mBuilder.storeToArray(makeDesc(toElement));
            testLabel.setLocation();
            mBuilder.integerIncrement(length, -1);
            mBuilder.loadLocal(length);
            mBuilder.ifZeroComparisonBranch(loopLabel, ">=");

            if (endLabel != null) {
                endLabel.setLocation();
            }
        }