1 package gov.nasa.jpf.jvm; 20 21 import gov.nasa.jpf.*; 22 import gov.nasa.jpf.jvm.bytecode.Instruction; 23 import gov.nasa.jpf.util.*; 24 import gov.nasa.jpf.util.Debug; 25 26 import java.io.*; 27 28 import java.util.*; 29 30 import org.apache.bcel.classfile.*; 31 import org.apache.bcel.util.SyntheticRepository; 32 import org.apache.bcel.generic.ConstantPoolGen; 33 34 35 40 public class ClassInfo { 41 46 protected static SyntheticRepository repository; 47 48 51 protected static Hashtable loadedClasses; 52 53 56 protected static Attributor attributor; 57 58 62 static ClassInfo classClassInfo; 63 64 67 static ClassInfo objectClassInfo; 68 static ClassInfo stringClassInfo; 69 static ClassInfo weakRefClassInfo; 70 static ClassInfo refClassInfo; 71 72 static FieldInfo[] emptyFields = new FieldInfo[0]; 73 74 81 static int level; 82 83 86 protected final String name; 87 88 protected boolean isClass = true; 90 protected boolean isWeakReference = false; 91 protected MethodInfo finalizer = null; 92 protected boolean isArray = false; 93 protected boolean isReferenceArray = false; 94 95 96 99 protected int elementInfoAttrs = 0; 100 101 105 protected final Map methods; 106 107 111 protected FieldInfo[] iFields; 112 113 114 protected int instanceDataSize; 115 116 117 protected int instanceDataOffset; 118 119 120 protected int nInstanceFields; 121 122 125 protected FieldInfo[] sFields; 126 127 128 protected int staticDataSize; 129 130 protected final ClassInfo superClass; 131 132 135 protected final Set interfaces; 136 137 138 protected Set allInterfaces; 139 140 141 protected final String packageName; 142 143 144 protected String sourceFileName; 145 146 151 NativePeer nativePeer; 152 153 154 protected Source source; 155 156 static String [] assertionPatterns; 157 boolean enableAssertions; 158 159 static boolean init (Config config) throws Config.Exception { 160 loadedClasses = new Hashtable(); 161 classClassInfo = null; 162 objectClassInfo = null; 163 stringClassInfo = null; 164 weakRefClassInfo = null; 165 166 setSourceRoots(config); 167 repository = createRepository(config); 168 169 attributor = (Attributor)config.getEssentialInstance("vm.attributor.class", 170 Attributor.class); 171 172 assertionPatterns = config.getStringArray("vm.enable_assertions"); 173 174 return true; 175 } 176 177 181 protected ClassInfo (String builtinClassName) { 182 isArray = (builtinClassName.charAt(0) == '['); 183 isReferenceArray = isArray && builtinClassName.endsWith(";"); 184 185 name = builtinClassName; 186 187 Debug.print(Debug.DEBUG, "generating builtin class "); 188 Debug.println(Debug.DEBUG, name); 189 190 packageName = ""; sourceFileName = null; 192 source = null; 193 194 iFields = emptyFields; 196 sFields = emptyFields; 197 198 if (isArray) { 199 superClass = objectClassInfo; 200 interfaces = loadArrayInterfaces(); 201 methods = loadArrayMethods(); 202 } else { 203 superClass = null; interfaces = loadBuiltinInterfaces(name); 205 methods = loadBuiltinMethods(name); 206 } 207 208 enableAssertions = true; 210 loadedClasses.put(name, this); 211 } 212 213 216 protected ClassInfo (JavaClass jc) { 217 name = jc.getClassName(); 218 219 Debug.print(Debug.DEBUG, "loading class "); 220 Debug.println(Debug.DEBUG, name); 221 222 loadedClasses.put(name, this); 223 224 if ((objectClassInfo == null) && name.equals("java.lang.Object")) { 225 objectClassInfo = this; 226 } else if ((classClassInfo == null) && name.equals("java.lang.Class")) { 227 classClassInfo = this; 228 } else if ((stringClassInfo == null) && name.equals("java.lang.String")) { 229 stringClassInfo = this; 230 } else if ((weakRefClassInfo == null) && 231 name.equals("java.lang.ref.WeakReference")) { 232 weakRefClassInfo = this; 233 } else if ((refClassInfo == null) && name.equals("java.lang.ref.Reference")) { 234 refClassInfo = this; 235 } 236 237 isClass = jc.isClass(); 238 superClass = loadSuperClass(jc); 239 240 interfaces = loadInterfaces(jc); 241 packageName = jc.getPackageName(); 242 243 iFields = loadInstanceFields(jc); 244 instanceDataSize = computeInstanceDataSize(); 245 instanceDataOffset = computeInstanceDataOffset(); 246 nInstanceFields = (superClass != null) ? 247 superClass.nInstanceFields + iFields.length : iFields.length; 248 249 sFields = loadStaticFields(jc); 250 staticDataSize = computeStaticDataSize(); 251 252 methods = loadMethods(jc); 253 254 nativePeer = NativePeer.getNativePeer(this); 259 260 sourceFileName = jc.getSourceFileName(); 261 262 if (sourceFileName.equalsIgnoreCase("<Unknown>")) { 265 sourceFileName = "Unkown"; 266 } 267 268 if (packageName.length() > 0) { 269 sourceFileName = packageName.replace('.', File.separatorChar) + 270 File.separator + sourceFileName; 271 } 272 273 source = null; 274 275 isWeakReference = isWeakReference0(); 276 finalizer = getFinalizer0(); 277 278 elementInfoAttrs = loadElementInfoAttrs(jc); 280 281 285 enableAssertions = getAssertionStatus(); 286 287 JVM.getVM().notifyClassLoaded(this); 289 } 290 291 boolean getAssertionStatus () { 292 if ((assertionPatterns == null) || (assertionPatterns.length == 0)){ 293 return false; 294 } else if ("*".equals(assertionPatterns[0])) { 295 return true; 296 } else { 297 for (int i=0; i<assertionPatterns.length; i++) { 298 if (name.matches(assertionPatterns[i])) { return true; 300 } 301 } 302 303 return false; 304 } 305 } 306 307 public boolean isArray () { 308 return isArray; 309 } 310 311 public boolean isReferenceArray () { 312 return isReferenceArray; 313 } 314 315 321 public static synchronized ClassInfo getClassInfo (String cname) { 322 JavaClass jc = null; 323 324 if (cname == null) { 325 return null; 326 } 327 328 cname = cname.replace('/', '.'); 329 330 ClassInfo ci = (ClassInfo) loadedClasses.get(cname); 331 332 if (ci == null) { 333 if (isBuiltinClass(cname)) { 334 ci = new ClassInfo(cname); 337 } else { 338 try { 339 jc = repository.loadClass(cname); 340 } catch (ClassNotFoundException x) { 341 throw new JPFException("could not load class " + cname); 342 } 343 344 repository.clear(); 348 349 ci = new ClassInfo(jc); 350 } 351 } 352 353 return ci; 354 } 355 356 public boolean areAssertionsEnabled() { 357 return enableAssertions; 358 } 359 360 public int getClassObjectRef () { 361 StaticArea sa = JVM.getVM().getStaticArea(); 366 367 StaticElementInfo sei = sa.get(name); 369 370 return (sei != null) ? sei.getClassObjectRef() : -1; 371 } 372 373 384 public MethodInfo getMethod (String uniqueName, boolean isRecursiveLookup) { 385 MethodInfo mi = null; 386 387 if (uniqueName.charAt(uniqueName.length() - 1) != ')') { 388 uniqueName = uniqueName.substring(0, uniqueName.indexOf(')') + 1); 390 } 391 392 mi = (MethodInfo) methods.get(uniqueName); 393 394 if ((mi == null) && isRecursiveLookup && (superClass != null)) { 395 mi = superClass.getMethod(uniqueName, true); 396 } 397 398 return mi; 399 } 400 401 public FieldInfo getStaticField (String clsBase, String fName) { 402 FieldInfo fi; 403 ClassInfo c = getClassBase(clsBase); 404 405 while (c != null) { 406 fi = c.getDeclaredStaticField(fName); 407 if (fi != null) return fi; 408 c = c.superClass; 409 } 410 411 return null; 412 } 413 414 public FieldInfo getStaticField (String fname) { 415 return getStaticField(null, fname); 416 } 417 418 423 public FieldInfo getDeclaredStaticField (String fName) { 424 for (int i=0; i<sFields.length; i++) { 425 if (sFields[i].getName().equals(fName)) return sFields[i]; 426 } 427 428 return null; 429 } 430 431 437 public FieldInfo getInstanceField (String clsBase, String fName) { 438 FieldInfo fi; 439 ClassInfo c = getClassBase(clsBase); 440 441 while (c != null) { 442 fi = c.getDeclaredInstanceField(fName); 443 if (fi != null) return fi; 444 c = c.superClass; 445 } 446 447 return null; 448 } 449 450 453 public FieldInfo getInstanceField (String fName) { 454 return getInstanceField(null, fName); 455 } 456 457 460 public FieldInfo getDeclaredInstanceField (String fName) { 461 for (int i=0; i<iFields.length; i++) { 462 if (iFields[i].getName().equals(fName)) return iFields[i]; 463 } 464 465 return null; 466 } 467 468 469 472 public boolean isMethodCondDeterministic (ThreadInfo th, MethodInfo mi) { 473 if (nativePeer != null) { 474 return nativePeer.isMethodCondDeterministic(th, mi); 475 } 476 477 return false; 478 } 479 480 483 public boolean isMethodCondExecutable (ThreadInfo th, MethodInfo mi) { 484 if (nativePeer != null) { 485 return nativePeer.isMethodCondExecutable(th, mi); 486 } 487 488 return false; 489 } 490 491 494 public String getName () { 495 return name; 496 } 497 498 public String getPackageName () { 499 return packageName; 500 } 501 502 public int getFieldAttrs (int fieldIndex) { 503 return 0; 504 } 505 506 public int getElementInfoAttrs () { 507 return elementInfoAttrs; 508 } 509 510 public Source getSource () { 511 if (source == null) { 512 source = loadSource(); 513 } 514 515 return source; 516 } 517 518 public String getSourceFileName () { 519 return sourceFileName; 520 } 521 522 525 public FieldInfo getStaticField (int index) { 526 return sFields[index]; 527 } 528 529 532 public String getStaticFieldName (int index) { 533 return getStaticField(index).getName(); 534 } 535 536 540 public boolean isStaticMethodAbstractionDeterministic (ThreadInfo th, 541 MethodInfo mi) { 542 return true; 546 } 547 548 551 public ClassInfo getSuperClass () { 552 return superClass; 553 } 554 555 559 public ClassInfo getSuperClass (String clsName) { 560 if (clsName.equals(name)) return this; 561 562 if (superClass != null) { 563 return superClass.getSuperClass(clsName); 564 } else { 565 return null; 566 } 567 } 568 569 public boolean isInstanceOf (ClassInfo ci) { 570 ClassInfo c = this; 571 do { 572 if (c == ci) { 573 return true; 574 } 575 c = c.superClass; 576 } while (c != null); 577 578 return false; 579 } 580 581 584 public boolean isSystemClass () { 585 return name.startsWith("java.") || name.startsWith("javax."); 586 } 587 588 591 public String getType () { 592 return "L" + name.replace('.', '/') + ";"; 593 } 594 595 599 public boolean isWeakReference () { 600 return isWeakReference; 601 } 602 603 606 public boolean isRefClass () { 607 return (this == refClassInfo); 608 } 609 610 613 public Fields createInstanceFields () { 614 return new DynamicFields(getType(), this); 615 } 616 617 boolean hasRefField (int ref, Fields fv) { 618 ClassInfo c = this; 619 620 do { 621 FieldInfo[] fia = c.iFields; 622 for (int i=0; i<fia.length; i++) { 623 FieldInfo fi = c.iFields[i]; 624 if (fi.isReference() && (fv.getIntValue( fi.getStorageOffset()) == ref)) return true; 625 } 626 c = c.superClass; 627 } while (c != null); 628 629 return false; 630 } 631 632 boolean hasImmutableInstances () { 633 return ((elementInfoAttrs & ElementInfo.ATTR_IMMUTABLE) != 0); 634 } 635 636 public Instruction executeNativeMethod (ThreadInfo th, MethodInfo mi) { 637 if (nativePeer != null) { 638 return nativePeer.executeMethod(th, mi); 639 } 640 641 return th.createAndThrowException("java.lang.UnsatisfiedLinkError", 642 name + '.' + mi.getName() + 643 " (no peer)"); 644 } 645 646 public static boolean exists (String cname) { 647 return (repository.findClass(cname) != null); 650 } 651 652 public void initializeClass (ThreadInfo th) { 653 if (th == null) { 654 return; } 656 657 Debug.print(Debug.DEBUG, "initializing class "); 658 Debug.println(Debug.DEBUG, name); 659 660 MethodInfo mi = getMethod("<clinit>()", false); 662 if (mi != null) { 663 th.executeMethod(mi); 666 } 668 } 669 670 674 public boolean instanceOf (String cname) { 675 cname = cname.replace('/', '.'); 676 677 if (name.equals(cname)) { 679 return true; 680 } 681 682 if ((superClass != null) && (superClass.instanceOf(cname))) { 684 return true; 685 } 686 687 if (interfaces.contains(cname)) { 689 return true; 690 } 691 692 if (getAllInterfaces().contains(cname)) { 694 return true; 695 } 696 697 return false; 699 } 700 701 704 public static void reset () { 705 if (repository != null) { 706 repository.clear(); 707 } 708 709 loadedClasses = new Hashtable(); 710 711 classClassInfo = null; 712 objectClassInfo = null; 713 stringClassInfo = null; 714 } 715 716 720 static String getDefaultBootClassPath () { 721 StringBuffer sb = new StringBuffer (); 722 723 sb.append("build"); 725 sb.append(File.separatorChar); 726 sb.append("env"); 727 sb.append(File.separatorChar); 728 sb.append("jpf"); 729 730 sb.append(File.pathSeparatorChar); 732 sb.append("lib"); 733 sb.append(File.separatorChar); 734 sb.append("env_jpf.jar"); 735 736 return sb.toString(); 737 } 738 739 742 static String getDefaultClassPath () { 743 return null; 744 } 745 746 protected static SyntheticRepository createRepository (Config config) { 747 org.apache.bcel.util.ClassPath cpath; 751 StringBuffer buf = new StringBuffer (128); 752 String sep = System.getProperty("path.separator"); 753 String v; 754 755 if ( (v = config.getExpandedString("vm.bootclasspath")) == null) { 757 v = getDefaultBootClassPath(); 758 } 759 buf.append(v); 760 761 if ( (v = config.getExpandedString("vm.classpath")) == null) { 763 v = getDefaultClassPath(); 764 } 765 766 if (v != null) { 767 buf.append(sep); 768 buf.append(v); 769 } 770 771 if (buf.length() > 0) { 774 buf.append(sep); 775 } 776 777 buf.append(System.getProperty("java.class.path")); 778 779 if (buf.length() > 0) { 781 buf.append(sep); 782 } 783 784 buf.append(System.getProperty("sun.boot.class.path")); 785 786 cpath = new org.apache.bcel.util.ClassPath(buf.toString()); 787 788 return SyntheticRepository.getInstance(cpath); 789 } 790 791 protected static Set loadArrayInterfaces () { 792 Set interfaces; 793 794 interfaces = new HashSet(); 795 interfaces.add("java.lang.Cloneable"); 796 interfaces.add("java.io.Serializable"); 797 798 return Collections.unmodifiableSet(interfaces); 799 } 800 801 protected static Set loadBuiltinInterfaces (String type) { 802 return Collections.unmodifiableSet(new HashSet(0)); 803 } 804 805 808 protected static Set loadInterfaces (JavaClass jc) { 809 Set interfaces; 810 String [] interfaceNames; 811 812 interfaceNames = jc.getInterfaceNames(); 813 interfaces = new HashSet(); 814 815 for (int i = 0, l = interfaceNames.length; i < l; i++) { 816 interfaces.add(interfaceNames[i]); 817 } 818 819 return Collections.unmodifiableSet(interfaces); 820 } 821 822 FieldInfo[] loadInstanceFields (JavaClass jc) { 823 Field[] fields = jc.getFields(); 824 int i, j, n; 825 int off = (superClass != null) ? superClass.instanceDataSize : 0; 826 827 for (i=0, n=0; i<fields.length; i++) { 828 if (!fields[i].isStatic()) n++; 829 } 830 831 int idx = (superClass != null) ? superClass.nInstanceFields : 0; 832 FieldInfo[] ifa = new FieldInfo[n]; 833 834 for (i=0, j=0; i<fields.length; i++) { 835 Field f = fields[i]; 836 if (!f.isStatic()) { 837 FieldInfo fi = FieldInfo.create(f, this, idx, off); 838 ifa[j++] = fi; 839 off += fi.getStorageSize(); 840 idx++; 841 842 if (attributor != null) { 843 fi.setAttributes( attributor.getFieldAttributes(jc, f)); 844 } 845 } 846 } 847 848 return ifa; 849 } 850 851 int computeInstanceDataOffset () { 852 if (superClass == null) { 853 return 0; 854 } else { 855 return superClass.getInstanceDataSize(); 856 } 857 } 858 859 int getInstanceDataOffset () { 860 return instanceDataOffset; 861 } 862 863 ClassInfo getClassBase (String clsBase) { 864 if ((clsBase == null) || (name.equals(clsBase))) return this; 865 866 if (superClass != null) { 867 return superClass.getClassBase(clsBase); 868 } 869 870 return null; } 872 873 int computeInstanceDataSize () { 874 int n = getDataSize( iFields); 875 876 for (ClassInfo c=superClass; c!= null; c=c.superClass) { 877 n += c.getDataSize(c.iFields); 878 } 879 880 return n; 881 } 882 883 int getInstanceDataSize () { 884 return instanceDataSize; 885 } 886 887 int getDataSize (FieldInfo[] fields) { 888 int n=0; 889 for (int i=0; i<fields.length; i++) { 890 n += fields[i].getStorageSize(); 891 } 892 893 return n; 894 } 895 896 public int getNumberOfDeclaredInstanceFields () { 897 return iFields.length; 898 } 899 900 FieldInfo getDeclaredInstanceField (int i) { 901 return iFields[i]; 902 } 903 904 public int getNumberOfInstanceFields () { 905 return nInstanceFields; 906 } 907 908 FieldInfo getInstanceField (int i) { 909 int idx = i - (nInstanceFields - iFields.length); 910 if (idx >= 0) { 911 return ((idx < iFields.length) ? iFields[idx] : null); 912 } else { 913 return ((superClass != null) ? superClass.getInstanceField(i) : null); 914 } 915 } 916 917 FieldInfo[] loadStaticFields (JavaClass jc) { 918 Field[] fields = jc.getFields(); 919 int i, j, n; 920 int off = 0; 921 922 for (i=0, n=0; i<fields.length; i++) { 923 if (fields[i].isStatic()) n++; 924 } 925 926 FieldInfo[] sfa = new FieldInfo[n]; 927 int idx = 0; 928 929 for (i=0; i<fields.length; i++) { 930 Field f = fields[i]; 931 if (f.isStatic()) { 932 FieldInfo fi = FieldInfo.create(f, this, idx, off); 933 sfa[idx] = fi; 934 idx++; 935 off += fi.getStorageSize(); 936 } 937 } 938 939 return sfa; 940 } 941 942 int getStaticDataSize () { 943 return staticDataSize; 944 } 945 946 int computeStaticDataSize () { 947 return getDataSize(sFields); 948 } 949 950 public int getNumberOfStaticFields () { 951 return sFields.length; 952 } 953 954 protected Source loadSource () { 955 return Source.getSource(sourceFileName); 956 } 957 958 static boolean isBuiltinClass (String cname) { 959 char c = cname.charAt(0); 960 961 if (c == '[') { 963 return true; 964 } 965 966 if (Character.isLowerCase(c)) { 968 if ("int".equals(cname) || "byte".equals(cname) || 969 "boolean".equals(cname) || "double".equals(cname) || 970 "long".equals(cname) || "char".equals(cname) || 971 "short".equals(cname) || "float".equals(cname)) { 972 return true; 973 } 974 } 975 976 return false; 977 } 978 979 982 static void setSourceRoots (Config config) { 983 String srcPath = config.getExpandedString("vm.sourcepath"); 984 if (srcPath == null) { Source.addSourceRoot("examples"); 986 Source.addSourceRoot("test"); 987 } else { 988 StringTokenizer st = new StringTokenizer(srcPath, File.pathSeparator); 989 while (st.hasMoreTokens()) { 990 String sroot = st.nextToken(); 991 992 if ((sroot.length() > 0) && !sroot.endsWith(".jar")) { 993 Source.addSourceRoot(sroot); 994 } 995 } 996 } 997 } 998 999 Set getAllInterfaces () { 1000 if (allInterfaces == null) { 1001 HashSet set = new HashSet(); 1002 1003 1004 loadInterfaceRec(set, this); 1006 1007 1008 loadInterfaceRec(set, superClass); 1010 1011 allInterfaces = Collections.unmodifiableSet(set); 1012 } 1013 1014 return allInterfaces; 1015 } 1016 1017 ClassInfo getComponentClassInfo () { 1018 if (isArray()) { 1019 String cn = name.substring(1); 1020 1021 if (cn.charAt(0) != '[') { 1022 cn = Types.getTypeName(cn); 1023 } 1024 1025 ClassInfo cci = getClassInfo(cn); 1026 1027 return cci; 1028 } 1029 1030 return null; 1031 } 1032 1033 1036 Map getDeclaredMethods () { 1037 return methods; 1038 } 1039 1040 MethodInfo getFinalizer () { 1041 return finalizer; 1042 } 1043 1044 int createClassObject (ThreadInfo th, int cref) { 1045 int objref; 1046 int cnref; 1047 DynamicArea da = JVM.getVM().getDynamicArea(); 1048 1049 objref = da.newObject(classClassInfo, th); 1050 cnref = da.newString(name, th); 1051 1052 ElementInfo e = da.get(objref); 1057 1058 try { 1059 e.setReferenceField("name", cnref); 1060 1061 e.setIntField("cref", cref); 1063 } catch (Exception x) { 1064 if (classClassInfo == null) { Debug.println(Debug.ERROR); 1068 Debug.println(Debug.ERROR,"FATAL ERROR: wrong java.lang.Class version"); 1069 Debug.println(Debug.ERROR," you need to set 'vm.classpath'"); 1070 Debug.println(Debug.ERROR," or start jpf from its root directory"); 1071 Debug.println(Debug.ERROR); 1072 Debug.println(Debug.ERROR, 1073 " !! assertions or java.lang.Class usage will fail !!"); 1074 Debug.println(Debug.ERROR); 1075 } 1076 1077 return -1; 1078 } 1079 1080 return objref; 1081 } 1082 1083 1087 Fields createStaticFields (StaticArea staticArea) { 1088 return new StaticFields(this); 1089 } 1090 1091 void initializeStaticData (Fields f) { 1092 for (int i=0; i<sFields.length; i++) { 1093 FieldInfo fi = sFields[i]; 1094 fi.initialize(f); 1095 } 1096 } 1097 1098 void initializeInstanceData (Fields f) { 1099 1103 for (int i=0; i<iFields.length; i++) { 1107 FieldInfo fi = iFields[i]; 1108 fi.initialize(f); 1109 } 1110 if (superClass != null) { 1111 superClass.initializeInstanceData(f); 1112 } 1113 } 1114 1115 Map loadArrayMethods () { 1116 return new HashMap(0); 1117 } 1118 1119 Map loadBuiltinMethods (String type) { 1120 return new HashMap(0); 1121 } 1122 1123 void loadInterfaceRec (Set set, ClassInfo ci) { 1124 if (ci != null) { 1125 Iterator it = ci.interfaces.iterator(); 1126 1127 while (it.hasNext()) { 1128 String iname = (String ) it.next(); 1129 set.add(iname); 1130 1131 ci = getClassInfo(iname); 1132 loadInterfaceRec(set, ci); 1133 } 1134 } 1135 } 1136 1137 1145 static ConstantPool cpCache; 1146 static ConstantPoolGen cpgCache; 1147 1148 public static ConstantPoolGen getConstantPoolGen (ConstantPool cp) { 1149 if (cp != cpCache) { 1150 cpCache = cp; 1151 cpgCache = new ConstantPoolGen(cp); 1152 } 1153 1154 return cpgCache; 1155 } 1156 1157 1158 static void resetCPCache () { 1159 cpCache = null; 1160 cpgCache = null; 1161 } 1162 1163 Map loadMethods (JavaClass jc) { 1164 Method[] ms = jc.getMethods(); 1165 HashMap map = new HashMap(ms.length); 1166 1167 for (int i = 0; i < ms.length; i++) { 1168 MethodInfo mi = MethodInfo.newInstance(ms[i], this); 1169 String id = mi.getUniqueName(); 1170 map.put(id, mi); 1171 1172 if (attributor != null) { 1173 mi.setAtomic( attributor.isMethodAtomic(jc, ms[i], id)); 1174 mi.setSchedulingRelevance( attributor.getSchedulingRelevance( jc, ms[i], id)); 1175 } 1176 } 1177 1178 resetCPCache(); 1180 return map; 1181 } 1182 1183 ClassInfo loadSuperClass (JavaClass jc) { 1184 if (this == objectClassInfo) { 1185 return null; 1186 } else { 1187 String superName = jc.getSuperclassName(); 1188 1189 return getClassInfo(superName); 1190 } 1191 } 1192 1193 int loadElementInfoAttrs (JavaClass jc) { 1194 if (attributor != null) { 1199 return attributor.getObjectAttributes(jc); 1200 } 1201 1202 return 0; 1203 } 1204 1205 1206 private MethodInfo getFinalizer0 () { 1207 MethodInfo mi = getMethod("finalize()", true); 1208 1209 if ((mi != null) && (mi.getClassInfo() != objectClassInfo)) { 1212 return mi; 1213 } 1214 1215 return null; 1216 } 1217 1218 private boolean isWeakReference0 () { 1219 for (ClassInfo ci = this; ci != objectClassInfo; ci = ci.superClass) { 1220 if (ci == weakRefClassInfo) { 1221 return true; 1222 } 1223 } 1224 1225 return false; 1226 } 1227} 1228 1229 1230 | Popular Tags |