Object access method, device, equipment and storage medium

By creating a proxy class in the second virtual machine and establishing an association relationship with the original class of the first virtual machine, the problem of interaction between different virtual machines is solved, and the editor is implemented in different virtual machine environments is reduced, and the interaction cost is reduced.

CN111290746BActive Publication Date: 2025-06-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202010091143.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-13
Publication Date
2025-06-17
Estimated Expiration
2040-02-13

AI Technical Summary

Technical Problem

Because different virtual machines cannot interact directly, the editor cannot run in the application development framework, and a large amount of code cannot be ported to another virtual machine.

Method used

By obtaining the association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, the second virtual machine receives the access request and carries the proxy class, accessing the original class associated with the proxy class according to the association relationship, realizing object access between virtual machines.

Benefits of technology

The interaction between different virtual machines is realized, the interaction cost is reduced, the application scope is expanded, and the editor can run in different virtual machine environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111290746B_ABST
    Figure CN111290746B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses an object method, apparatus, device, and storage medium, belonging to the field of computer technology. The method includes: obtaining a first association relationship between an original class in a first virtual machine and a proxy class in a second virtual machine; receiving an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine; and accessing the original class associated with the proxy class according to the first association relationship and the access request. Through the association relationship between the original class and the proxy class, the original class can be accessed by accessing the proxy class, realizing the simultaneous operation of the first virtual machine and the second virtual machine, and the interaction between the second virtual machine and the first virtual machine. Moreover, this interaction method has low interaction cost and is easy to be applied to various scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to an object access method, apparatus, device, and storage medium. Background Art

[0002] With the continuous progress of computer technology, application development has been widely developed, and an editor for developing applications can run in an application development framework. However, if the first virtual machine adopted by the editor is different from the second virtual machine adopted by the application development framework, since the two different virtual machines cannot directly interact, the second virtual machine cannot access the objects in the first virtual machine, and thus the editor cannot run in the application development framework.

[0003] Currently, all the code running in the first virtual machine can be transplanted to the second virtual machine, so that application development can be realized in the second virtual machine without accessing the first virtual machine. However, since a large amount of code in the first virtual machine cannot be transplanted and cannot be transplanted to the second virtual machine, the editor cannot perform application development. Summary of the Invention

[0004] The embodiments of the present application provide a virtual object control method, apparatus, and storage medium, which can enrich the control method and have a wide range of applications. The technical solutions are as follows:

[0005] On the one hand, an object access method is provided, and the method includes:

[0006] Obtain a first association relationship between a raw class in a first virtual machine and a proxy class in a second virtual machine;

[0007] Receive an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine;

[0008] Access the raw class associated with the proxy class according to the first association relationship and the access request.

[0009] On the other hand, an object access apparatus is provided, and the apparatus includes:

[0010] An obtaining module, configured to obtain a first association relationship between a raw class in a first virtual machine and a proxy class in a second virtual machine;

[0011] A receiving module, configured to receive an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine;

[0012] An access module, configured to access the raw class associated with the proxy class according to the first association relationship and the access request.

[0013] In a possible implementation, the obtaining module includes:

[0014] An obtaining unit, configured to obtain a first assembly of a first virtual machine and a second assembly of a second virtual machine, where the first assembly includes at least one original class, and the second assembly includes at least one proxy class;

[0015] A determining unit, configured to determine an original class in the first virtual machine corresponding to a proxy class in the second virtual machine;

[0016] An establishing unit, configured to establish a first association relationship between the original class and the corresponding proxy class.

[0017] In a possible implementation, the determining unit is configured to determine an original class corresponding to any proxy class according to binding information in any proxy class in the second virtual machine.

[0018] In a possible implementation, the determining unit is configured to perform at least one of the following:

[0019] In response to an interface of any proxy class in the second assembly being the same as an interface of any original class in the first assembly, determining the any original class as the original class corresponding to the any proxy class;

[0020] In response to a class name of any proxy class in the second assembly being the same as a class name of any original class in the first assembly, determining the any original class as the original class corresponding to the any proxy class;

[0021] In response to a namespace of any proxy class in the second assembly being the same as a namespace of any original class in the first assembly, determining the any original class as the original class corresponding to the any proxy class.

[0022] In a possible implementation, the establishing unit is further configured to add description information of the original class to the proxy class, where the description information is used to determine an address of the original class.

[0023] In a possible implementation, the establishing unit is further configured to establish a second association relationship between an original object in the original class and a proxy object in the proxy class corresponding to the original object.

[0024] In a possible implementation, the establishing unit is further configured to, in response to any object being an original object in the original class, create a proxy object corresponding to the original object in the proxy class associated with the original class, and establish the second association relationship between the original object and the proxy object.

[0025] In a possible implementation, the original class includes at least one object among fields, methods, and attributes, and the establishing unit is further configured to perform at least one of the following:

[0026] Determine a proxy field in the proxy class corresponding to the original field in the original class, and establish a second association relationship between the original field and the proxy field;

[0027] Determine a proxy method in the proxy class corresponding to the original method in the original class, and establish a second association relationship between the original method and the proxy method;

[0028] Determine a proxy attribute in the proxy class corresponding to the original attribute in the original class, and establish a second association relationship between the original attribute and the proxy attribute.

[0029] In a possible implementation, the access request carries a proxy object in the proxy class; the access module includes:

[0030] An obtaining unit, configured to obtain a second association relationship between the original object in the original class and the proxy object in the proxy class;

[0031] An access unit, configured to access, according to the first association relationship, the second association relationship, and the access request, an original object associated with the proxy object in the original class associated with the proxy class.

[0032] In a possible implementation, the access unit is configured to perform at least one of the following:

[0033] Access the original class through the access request to obtain corresponding data in the first virtual machine, where the access request is used to obtain a field;

[0034] Access the original class through the access request to change a corresponding field in the first virtual machine, where the access request is used to set a field;

[0035] Access the original class according to the access request to call a corresponding method in the first virtual machine, where the access request is used to call a method or access an attribute.

[0036] In a possible implementation, the access module includes:

[0037] A conversion unit, configured to convert access data carried in the access request into a data format supported by the first virtual machine;

[0038] An access unit, configured to access the original class according to the converted access request.

[0039] In a possible implementation, the apparatus further includes:

[0040] A conversion module, configured to convert the format of the return value to a format supported by the second virtual machine in response to obtaining a return value after accessing the original class;

[0041] A sending module, configured to send the converted return value to the second virtual machine according to the first association relationship.

[0042] In a possible implementation manner, the obtaining unit is configured to obtain the first assembly, determine each original class in the first assembly; generate a proxy class corresponding to each original class in the second virtual machine; and generate the second assembly according to each proxy class.

[0043] In a possible implementation manner, the obtaining unit is configured to generate a proxy class corresponding to each original class according to the description information of the original class, and the interface of the proxy class is the same as the interface of the corresponding original class.

[0044] In a possible implementation manner, the proxy class includes binding information, and the obtaining unit is configured to generate the binding information of each original class according to the description information of each original class.

