Package org.objectweb.asm

Examples of org.objectweb.asm.Label


        methodCompiler.loadThreadContext();
        methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, attrName, CallType.FUNCTIONAL);
       
        methodCompiler.invokeUtilityMethod("preOpAsgnWithOrAnd", sig(IRubyObject.class, IRubyObject.class, ThreadContext.class, CallSite.class));
       
        Label done = new Label();
        Label isTrue = new Label();
       
        method.dup();
        methodCompiler.invokeIRubyObject("isTrue", sig(boolean.class));
        method.ifne(isTrue);
       
View Full Code Here


                    method.pop();
                }

                // next, iterate over all optional args, until no more arguments
                for (int optArgElement = 0; optArgElement < optArgsCount; currentArgElement++, optArgElement++) {
                    Label noMoreArrayElements = new Label();
                    Label doneWithElement = new Label();

                    // confirm we're not past the end of the array
                    method.dup(); // dup the original array
                    method.arraylength();
                    method.pushInt(currentArgElement);
                    method.if_icmple(noMoreArrayElements); // if length <= start, end loop

                    // extract item from array
                    method.dup(); // dup the original array
                    method.pushInt(currentArgElement); // index for the item
                    method.arrayload();
                    optGivenAssignment.nextValue(methodCompiler, optArgs, optArgElement);
                    method.go_to(doneWithElement);

                    // otherwise no items left available, use the code for default
                    method.label(noMoreArrayElements);
                    optNotGivenAssignment.nextValue(methodCompiler, optArgs, optArgElement);

                    // end of this element
                    method.label(doneWithElement);
                    // normal assignment leaves the value; pop it.
                    method.pop();
                }

                // if there's args left and we want them, assign to rest arg
                if (restAssignment != null) {
                    Label emptyArray = new Label();
                    Label readyForArgs = new Label();

                    // confirm we're not past the end of the array
                    method.dup(); // dup the original array
                    method.arraylength();
                    method.pushInt(currentArgElement);
View Full Code Here

            lastLine = thisLine;
        } else {
            return;
        }

        Label line = new Label();
        method.label(line);
        method.visitLineNumber(thisLine + 1, line);
    }
View Full Code Here

    private void isTrue() {
        invokeIRubyObject("isTrue", sig(Boolean.TYPE));
    }

    public void performBooleanBranch(BranchCallback trueBranch, BranchCallback falseBranch) {
        Label afterJmp = new Label();
        Label falseJmp = new Label();

        // call isTrue on the result
        isTrue();

        method.ifeq(falseJmp); // EQ == 0 (i.e. false)
View Full Code Here

        method.label(afterJmp);
    }

    public void performLogicalAnd(BranchCallback longBranch) {
        Label falseJmp = new Label();

        // dup it since we need to return appropriately if it's false
        method.dup();

        // call isTrue on the result
View Full Code Here

    }

    public void performLogicalOr(BranchCallback longBranch) {
        // FIXME: after jump is not in here.  Will if ever be?
        //Label afterJmp = new Label();
        Label falseJmp = new Label();

        // dup it since we need to return appropriately if it's false
        method.dup();

        // call isTrue on the result
View Full Code Here

        endBody();
    }

    public void performBooleanLoop(BranchCallback condition, final BranchCallback body, boolean checkFirst) {
        Label tryBegin = new Label();
        Label tryEnd = new Label();
        Label catchNext = new Label();
        Label catchBreak = new Label();
        Label endOfBody = new Label();
        Label conditionCheck = new Label();
        final Label topOfBody = new Label();
        Label done = new Label();
        Label normalLoopEnd = new Label();
        method.trycatch(tryBegin, tryEnd, catchNext, p(JumpException.NextJump.class));
        method.trycatch(tryBegin, tryEnd, catchBreak, p(JumpException.BreakJump.class));

        method.label(tryBegin);
        {
View Full Code Here

        loadNil();
        method.label(done);
    }

    public void performBooleanLoopLight(BranchCallback condition, BranchCallback body, boolean checkFirst) {
        Label endOfBody = new Label();
        Label conditionCheck = new Label();
        Label topOfBody = new Label();
        Label done = new Label();

        Label[] oldLoopLabels = currentLoopLabels;

        currentLoopLabels = new Label[]{endOfBody, topOfBody, done};
View Full Code Here

        // in current method, load the field to see if we've created a Pattern yet
        method.aload(StandardASMCompiler.THIS);
        method.getfield(script.getClassname(), regexpField, ci(RubyRegexp.class));

        Label alreadyCreated = new Label();
        method.ifnonnull(alreadyCreated); //[]

        // load string, for Regexp#source and Regexp#inspect
        String regexpString = value.toString();
View Full Code Here

        method.getfield(script.getClassname(), regexpField, ci(RubyRegexp.class));
    }

    public void createNewRegexp(CompilerCallback createStringCallback, final int options) {
        boolean onceOnly = (options & ReOptions.RE_OPTION_ONCE) != 0;   // for regular expressions with the /o flag
        Label alreadyCreated = null;
        String regexpField = null;

        // only alter the code if the /o flag was present
        if (onceOnly) {
            regexpField = script.getNewConstant(ci(RubyRegexp.class), "lit_reg_");

            // in current method, load the field to see if we've created a Pattern yet
            method.aload(StandardASMCompiler.THIS);
            method.getfield(script.getClassname(), regexpField, ci(RubyRegexp.class));

            alreadyCreated = new Label();
            method.ifnonnull(alreadyCreated);
        }

        loadRuntime();
View Full Code Here

TOP

Related Classes of org.objectweb.asm.Label

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.