jtulach@144: /* jtulach@144: * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. jtulach@144: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jtulach@144: * jtulach@144: * This code is free software; you can redistribute it and/or modify it jtulach@144: * under the terms of the GNU General Public License version 2 only, as jtulach@144: * published by the Free Software Foundation. Oracle designates this jtulach@144: * particular file as subject to the "Classpath" exception as provided jtulach@144: * by Oracle in the LICENSE file that accompanied this code. jtulach@144: * jtulach@144: * This code is distributed in the hope that it will be useful, but WITHOUT jtulach@144: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jtulach@144: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jtulach@144: * version 2 for more details (a copy is included in the LICENSE file that jtulach@144: * accompanied this code). jtulach@144: * jtulach@144: * You should have received a copy of the GNU General Public License version jtulach@144: * 2 along with this work; if not, write to the Free Software Foundation, jtulach@144: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jtulach@144: * jtulach@144: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jtulach@144: * or visit www.oracle.com if you need additional information or have any jtulach@144: * questions. jtulach@144: */ jtulach@144: jtulach@144: jtulach@167: package org.apidesign.javap; jtulach@144: jtulach@144: import java.util.*; jtulach@144: import java.io.*; jtulach@144: jtulach@167: import static org.apidesign.javap.RuntimeConstants.*; jtulach@144: jtulach@144: /* represents one entry of StackMap attribute jtulach@144: */ jtulach@144: class StackMapData { jtulach@144: final int offset; jtulach@144: final int[] locals; jtulach@144: final int[] stack; jtulach@144: jtulach@144: StackMapData(int offset, int[] locals, int[] stack) { jtulach@144: this.offset = offset; jtulach@144: this.locals = locals; jtulach@144: this.stack = stack; jtulach@144: } jtulach@144: jtulach@144: StackMapData(DataInputStream in, MethodData method) throws IOException { jtulach@144: offset = in.readUnsignedShort(); jtulach@144: int local_size = in.readUnsignedShort(); jtulach@144: locals = readTypeArray(in, local_size, method); jtulach@144: int stack_size = in.readUnsignedShort(); jtulach@144: stack = readTypeArray(in, stack_size, method); jtulach@144: } jtulach@144: jtulach@144: static final int[] readTypeArray(DataInputStream in, int length, MethodData method) throws IOException { jtulach@144: int[] types = new int[length]; jtulach@144: for (int i=0; i