Source Code Cross Referenced for Interpreter.java in  » Testing » Ejb3Unit » org » ejb3unit » asm » tree » analysis » 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 » Testing » Ejb3Unit » org.ejb3unit.asm.tree.analysis 
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:         */package org.ejb3unit.asm.tree.analysis;
030:
031:        import java.util.List;
032:
033:        import org.ejb3unit.asm.Type;
034:        import org.ejb3unit.asm.tree.AbstractInsnNode;
035:
036:        /**
037:         * A semantic bytecode interpreter. More precisely, this interpreter only
038:         * manages the computation of values from other values: it does not manage the
039:         * transfer of values to or from the stack, and to or from the local variables.
040:         * This separation allows a generic bytecode {@link Analyzer} to work with
041:         * various semantic interpreters, without needing to duplicate the code to
042:         * simulate the transfer of values.
043:         * 
044:         * @author Eric Bruneton
045:         */
046:        public interface Interpreter {
047:
048:            /**
049:             * Creates a new value that represents the given type.
050:             * 
051:             * Called for method parameters (including <code>this</code>), exception
052:             * handler variable and with <code>null</code> type for variables reserved
053:             * by long and double types.
054:             * 
055:             * @param type
056:             *            a primitive or reference type, or <tt>null</tt> to represent
057:             *            an uninitialized value.
058:             * @return a value that represents the given type. The size of the returned
059:             *         value must be equal to the size of the given type.
060:             */
061:            Value newValue(Type type);
062:
063:            /**
064:             * Interprets a bytecode instruction without arguments. This method is
065:             * called for the following opcodes:
066:             * 
067:             * ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4,
068:             * ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0,
069:             * DCONST_1, BIPUSH, SIPUSH, LDC, JSR, GETSTATIC, NEW
070:             * 
071:             * @param insn
072:             *            the bytecode instruction to be interpreted.
073:             * @return the result of the interpretation of the given instruction.
074:             * @throws AnalyzerException
075:             *             if an error occured during the interpretation.
076:             */
077:            Value newOperation(AbstractInsnNode insn) throws AnalyzerException;
078:
079:            /**
080:             * Interprets a bytecode instruction that moves a value on the stack or to
081:             * or from local variables. This method is called for the following opcodes:
082:             * 
083:             * ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE,
084:             * ASTORE, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP
085:             * 
086:             * @param insn
087:             *            the bytecode instruction to be interpreted.
088:             * @param value
089:             *            the value that must be moved by the instruction.
090:             * @return the result of the interpretation of the given instruction. The
091:             *         returned value must be <tt>equal</tt> to the given value.
092:             * @throws AnalyzerException
093:             *             if an error occured during the interpretation.
094:             */
095:            Value copyOperation(AbstractInsnNode insn, Value value)
096:                    throws AnalyzerException;
097:
098:            /**
099:             * Interprets a bytecode instruction with a single argument. This method is
100:             * called for the following opcodes:
101:             * 
102:             * INEG, LNEG, FNEG, DNEG, IINC, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
103:             * F2D, D2I, D2L, D2F, I2B, I2C, I2S, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE,
104:             * TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
105:             * PUTSTATIC, GETFIELD, NEWARRAY, ANEWARRAY, ARRAYLENGTH, ATHROW, CHECKCAST,
106:             * INSTANCEOF, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL
107:             * 
108:             * @param insn
109:             *            the bytecode instruction to be interpreted.
110:             * @param value
111:             *            the argument of the instruction to be interpreted.
112:             * @return the result of the interpretation of the given instruction.
113:             * @throws AnalyzerException
114:             *             if an error occured during the interpretation.
115:             */
116:            Value unaryOperation(AbstractInsnNode insn, Value value)
117:                    throws AnalyzerException;
118:
119:            /**
120:             * Interprets a bytecode instruction with two arguments. This method is
121:             * called for the following opcodes:
122:             * 
123:             * IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IADD,
124:             * LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV,
125:             * LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, ISHL, LSHL, ISHR, LSHR, IUSHR,
126:             * LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LCMP, FCMPL, FCMPG, DCMPL,
127:             * DCMPG, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
128:             * IF_ACMPEQ, IF_ACMPNE, PUTFIELD
129:             * 
130:             * @param insn
131:             *            the bytecode instruction to be interpreted.
132:             * @param value1
133:             *            the first argument of the instruction to be interpreted.
134:             * @param value2
135:             *            the second argument of the instruction to be interpreted.
136:             * @return the result of the interpretation of the given instruction.
137:             * @throws AnalyzerException
138:             *             if an error occured during the interpretation.
139:             */
140:            Value binaryOperation(AbstractInsnNode insn, Value value1,
141:                    Value value2) throws AnalyzerException;
142:
143:            /**
144:             * Interprets a bytecode instruction with three arguments. This method is
145:             * called for the following opcodes:
146:             * 
147:             * IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE
148:             * 
149:             * @param insn
150:             *            the bytecode instruction to be interpreted.
151:             * @param value1
152:             *            the first argument of the instruction to be interpreted.
153:             * @param value2
154:             *            the second argument of the instruction to be interpreted.
155:             * @param value3
156:             *            the third argument of the instruction to be interpreted.
157:             * @return the result of the interpretation of the given instruction.
158:             * @throws AnalyzerException
159:             *             if an error occured during the interpretation.
160:             */
161:            Value ternaryOperation(AbstractInsnNode insn, Value value1,
162:                    Value value2, Value value3) throws AnalyzerException;
163:
164:            /**
165:             * Interprets a bytecode instruction with a variable number of arguments.
166:             * This method is called for the following opcodes:
167:             * 
168:             * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE,
169:             * MULTIANEWARRAY
170:             * 
171:             * @param insn
172:             *            the bytecode instruction to be interpreted.
173:             * @param values
174:             *            the arguments of the instruction to be interpreted.
175:             * @return the result of the interpretation of the given instruction.
176:             * @throws AnalyzerException
177:             *             if an error occured during the interpretation.
178:             */
179:            Value naryOperation(AbstractInsnNode insn, List values)
180:                    throws AnalyzerException;
181:
182:            /**
183:             * Merges two values. The merge operation must return a value that
184:             * represents both values (for instance, if the two values are two types,
185:             * the merged value must be a common super type of the two types. If the two
186:             * values are integer intervals, the merged value must be an interval that
187:             * contains the previous ones. Likewise for other types of values).
188:             * 
189:             * @param v
190:             *            a value.
191:             * @param w
192:             *            another value.
193:             * @return the merged value. If the merged value is equal to <tt>v</tt>,
194:             *         this method <i>must</i> return <tt>v</tt>.
195:             */
196:            Value merge(Value v, Value w);
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.