[0045] On the other hand, a computer device is provided, which includes a processor and a memory. At least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor to implement the object access method as described in the above aspect.

[0046] On the other hand, a computer-readable storage medium is provided, in which at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the object access method as described in the above aspect.

[0047] The beneficial effects brought by the technical solution provided by the embodiments of the present application at least include:

[0048] The object access method, device, device and storage medium provided by the embodiments of the present application obtain the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, receive an access request through the second virtual machine, and the access request carries the proxy class in the second virtual machine. According to the first association relationship and the access request, the original class associated with the proxy class is accessed. Through the association relationship between the original class and the proxy class, the original class can be accessed by accessing the proxy class, realizing the simultaneous operation of the first virtual machine and the second virtual machine, and through the association relationship between the proxy class and the original class, the second virtual machine and the first virtual machine can interact, and this interaction method has low interaction cost and is easy to be applied to various scenarios. Description of the Drawings

[0049] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0050] Figure 1 is a flowchart of an object access method provided by an embodiment of the present application;

[0051] Figure 2 is a flowchart of a second program set generation method provided by an embodiment of the present application;

[0052] Figure 3 is a flowchart of a method for establishing an association relationship provided by an embodiment of the present application;

[0053] Figure 4 is a flowchart of a method for accessing an original object provided by an embodiment of the present application;

[0054] Figure 5 is a schematic diagram of the display interface of an application program provided by an embodiment of the present application;

[0055] Figure 6 is a schematic diagram of the interface of an editor provided by an embodiment of the present application;

[0056] Figure 7 is a schematic diagram of the structure of an object access device provided by an embodiment of the present application;

[0057] Figure 8 is a schematic diagram of the structure of an object access device provided by an embodiment of the present application;

[0058] Figure 9 is a schematic diagram of the structure of a terminal provided by an embodiment of the present application;

[0059] Figure 10 is a schematic diagram of the structure of a server provided by an embodiment of the present application. Detailed implementation manners

