All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.jdo.api.persistence.enhancer.classfile.InsnTableSwitch Maven / Gradle / Ivy

/*
 * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

package com.sun.jdo.api.persistence.enhancer.classfile;


import java.io.PrintStream;

/**
 * Special instruction form for the opc_tableswitch instruction
 */
public class InsnTableSwitch extends Insn {
    /* The lowest value in the jump table */
    private int lowOp;

    /* The default target for the switch */
    private InsnTarget defaultOp;

    /* The targets for the switch - a switch value of lowOp dispatches
     * to targetsOp[0], lowOp+1 dispatches to targetsOp[1], etc. */
    private InsnTarget[] targetsOp;

    /* public accessors */

    public int nStackArgs() {
        return 1;
    }

    public int nStackResults() {
        return 0;
    }

    public String argTypes() {
        return "I";//NOI18N
    }

    public String resultTypes() {
        return "";//NOI18N
    }

    public boolean branches() {
        return true;
    }

    /**
     * Mark possible branch targets
     */
    public void markTargets() {
        defaultOp.setBranchTarget();
        for (int i=0; i " + targetsOp[i].offset());//NOI18N
            }
        }
        ClassPrint.spaces(out, indent+2);
        out.println("default -> " + defaultOp.offset());//NOI18N
    }

    int store(byte[] buf, int index) {
        buf[index++] = (byte) opcode();
        index = (index + 3) & ~3;
        index = storeInt(buf, index, defaultOp.offset() - offset());
        index = storeInt(buf, index, lowOp);
        index = storeInt(buf, index, lowOp+targetsOp.length-1);
        for (int i=0; i 0; pads--)
            insnEnv.getByte();
        InsnTarget defaultTarget = insnEnv.getTarget(insnEnv.getInt() + myPC);
        int low = insnEnv.getInt();
        int high = insnEnv.getInt();
        InsnTarget[] offsets = new InsnTarget[high - low + 1];
        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy