Source Code Cross Referenced for FieldInstruction.java in  » Code-Analyzer » javapathfinder » gov » nasa » jpf » jvm » bytecode » 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 » Code Analyzer » javapathfinder » gov.nasa.jpf.jvm.bytecode 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //
002:        // Copyright (C) 2005 United States Government as represented by the
003:        // Administrator of the National Aeronautics and Space Administration
004:        // (NASA).  All Rights Reserved.
005:        // 
006:        // This software is distributed under the NASA Open Source Agreement
007:        // (NOSA), version 1.3.  The NOSA has been approved by the Open Source
008:        // Initiative.  See the file NOSA-1.3-JPF at the top of the distribution
009:        // directory tree for the complete NOSA document.
010:        // 
011:        // THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
012:        // KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
013:        // LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
014:        // SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
015:        // A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
016:        // THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
017:        // DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
018:        //
019:        package gov.nasa.jpf.jvm.bytecode;
020:
021:        import gov.nasa.jpf.Config;
022:        import gov.nasa.jpf.JPFException;
023:        import gov.nasa.jpf.jvm.ElementInfo;
024:        import gov.nasa.jpf.jvm.ThreadInfo;
025:        import gov.nasa.jpf.jvm.ClassInfo;
026:
027:        import org.apache.bcel.classfile.ConstantPool;
028:        import org.apache.bcel.generic.ConstantPoolGen;
029:        import org.apache.bcel.generic.Type;
030:        import org.apache.bcel.generic.ReferenceType;
031:        import gov.nasa.jpf.jvm.FieldInfo;
032:        import gov.nasa.jpf.jvm.FieldLockInfo;
033:
034:        /**
035:         * parent class for PUT/GET FIELD/STATIC insns
036:         *
037:         * <2do> there is a inheritance level missing to deal with instance/static
038:         * fields - w/o the instance/static helper methods we would have to duplicate
039:         * code in the getters/setters
040:         */
041:        public abstract class FieldInstruction extends Instruction implements 
042:                VariableAccessor {
043:            static FieldLockInfo prototype; //optimization measure
044:
045:            protected String fname;
046:            protected String className;
047:            protected String varId;
048:
049:            protected FieldInfo fi; // lazy eval, hence not public
050:
051:            protected int size;
052:            protected boolean isReferenceField;
053:
054:            public static void init(Config config) throws Config.Exception {
055:                if (config.getBoolean("vm.por")
056:                        && config.getBoolean("vm.por.sync_detection")) {
057:                    prototype = (FieldLockInfo) config.getEssentialInstance(
058:                            "vm.por.fieldlockinfo.class", FieldLockInfo.class);
059:                }
060:            }
061:
062:            public void setPeer(org.apache.bcel.generic.Instruction i,
063:                    ConstantPool cp) {
064:                org.apache.bcel.generic.FieldInstruction fi;
065:                ConstantPoolGen cpg;
066:
067:                fi = (org.apache.bcel.generic.FieldInstruction) i;
068:                cpg = ClassInfo.getConstantPoolGen(cp);
069:
070:                fname = fi.getFieldName(cpg);
071:                className = fi.getClassName(cpg);
072:
073:                Type ft = fi.getFieldType(cpg);
074:                if (ft instanceof  ReferenceType) {
075:                    isReferenceField = true;
076:                }
077:
078:                size = ft.getSize();
079:            }
080:
081:            public abstract FieldInfo getFieldInfo();
082:
083:            public boolean isReferenceField() {
084:                return isReferenceField;
085:            }
086:
087:            public String getId(ElementInfo ei) {
088:                // <2do> - OUTCH, should be optimized
089:                return (ei.toString() + '.' + fname);
090:            }
091:
092:            public String getVariableId() {
093:                if (varId == null) {
094:                    varId = className + '.' + fname;
095:                }
096:                return varId;
097:            }
098:
099:            /**
100:             * is this field supposed to be protected by a lock?
101:             * this only gets called if on-the-fly POR is in effect
102:             */
103:            protected boolean isLockProtected(ElementInfo ei, ThreadInfo ti) {
104:                String id = getId(ei);
105:                FieldLockInfo flInfo = ei.getFieldLockInfo(id);
106:                FieldLockInfo flInfoNext;
107:
108:                FieldInfo fi = getFieldInfo(); // so that we make sure it's computed
109:
110:                if (flInfo == null) {
111:                    try {
112:                        flInfoNext = (FieldLockInfo) prototype.clone();
113:                    } catch (Exception x) {
114:                        throw new JPFException(x); // pretty lame error handling here
115:                    }
116:                } else {
117:                    flInfoNext = flInfo.checkProtection(ei, fi, ti);
118:                }
119:
120:                if (flInfoNext != flInfo) {
121:                    ei.setFieldLockInfo(id, flInfoNext);
122:                }
123:
124:                return flInfoNext.isProtected();
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.