[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the drawings.

[0061] It can be understood that the terms "first", "second", etc. used in this application may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of this application, the first virtual machine may be referred to as the second virtual machine, and similarly, the second virtual machine may be referred to as the first virtual machine.

[0062] The terms "at least one", "multiple", "each", "any one" used in this application, at least one includes one, two or more than two, multiple includes two or more than two, and each refers to each one in the corresponding multiple, and any one refers to any one in the multiple. For example, multiple objects include 3 objects, and each refers to each one of these 3 objects, and any one refers to any one of these 3 objects, which can be the first, the second, or the third.

[0063] .NET (the third-generation Internet): is an operating platform on which users can build various applications.

[0064] .NET Framework (Common Language Runtime Platform): is an application development framework that can be used to build applications with visually appealing user experiences, achieve seamless communication across technology boundaries, and support various business processes.

[0065] CLR (Common Language Runtime): is the name of the virtual machine of.NET. CLR runs a bytecode called Common Intermediate Language, which is an implementation version of CLI (Common Language Infrastructure).

[0066] CLI (Common Language Infrastructure): CLI defines the specifications of the executable code that constitutes the.NET Framework infrastructure and the runtime environment of the code. It defines a language-independent cross-architecture executable code and the specifications of the runtime environment of the code, enabling developers to develop software in various high-level languages defined within the specifications and run the applications on different computer architectures without modification.

[0067] Mono: It is a free and open-source project that includes a C# compiler and the Common Language Infrastructure. The goal of this project is to create a series of.NET tools that comply with the standards of ECMA (European Computer Manufacturers Association) (Ecma-334 and Ecma-335). Different from the.NET Framework, the Mono project can run not only on the Windows system, but also on systems such as Linux, FreeBSD, Unix, OS X, and Solaris, and can also run on some game platforms, such as Playstation 3, Wii, or XBox 360.

[0068] Mono Virtual Machine: It is a virtual machine that can run C# code. Compared with the CLR virtual machine, the Mono virtual machine can run across platforms.

[0069] UnityEngine (Engine): It is a cross-platform 2D / 3D game engine.

[0070] Assembly: It is a code library obtained by compiling code and is further compiled and executed by the CLR. In the WINDOWS system, it generally appears in the format of.dll or.exe. The code of this assembly is represented in Common Intermediate Language (CIL) and is just-in-time compiled into machine language at runtime. In the.NET Framework implementation, this just-in-time compilation is part of the Common Language Runtime (CLR). In a compiled application, the created CIL code is stored in an assembly, which includes an executable application file (process assembly (EXE)) and libraries used by other applications (library assembly (DLL)).

[0071] C#: It is a high-level object-oriented programming language launched by Microsoft based on the.NET framework. C# is based on the.NET framework class library.

[0072] Mono.Ceil: It is a tool that can statically read and analyze ECMA CIL format files. Through this tool, various type and property information in the assembly can be analyzed offline.

[0073] mono.dll: The execution module of the Mono virtual machine under Windows and is the main body of the Mono virtual machine. It has some exported functions that can be directly called externally.

[0074] MonoApi (Application Programming Interface): Some functions inside the Mono virtual machine that support the running of C#. These functions are exported through mono.dll and can be called externally.

[0075] MonoType (type): The type in the Mono virtual machine that is equivalent to System.Type in the CLR virtual machine and is used to describe a specific type.

[0076] MonoObject (object): The common base class type in the Mono virtual machine that is equivalent to System.Object in the CLR virtual machine.

[0077] MonoMethod (method): The type in the Mono virtual machine that is equivalent to System.Reflection.MethodInfo in the CLR and is used to describe a method.

[0078] MonoField (field): The type in the Mono virtual machine that is equivalent to System.Reflection.FieldInfo in the CLR and is used to describe a field.

[0079] MonoClass (class): Used inside the Mono virtual machine to describe a type.

[0080] MonoArray (array): The array in the Mono virtual machine.

[0081] Object-oriented programming (OOP): A programming paradigm with the concept of objects and an abstract guideline for application development. It can include data, attributes, code, and methods. Here, an object refers to an instance of a class. It can also take objects as the basic unit of a program, encapsulating the program and data within to improve the reusability, flexibility, and extensibility of the application. The program inside an object can access and often modify the data associated with the object.

[0082] Class: A construct in an object-oriented computer programming language in object-oriented programming. It is the blueprint for creating objects and describes the common attributes and methods of the created objects.

[0083] Object: In an application system, an object has a unique identifier. An object includes properties and methods. Properties are the information that needs to be remembered, and methods are the services that an object can provide. In an object-oriented application, an object is an instance of a certain class.

[0084] Properties: In an object-oriented programming language, a property is a concept between a field and a method. The code writing of a property is similar to that of a field, but the property code is actually a method call. In C#, a property is implemented through hidden getter and setter methods.

[0085] An object access method provided by an embodiment of the present application can be applied to a computer device. The computer device can be various types of terminals such as a mobile phone, a computer, a tablet computer, etc., or a server. The server can be a single server, or a server cluster composed of several servers, or a cloud computing service center. The embodiment of the present application does not make any limitations in this regard.

[0086] The object access method provided by an embodiment of the present application can be applied to the scenario of software development.

[0087] For example, the scenario of developing an application in an application development framework through an application development editor.

[0088] Among them, the editor uses a first virtual machine, and the application development framework uses a second virtual machine. Since the two different virtual machines cannot directly interact, the second virtual machine cannot access the objects in the first virtual machine, resulting in the editor being unable to run in the application development framework. By using the object access method provided by an embodiment of the present application, a proxy class can be created in the second virtual machine, and a first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine can be obtained. The second virtual machine receives an access request, and the access request carries the proxy class in the second virtual machine; according to the first association relationship and the access request, the original class associated with the proxy class is accessed, realizing the access of the second virtual machine to the first virtual machine and indirectly realizing the interaction between the two virtual machines. Thus, the editor can run in the application development framework for application development.

[0089] Figure 1 It is a flowchart of an object access method provided by an embodiment of the present application, which is applied to a computer device, as Figure 1 shown. The method includes:

[0090] 101. The computer device obtains the first assembly of the first virtual machine and determines each original class in the first assembly.

[0091] Among them, a virtual machine refers to a complete computer system with complete hardware system functions simulated by an application program and running in a completely isolated environment. All the work that can be completed in a computer device can be realized in a virtual machine. Among them, the first virtual machine can be any type of virtual machine. For example, a Mono virtual machine, a CLR virtual machine, a linux virtual machine, a Java virtual machine, etc. The embodiments of the present application do not limit the first virtual machine.

[0092] An assembly is a logical collection composed of type definitions, data files, and resource files, and this assembly can be run by a virtual machine. The first assembly of the first virtual machine can be regarded as the assembly run by the first virtual machine.

[0093] In an application development scenario, an editor can be used to develop an application. The virtual machine used by the editor is the first virtual machine. During the process of developing an application using the editor, multiple projects can be developed. Among them, the code of one project can be compiled into one assembly, the code of multiple projects can be compiled into one assembly, or the code of one project can be compiled into multiple assemblies; the code compiled into the assembly can be run through the first virtual machine. Therefore, the first assembly of the first virtual machine can be one assembly or multiple assemblies, and the embodiments of the present application do not limit this.

[0094] Among them, an assembly can include at least one namespace, and each namespace can include at least one type. Among them, the original types in the assembly can be the original classes of the assembly. In view of the fact that the present application generates proxy classes corresponding to the original classes, therefore, in the present application, the original classes of the assembly are not only the original types in the assembly but also the types used to generate proxy classes. In a possible implementation manner, for the computer device to obtain the first assembly of the first virtual machine and determine each original class in the first assembly, it can include: the computer device obtains at least one assembly run by the first virtual machine, determines the first assembly among the at least one assembly, and the first assembly is the assembly run by the first virtual machine and needs to be accessed by other virtual machines; according to the first assembly, determines each original class in the first assembly.

[0095] Among them, the at least one assembly run by the first virtual machine may be all the assemblies run by the first virtual machine, or may be some of the assemblies run by the first virtual machine. This application embodiment does not make a limitation here. In addition, the computer device can analyze each assembly in the at least one assembly to determine whether the assembly needs to be accessed by other virtual machines. If the assembly needs to be accessed by other virtual machines, then the assembly is the first assembly. After traversing the at least one assembly, the first assembly of the first virtual machine is obtained.

[0096] For example, the computer device can use Mono.Ceil to analyze the Mono assembly and determine the first assembly that needs to be accessed from the Mono assembly.

[0097] Optionally, the computer device determines each original class in the first assembly, which may include: traversing the types in the first assembly and using the types in the first assembly for interaction with other virtual machines as the original classes. Among them, the types used for interaction with other virtual machines are the types that other virtual machines need to access for interaction with the first virtual machine.

[0098] Optionally, determining the types in the first assembly used for interaction with other virtual machines may include at least one of the following:

[0099] (1) For any type in the first assembly, in response to the external configuration of the type satisfying the target condition, determine that the type is a type used for interaction with other virtual machines.

[0100] (2) For any type in the first assembly, in response to the type attribute of the type being the target attribute, determine that the type is a type used for interaction with other virtual machines.

[0101] For example, as Figure 2 shown, the computer device uses Mono.Ceil to analyze the first assembly and traverses the types in the first assembly. Analyze whether the type needs to be exported for CLR interaction through the external configuration or the type attribute. If it needs to be exported, then the type is the original class in the first assembly. If it does not need to be exported, continue to analyze the next type until the analysis of each type in the first assembly is completed.

[0102] In addition, optionally, the first assembly may also be all the assemblies run by the first virtual machine. Then the computer device can traverse the first assembly, determine the types in the first assembly used for interaction with other virtual machines, and use the types as the original classes of the first assembly. Among them, the method for determining the types in the first assembly used for interaction with other virtual machines is similar to the above method and will not be elaborated here one by one.

[0103] For example, asFigure 2 As shown, the computer device uses Mono.Ceil to analyze the first assembly, which is all the assemblies run by the first virtual machine, and traverses the types in the first assembly. It analyzes whether the type needs to be exported for CLR interaction through external configuration or type attributes. If it needs to be exported, the type is the original class in the first assembly. If it does not need to be exported, it continues to analyze the next type until all types in the first assembly have been analyzed.

[0104] 102. The computer device generates a proxy class corresponding to each original class in the second virtual machine.

[0105] Among them, the second virtual machine is any virtual machine of a different type from the first virtual machine. The second virtual machine can be a CLR virtual machine, a Mono virtual machine, a linux virtual machine, a Java virtual machine, etc. The embodiments of the present application do not limit the second virtual machine.

[0106] In addition, the first virtual machine can be the virtual machine used by the editor for developing applications, and the second virtual machine can be the virtual machine used by the application development framework; or, the first virtual machine can be the virtual machine used by the application development framework, and the second virtual machine is the virtual machine used by the editor for developing applications. For example, the first virtual machine is a Mono virtual machine, and the second virtual machine is a CLR virtual machine.

[0107] In a possible implementation, the computer device generating a proxy class corresponding to each original class in the second virtual machine may include: generating a proxy class corresponding to each original class according to the description information of the original class, and the interface of the proxy class is the same as the interface of the corresponding original class.

[0108] Among them, the description information of the original class can be the description information of the type of the original class, such as class name, namespace, etc. The original class can include at least one object such as fields, properties, methods, etc. The description information of the original class can also be the description information of the at least one object. For example, if the original class includes fields, the description information can include at least one of field name, namespace, field address, etc.; if the original class includes properties, the description information can include at least one of property name, namespace, etc.; if the original class includes methods, the description information can include at least one of method name, number of parameters, parameter type, return value type, etc.

[0109] For example, after the computer device determines that any type in the first assembly is a primitive class, it can continue to analyze all objects of the primitive class to obtain the description information of each object. Among them, the objects of the primitive class can be fields, properties, methods, etc. The description information of each member is generated into the proxy class, and the external interfaces such as field names, property names, method names, and method signatures are kept unchanged. Inside the proxy class, the access to these external interfaces is forwarded to the first virtual machine through the proxy mechanism. Among them, generating the description information of each member into the proxy class means generating a C# class file that can be directly used by the CLR.

[0110] In a possible implementation, the computer device generates a proxy class corresponding to each primitive class in the second virtual machine, which may include: generating the binding information of the primitive class according to the description information of each primitive class. The binding information is used to identify the binding relationship between the primitive class and the proxy class, and the computer device can determine the primitive class corresponding to the proxy class according to the binding information. The binding information of the proxy class may include the description information of the primitive class corresponding to the proxy class, and the primitive class corresponding to the proxy class can be determined according to the description information.

[0111] Optionally, the computer device generates a proxy class corresponding to each primitive class according to the description information of the primitive class, which may include: after the computer device determines that any type in the first assembly is a primitive class, it obtains any object included in the primitive class. In response to the object being a target object, it obtains the description information of each target object in the primitive class, and generates a proxy class corresponding to the primitive class according to the description information. The target object is an object that the second virtual machine needs to access. That is to say, when generating a proxy class corresponding to a primitive class, there is no need to generate a proxy class according to each object in the primitive class, and only the target object with access requirements needs to be used to generate the proxy class. On the basis of ensuring that the proxy class can meet the access to the first virtual machine through the second virtual machine, the size of the proxy class is reduced, and the waste of resources caused by generating useless proxy objects in the proxy class when generating the proxy class is also avoided.

[0112] For example, after the computer device determines that any type in the first assembly is a primitive class, it can continue to analyze all objects of the primitive class. After determining that any object is a target object, it obtains the description information of the target object, and generates the description information of each target object into the proxy class, and keeps the external interfaces such as field names, property names, method names, and method signatures unchanged. Inside the proxy class, the access to these external interfaces is forwarded to the first virtual machine through the proxy mechanism. Among them, generating the description information of each object into the proxy class means generating a C# class file that can be directly used by the CLR.

[0113] 103. The computer device generates a second assembly according to each proxy class.

[0114] Optionally, the computer device generating a second assembly according to each proxy class may include: The computer device may construct a project corresponding to the proxy class according to each proxy class, and compile the project to obtain the second assembly.

[0115] For example, as Figure 2 shown, the computer device constructs the generated C# class file into a C# project, and calls a compilation tool to compile this project, thereby generating a new second assembly 201 for the second virtual machine to call. The type interfaces in the second assembly are consistent with the corresponding type interfaces in the first assembly, so that when using these types in the second virtual machine, it is the same as directly using them in the first virtual machine.

[0116] That is to say, the proxy class is a type used in the second virtual machine, and the role of the proxy class is to help the user access a certain type in the second virtual machine in the same way as accessing the type in the first virtual machine. The proxy class has the same external interface as the original class, and accessing the fields, properties, and methods of the proxy class is equivalent to directly accessing the original class in the second virtual machine.

[0117] It should be noted that the above steps 101 to 103 can be performed during the offline process or can be executed online. That is to say, after step 103 is completed, step 104 can be immediately executed, or step 104 can be temporarily not executed, but executed when the computer device is restarted again, or can be executed at other times. The embodiments of the present application do not limit the execution timing of the above steps 101 to 103 and the timing of step 104.

[0118] 104. The computer device determines the original class in the first virtual machine corresponding to the proxy class in the second virtual machine according to the first assembly and the second assembly, and establishes a first association relationship between the original class and the corresponding proxy class.

[0119] Among them, the first assembly includes at least one original class, and the second assembly includes at least one proxy class. The computer device may traverse the first assembly and the second assembly to determine the proxy class in the second virtual machine corresponding to the original class in the first virtual machine.

[0120] In a possible implementation, determining the original class in the first virtual machine corresponding to the proxy class in the second virtual machine may include: determining the original class corresponding to any proxy class in the second virtual machine according to the binding information in any proxy class in the second virtual machine. The binding information may include information such as the class name and namespace of the original class. The computer device may determine the class name, namespace, etc. of the original class according to the binding information in any proxy class in the second virtual machine, so as to find the original class.

[0121] For example, as Figure 3 shown, the computer device establishes a first association relationship by executing step 301 and step 302.

[0122] Step 301: Traverse the second assembly to find the proxy classes in the second assembly.

[0123] Step 302: Determine the original class corresponding to each proxy class according to the binding information in the proxy class, and establish a first association relationship between the proxy class and the original class.

[0124] In a possible implementation, determining the original class in the first virtual machine corresponding to the proxy class in the second virtual machine includes at least one of the following:

[0125] (1) In response to the interface of any proxy class in the second assembly being the same as the interface of any original class in the first assembly, determining any original class as the original class corresponding to any proxy class.

[0126] Since in the process of generating a proxy class from an original class, it is ensured that the external interface of the original class is the same as the external interface of the proxy class, therefore, it can be determined whether the original class is the original class corresponding to the proxy class according to whether the interface of any proxy class in the second assembly is the same as the interface of any original class in the first assembly.

[0127] (2) In response to the class name of any proxy class in the second assembly being the same as the class name of any original class in the first assembly, determining any original class as the original class corresponding to any proxy class.

[0128] Since in the process of generating a proxy class from an original class, the class name of the original class and the class name of the proxy class are kept unchanged, therefore, it can be determined whether the original class is the original class corresponding to the proxy class according to the class name of the proxy class and the class name of the original class.

[0129] (3) In response to the namespace of any proxy class in the second assembly being the same as the namespace of any original class in the first assembly, determining any original class as the original class corresponding to any proxy class.

[0130] Since the same class name in the same namespace represents the same type, it is also possible to determine whether the original class is the original class corresponding to the proxy class based on whether the original class and the proxy class belong to the same namespace.

[0131] It should be noted that the above three methods are only exemplary descriptions of the methods for determining the original class corresponding to the proxy class in the second virtual machine in the first virtual machine in the embodiments of the present application. That is to say, it is also possible to determine the original class corresponding to the proxy class in the second virtual machine in the first virtual machine by other methods, and the embodiments of the present application do not limit this.

[0132] In addition, at least two of the above three provided methods can be arbitrarily selected and combined. For example, in a possible implementation, determining the original class corresponding to the proxy class in the second virtual machine in the first virtual machine may include: in response to the class name of any proxy class in the second assembly being the same as the class name of any original class in the first assembly, and the namespace of the any proxy class being the same as the namespace of the any original class, determining the any original class as the original class corresponding to the any proxy class.

[0133] Among them, the description information of the type may include at least one of the class name and the namespace. That is to say, it is possible to determine whether the original class is the original class corresponding to the proxy class based on the description information of the proxy class and the description information of the original class. Optionally, the computer device determines the any original class as the original class corresponding to the any proxy class in response to the description information of any proxy class in the second assembly being the same as the description information of any original class in the first assembly.

[0134] It should be noted that the present application only takes determining the original class corresponding to the proxy class by the proxy class as an example for description. In another embodiment, it is also possible to determine the proxy class corresponding to the original class by the original class, and the embodiments of the present application do not limit this.

[0135] In a possible implementation, establishing the first association relationship between the original class and the proxy class may include: adding the description information of the original class to the proxy class, and the description information is used to determine the address of the original class.

[0136] For example, as Figure 3 shown, when the computer device is started, the first association relationship between the original class and the proxy class is established, where the first association relationship may be a dictionary relationship, and the dictionary relationship means that the association relationship between the original class and the proxy class is like a dictionary, and the proxy class corresponding to the original class can be queried according to the original class, and the original class corresponding to the proxy class can also be queried according to the proxy class.

[0137] At runtime, the expression of types inside the second virtual machine is implemented by a series of internal objects. For example, in the Mono virtual machine, this series of objects can be MonoType, MonoField, MonoMethod, MonoClass, etc. The method for implementing the proxy class in the embodiments of the present application can be to directly call the APIs in mono.dll, find the description information of the original class, and save this description information in the proxy class. In this way, the proxy class has the description information of the original class.

[0138] Optionally, the proxy class needs to be associated with the original class in the second virtual machine. The computer device can associate the original class and the proxy class through MonoApi mono_assembly_get_image and mono_class_from_name.

[0139] 105. The computer device establishes a second association relationship between the original object in the original class and the proxy object in the proxy class.

[0140] In a possible implementation manner, after establishing the first association relationship between the original class and the proxy class, a second association relationship between the original object in the original class and the proxy object in the proxy class can also be established.

[0141] Optionally, for the computer device to establish the second association between the original object in the original class and the proxy object in the proxy class, it can include: determining the original object bound to the proxy object according to the binding information of the proxy object in the proxy class. Optionally, the binding information of the proxy object can include the description information of the original object associated with the proxy object. The computer device can determine the original object from the original class according to the description information of the original object.

[0142] Optionally, the original class includes at least one of objects such as fields, methods, and properties. Establishing the second association relationship between the original object in the original class and the proxy object in the proxy class further includes at least one of the following:

[0143] (1) Determining the proxy field in the proxy class corresponding to the original field in the original class, and establishing the second association relationship between the original field and the proxy field.

[0144] Among them, the original field is a field in the original class, and the proxy field is a field in the proxy class. Since the original class and the proxy class are in an association relationship and the proxy class is generated according to the description information of the original class, the proxy field in the proxy class is also associated with the original field in the original class. Therefore, the second association relationship between the original field and the proxy field can be established.

[0145] Among them, determining the proxy field in the proxy class corresponding to the original field in the original class may include: in response to the description information of any original field in the original class being the same as the description information of any proxy field in the proxy class, determining that the any original field is the original field corresponding to the any proxy field.

[0146] For example, in response to the field name of any proxy field being the same as the field name of any original field, determining that the proxy field is the proxy field corresponding to the original field. For example, the original class of the Mono virtual machine includes the field MonoField, and the proxy class of the CLR virtual machine includes the field CLRField, whereby a second association relationship between the field MonoField and the field CLRField can be established.

[0147] In addition, establishing the second association relationship between the original field and the proxy field may include: adding the description information of the original field to the proxy field, and the description information can be used to determine the address of the original field.

[0148] In addition, the second association relationship between the original field and the proxy field can also be implemented through MonoApimono_class_get_field_from_name.

[0149] (2) Determine the proxy method in the proxy class corresponding to the original method in the original class, and establish the second association relationship between the original method and the proxy method.

[0150] Among them, the method of determining the proxy method in the proxy class corresponding to the original method in the original class is similar to the method of determining the proxy field in the proxy class corresponding to the original field in the original class; and the method of establishing the second association relationship between the original method and the proxy method is similar to the method of establishing the second association relationship between the original field and the proxy field, which will not be elaborated one by one here.

[0151] In addition, the second association relationship between the original method and the proxy method can also be implemented through MonoApimono_method_signature.

[0152] (3) Determine the proxy property in the proxy class corresponding to the original property in the original class, and establish the second association relationship between the original property and the proxy property.

[0153] Among them, the method of determining the proxy property in the proxy class corresponding to the original property in the original class is similar to the method of determining the proxy field in the proxy class corresponding to the original field in the original class; and the method of establishing the second association relationship between the original property and the proxy property is similar to the method of establishing the second association relationship between the original field and the proxy field, which will not be elaborated one by one here.

[0154] In addition, establishing the second association relationship between the original attribute and the proxy attribute can also be achieved through MonoApimono_method_signature.

[0155] In a possible implementation manner, establishing the second association relationship between the original object in the original class and the proxy object in the proxy class further includes at least one of the following:

[0156] (1) Determine the original field in the original class corresponding to the proxy field in the proxy class, and establish the second association relationship between the original field and the proxy field.

[0157] (2) Determine the original method in the original class corresponding to the proxy method in the proxy class, and establish the second association relationship between the original method and the proxy method.

[0158] (3) Determine the original attribute in the original class corresponding to the proxy attribute in the proxy class, and establish the second association relationship between the original attribute and the proxy attribute.

[0159] In another possible implementation manner, after establishing the first association relationship between the original class and the proxy class, the method further includes: in response to any object being the original object in the original class, create a proxy object corresponding to the original object in the proxy class corresponding to the original class, and establish the second association relationship between the original object and the proxy object. That is to say, the computer device can also first create a proxy object in the proxy class, and then establish the second association relationship between the original object and the proxy object.

[0160] For example, through MonoApi mono_object_get_class, the description information of the object inside the Mono virtual machine can be obtained. Based on this description information, the CLR proxy class corresponding to any Mono original class can be found in the first association relationship created at system startup, and then an object corresponding to it can be created based on this CLR proxy class and associated with the specified Mono virtual machine object.

[0161] 106. The computer device receives an access request through the second virtual machine, and the access request carries the proxy class in the second virtual machine and the proxy object in the proxy class.

[0162] Among them, since the external interfaces of the proxy class and the original class are the same, therefore, the original class carried in the access request can be regarded as the proxy class in the second virtual machine, and the original object carried in the access request can be regarded as the proxy object in the second virtual machine.

[0163] Since the access request carries the proxy class in the second virtual machine and the proxy object in the proxy class, therefore, receiving the access request through the second virtual machine is actually the second virtual machine accessing the object inside the second virtual machine according to the access request.

[0164] 107. The computer device accesses the original object associated with the proxy object in the original class associated with the proxy class according to the first association relationship, the second association relationship, and the access request.

[0165] The second virtual machine can access the proxy class and the proxy object in the second virtual machine according to the access request, determine the original class and the original object associated with the proxy class and the proxy object based on the first association relationship and the second association relationship, and access the original object in the original class according to the access request. That is, directly forward the access information to run on the original object inside the first virtual machine.

[0166] In a possible implementation manner, accessing the original object associated with the proxy object in the original class associated with the proxy class according to the first association relationship, the second association relationship, and the access request includes: converting the access data carried in the access request into a data format supported by the first virtual machine; accessing the original object according to the converted access request.

[0167] In a possible implementation manner, as Figure 4 shown, accessing the original object associated with the proxy object in the original class associated with the proxy class according to the first association relationship, the second association relationship, and the access request includes at least one of the following:

[0168] (1) Accessing the original object in the original class through the access request to obtain the corresponding data in the first virtual machine, where the access request is used to obtain a field. Wherein, the original object is a field.

[0169] As Figure 4 shown, when the access request is used to obtain field 401, the computer device invokes the interface in the first virtual machine through the field binding information of the proxy field to obtain the data in the first virtual machine.

[0170] For example, obtaining the corresponding data in the first virtual machine through the access request above can be implemented by mono_field_get_value and mono_field_static_get_value. Among them, mono_field_get_value is used to obtain ordinary fields, and mono_field_static_get_value is used to obtain static fields.

[0171] (2) Accessing the original object in the original class through the access request to change the corresponding field in the first virtual machine, where the access request is used to set a field. Wherein, the original object is a field.

[0172] As Figure 4As shown, the access request is used to set field 402. The computer device converts the data in the second virtual machine into a data format supported by the first virtual machine, and through the field binding information of the proxy field, calls the interface of the first virtual machine and passes the converted data to the first virtual machine.

[0173] Among them, changing the corresponding field in the first virtual machine through the access request can be achieved by using mono_field_get_value and mono_field_static_get_value. Among them,

[0174] (3) Access the original object in the original class according to the access request, and call the associated method in the first virtual machine. The access request is used to call a method or access an attribute. Among them, the original object is a method or an attribute.

[0175] For example, as Figure 4 shown, the access request is used to call method 403. The computer device determines whether the method has parameters. If there are parameters, it converts the parameters into a data format supported by the first virtual machine, and through the method binding information, calls the interface of the first virtual machine to trigger the method call of the corresponding original object in the first virtual machine.

[0176] Another example, as Figure 4 shown, the access request is used to access attribute 404. The computer device calls a method according to the access request, determines whether the method has parameters. If there are parameters, it converts the parameters into a data format supported by the first virtual machine, and through the method binding information, calls the interface of the first virtual machine to trigger the method call of the corresponding original object in the first virtual machine.

[0177] Among them, calling the corresponding method in the first virtual machine according to the access request may include: obtaining the corresponding attribute in the first virtual machine according to the access request; or setting the corresponding attribute in the first virtual machine.

[0178] Among them, obtaining an attribute is equivalent to calling the Getter method corresponding to the attribute, setting an attribute is equivalent to calling the Setter method corresponding to the attribute, and calling the corresponding method in the first virtual machine can be achieved by mono_runtime_invoke.

[0179] It should be noted that the above steps 106 and 107 are only exemplary descriptions of accessing the original class through the proxy class. In another embodiment, it may also be to access the original class associated with the proxy class according to the first association relationship and the access request. In a possible implementation, accessing the original class associated with the proxy class according to the first association relationship and the access request includes: converting the access data carried in the access request into a data format supported by the first virtual machine; accessing the original class according to the converted access request.

[0180] Optionally, accessing the original class associated with the proxy class according to the first association relationship and the access request includes at least one of the following:

[0181] (1) Access the original class through the access request to obtain the corresponding data in the first virtual machine, and the access request is used to obtain a field.

[0182] (2) Access the original class through the access request to change the corresponding field in the first virtual machine, and the access request is used to set a field.

[0183] (3) Access the original class according to the access request to call the corresponding method in the first virtual machine, and the access request is used to call a method or access an attribute.

[0184] 108. The computer device converts the format of the return value into a format supported by the second virtual machine in response to obtaining a return value after accessing the original object.

[0185] If accessing the original object in the first virtual machine has a return value, it is necessary to convert it into data recognizable by the second virtual machine, that is, convert the format of the return value into a format supported by the second virtual machine.

[0186] According to the difference of the return value, converting the format of the return value into a format supported by the second virtual machine may include the following processing methods:

[0187] (1) The return value is Void: that is, there is no return value after accessing the original object, and the return value of the relevant interface on the second virtual machine side is also Void.

[0188] (2) The return value is a built-in simple type, such as Boolean, Char, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Enum (enumeration), etc., and the computer device can directly convert the return value into the corresponding type of the second virtual machine.

[0189] (3) The return value is a string, and the string has its own text encoding format in the first virtual machine, which is different from the text encoding format used by the second virtual machine. Therefore, text encoding conversion is required to generate a string that can be used by the second virtual machine.

[0190] For example, the string has its own text encoding format in the Mono virtual machine, which is different from the text encoding format used by the CLR virtual machine. Therefore, text encoding conversion is required, and at the same time, a string of type String that can be used by the CLR is generated.

[0191] (4) The return value is a structure, and the structures supported by the system can be simple structures distributed in the normal byte order. At this time, directly provide the internal structure memory area of the first virtual machine for the second virtual machine to use, and create a structure from this memory area.

[0192] For example, provide the internal structure memory area of the Mono virtual machine for the CLR virtual machine to use, and create a structure from this memory area.

[0193] 109. The computer device sends the converted return value to the second virtual machine according to the first association relationship.

[0194] The computer device sending the converted return value to the second virtual machine according to the first association relationship means: according to the first association relationship, send the converted return value to the second virtual machine through the external interface of the proxy class. This solution is equivalent to the computer device accessing the proxy class through the external interface of the proxy class and receiving the return value of the proxy class. And this solution actually calls the original object in the original class through the proxy class, the first association relationship, and the second association relationship, runs the code in the first virtual machine, obtains the return value, and sends the return value to the second virtual machine.

[0195] The object access method provided by the embodiments of the present application can be applied to the scenario of application development. Figure 5 A display interface of an application program is provided, and the display interface includes various virtual objects such as a virtual character 501 and an operation button 502. Figure 6 It is a display interface of an editor for application development. In this display interface, there are a map setting option 601, a scene tree option 602, and a property setting option 603. Operations can be performed in this display interface to edit the scene, gameplay, etc. of the application program. Since this editor uses the Mono virtual machine, when running in the.NET framework, the solution provided by the embodiments of the present application can be adopted.

[0196] The object access method provided by the embodiment of the present application obtains the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, receives an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine, and accesses the original class associated with the proxy class according to the first association relationship and the access request. Through the association relationship between the original class and the proxy class, the original class can be accessed by accessing the proxy class, realizing the simultaneous operation of the first virtual machine and the second virtual machine, and enabling the second virtual machine to interact with the first virtual machine through the association relationship between the proxy class and the original class. Moreover, this interaction method has low interaction cost and is easy to be applied to various scenarios.

[0197] Figure 7 is a schematic structural diagram of a virtual object control device provided by the embodiment of the present application, as Figure 7 shown, the device includes:

[0198] An obtaining module 701, configured to obtain the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine;

[0199] A receiving module 702, configured to receive an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine;

[0200] An access module 703, configured to access the original class associated with the proxy class according to the first association relationship and the access request.

[0201] The object access device provided by the embodiment of the present application obtains the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, receives an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine, and accesses the original class associated with the proxy class according to the first association relationship and the access request. Through the association relationship between the original class and the proxy class, the original class can be accessed by accessing the proxy class, realizing the simultaneous operation of the first virtual machine and the second virtual machine, and enabling the second virtual machine to interact with the first virtual machine through the association relationship between the proxy class and the original class. Moreover, this interaction method has low interaction cost and is easy to be applied to various scenarios.

[0202] As Figure 8 shown, in a possible implementation manner, the obtaining module 701 includes:

[0203] An obtaining unit 7011, configured to obtain the first assembly of the first virtual machine and the second assembly of the second virtual machine, where the first assembly includes at least one original class and the second assembly includes at least one proxy class;

[0204] A determining unit 7012, configured to determine the original class in the first virtual machine corresponding to the proxy class in the second virtual machine;

[0205] A creation unit 7013 is configured to create a first association relationship between the original class and the corresponding proxy class.

[0206] In a possible implementation, the determination unit 7012 is configured to determine the original class corresponding to any proxy class according to the binding information in any proxy class in the second virtual machine.

[0207] In a possible implementation, the determination unit 7012 is configured to perform at least one of the following:

[0208] In response to the interface of any proxy class in the second assembly being the same as the interface of any original class in the first assembly, determining that the any original class is the original class corresponding to the any proxy class;

[0209] In response to the class name of any proxy class in the second assembly being the same as the class name of any original class in the first assembly, determining that the any original class is the original class corresponding to the any proxy class;

[0210] In response to the namespace of any proxy class in the second assembly being the same as the namespace of any original class in the first assembly, determining that the any original class is the original class corresponding to the any proxy class.

[0211] In a possible implementation, the creation unit 7013 is further configured to add the description information of the original class to the proxy class, where the description information is used to determine the address of the original class.

[0212] In a possible implementation, the creation unit 7013 is further configured to create a second association relationship between the original object and the proxy object.

[0213] In a possible implementation, the creation unit 7013 is further configured to, in response to any object being the original object in the original class, create a proxy object corresponding to the original object in the proxy class associated with the original class, and create a second association relationship between the original object and the proxy object.

[0214] In a possible implementation, the original class includes at least one of an object such as a field, a method, and a property. The creation unit 7013 is further configured to perform at least one of the following:

[0215] Determine a proxy field in the proxy class corresponding to the original field in the original class, and create a second association relationship between the original field and the proxy field;

[0216] Determine a proxy method in the proxy class corresponding to the original method in the original class, and create a second association relationship between the original method and the proxy method;

[0217] Determine the proxy attributes in the proxy class that correspond to the original attributes in the original class, and establish a second association relationship between the original attribute and the proxy attribute.

[0218] In a possible implementation, the access request carries a proxy object in the proxy class; the access module 703 includes:

[0219] An acquisition unit 7031, configured to acquire a second association relationship between the original object in the original class and the proxy object in the proxy class;

[0220] An access unit 7032, configured to access, according to the first association relationship, the second association relationship, and the access request, the original object associated with the proxy object in the original class associated with the proxy class.

[0221] In a possible implementation, the access unit 7032 is configured to perform at least one of the following:

[0222] Access the original class through the access request to obtain corresponding data in the first virtual machine, where the access request is used to obtain a field;

[0223] Access the original class through the access request to change the corresponding field in the first virtual machine, where the access request is used to set a field;

[0224] Access the original class according to the access request to call the corresponding method in the first virtual machine, where the access request is used to call a method or access an attribute.

[0225] In a possible implementation, the access module 703 includes:

[0226] A conversion unit 7033, configured to convert the access data carried by the access request into a data format supported by the first virtual machine;

[0227] An access unit 7032, configured to access the original class according to the converted access request.

[0228] In a possible implementation, the apparatus further includes:

[0229] A conversion module 704, configured to convert the format of the return value into a format supported by the second virtual machine in response to obtaining a return value after accessing the original class;

[0230] A distribution module 705, configured to distribute the converted return value to the second virtual machine according to the first association relationship.

[0231] In a possible implementation manner, the obtaining unit 7031 is configured to obtain the first assembly, determine each original class in the first assembly; generate a proxy class corresponding to each original class in the second virtual machine; and generate the second assembly according to each proxy class.

[0232] In a possible implementation manner, the obtaining unit 7031 is configured to generate a proxy class corresponding to each original class according to the description information of the original class, and the interface of the proxy class is the same as the interface of the corresponding original class.

[0233] In a possible implementation manner, the proxy class includes binding information, and the obtaining unit 7031 is configured to generate the binding information of each original class according to the description information of each original class.

[0234] Figure 9 FIG. is a schematic structural diagram of a terminal provided in an embodiment of the present application, which can implement the operations performed by the first terminal, the second terminal, and the third terminal in the above embodiments. The terminal 900 may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer, a desktop computer, a head-mounted device, a smart TV, a smart speaker, a smart remote control, a smart microphone, or any other smart terminal. The terminal 900 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.

[0235] Generally, the terminal 900 includes: a processor 901 and a memory 902.

[0236] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The memory 902 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory and used to store at least one instruction, and the at least one instruction is used to be executed by the processor 901 to implement the object access method provided in the method embodiment of the present application.

[0237] In some embodiments, the terminal 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902, and the peripheral device interface 903 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 903 through a bus, signal lines, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 904, a display screen 905, and an audio circuit 906.

[0238] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with the communication network and other communication devices through electromagnetic signals.

[0239] The display screen 905 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. The display screen 905 may be a touch display screen and may also be used to provide virtual buttons and / or virtual keyboards.

[0240] The audio circuit 906 may include a microphone and a speaker. The microphone is used to collect audio signals of the user and the environment, and convert the audio signals into electrical signals for input to the processor 901 for processing, or input to the radio frequency circuit 904 to implement voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 901 or the radio frequency circuit 904 into audio signals.

[0241] Those skilled in the art can understand that Figure 9 the structure shown in does not constitute a limitation on the terminal 900, and may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.

[0242] Figure 10 FIG. is a schematic structural diagram of a server provided by an embodiment of the present application. The server 1000 may vary greatly due to different configurations or performances, and may include one or more processors (Central Processing Units, CPUs) 1001 and one or more memories 1002. Among them, at least one instruction is stored in the memory 1002, and at least one instruction is loaded and executed by the processor 1001 to implement the methods provided by the above-mentioned various method embodiments. Of course, the server may also have components such as wired or wireless network interfaces, keyboards, and input / output interfaces for input / output. The server may also include other components for implementing device functions, which will not be elaborated here.

[0243] The server 1000 may be used to execute the above object access method.

[0244] An embodiment of the present application also provides a computer device, which includes a processor and a memory. At least one program code is stored in the memory, and at least one program code is loaded by the processor and is used to implement the object access method of the above embodiment.

[0245] The embodiment of the present application also provides a computer-readable storage medium, in which at least one program code is stored, and the at least one program code is loaded by a processor and is used to implement the object access method in the above embodiment.

[0246] The embodiment of the present application also provides a computer program, in which at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the object access method in the above embodiment.

[0247] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiment can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disc, etc.

[0248] The above are only optional embodiments of the embodiments of the present application, and are not intended to limit the embodiments of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the embodiments of the present application shall be included in the protection scope of the present application.

Claims

1. An object access method, characterized in that, The method includes: Obtain a first assembly in a first virtual machine, where the first assembly includes at least one original class; Generate a second assembly according to the first assembly, where the second assembly includes proxy classes corresponding to the at least one original class, the interface of each proxy class is the same as the interface of the corresponding original class, and the second assembly is the assembly called by a second virtual machine; the first virtual machine and the second virtual machine run simultaneously; Obtain a first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, where the first virtual machine is the virtual machine adopted by an editor for developing an application, the second virtual machine is the virtual machine adopted by an application development framework, and the first virtual machine and the second virtual machine are virtual machines of different types; Receive an access request through the second virtual machine, where the access request carries the proxy class in the second virtual machine; According to the first association relationship and the access request, access the original class associated with the proxy class by accessing the proxy class.

2. The method according to claim 1, characterized in that, The obtaining the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine includes: Determine the original class in the first virtual machine corresponding to the proxy class in the second virtual machine; Establish a first association relationship between the original class and the corresponding proxy class.

3. The method according to claim 2, characterized in that, The determining the original class in the first virtual machine corresponding to the proxy class in the second virtual machine includes: Determine the original class corresponding to any proxy class according to the binding information in any proxy class in the second virtual machine.

4. The method according to claim 2, characterized in that, The determining the original class in the first virtual machine corresponding to the proxy class in the second virtual machine includes at least one of the following: In response to the interface of any proxy class in the second assembly being the same as the interface of any original class in the first assembly, determine the any original class as the original class corresponding to the any proxy class; In response to the class name of any proxy class in the second assembly being the same as the class name of any original class in the first assembly, determine the any original class as the original class corresponding to the any proxy class; In response to the namespace of any proxy class in the second assembly being the same as the namespace of any original class in the first assembly, determine the any original class as the original class corresponding to the any proxy class.

5. The method according to claim 2, characterized in that, The establishing the first association relationship between the original class and the corresponding proxy class includes: Add the description information of the original class to the proxy class, where the description information is used to determine the address of the original class.

6. The method according to claim 2, characterized in that, After the establishing the first association relationship between the original class and the corresponding proxy class, the method further includes: Establish a second association relationship between the original object in the original class and the proxy object corresponding to the original object in the proxy class.

7. The method according to claim 6, characterized in that, The establishing the second association relationship between the original object in the original class and the proxy object corresponding to the original object in the proxy class includes: In response to any object being the original object in the original class, create a proxy object corresponding to the original object in the proxy class associated with the original class, and establish a second association relationship between the original object and the proxy object.

8. The method according to claim 6, characterized in that, The original class includes at least one object among fields, methods, and properties. Establishing the second association relationship between the original object in the original class and the proxy object corresponding to the original object in the proxy class includes at least one of the following: Determine the proxy field in the proxy class corresponding to the original field in the original class, and establish the second association relationship between the original field and the proxy field; Determine the proxy method in the proxy class corresponding to the original method in the original class, and establish the second association relationship between the original method and the proxy method; Determine the proxy property in the proxy class corresponding to the original property in the original class, and establish the second association relationship between the original property and the proxy property.

9. The method according to claim 1, characterized in that, The access request carries the proxy object in the proxy class; accessing the original class associated with the proxy class by accessing the proxy class according to the first association relationship and the access request includes: Obtain the second association relationship between the original object in the original class and the proxy object in the proxy class; According to the first association relationship, the second association relationship, and the access request, access the original object associated with the proxy object in the original class associated with the proxy class by accessing the proxy object in the proxy class.

10. The method according to claim 9, characterized in that, The accessing the original object associated with the proxy object in the original class associated with the proxy class by accessing the proxy object in the proxy class according to the first association relationship, the second association relationship, and the access request includes at least one of the following: Access the original class through the access request to obtain the corresponding data in the first virtual machine, and the access request is used to obtain a field; Access the original class through the access request to change the corresponding field in the first virtual machine, and the access request is used to set a field; Access the original class according to the access request and call the corresponding method in the first virtual machine, and the access request is used to call a method or access a property.

11. The method according to claim 1, wherein The accessing the original class associated with the proxy class by accessing the proxy class according to the first association relationship and the access request includes: Convert the access data carried by the access request into a data format supported by the first virtual machine; According to the converted access request, access the original class by accessing the proxy class.

12. The method according to claim 1, wherein After accessing the original class associated with the proxy class by accessing the proxy class according to the first association relationship and the access request, the method further includes: In response to obtaining a return value after accessing the original class, convert the format of the return value into a format supported by the second virtual machine; According to the first association relationship, send the converted return value to the second virtual machine.

13. The method according to claim 2, wherein Generating the second assembly according to the first assembly includes: Generate the proxy class corresponding to each original class in the second virtual machine according to each original class in the first assembly; Generate the second assembly according to each proxy class.

14. The method according to claim 13, wherein Generating a proxy class corresponding to each original class in the second virtual machine according to each original class in the first assembly includes: Generating a proxy class corresponding to each original class according to the description information of the original class.

15. The method according to claim 13, wherein The proxy class includes binding information. Generating a proxy class corresponding to each original class in the second virtual machine according to each original class in the first assembly includes: Generating binding information for each original class according to the description information of each original class.

16. An object access device, wherein The device includes: An acquisition module, configured to acquire a first assembly in a first virtual machine, where the first assembly includes at least one original class; generate a second assembly according to the first assembly, where the second assembly includes proxy classes corresponding to the at least one original class, and interfaces of each proxy class are the same as interfaces of the corresponding original class, and the second assembly is an assembly called by a second virtual machine; the first virtual machine and the second virtual machine run simultaneously; An acquisition module, configured to acquire a first association relationship between an original class in the first virtual machine and a proxy class in the second virtual machine, where the first virtual machine is a virtual machine adopted by an editor for developing an application, the second virtual machine is a virtual machine adopted by an application development framework, and the first virtual machine and the second virtual machine are virtual machines of different types; A receiving module, configured to receive an access request through the second virtual machine, where the access request carries a proxy class in the second virtual machine; An access module, configured to access an original class associated with the proxy class by accessing the proxy class according to the first association relationship and the access request.

17. A computer device, wherein The computer device includes a processor and a memory. At least one program code is stored in the memory and is loaded and executed by the processor to implement the object access method according to any one of claims 1 to 15.

18. A computer-readable storage medium, wherein At least one program code is stored in the computer-readable storage medium and is loaded and executed by a processor to implement the object access method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • System and method for having access to internal objects of application systems

    CN103677975A

  • Access method and device of access object and terminal

    CN106778296A

  • Communication method and system between multiple virtual machines

    CN107453971A

  • Method, device and electronic equipment for object access

    CN108427677A

  • A kernel object access method and device for an embedded operating system

    CN109740310A