Source Code Cross Referenced for FrameNode.java in  » IDE » tIDE » org » objectweb » asm » tree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » tIDE » org.objectweb.asm.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ASM: a very small and fast Java bytecode manipulation framework
003:         * Copyright (c) 2000-2005 INRIA, France Telecom
004:         * All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         * 1. Redistributions of source code must retain the above copyright
010:         *    notice, this list of conditions and the following disclaimer.
011:         * 2. Redistributions in binary form must reproduce the above copyright
012:         *    notice, this list of conditions and the following disclaimer in the
013:         *    documentation and/or other materials provided with the distribution.
014:         * 3. Neither the name of the copyright holders nor the names of its
015:         *    contributors may be used to endorse or promote products derived from
016:         *    this software without specific prior written permission.
017:         *
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021:         * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022:         * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023:         * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024:         * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025:         * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026:         * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
028:         * THE POSSIBILITY OF SUCH DAMAGE.
029:         */
030:        package org.objectweb.asm.tree;
031:
032:        import java.util.ArrayList;
033:        import java.util.List;
034:        import java.util.Map;
035:
036:        import org.objectweb.asm.MethodVisitor;
037:        import org.objectweb.asm.Opcodes;
038:
039:        /**
040:         * A node that represents a stack map frame. These nodes are pseudo instruction
041:         * nodes in order to be inserted in an instruction list. In fact these nodes
042:         * must(*) be inserted <i>just before</i> any instruction node <b>i</b> that
043:         * follows an unconditionnal branch instruction such as GOTO or THROW, that is
044:         * the target of a jump instruction, or that starts an exception handler block.
045:         * The stack map frame types must describe the values of the local variables and
046:         * of the operand stack elements <i>just before</i> <b>i</b> is executed. <br>
047:         * <br> (*) this is mandatory only for classes whose version is greater than or
048:         * equal to {@link Opcodes#V1_6 V1_6}.
049:         *
050:         * @author Eric Bruneton
051:         */
052:        @SuppressWarnings("unchecked")
053:        public class FrameNode extends AbstractInsnNode {
054:
055:            /**
056:             * The type of this frame. Must be {@link Opcodes#F_NEW} for expanded
057:             * frames, or {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND},
058:             * {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or
059:             * {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames.
060:             */
061:            public int type;
062:
063:            /**
064:             * The types of the local variables of this stack map frame. Elements of
065:             * this list can be Integer, String or LabelNode objects (for primitive,
066:             * reference and uninitialized types respectively - see
067:             * {@link MethodVisitor}).
068:             */
069:            public List local;
070:
071:            /**
072:             * The types of the operand stack elements of this stack map frame. Elements
073:             * of this list can be Integer, String or LabelNode objects (for primitive,
074:             * reference and uninitialized types respectively - see
075:             * {@link MethodVisitor}).
076:             */
077:            public List stack;
078:
079:            private FrameNode() {
080:                super (-1);
081:            }
082:
083:            /**
084:             * Constructs a new {@link FrameNode}.
085:             *
086:             * @param type the type of this frame. Must be {@link Opcodes#F_NEW} for
087:             *        expanded frames, or {@link Opcodes#F_FULL},
088:             *        {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP},
089:             *        {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND},
090:             *        {@link Opcodes#F_SAME1} for compressed frames.
091:             * @param nLocal number of local variables of this stack map frame.
092:             * @param local the types of the local variables of this stack map frame.
093:             *        Elements of this list can be Integer, String or LabelNode objects
094:             *        (for primitive, reference and uninitialized types respectively -
095:             *        see {@link MethodVisitor}).
096:             * @param nStack number of operand stack elements of this stack map frame.
097:             * @param stack the types of the operand stack elements of this stack map
098:             *        frame. Elements of this list can be Integer, String or LabelNode
099:             *        objects (for primitive, reference and uninitialized types
100:             *        respectively - see {@link MethodVisitor}).
101:             */
102:            public FrameNode(final int type, final int nLocal,
103:                    final Object[] local, final int nStack, final Object[] stack) {
104:                super (-1);
105:                this .type = type;
106:                switch (type) {
107:                case Opcodes.F_NEW:
108:                case Opcodes.F_FULL:
109:                    this .local = asList(nLocal, local);
110:                    this .stack = asList(nStack, stack);
111:                    break;
112:                case Opcodes.F_APPEND:
113:                    this .local = asList(nLocal, local);
114:                    break;
115:                case Opcodes.F_CHOP:
116:                    this .local = asList(nLocal, new Object[nLocal]);
117:                    break;
118:                case Opcodes.F_SAME:
119:                    break;
120:                case Opcodes.F_SAME1:
121:                    this .stack = asList(1, stack);
122:                    break;
123:                }
124:            }
125:
126:            public int getType() {
127:                return FRAME;
128:            }
129:
130:            /**
131:             * Makes the given visitor visit this stack map frame.
132:             *
133:             * @param mv a method visitor.
134:             */
135:            public void accept(final MethodVisitor mv) {
136:                switch (type) {
137:                case Opcodes.F_NEW:
138:                case Opcodes.F_FULL:
139:                    mv.visitFrame(type, local.size(), asArray(local), stack
140:                            .size(), asArray(stack));
141:                    break;
142:                case Opcodes.F_APPEND:
143:                    mv.visitFrame(type, local.size(), asArray(local), 0, null);
144:                    break;
145:                case Opcodes.F_CHOP:
146:                    mv.visitFrame(type, local.size(), null, 0, null);
147:                    break;
148:                case Opcodes.F_SAME:
149:                    mv.visitFrame(type, 0, null, 0, null);
150:                    break;
151:                case Opcodes.F_SAME1:
152:                    mv.visitFrame(type, 0, null, 1, asArray(stack));
153:                    break;
154:                }
155:            }
156:
157:            public AbstractInsnNode clone(final Map labels) {
158:                FrameNode clone = new FrameNode();
159:                clone.type = type;
160:                if (local != null) {
161:                    clone.local = new ArrayList();
162:                    for (int i = 0; i < local.size(); ++i) {
163:                        Object l = local.get(i);
164:                        if (l instanceof  LabelNode) {
165:                            l = labels.get(l);
166:                        }
167:                        clone.local.add(l);
168:                    }
169:                }
170:                if (stack != null) {
171:                    clone.stack = new ArrayList();
172:                    for (int i = 0; i < stack.size(); ++i) {
173:                        Object s = stack.get(i);
174:                        if (s instanceof  LabelNode) {
175:                            s = labels.get(s);
176:                        }
177:                        clone.stack.add(s);
178:                    }
179:                }
180:                return clone;
181:            }
182:
183:            // ------------------------------------------------------------------------
184:
185:            private static List asList(final int n, final Object[] o) {
186:                List l = new ArrayList(n);
187:                for (int i = 0; i < n; ++i) {
188:                    l.add(o[i]);
189:                }
190:                return l;
191:            }
192:
193:            private static Object[] asArray(final List l) {
194:                Object[] objs = new Object[l.size()];
195:                for (int i = 0; i < objs.length; ++i) {
196:                    Object o = l.get(i);
197:                    if (o instanceof  LabelNode) {
198:                        o = ((LabelNode) o).getLabel();
199:                    }
200:                    objs[i] = o;
201:                }
202:                return objs;
203:            }
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.