コード例 #1
0
ファイル: Class.java プロジェクト: abhijangda/JikesRVM
 private static Class<?> forNameInternal(
     String className, boolean initialize, ClassLoader classLoader)
     throws ClassNotFoundException, LinkageError, ExceptionInInitializerError {
   try {
     if (className.startsWith("[")) {
       if (!validArrayDescriptor(className)) {
         throw new ClassNotFoundException(className);
       }
     }
     Atom descriptor =
         Atom.findOrCreateAsciiAtom(className.replace('.', '/')).descriptorFromClassName();
     TypeReference tRef = TypeReference.findOrCreate(classLoader, descriptor);
     RVMType ans = tRef.resolve();
     Callbacks.notifyForName(ans);
     if (initialize && !ans.isInitialized()) {
       ans.resolve();
       ans.instantiate();
       ans.initialize();
     }
     return ans.getClassForType();
   } catch (NoClassDefFoundError ncdfe) {
     Throwable cause2 = ncdfe.getCause();
     ClassNotFoundException cnf;
     // If we get a NCDFE that was caused by a CNFE, throw the original CNFE.
     if (cause2 instanceof ClassNotFoundException) cnf = (ClassNotFoundException) cause2;
     else cnf = new ClassNotFoundException(className, ncdfe);
     throw cnf;
   }
 }
  /** Create the organizerThreads and schedule them */
  private void createOrganizerThreads() {
    AOSOptions opts = Controller.options;

    if (opts.sampling()) {
      // Primary backing store for method sample data
      Controller.methodSamples = new MethodCountData();

      // Install organizer to drive method recompilation
      Controller.organizers.add(new MethodSampleOrganizer(opts.DERIVED_FILTER_OPT_LEVEL));
      // Additional set up for feedback directed inlining
      if (opts.ADAPTIVE_INLINING) {
        Organizer decayOrganizer =
            new DecayOrganizer(new YieldCounterListener(opts.DECAY_FREQUENCY));
        Controller.organizers.add(decayOrganizer);
        createDynamicCallGraphOrganizer();
      }
    }

    if (RecompilationDataProvider.ENABLED) {
      RecompilationDataProvider rdp = new RecompilationDataProvider();
      Callbacks.addMethodCompileMonitor(rdp);
      RuntimeMeasurements.registerReportableObject(rdp);
    }

    if (opts.PARAMETER_PROFILING) {
      if (VM.BuildFor32Addr && VM.BuildForIA32 && VM.BuildForLinux) {
        if (opts.PARAMETER_PROFILING_INCLUDE_VM) {
          ParameterListener.enableProfilingOfVMMethods();
        }

        ParameterProfileOrganizer parameterProfileOrganizer = new ParameterProfileOrganizer();
        Controller.organizers.addElement(parameterProfileOrganizer);
      } else {
        VM.sysFail(
            "Trying to use parameter profiling for an untested configuration."
                + "Please modify the source code to support your platform");
      }
    }

    if ((!Controller.options.ENABLE_PRECOMPILE) && (!Controller.options.ENABLE_BULK_COMPILE)) {
      Controller.osrOrganizer = new OSROrganizerThread();
      Controller.osrOrganizer.start();
    }
  }