Package r.data

Examples of r.data.RAny


                    return update(lhs, rhs);
                } catch (SpecializationException e) {
                    Selector failedSelector = (Selector) e.getResult();
                    for (int i = 0; i < selectorVals.length; ++i) {
                        if (selectorVals[i] == failedSelector) {
                            RAny index = failedSelector.getIndex();
                            SelectorNode newSelector = Selector.createSelectorNode(ast, subset, index, selectorExprs[i].child, false, failedSelector.getTransition());
                            selectorExprs[i].replace(newSelector);
                            assert Utils.check(selectorExprs[i] == newSelector);
                            selectorVals[i] = newSelector.executeSelector(index);
                            if (DEBUG_UP) Utils.debug("Selector " + i + " changed...");
View Full Code Here


         * This is the general case that performs all the computations at once. In the slowpath makes a copy of the lhs
         * and determines if a copy of the rhs should be made and then runs the update of arrays for non-const rhs
         * values (this will work for the const values too, of course).
         */
        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhsParam) {
            RAny lhs = lhsParam;
            RAny rhs = rhsParam;
            if (Configuration.ARRAY_UPDATE_DIRECT_SPECIALIZATIONS_IN_GENERALIZED && !lhs.isShared()) {
                if (Configuration.ARRAY_UPDATE_DIRECT_SPECIALIZATIONS_IN_GENERALIZED_CACHE) {
                    // check if we have a reason to believe that we are specialized, and if so, just use the simple checks to
                    // confirm and proceed
                    switch (updateType) {
View Full Code Here

         * This is the general case that performs all the computations at once. In the slowpath makes a copy of the lhs
         * and determines if a copy of the rhs should be made and then runs the update of arrays for non-const rhs
         * values (this will work for the const values too, of course).
         */
        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhsParam) {
            RAny lhs = lhsParam;
            RAny rhs = rhsParam;

            // 1. copy the rhs
            ValueCopy.Impl rhsImpl = CopyRhs.determineCopyImplementation(lhs, rhs, selectorExprs.length, ast); // can be null if no copy is needed
            if (rhsImpl != null) {
                try {
                    rhs = rhsImpl.copy(rhs);
                } catch (SpecializationException e) {
                    assert (false) : "unreachable";
                }
            }

            // now the type of lhs <= type of rhs
            ValueCopy.Impl lhsImpl = CopyLhs.determineCopyImplementation(lhs, rhs, selectorExprs.length, !subset, ast); // will not be null, will be an upcast or a duplicate
            if (!(lhsImpl instanceof ValueCopy.Duplicate) || lhs.isShared() || rhs.dependsOn(lhs)) {
                try {
                    lhs = lhsImpl.copy(lhs);
                } catch (SpecializationException e) {
                    assert (false) : "unreachable";
                }
View Full Code Here

            /**
             * Copies the lhs and then executes the child of the copy lhs node (the assignment itself). Upon failure of
             * the copy code rewrites the whole tree to the general case.
             */
            @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
                RAny lhs = lhsParam;
                try {
                    // we need to check the LHS type to make sure that we still need to copy the RHS
                    // otherwise we may up-cast it to a wrong type (note the original rhs would be lost)
                    rhsTypeGuard.check(rhs);

View Full Code Here

                this.impl = copy;
            }

            @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
                RAny lhs;
                if (lhsParam.isShared() || rhs.dependsOn(lhsParam)) {
                    try {
                        lhs = impl.copy(lhsParam);
                    } catch (SpecializationException e) {
                        if (DEBUG_UP) Utils.debug("CopyLhs.SpecializedDuplicate -> Generalized");
View Full Code Here

            /**
             * Executes the child on the typecasted rhs and given lhs. If the typecast fails rewrites itself to the
             * generalized case.
             */
            @Override public RAny execute(Frame frame, RAny lhs, RAny rhsParam) {
                RAny rhs;
                try {
                    // we need to check the LHS type to make sure that we still need to copy the RHS
                    // otherwise we may up-cast it to a wrong type (note the original rhs would be lost)
                    lhsTypeGuard.check(lhs);

View Full Code Here

                Selector columnSel = selectorExprs[lastSel].executeSelector(frame);
                while (true) {
                    try {
                        return update((RArray) lhs, (RArray) rhs, columnSel);
                    } catch (SpecializationException e) {
                        RAny index = columnSel.getIndex();
                        SelectorNode newSelector = Selector.createSelectorNode(ast, subset, index, selectorExprs[lastSel].child, false, columnSel.getTransition());
                        selectorExprs[lastSel].replace(newSelector);
                        assert Utils.check(selectorExprs[lastSel] == newSelector);
                        columnSel = newSelector.executeSelector(index);
                        if (DEBUG_UP) Utils.debug("Column selector changed...");
View Full Code Here

        protected IntToIntDirect(UpdateArray other) {
            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            RAny lhs;
            try {
                if (!(lhsParam instanceof IntImpl) || !(rhs instanceof IntImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS || (lhsParam == rhs)) {
                    lhs = ValueCopy.INT_TO_INT_DIRECT.copy(lhsParam);
                } else {
View Full Code Here

            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            try {
                RAny lhs;
                if (!(lhsParam instanceof DoubleImpl) || !(rhs instanceof IntImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS) {
                    lhs = ValueCopy.DOUBLE_TO_DOUBLE_DIRECT.copy(lhs);
                } else {
                    lhs = lhsParam;
View Full Code Here

            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            try {
                RAny lhs;
                if (!(lhsParam instanceof DoubleImpl) || !(rhs instanceof DoubleImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS || (lhsParam == rhs)) {
                    lhs = ValueCopy.DOUBLE_TO_DOUBLE_DIRECT.copy(lhsParam);
                } else {
                    lhs = lhsParam;
View Full Code Here

TOP

Related Classes of r.data.RAny

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.