美文网首页
Dalivk虚拟机对Dex的加载过程(二)

Dalivk虚拟机对Dex的加载过程(二)

作者: 噜噜丶 | 来源:发表于2018-08-31 11:19 被阅读0次

1:序言

深入理解插件化-Dalvik虚拟机对Dex的加载过程(一)
Java层的dex加载可以先看下这个,这篇文章主要说Native层的加载

2:DexFile

路径:\libcore\dalvik\src\main\java\dalvik\system/DexFile

    public DexFile(String fileName) throws IOException {
        mCookie = openDexFile(fileName, null, 0);
        mFileName = fileName;
        guard.open("close");
        //System.out.println("DEX FILE cookie is " + mCookie);
    }

3:openDexFile

    /*
     * Open a DEX file.  The value returned is a magic VM cookie.  On
     * failure, an IOException is thrown.
     */
    private static int openDexFile(String sourceName, String outputName,
        int flags) throws IOException {
        return openDexFileNative(new File(sourceName).getCanonicalPath(),
                                 (outputName == null) ? null : new File(outputName).getCanonicalPath(),
                                 flags);
    }

openDexFileNative

路径:\dalvik\vm\native\dalvik_system_DexFile.cpp

相关文章

网友评论

      本文标题:Dalivk虚拟机对Dex的加载过程(二)

      本文链接:https://www.haomeiwen.com/subject/xtrswftx.html