Skip to content

AsyncJITCompileWorker与主线程应该有数据竞争 #782

@Shiling1234

Description

@Shiling1234

Describe the bug
A clear and concise description of what the bug is.
请描述Bug的现象
iltype 类的 public IMethod GetMethod ( string name, List param, IType [] genericArguments, IType returnType = null, bool declaredOnly = false ) 可能内存会list集合越界

To Reproduce
Steps to reproduce the behavior:
请描述重现步骤或上下文
JITOnDemand 模式,在触发异步jit就有可能,AsyncJITCompileWorker是单开了一个线程编译方法,方法的调用链会触发到上述iltype里的getmethod。 主线程有可能也触发到此方法,iltype的methods成员变量是惰性填充的,调用方法才填充,那么这两个线程可能有数据竞争,一个在填充另外一个开始遍历,或者两个一起填充之类的,会导致数据错乱。 issue777 应该是类似问题。

Expected behavior
A clear and concise description of what you expected to happen.
不应该报错

Unity Version
Please fill in the version of Unity you're currently using
请填写使用的Unity版本
2022
ILRuntime Version
Please fill in the version of ILRuntime you're currently using(package version or git commit hash or repository download date)
请填写使用的ILRuntime版本(package版本或Git提交号或下载日期)
2.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions