Package org.jruby.truffle.runtime.core

Examples of org.jruby.truffle.runtime.core.RubyBasicObject


            return new RubyArray(getContext().getCoreLibrary().getArrayClass(), new Object[]{sign * mantissa, exponent}, 2);
        }

        @Fallback
        public RubyArray frexp(VirtualFrame frame, Object a) {
            final RubyBasicObject boxed = box.box(a);

            if (boxed.isNumeric()) {
                try {
                    return frexp(floatNode.callFloat(frame, boxed, "to_f", null));
                } catch (UseMethodMissingException e) {
                    throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                            boxed.getLogicalClass().getName(),
                            getContext().getCoreLibrary().getFloatClass().getName(),
                            this));
                }
            } else {
                CompilerDirectives.transferToInterpreter();

                throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                        boxed.getLogicalClass().getName(),
                        getContext().getCoreLibrary().getFloatClass().getName(),
                        this));
            }
        }
View Full Code Here


            return doFunction(a, b);
        }

        @Fallback
        public double function(VirtualFrame frame, Object a, Object b) {
            final RubyBasicObject aBoxed = box.box(a);
            final RubyBasicObject bBoxed = box.box(b);

            if (aBoxed.isNumeric() && bBoxed.isNumeric()) {
                try {
                    return doFunction(
                            floatANode.callFloat(frame, aBoxed, "to_f", null),
                            floatBNode.callFloat(frame, bBoxed, "to_f", null));
                } catch (UseMethodMissingException e) {
View Full Code Here

        notDesignedForCompilation();

        final RubyContext context = getContext();

        try {
            final RubyBasicObject self = context.getCoreLibrary().box(RubyArguments.getSelf(frame.getArguments()));

            if (!guard()) {
                lookup(frame);
            }

            if (method == null || method.isUndefined() || !method.isVisibleTo(this, self.getMetaClass())) {
                return getContext().getCoreLibrary().getNilObject();
            } else {
                return context.makeString("super");
            }
        } catch (Exception e) {
View Full Code Here

            return a * Math.pow(2, b);
        }

        @Fallback
        public double function(VirtualFrame frame, Object a, Object b) {
            final RubyBasicObject aBoxed = box.box(a);
            final RubyBasicObject bBoxed = box.box(b);

            if (aBoxed.isNumeric()) {
                try {
                    return function(
                            floatANode.callFloat(frame, aBoxed, "to_f", null),
View Full Code Here

            return new RubyArray(getContext().getCoreLibrary().getArrayClass(), new Object[]{l.value, l.sign}, 2);
        }

        @Fallback
        public RubyArray lgamma(VirtualFrame frame, Object a) {
            final RubyBasicObject boxed = box.box(a);

            if (boxed.isNumeric()) {
                try {
                    return lgamma(floatNode.callFloat(frame, boxed, "to_f", null));
                } catch (UseMethodMissingException e) {
                    throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                            boxed.getLogicalClass().getName(),
                            getContext().getCoreLibrary().getFloatClass().getName(),
                            this));
                }
            } else {
                CompilerDirectives.transferToInterpreter();

                throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                        boxed.getLogicalClass().getName(),
                        getContext().getCoreLibrary().getFloatClass().getName(),
                        this));
            }
        }
View Full Code Here

            return doFunction(a);
        }

        @Specialization
        public double function(VirtualFrame frame, Object a, UndefinedPlaceholder b) {
            final RubyBasicObject boxed = box.box(a);

            if (boxed.isNumeric()) {
                try {
                    return doFunction(
                            floatANode.callFloat(frame, boxed, "to_f", null));
                } catch (UseMethodMissingException e) {
                    throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                            boxed.getLogicalClass().getName(),
                            getContext().getCoreLibrary().getFloatClass().getName(),
                            this));
                }
            } else {
                CompilerDirectives.transferToInterpreter();

                throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                        boxed.getLogicalClass().getName(),
                        getContext().getCoreLibrary().getFloatClass().getName(),
                        this));
            }
        }
View Full Code Here

            return doFunction(a);
        }

        @Fallback
        public double function(VirtualFrame frame, Object a) {
            final RubyBasicObject boxed = box.box(a);

            if (boxed.isNumeric()) {
                try {
                    return doFunction(floatNode.callFloat(frame, boxed, "to_f", null));
                } catch (UseMethodMissingException e) {
                    throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                            boxed.getLogicalClass().getName(),
                            getContext().getCoreLibrary().getFloatClass().getName(),
                            this));
                }
            } else {
                CompilerDirectives.transferToInterpreter();

                throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertInto(
                        boxed.getLogicalClass().getName(),
                        getContext().getCoreLibrary().getFloatClass().getName(),
                        this));
            }
        }
View Full Code Here

        this.isGlobal = isGlobal;
    }

    @Override
    public int executeIntegerFixnum(VirtualFrame frame) throws UnexpectedResultException {
        final RubyBasicObject object = receiver.executeRubyBasicObject(frame);

        try {
            final int value = rhs.executeIntegerFixnum(frame);

            writeNode.execute(object, value);
View Full Code Here

        }
    }

    @Override
    public long executeLongFixnum(VirtualFrame frame) throws UnexpectedResultException {
        final RubyBasicObject object = receiver.executeRubyBasicObject(frame);

        try {
            final long value = rhs.executeLongFixnum(frame);

            writeNode.execute(object, value);
View Full Code Here

        }
    }

    @Override
    public double executeFloat(VirtualFrame frame) throws UnexpectedResultException {
        final RubyBasicObject object = receiver.executeRubyBasicObject(frame);

        try {
            final double value = rhs.executeFloat(frame);

            writeNode.execute(object, value);
View Full Code Here

TOP

Related Classes of org.jruby.truffle.runtime.core.RubyBasicObject

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.