KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > coffi > Instruction_Multianewarray


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1997 Clark Verbrugge
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /*
21  * Modified by the Sable Research Group and others 1997-1999.
22  * See the 'credits' file distributed with Soot for the complete list of
23  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24  */

25
26
27
28
29
30
31
32 package soot.coffi;
33 import java.io.*;
34 /** Instruction subclasses are used to represent parsed bytecode; each
35  * bytecode operation has a corresponding subclass of Instruction.
36  * <p>
37  * Each subclass is derived from one of
38  * <ul><li>Instruction</li>
39  * <li>Instruction_noargs (an Instruction with no embedded arguments)</li>
40  * <li>Instruction_byte (an Instruction with a single byte data argument)</li>
41  * <li>Instruction_bytevar (a byte argument specifying a local variable)</li>
42  * <li>Instruction_byteindex (a byte argument specifying a constant pool index)</li>
43  * <li>Instruction_int (an Instruction with a single short data argument)</li>
44  * <li>Instruction_intvar (a short argument specifying a local variable)</li>
45  * <li>Instruction_intindex (a short argument specifying a constant pool index)</li>
46  * <li>Instruction_intbranch (a short argument specifying a code offset)</li>
47  * <li>Instruction_longbranch (an int argument specifying a code offset)</li>
48  * </ul>
49  * @author Clark Verbrugge
50  * @see Instruction
51  * @see Instruction_noargs
52  * @see Instruction_byte
53  * @see Instruction_bytevar
54  * @see Instruction_byteindex
55  * @see Instruction_int
56  * @see Instruction_intvar
57  * @see Instruction_intindex
58  * @see Instruction_intbranch
59  * @see Instruction_longbranch
60  * @see Instruction_Unknown
61  */

62 class Instruction_Multianewarray extends Instruction_intindex {
63    public byte dims;
64    public Instruction_Multianewarray() {
65       super((byte)ByteCode.MULTIANEWARRAY);
66       name = "multianewarray";
67    }
68    public String JavaDoc toString(cp_info constant_pool[]) {
69       return super.toString(constant_pool) + argsep + dims;
70    }
71    public int nextOffset(int curr) { return super.nextOffset(curr)+1; }
72    public int parse(byte bc[],int index) {
73       index = super.parse(bc,index);
74       dims = bc[index];
75       return index+1;
76    }
77    public int compile(byte bc[],int index) {
78       index = super.compile(bc,index);
79       bc[index] = dims;
80       return index+1;
81    }
82 }
83
Popular Tags