dalvik_system_DexFile.cc revision 9c290012b7f505ae1943ab87236f775b97a46e2d
1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <algorithm>
18#include <set>
19#include <fcntl.h>
20#ifdef __linux__
21#include <sys/sendfile.h>
22#else
23#include <sys/socket.h>
24#endif
25#include <sys/stat.h>
26#include <unistd.h>
27
28#include "base/logging.h"
29#include "base/stl_util.h"
30#include "class_linker.h"
31#include "common_throws.h"
32#include "dex_file-inl.h"
33#include "gc/space/image_space.h"
34#include "gc/space/space-inl.h"
35#include "image.h"
36#include "jni_internal.h"
37#include "mirror/class_loader.h"
38#include "mirror/object-inl.h"
39#include "mirror/string.h"
40#include "oat.h"
41#include "os.h"
42#include "profiler.h"
43#include "runtime.h"
44#include "scoped_thread_state_change.h"
45#include "ScopedFd.h"
46#include "ScopedLocalRef.h"
47#include "ScopedUtfChars.h"
48#include "utils.h"
49#include "well_known_classes.h"
50#include "zip_archive.h"
51
52namespace art {
53
54// A smart pointer that provides read-only access to a Java string's UTF chars.
55// Unlike libcore's NullableScopedUtfChars, this will *not* throw NullPointerException if
56// passed a null jstring. The correct idiom is:
57//
58//   NullableScopedUtfChars name(env, javaName);
59//   if (env->ExceptionCheck()) {
60//       return NULL;
61//   }
62//   // ... use name.c_str()
63//
64// TODO: rewrite to get rid of this, or change ScopedUtfChars to offer this option.
65class NullableScopedUtfChars {
66 public:
67  NullableScopedUtfChars(JNIEnv* env, jstring s) : mEnv(env), mString(s) {
68    mUtfChars = (s != NULL) ? env->GetStringUTFChars(s, NULL) : NULL;
69  }
70
71  ~NullableScopedUtfChars() {
72    if (mUtfChars) {
73      mEnv->ReleaseStringUTFChars(mString, mUtfChars);
74    }
75  }
76
77  const char* c_str() const {
78    return mUtfChars;
79  }
80
81  size_t size() const {
82    return strlen(mUtfChars);
83  }
84
85  // Element access.
86  const char& operator[](size_t n) const {
87    return mUtfChars[n];
88  }
89
90 private:
91  JNIEnv* mEnv;
92  jstring mString;
93  const char* mUtfChars;
94
95  // Disallow copy and assignment.
96  NullableScopedUtfChars(const NullableScopedUtfChars&);
97  void operator=(const NullableScopedUtfChars&);
98};
99
100static jlong DexFile_openDexFileNative(JNIEnv* env, jclass, jstring javaSourceName, jstring javaOutputName, jint) {
101  ScopedUtfChars sourceName(env, javaSourceName);
102  if (sourceName.c_str() == NULL) {
103    return 0;
104  }
105  NullableScopedUtfChars outputName(env, javaOutputName);
106  if (env->ExceptionCheck()) {
107    return 0;
108  }
109
110  ClassLinker* linker = Runtime::Current()->GetClassLinker();
111  std::unique_ptr<std::vector<const DexFile*>> dex_files(new std::vector<const DexFile*>());
112  std::vector<std::string> error_msgs;
113
114  bool success = linker->OpenDexFilesFromOat(sourceName.c_str(), outputName.c_str(), &error_msgs,
115                                             dex_files.get());
116
117  if (success || !dex_files->empty()) {
118    // In the case of non-success, we have not found or could not generate the oat file.
119    // But we may still have found a dex file that we can use.
120    return static_cast<jlong>(reinterpret_cast<uintptr_t>(dex_files.release()));
121  } else {
122    // The vector should be empty after a failed loading attempt.
123    DCHECK_EQ(0U, dex_files->size());
124
125    ScopedObjectAccess soa(env);
126    CHECK(!error_msgs.empty());
127    // The most important message is at the end. So set up nesting by going forward, which will
128    // wrap the existing exception as a cause for the following one.
129    auto it = error_msgs.begin();
130    auto itEnd = error_msgs.end();
131    for ( ; it != itEnd; ++it) {
132      ThrowWrappedIOException("%s", it->c_str());
133    }
134
135    return 0;
136  }
137}
138
139static std::vector<const DexFile*>* toDexFiles(jlong dex_file_address, JNIEnv* env) {
140  std::vector<const DexFile*>* dex_files = reinterpret_cast<std::vector<const DexFile*>*>(
141      static_cast<uintptr_t>(dex_file_address));
142  if (UNLIKELY(dex_files == nullptr)) {
143    ScopedObjectAccess soa(env);
144    ThrowNullPointerException(NULL, "dex_file == null");
145  }
146  return dex_files;
147}
148
149static void DexFile_closeDexFile(JNIEnv* env, jclass, jlong cookie) {
150  std::unique_ptr<std::vector<const DexFile*>> dex_files(toDexFiles(cookie, env));
151  if (dex_files.get() == nullptr) {
152    return;
153  }
154  ScopedObjectAccess soa(env);
155
156  size_t index = 0;
157  for (const DexFile* dex_file : *dex_files) {
158    if (Runtime::Current()->GetClassLinker()->IsDexFileRegistered(*dex_file)) {
159      (*dex_files)[index] = nullptr;
160    }
161    index++;
162  }
163
164  STLDeleteElements(dex_files.get());
165  // Unique_ptr will delete the vector itself.
166}
167
168static jclass DexFile_defineClassNative(JNIEnv* env, jclass, jstring javaName, jobject javaLoader,
169                                        jlong cookie) {
170  std::vector<const DexFile*>* dex_files = toDexFiles(cookie, env);
171  if (dex_files == NULL) {
172    VLOG(class_linker) << "Failed to find dex_file";
173    return NULL;
174  }
175  ScopedUtfChars class_name(env, javaName);
176  if (class_name.c_str() == NULL) {
177    VLOG(class_linker) << "Failed to find class_name";
178    return NULL;
179  }
180  const std::string descriptor(DotToDescriptor(class_name.c_str()));
181
182  for (const DexFile* dex_file : *dex_files) {
183    const DexFile::ClassDef* dex_class_def = dex_file->FindClassDef(descriptor.c_str());
184    if (dex_class_def != nullptr) {
185      ScopedObjectAccess soa(env);
186      ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
187      class_linker->RegisterDexFile(*dex_file);
188      StackHandleScope<1> hs(soa.Self());
189      Handle<mirror::ClassLoader> class_loader(
190          hs.NewHandle(soa.Decode<mirror::ClassLoader*>(javaLoader)));
191      mirror::Class* result = class_linker->DefineClass(descriptor.c_str(), class_loader, *dex_file,
192                                                        *dex_class_def);
193      if (result != nullptr) {
194        VLOG(class_linker) << "DexFile_defineClassNative returning " << result;
195        return soa.AddLocalReference<jclass>(result);
196      }
197    }
198  }
199  VLOG(class_linker) << "Failed to find dex_class_def";
200  return nullptr;
201}
202
203// Needed as a compare functor for sets of const char
204struct CharPointerComparator {
205  bool operator()(const char *str1, const char *str2) const {
206    return strcmp(str1, str2) < 0;
207  }
208};
209
210// Note: this can be an expensive call, as we sort out duplicates in MultiDex files.
211static jobjectArray DexFile_getClassNameList(JNIEnv* env, jclass, jlong cookie) {
212  jobjectArray result = nullptr;
213  std::vector<const DexFile*>* dex_files = toDexFiles(cookie, env);
214
215  if (dex_files != nullptr) {
216    // Push all class descriptors into a set. Use set instead of unordered_set as we want to
217    // retrieve all in the end.
218    std::set<const char*, CharPointerComparator> descriptors;
219    for (const DexFile* dex_file : *dex_files) {
220      for (size_t i = 0; i < dex_file->NumClassDefs(); ++i) {
221        const DexFile::ClassDef& class_def = dex_file->GetClassDef(i);
222        const char* descriptor = dex_file->GetClassDescriptor(class_def);
223        descriptors.insert(descriptor);
224      }
225    }
226
227    // Now create output array and copy the set into it.
228    result = env->NewObjectArray(descriptors.size(), WellKnownClasses::java_lang_String, nullptr);
229    if (result != nullptr) {
230      auto it = descriptors.begin();
231      auto it_end = descriptors.end();
232      jsize i = 0;
233      for (; it != it_end; it++, ++i) {
234        std::string descriptor(DescriptorToDot(*it));
235        ScopedLocalRef<jstring> jdescriptor(env, env->NewStringUTF(descriptor.c_str()));
236        if (jdescriptor.get() == nullptr) {
237          return nullptr;
238        }
239        env->SetObjectArrayElement(result, i, jdescriptor.get());
240      }
241    }
242  }
243  return result;
244}
245
246static void CopyProfileFile(const char* oldfile, const char* newfile) {
247  ScopedFd src(open(oldfile, O_RDONLY));
248  if (src.get() == -1) {
249    PLOG(ERROR) << "Failed to open profile file " << oldfile
250      << ". My uid:gid is " << getuid() << ":" << getgid();
251    return;
252  }
253
254  struct stat stat_src;
255  if (fstat(src.get(), &stat_src) == -1) {
256    PLOG(ERROR) << "Failed to get stats for profile file  " << oldfile
257      << ". My uid:gid is " << getuid() << ":" << getgid();
258    return;
259  }
260
261  // Create the copy with rw------- (only accessible by system)
262  ScopedFd dst(open(newfile, O_WRONLY|O_CREAT|O_TRUNC, 0600));
263  if (dst.get()  == -1) {
264    PLOG(ERROR) << "Failed to create/write prev profile file " << newfile
265      << ".  My uid:gid is " << getuid() << ":" << getgid();
266    return;
267  }
268
269#ifdef __linux__
270  if (sendfile(dst.get(), src.get(), nullptr, stat_src.st_size) == -1) {
271#else
272  off_t len;
273  if (sendfile(dst.get(), src.get(), 0, &len, nullptr, 0) == -1) {
274#endif
275    PLOG(ERROR) << "Failed to copy profile file " << oldfile << " to " << newfile
276      << ". My uid:gid is " << getuid() << ":" << getgid();
277  }
278}
279
280// Java: dalvik.system.DexFile.UP_TO_DATE
281static const jbyte kUpToDate = 0;
282// Java: dalvik.system.DexFile.DEXOPT_NEEDED
283static const jbyte kPatchoatNeeded = 1;
284// Java: dalvik.system.DexFile.PATCHOAT_NEEDED
285static const jbyte kDexoptNeeded = 2;
286
287template <const bool kVerboseLogging, const bool kReasonLogging>
288static jbyte IsDexOptNeededForFile(const std::string& oat_filename, const char* filename,
289                                   InstructionSet target_instruction_set) {
290  std::string error_msg;
291  std::unique_ptr<const OatFile> oat_file(OatFile::Open(oat_filename, oat_filename, nullptr,
292                                                        false, &error_msg));
293  if (oat_file.get() == nullptr) {
294    if (kVerboseLogging) {
295      LOG(INFO) << "DexFile_isDexOptNeeded failed to open oat file '" << oat_filename
296          << "' for file location '" << filename << "': " << error_msg;
297    }
298    error_msg.clear();
299    return kDexoptNeeded;
300  }
301  bool should_relocate_if_possible = Runtime::Current()->ShouldRelocate();
302  uint32_t location_checksum = 0;
303  const art::OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(filename, nullptr,
304                                                                          kReasonLogging);
305  if (oat_dex_file != nullptr) {
306    // If its not possible to read the classes.dex assume up-to-date as we won't be able to
307    // compile it anyway.
308    if (!DexFile::GetChecksum(filename, &location_checksum, &error_msg)) {
309      if (kVerboseLogging) {
310        LOG(INFO) << "DexFile_isDexOptNeeded found precompiled stripped file: "
311            << filename << " for " << oat_filename << ": " << error_msg;
312      }
313      if (ClassLinker::VerifyOatChecksums(oat_file.get(), target_instruction_set, &error_msg)) {
314        if (kVerboseLogging) {
315          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
316                    << " is up-to-date for " << filename;
317        }
318        return kUpToDate;
319      } else if (should_relocate_if_possible &&
320                  ClassLinker::VerifyOatImageChecksum(oat_file.get(), target_instruction_set)) {
321        if (kVerboseLogging) {
322          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
323                    << " needs to be relocated for " << filename;
324        }
325        return kPatchoatNeeded;
326      } else {
327        if (kVerboseLogging) {
328          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
329                    << " is out of date for " << filename;
330        }
331        return kDexoptNeeded;
332      }
333      // If we get here the file is out of date and we should use the system one to relocate.
334    } else {
335      if (ClassLinker::VerifyOatAndDexFileChecksums(oat_file.get(), filename, location_checksum,
336                                                    target_instruction_set, &error_msg)) {
337        if (kVerboseLogging) {
338          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
339                    << " is up-to-date for " << filename;
340        }
341        return kUpToDate;
342      } else if (location_checksum == oat_dex_file->GetDexFileLocationChecksum()
343                  && should_relocate_if_possible
344                  && ClassLinker::VerifyOatImageChecksum(oat_file.get(), target_instruction_set)) {
345        if (kVerboseLogging) {
346          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
347                    << " needs to be relocated for " << filename;
348        }
349        return kPatchoatNeeded;
350      } else {
351        if (kVerboseLogging) {
352          LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
353                    << " is out of date for " << filename;
354        }
355        return kDexoptNeeded;
356      }
357    }
358  } else {
359    if (kVerboseLogging) {
360      LOG(INFO) << "DexFile_isDexOptNeeded file " << oat_filename
361                << " does not contain " << filename;
362    }
363    return kDexoptNeeded;
364  }
365}
366
367static jbyte IsDexOptNeededInternal(JNIEnv* env, const char* filename,
368    const char* pkgname, const char* instruction_set, const jboolean defer) {
369  // TODO disable this logging.
370  const bool kVerboseLogging = false;  // Spammy logging.
371  const bool kReasonLogging = true;  // Logging of reason for returning JNI_TRUE.
372
373  if ((filename == nullptr) || !OS::FileExists(filename)) {
374    LOG(ERROR) << "DexFile_isDexOptNeeded file '" << filename << "' does not exist";
375    ScopedLocalRef<jclass> fnfe(env, env->FindClass("java/io/FileNotFoundException"));
376    const char* message = (filename == nullptr) ? "<empty file name>" : filename;
377    env->ThrowNew(fnfe.get(), message);
378    return kUpToDate;
379  }
380
381  // Always treat elements of the bootclasspath as up-to-date.  The
382  // fact that code is running at all means that this should be true.
383  Runtime* runtime = Runtime::Current();
384  ClassLinker* class_linker = runtime->GetClassLinker();
385  // TODO: We're assuming that the 64 and 32 bit runtimes have identical
386  // class paths. isDexOptNeeded will not necessarily be called on a runtime
387  // that has the same instruction set as the file being dexopted.
388  const std::vector<const DexFile*>& boot_class_path = class_linker->GetBootClassPath();
389  for (size_t i = 0; i < boot_class_path.size(); i++) {
390    if (boot_class_path[i]->GetLocation() == filename) {
391      if (kVerboseLogging) {
392        LOG(INFO) << "DexFile_isDexOptNeeded ignoring boot class path file: " << filename;
393      }
394      return kUpToDate;
395    }
396  }
397
398  bool force_system_only = false;
399  bool require_system_version = false;
400
401  // Check the profile file.  We need to rerun dex2oat if the profile has changed significantly
402  // since the last time, or it's new.
403  // If the 'defer' argument is true then this will be retried later.  In this case we
404  // need to make sure that the profile file copy is not made so that we will get the
405  // same result second time.
406  std::string profile_file;
407  std::string prev_profile_file;
408  bool should_copy_profile = false;
409  if (Runtime::Current()->GetProfilerOptions().IsEnabled() && (pkgname != nullptr)) {
410    profile_file = GetDalvikCacheOrDie("profiles", false /* create_if_absent */)
411        + std::string("/") + pkgname;
412    prev_profile_file = profile_file + std::string("@old");
413
414    struct stat profstat, prevstat;
415    int e1 = stat(profile_file.c_str(), &profstat);
416    int e1_errno = errno;
417    int e2 = stat(prev_profile_file.c_str(), &prevstat);
418    int e2_errno = errno;
419    if (e1 < 0) {
420      if (e1_errno != EACCES) {
421        // No profile file, need to run dex2oat, unless we find a file in system
422        if (kReasonLogging) {
423          LOG(INFO) << "DexFile_isDexOptNeededInternal profile file " << profile_file << " doesn't exist. "
424                    << "Will check odex to see if we can find a working version.";
425        }
426        // Force it to only accept system files/files with versions in system.
427        require_system_version = true;
428      } else {
429        LOG(INFO) << "DexFile_isDexOptNeededInternal recieved EACCES trying to stat profile file "
430                  << profile_file;
431      }
432    } else if (e2 == 0) {
433      // There is a previous profile file.  Check if the profile has changed significantly.
434      // A change in profile is considered significant if X% (change_thr property) of the top K%
435      // (compile_thr property) samples has changed.
436      double top_k_threshold = Runtime::Current()->GetProfilerOptions().GetTopKThreshold();
437      double change_threshold = Runtime::Current()->GetProfilerOptions().GetTopKChangeThreshold();
438      double change_percent = 0.0;
439      ProfileFile new_profile, old_profile;
440      bool new_ok = new_profile.LoadFile(profile_file);
441      bool old_ok = old_profile.LoadFile(prev_profile_file);
442      if (!new_ok || !old_ok) {
443        if (kVerboseLogging) {
444          LOG(INFO) << "DexFile_isDexOptNeededInternal Ignoring invalid profiles: "
445                    << (new_ok ?  "" : profile_file) << " " << (old_ok ? "" : prev_profile_file);
446        }
447      } else {
448        std::set<std::string> new_top_k, old_top_k;
449        new_profile.GetTopKSamples(new_top_k, top_k_threshold);
450        old_profile.GetTopKSamples(old_top_k, top_k_threshold);
451        if (new_top_k.empty()) {
452          if (kVerboseLogging) {
453            LOG(INFO) << "DexFile_isDexOptNeededInternal empty profile: " << profile_file;
454          }
455          // If the new topK is empty we shouldn't optimize so we leave the change_percent at 0.0.
456        } else {
457          std::set<std::string> diff;
458          std::set_difference(new_top_k.begin(), new_top_k.end(), old_top_k.begin(), old_top_k.end(),
459            std::inserter(diff, diff.end()));
460          // TODO: consider using the usedPercentage instead of the plain diff count.
461          change_percent = 100.0 * static_cast<double>(diff.size()) / static_cast<double>(new_top_k.size());
462          if (kVerboseLogging) {
463            std::set<std::string>::iterator end = diff.end();
464            for (std::set<std::string>::iterator it = diff.begin(); it != end; it++) {
465              LOG(INFO) << "DexFile_isDexOptNeededInternal new in topK: " << *it;
466            }
467          }
468        }
469      }
470
471      if (change_percent > change_threshold) {
472        if (kReasonLogging) {
473          LOG(INFO) << "DexFile_isDexOptNeededInternal size of new profile file " << profile_file <<
474          " is significantly different from old profile file " << prev_profile_file << " (top "
475          << top_k_threshold << "% samples changed in proportion of " << change_percent << "%)";
476        }
477        should_copy_profile = !defer;
478        // Force us to only accept system files.
479        force_system_only = true;
480      }
481    } else if (e2_errno == ENOENT) {
482      // Previous profile does not exist.  Make a copy of the current one.
483      if (kVerboseLogging) {
484        LOG(INFO) << "DexFile_isDexOptNeededInternal previous profile doesn't exist: " << prev_profile_file;
485      }
486      should_copy_profile = !defer;
487    } else {
488      PLOG(INFO) << "Unable to stat previous profile file " << prev_profile_file;
489    }
490  }
491
492  const InstructionSet target_instruction_set = GetInstructionSetFromString(instruction_set);
493
494  // Get the filename for odex file next to the dex file.
495  std::string odex_filename(DexFilenameToOdexFilename(filename, target_instruction_set));
496  // Get the filename for the dalvik-cache file
497  std::string cache_dir;
498  bool have_android_data = false;
499  bool dalvik_cache_exists = false;
500  GetDalvikCache(instruction_set, false, &cache_dir, &have_android_data, &dalvik_cache_exists);
501  std::string cache_filename;  // was cache_location
502  bool have_cache_filename = false;
503  if (dalvik_cache_exists) {
504    std::string error_msg;
505    have_cache_filename = GetDalvikCacheFilename(filename, cache_dir.c_str(), &cache_filename,
506                                                 &error_msg);
507    if (!have_cache_filename && kVerboseLogging) {
508      LOG(INFO) << "DexFile_isDexOptNeededInternal failed to find cache file for dex file " << filename
509                << ": " << error_msg;
510    }
511  }
512
513  bool should_relocate_if_possible = Runtime::Current()->ShouldRelocate();
514
515  jbyte dalvik_cache_decision = -1;
516  // Lets try the cache first (since we want to load from there since thats where the relocated
517  // versions will be).
518  if (have_cache_filename && !force_system_only) {
519    // We can use the dalvik-cache if we find a good file.
520    dalvik_cache_decision =
521        IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(cache_filename, filename,
522                                                               target_instruction_set);
523    // We will only return DexOptNeeded if both the cache and system return it.
524    if (dalvik_cache_decision != kDexoptNeeded && !require_system_version) {
525      CHECK(!(dalvik_cache_decision == kPatchoatNeeded && !should_relocate_if_possible))
526          << "May not return PatchoatNeeded when patching is disabled.";
527      return dalvik_cache_decision;
528    }
529    // We couldn't find one thats easy. We should now try the system.
530  }
531
532  jbyte system_decision =
533      IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(odex_filename, filename,
534                                                             target_instruction_set);
535  CHECK(!(system_decision == kPatchoatNeeded && !should_relocate_if_possible))
536      << "May not return PatchoatNeeded when patching is disabled.";
537
538  if (require_system_version && system_decision == kPatchoatNeeded
539                             && dalvik_cache_decision == kUpToDate) {
540    // We have a version from system relocated to the cache. Return it.
541    return dalvik_cache_decision;
542  }
543
544  if (should_copy_profile && system_decision == kDexoptNeeded) {
545    CopyProfileFile(profile_file.c_str(), prev_profile_file.c_str());
546  }
547
548  return system_decision;
549}
550
551static jbyte DexFile_isDexOptNeededInternal(JNIEnv* env, jclass, jstring javaFilename,
552    jstring javaPkgname, jstring javaInstructionSet, jboolean defer) {
553  ScopedUtfChars filename(env, javaFilename);
554  NullableScopedUtfChars pkgname(env, javaPkgname);
555  ScopedUtfChars instruction_set(env, javaInstructionSet);
556
557  return IsDexOptNeededInternal(env, filename.c_str(), pkgname.c_str(),
558                                instruction_set.c_str(), defer);
559}
560
561// public API, NULL pkgname
562static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) {
563  const char* instruction_set = GetInstructionSetString(kRuntimeISA);
564  ScopedUtfChars filename(env, javaFilename);
565  return kUpToDate != IsDexOptNeededInternal(env, filename.c_str(), nullptr /* pkgname */,
566                                             instruction_set, false /* defer */);
567}
568
569
570static JNINativeMethod gMethods[] = {
571  NATIVE_METHOD(DexFile, closeDexFile, "(J)V"),
572  NATIVE_METHOD(DexFile, defineClassNative, "(Ljava/lang/String;Ljava/lang/ClassLoader;J)Ljava/lang/Class;"),
573  NATIVE_METHOD(DexFile, getClassNameList, "(J)[Ljava/lang/String;"),
574  NATIVE_METHOD(DexFile, isDexOptNeeded, "(Ljava/lang/String;)Z"),
575  NATIVE_METHOD(DexFile, isDexOptNeededInternal, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)B"),
576  NATIVE_METHOD(DexFile, openDexFileNative, "(Ljava/lang/String;Ljava/lang/String;I)J"),
577};
578
579void register_dalvik_system_DexFile(JNIEnv* env) {
580  REGISTER_NATIVE_METHODS("dalvik/system/DexFile");
581}
582
583}  // namespace art
584