CN111290746A - Object access method, device, equipment and storage medium - Google Patents

Object access method, device, equipment and storage medium Download PDF

Info

Publication number
CN111290746A
CN111290746A CN202010091143.3A CN202010091143A CN111290746A CN 111290746 A CN111290746 A CN 111290746A CN 202010091143 A CN202010091143 A CN 202010091143A CN 111290746 A CN111290746 A CN 111290746A
Authority
CN
China
Prior art keywords
class
original
proxy
virtual machine
access request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010091143.3A
Other languages
Chinese (zh)
Inventor
董波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010091143.3A priority Critical patent/CN111290746A/en
Publication of CN111290746A publication Critical patent/CN111290746A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application discloses an object method, an object device, object equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring a first association relation between an original class in a first virtual machine and an agent class in a second virtual machine; receiving an access request through the second virtual machine, wherein the access request carries an agent class in the second virtual machine; and accessing the original class associated with the proxy class according to the first association relation and the access request. Through the incidence relation between the original class and the proxy class, the original class can be accessed through accessing the proxy class, the first virtual machine and the second virtual machine can be operated simultaneously, and the interaction with the first virtual machine is realized through the second virtual machine.

Description

Object access method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to an object access method, device, equipment and storage medium.
Background
With the continuous progress of computer technology, application development is widely developed, and an editor for developing applications can run in an application development framework. However, if the first virtual machine used by the editor is different from the second virtual machine used by the application development framework, since the two different virtual machines cannot directly interact with each other, the second virtual machine cannot access the object in the first virtual machine, and thus the editor cannot run in the application development framework.
At present, all codes running in the first virtual machine can be transplanted into the second virtual machine, and 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 migrated and cannot be migrated to the second virtual machine, the editor cannot be used for application development.
Disclosure of Invention
The embodiment of the application provides a virtual object control method, a virtual object control device and a storage medium, which can enrich control modes and enable the application range to be wide. The technical scheme is as follows:
in one aspect, an object access method is provided, and the method includes:
acquiring a first association relation between an original class in a first virtual machine and an agent class in a second virtual machine;
receiving an access request through the second virtual machine, wherein the access request carries an agent class in the second virtual machine;
and accessing the original class associated with the proxy class according to the first association relation and the access request.
In another aspect, an object access apparatus is provided, the apparatus including:
the acquisition module is used for acquiring a first association relation between an original class in the first virtual machine and an agent class in the second virtual machine;
a receiving module, configured to receive, by the second virtual machine, an access request, where the access request carries an agent class in the second virtual machine;
and the access module is used for accessing the original class associated with the proxy class according to the first association relation and the access request.
In one possible implementation manner, the obtaining module includes:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first program set of a first virtual machine and a second program set of a second virtual machine, the first program set comprises at least one original class, and the second program set comprises at least one proxy class;
a determining unit, configured to determine an original class in the first virtual machine, where the original class corresponds to an agent class in the second virtual machine;
and the establishing unit is used for establishing a first association relation between the original class and the corresponding proxy class.
In a possible implementation manner, the determining unit is configured to determine, according to binding information in any one of the agent classes in the second virtual machine, an original class corresponding to the any one of the agent classes.
In one possible implementation, the determining unit is configured to perform at least one of:
in response to that an interface of any proxy class in the second program set is the same as an interface of any original class in the first program set, determining that the any original class is an original class corresponding to the any proxy class;
in response to that the class name of any proxy class in the second program set is the same as the class name of any original class in the first program set, determining that the any original class is an original class corresponding to the any proxy class;
and determining any original class as an original class corresponding to any proxy class in the second program set in response to the fact that the name space of any proxy class in the second program set is the same as the name space of any original class in the first program set.
In a possible implementation manner, 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.
In a possible implementation manner, 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.
In a possible implementation manner, the establishing unit is further configured to, in response to that any object is an original object in the original class, create a proxy object corresponding to the original object in a proxy class associated with the original class, and establish a second association relationship between the original object and the proxy object.
In a possible implementation manner, the original class includes at least one object of a field, a method, and an attribute, and the creating unit is further configured to perform at least one of the following:
determining a proxy field corresponding to an original field in the original class in the proxy class, and establishing a second association relationship between the original field and the proxy field;
determining an agent method corresponding to the original method in the original class in the agent class, and establishing a second association relation between the original method and the agent method;
determining the proxy attribute corresponding to the original attribute in the original class in the proxy class, and establishing a second association relationship between the original attribute and the proxy attribute.
In one possible implementation, the access request carries a proxy object in the proxy class; the access module includes:
the acquiring unit is used for acquiring a second association relation between the original object in the original class and the proxy object in the proxy class;
and the access unit is used for accessing the original object associated with the proxy object in the original class associated with the proxy class according to the first association relation, the second association relation and the access request.
In one possible implementation, the access unit is configured to perform at least one of:
accessing the original class through the access request to acquire corresponding data in the first virtual machine, wherein the access request is used for acquiring a field;
accessing the original class through the access request, and changing a corresponding field in the first virtual machine, wherein the access request is used for setting the field;
and accessing the original class according to the access request, and calling a corresponding method in the first virtual machine, wherein the access request is used for calling a method or accessing an attribute.
In one possible implementation, the access module includes:
a conversion unit, configured to convert access data carried by the access request into a data format supported by the first virtual machine;
and the access unit is used for accessing the original class according to the converted access request.
In one possible implementation, the apparatus further includes:
the conversion module is used for responding to the original class to obtain a return value and converting the format of the return value into a format supported by the second virtual machine;
and the issuing module is used for issuing the converted return value to the second virtual machine according to the first incidence relation.
In a possible implementation manner, the obtaining unit is configured to obtain the first program set, and determine each original class in the first program set; generating a proxy class corresponding to each original class in the second virtual machine; and generating the second program set according to each proxy class.
In a possible implementation manner, the obtaining unit is configured to generate, according to the description information of the original class, a proxy class corresponding to each original class, where an interface of the proxy class is the same as an interface of the corresponding original class.
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.
In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory having stored therein at least one program code, the at least one program code being loaded and executed by the processor to implement the object access method according to the above aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one program code is stored, the at least one program code being loaded and executed by a processor to implement the object access method according to the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the object access method, the object access device, the object access equipment and the storage medium, the first association relation between the original class in the first virtual machine and the proxy class in the second virtual machine is obtained, the second virtual machine receives the access request, the access request carries the proxy class in the second virtual machine, and the original class associated with the proxy class is accessed according to the first association relation and the access request. Through the incidence relation between the original class and the proxy class, the original class can be accessed through accessing the proxy class, the first virtual machine and the second virtual machine can be operated simultaneously, and the second virtual machine and the first virtual machine can be interacted through the incidence relation between the proxy class and the original class.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of an object access method provided in an embodiment of the present application;
fig. 2 is a flowchart of a second program set generating method according to an embodiment of the present application;
fig. 3 is a flowchart of a method for establishing an association relationship according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for accessing an original object according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a display interface of an application provided in an embodiment of the present application;
FIG. 6 is a schematic interface diagram of an editor provided by an embodiment of the present application;
fig. 7 is a schematic structural diagram of an object access apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an object access apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
It will be understood that the terms "first," "second," and the like as used herein may be used herein to describe various concepts, which are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, a first virtual machine may be referred to as a second virtual machine, and similarly, a second virtual machine may be referred to as a first virtual machine, without departing from the scope of the present application.
As used herein, the terms "at least one," "a plurality," "each," and "any," at least one of which includes one, two, or more than two, a plurality of which includes two or more than two, and each of which refers to each of the corresponding plurality, and any of which refers to any of the plurality, for example, a plurality of objects includes 3 objects, and each of which refers to each of the 3 objects, and any of which refers to any of the 3 objects, which may be the first, second, or third.
NET (third generation internet): the network is an operation platform, and a user can construct various applications in the NET.
NET Framework (common language operating platform): the method is an application development framework, can be used for constructing an application program with visually attractive user experience, realizes seamless communication across technical boundaries, and can support various business processes.
CLR (Common Language Runtime): is the name of the virtual machine of the NET. The CLR runs a bytecode called a Common intermediate Language, which is an implementation version of CLI (Common Language architecture).
CLI (Common Language architecture): NETFramework infrastructure is a specification of the runtime environment of executable code and code that defines a language independent cross-architecture executable code and code, allowing developers to develop software in a variety of high-level languages defined within the specification, and run applications on different computer architectures without modification.
Mono: is a free open source project and comprises a C # compiler and a general language architecture. The goal of this project is to create a series of.NET tools that conform to the ECMA (European Computer Manufacturers Association) standards (Ecma-334 and Ecma-335). Unlike the NET Framework, the following are: the Mono project can be operated on a Windows system, systems such as Linux, FreeBSD, Unix, OS X and Solaris, and some game platforms, such as: playstation 3, Wii or XBox 360.
Mono virtual machine: the virtual machine can run C # code, and compared with the CLR virtual machine, the Mono virtual machine can run across platforms.
UnityEngine is a cross-platform 2D/3D game engine.
Assembly (Assembly): is a code base obtained by compiling code for further compilation execution by the CLR, which is generally expressed in the format of · dll or · exe in WINDOWS systems. The code of the assembly is represented in Common Intermediate Language (CIL) and is just-in-time compiled at runtime to machine Language-in-NETFramework implementation, such just-in-time compilation being part of the Common Language Runtime (CLR). In compiling an application, the created CIL code is stored in a set of programs, including executable application files (the set of process programs (EXE)) and libraries (the set of library programs (DLL)) used by other applications.
C #, an object-oriented high-level programming language based on the NET framework, which is introduced by Microsoft. C # is based on the NET framework class library.
Mono.Ceil is a tool which can statically read and analyze ECMA CIL format files, and various types and attribute information in a program set can be analyzed off line through the tool.
Dll, execution module of the Mono virtual machine under Windows, which is the main body of the Mono virtual machine. It has some export functions that can be directly called externally.
MonoApi (Application Programming Interface), some functions used to support C # operation inside Mono virtual machine. These functions are derived from mono.dll and can be called externally.
Mono type A type in a Mono virtual machine, which is identical to the System.
MonoObject (object) common base class type in Mono virtual machines equivalent to System. Object in CLR virtual machines.
MonoMethod (method) Mono is virtually equivalent to the type of system in CLR.
MonoField-Mono is virtually equivalent to the type of System.Refraction.FieldInfo in CLR, for describing a field.
MonoClass (class) Mono virtual machines are used internally to describe a type.
MonoArray (array) array in Mono virtual machine.
Object-oriented programming (OOP) is an application programming paradigm with Object concepts and is also an abstract guideline for application development. It may include data, attributes, code, and methods, where an object refers to an instance of a class. The object can be used as a basic unit of the program, the program and the data are packaged in the basic unit, so that the reusability, the flexibility and the expansibility of the application are improved, and the program in the object can access and often modify the data related to the object.
Class (class): in object-oriented programming, the object-oriented computer programming language is constructed by creating blueprints of objects, describing properties and methods common to the created objects.
Object: in the application system, the object has a unique identifier, the object comprises Properties (Properties) and Methods (Methods), the Properties are information needing to be memorized, and the Methods are services which can be provided by the object. In an Object oriented application, an Object is an Instance (Instance) of a Class (Class).
Properties (Properties): in an object-oriented programming language, an attribute is a concept between a field and a method, and the code writing of an attribute is similar to that of a field, but the attribute code is actually a method call. In C #, the attribute is implemented by a hidden acquisition method (Getter) and a setting method (Setter).
The object access method provided by the embodiment of the present application can be applied to a computer device, where the computer device can be a plurality of types of terminals such as a mobile phone, a computer, a tablet computer, and the like, and can also be a server, and the server can be a server, a server cluster composed of a plurality of servers, or a cloud computing service center, and the method is not limited in the embodiment of the present application.
The object access method provided by the embodiment of the application can be applied to a software development scene.
For example, a scene of an application is developed in an application development framework by an editor that develops the application.
The editor adopts a first virtual machine, the application development framework adopts a second virtual machine, and the second virtual machine cannot access an object in the first virtual machine due to the fact that two different virtual machines cannot interact directly, so that the editor cannot run in the application development framework. By adopting the object access method provided by the embodiment of the application, the proxy class can be created in the second virtual machine, the first association relation between the original class in the first virtual machine and the proxy class in the second virtual machine is obtained, and the second virtual machine receives the access request which carries the proxy class in the second virtual machine; according to the first association relation and the access request, the original class associated with the agent class is accessed, the second virtual machine is accessed to the first virtual machine, the interaction of the two virtual machines is indirectly realized, and therefore the editor can run in an application development framework to carry out application development.
Fig. 1 is a flowchart of an object access method provided in an embodiment of the present application, and is applied to a computer device, as shown in fig. 1, the method includes:
101. the computer device obtains a first set of programs for the first virtual machine, and determines each original class in the first set of programs.
A Virtual Machine (Virtual Machine) refers to a complete computer system with complete hardware system functions, which is simulated by an application program and runs in a completely isolated environment. The work that can be done in the computer device can be implemented in a virtual machine. The first virtual machine may be any type of virtual machine, for example, a Mono virtual machine, a CLR virtual machine, a linux virtual machine, a Java virtual machine, and the like.
An assembly is a logical collection of type definitions, data files, and resource files that may be run by a virtual machine. The first set of programs of the first virtual machine may be viewed as a set of programs run by the first virtual machine.
In an application development scene, an editor can be used for developing application, a virtual machine adopted by the editor is a first virtual machine, and a plurality of projects can be developed in the process of developing application by the editor, wherein codes of one project can be compiled into one program set, codes of a plurality of projects can be compiled into one program set, and codes of one project can be compiled into a plurality of program sets; the first virtual machine may run the code compiled into the program set, so that the first program set of the first virtual machine may be one program set or may be multiple program sets, which is not limited in this embodiment of the present application.
The program set may include at least one namespace, each namespace may include at least one type, where an original type in the program set may be an original class of the program set, and in view of the generation of the proxy class corresponding to the original class, the original class of the program set in the present application is not only the original type in the program set, but also a type used for generating the proxy class. In one possible implementation, the computer device obtaining a first program set of a first virtual machine, determining each original class in the first program set, may include: the method comprises the steps that computer equipment obtains at least one program set operated by a first virtual machine, and determines a first program set in the at least one program set, wherein the first program set is operated by the first virtual machine and needs to be accessed by other virtual machines; based on the first set of programs, each original class in the first set of programs is determined.
The at least one program set run by the first virtual machine may be a whole program set run by the first virtual machine, or may be a partial program set run by the first virtual machine, which is not limited herein in this embodiment of the application. In addition, the computer device may analyze each program set in the at least one program set to determine whether the program set needs to be accessed by other virtual machines, if so, the program set is a first program set, and after traversing the at least one program set, the first program set of the first virtual machine is obtained.
For example, the computer device can determine a first set of programs that need to be accessed from a set of Mono programs using Mono.
Optionally, the determining, by the computer device, each original class in the first set of programs according to the first set of programs may include: and traversing the types in the first program set, and taking the types in the first program set for interactive use with other virtual machines as original classes. The type used for interacting with other virtual machines is the type which needs to be accessed when the other virtual machines interact with the first virtual machine.
Optionally, determining the type of the first program set for interactive use with other virtual machines may include at least one of:
(1) for any type in the first set of programs, in response to an external configuration of the type satisfying a target condition, determining the type as a type for interactive use with other virtual machines.
(2) For any type in the first program set, in response to the type attribute of the type being the target attribute, determining the type as a type for interactive use with other virtual machines.
For example, as shown in FIG. 2, the computer device analyzes the first program set using Mono.Ceil, traversing the types in the first program set. Whether the type needs to be exported for CLR interactive use is analyzed through external configuration or type attributes. If export is required, then the type is the original class in the first program set. If no export is required, the next type continues to be analyzed until each type in the first set of programs is completed.
Alternatively, the first set of programs may be all sets of programs run by the first virtual machine, and the computer device may traverse the first set of programs, determine a type in the first set of programs for use in interacting with other virtual machines, and use the type as an original class of the first set of programs. The method for determining the type of the first program set for interactive use with other virtual machines is similar to the above method, and is not described in detail here.
For example, as shown in fig. 2, the computer device analyzes a first program set using mono.ceil, the first program set being the entire set that the first virtual machine runs, traversing the types in the first program set. Whether the type needs to be exported for CLR interactive use is analyzed through external configuration or type attributes. If export is required, then the type is the original class in the first program set. If no export is required, the next type continues to be analyzed until each type in the first set of programs is completed.
102. The computer device generates a proxy class for each original class corresponding to the second virtual machine.
The second virtual machine is any virtual machine of a different type from the first virtual machine, and the second virtual machine may be a CLR virtual machine, a Mono virtual machine, a linux virtual machine, a Java virtual machine, or the like.
In addition, the first virtual machine may be a virtual machine employed by an editor for developing applications, and the second virtual machine may be a virtual machine employed by an application development framework; alternatively, the first virtual machine may be a virtual machine employed by an application development framework and the second virtual machine is a virtual machine employed by an editor that develops the application. For example, the first virtual machine is a Mono virtual machine and the second virtual machine is a CLR virtual machine.
In one possible implementation, the generating, by the computer device, a proxy class corresponding to each original class in the second virtual machine may include: and generating an agent class corresponding to each original class according to the description information of the original classes, wherein the interface of the agent class is the same as that of the corresponding original class.
The description information of the original class may be description information of the type of the original class, such as class name, namespace, and the like. The original class may include at least one object such as a field, an attribute, a method, and the like, and the description information of the original class may also be description information of the at least one object. For example, if a field is included in the original class, the description information may include at least one of a field name, a name space, a field address, and the like; if the original class includes the attribute, the description information may include at least one of an attribute name, a namespace, and the like; if the original class includes a method, the description information may include at least one of a method name, a parameter number, a parameter type, a return value type, and the like.
For example: after the computer device determines that any type of the first program set is an original class, all objects of the original class can be continuously analyzed to obtain description information of each object, wherein the objects of the original class can be Fields (Fields), Properties (Properties), Methods (Methods) and the like, the description information of each member is generated into the proxy class, and external interfaces such as field names, property names, method signatures and the like are kept unchanged. The inside of the proxy class forwards the access of the external interfaces to the first virtual machine through a proxy mechanism. Wherein, 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.
In one possible implementation, the generating, by the computer device, a proxy class corresponding to each original class in the second virtual machine by the computer device may include: and generating the binding information of each original class according to the description information of the original class. The binding information is used for identifying the binding relationship between the original class and the proxy class, and the computer device can determine the original class corresponding to the proxy class according to the binding information. The binding information of the proxy class may include description information of an original class corresponding to the proxy class, and the original class corresponding to the proxy class may be determined according to the description information.
Optionally, the generating, by the computer device, the proxy class corresponding to each original class according to the description information of the original class may include: the computer equipment acquires any object included in an original class after determining that any type of a first program set is the original class, acquires description information of each target object in the original class in response to the object being the target object, and generates a proxy class corresponding to the original class according to the description information, wherein the target object is an object which needs to be accessed by a second virtual machine. That is, when generating the proxy class corresponding to the original class, it is not necessary to generate the proxy class according to each object in the original class, but only necessary to generate the proxy class according to the target object having the access requirement, so that the size of the proxy class is reduced on the basis of ensuring that the proxy class can meet the requirement of accessing the first virtual machine through the second virtual machine, and resource waste caused by generating useless proxy objects in the proxy class when generating the proxy class is also avoided.
For example: after the computer device determines that any type of the first program set is an original class, all objects of the original class can be continuously analyzed, after any object is determined to be a target object, description information of the target object is obtained, the description information of each target object is generated into a proxy class, and external interfaces such as field names, attribute names, method names and method signatures are kept unchanged. The inside of the proxy class forwards the access of the external interfaces to the first virtual machine through a proxy mechanism. Wherein, 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.
103. The computer device generates a second set of programs from each proxy class.
Optionally, the computer device generating the second set of programs according to each agent class may include: the computer device may construct a project corresponding to the agent class according to each agent class, and compile the project to obtain the second assembly.
For example, as shown in FIG. 2, the computer device constructs the generated C # class file into a C # project, and calls the compilation tool to compile the project, thereby generating a second set of programs 201 for calling the second virtual machine, which is entirely new. The type interfaces in the second program set are consistent with the corresponding type interfaces in the first program set, so that when the types are used in the second virtual machine, the same as when the types are used in the first virtual machine directly.
That is, the proxy class is a type used in the second virtual machine, and functions to help a user access a certain type in the second virtual machine in such a manner that the user can access the type in the first virtual machine. The agent class has the same external interface as the original class, and the access to the field, the attribute and the method of the agent class is equal to the direct access to the original class in the second virtual machine.
It should be noted that, the steps 101 to 103 may be performed in an offline process, or may be performed online, that is, after the step 103 is performed, the step 104 may be performed immediately, or the step 104 may not be performed temporarily, but may be performed when the computer device is restarted, or may be performed at another time. The execution timing of the steps 101 to 103 and the timing of the step 104 are not limited in the embodiment of the present application.
104. The computer equipment determines an original class corresponding to the proxy class in the second virtual machine in the first virtual machine according to the first program set and the second program set, and establishes a first association relation between the original class and the corresponding proxy class.
The computer device may traverse the first program set and the second program set to determine an agent class corresponding to the original class in the first virtual machine in the second virtual machine.
In one possible implementation, determining an original class in the first virtual machine corresponding to the proxy class in the second virtual machine may include: and determining an original class corresponding to any proxy class according to the binding information in any proxy class in the second virtual machine. The binding information may include information such as a class name and a namespace of the original class, and the computer device may determine the class name and the namespace 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.
For example, as shown in fig. 3, the computer device establishes the first association relationship by performing step 301 and step 302.
Step 301: and traversing the second program set to find the proxy class in the second program set.
Step 302: according to the binding information in the proxy classes, determining an original class corresponding to each proxy class, and establishing a first association relation between the proxy classes and the original classes.
In one possible implementation, determining an original class in the first virtual machine corresponding to the proxy class in the second virtual machine includes at least one of:
(1) and determining any original class as an original class corresponding to any proxy class in response to the fact that the interface of any proxy class in the second program set is the same as the interface of any original class in the first program set.
In the process of generating the proxy class according to the original class, it is ensured that the external interface of the original class is consistent with the external interface of the proxy class, and therefore, whether the original class is the original class corresponding to the proxy class can be determined according to whether the interface of any proxy class in the second program set is the same as the interface of any original class in the first program set.
(2) And determining any original class as the original class corresponding to any proxy class in response to the fact that the class name of any proxy class in the second program set is the same as the class name of any original class in the first program set.
In the process of generating the proxy class according to the original class, the class name of the original class and the class name of the proxy class are kept unchanged, so whether the original class is the original class corresponding to the proxy class can be determined according to the class name of the proxy class and the class name of the original class.
(3) And determining any original class as the original class corresponding to any proxy class in response to the fact that the namespace of any proxy class in the second program set is the same as the namespace of any original class in the second program set.
Because the same class name in the same name space represents the same type, whether the original class is the original class corresponding to the proxy class can be determined according to whether the original class and the proxy class belong to the same name space.
It should be noted that the three manners are merely exemplary descriptions of the manner of determining the original class in the first virtual machine corresponding to the proxy class in the second virtual machine in this embodiment, that is, the original class in the first virtual machine corresponding to the proxy class in the second virtual machine may also be determined in other manners, which is not limited in this embodiment of the present application.
In addition, the three manners provided above may be combined in any two manners, for example, in a possible implementation manner, determining an original class in the first virtual machine corresponding to the proxy class in the second virtual machine may include: and determining any original class as the original class corresponding to any proxy class in response to the fact that the class name of any proxy class in the second program set is the same as the class name of any original class in the first program set and the name space of any proxy class is the same as the name space of any original class.
The type description information may include at least one of a class name and a namespace, that is, whether the original class is the original class corresponding to the proxy class or not may be determined by the description information of the proxy class and the description information of the original class. Optionally, the computer device determines, in response to that the description information of any proxy class in the second program set is the same as the description information of any original class in the first program set, that any original class is an original class corresponding to any proxy class.
It should be noted that, the present application is only described by taking an example of determining an original class corresponding to a proxy class through the proxy class, and in another embodiment, the proxy class corresponding to the original class may also be determined through the original class, which is not limited in this embodiment of the present application.
In one possible implementation, establishing the first association relationship between the original class and the proxy class may include: description information of the original class is added to the proxy class, and the description information is used for determining the address of the original class.
For example, as shown in fig. 3, when the computer device is started, a first association relationship between an original class and an agent class is established, where the first association relationship may be a dictionary relationship, and the dictionary relationship refers to that the association relationship between the original class and the agent class is like a dictionary, and an agent class corresponding to the original class may be queried according to the original class, or an original class corresponding to the agent class may be queried according to the agent class.
During the operation, the expression of the type inside the second virtual machine is realized by a series of internal objects, for example, in a Mono virtual machine, the series of objects may be a MonoType, a MonoField, a MonoMethod, a MonoClass, etc., and the method for realizing the proxy class in the embodiment of the present application may be to directly call an API in Mono.
Optionally, the proxy class needs to be associated with the original class in the second virtual machine, and the computer device may associate the original class with the proxy class through a MonoApi mono _ assembly _ get _ image, mono _ class _ from _ name.
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.
In one possible implementation, after the first association relationship between the original class and the proxy class is established, a second association relationship between the original object in the original class and the proxy object in the proxy class may also be established.
Optionally, the establishing, by the computer device, a second association between the original object in the original class and the proxy object in the proxy class may include: and determining an original object bound with the proxy object according to the binding information of the proxy object in the proxy class. Optionally, the binding information of the proxy object may include description information of an original object associated with the proxy object, and the computer device may determine the original object from the original class according to the description information of the original object.
Optionally, the original class includes at least one object of a field, a method, and an attribute, and a second association relationship between the original object in the original class and the proxy object in the proxy class is established, where the second association relationship further includes at least one of:
(1) determining a proxy field in the proxy class corresponding to the original field in the original class, and establishing a second association relation between the original field and the proxy field.
The original field is a field in the original class, the proxy field is a field in the proxy class, and 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, so that the proxy field in the proxy class is also associated with the original field in the original class, and a second association relationship between the original field and the proxy field can be established.
Determining the proxy field in the proxy class corresponding to the original field in the original class may include: and in response to that the description information of any original field in the original class is the same as that of any proxy field in the proxy class, determining that any original field is the original field corresponding to any proxy field.
For example, in response to the field name of any proxy field being the same as the field name of any original field, the proxy field is determined to be the proxy field corresponding to the original field. For example, the original class of the Mono virtual machine includes a field MonoField, and the proxy class of the CLR virtual machine includes a field CLRField, so that a second association relationship between the field MonoField and the field CLRField can be established.
In addition, establishing a second association relationship between the original field and the proxy field may include: the description information of the original field is added to the proxy field, which can be used to determine the address of the original field.
In addition, establishing the second association relationship between the original field and the proxy field can also be realized by a monoapi _ class _ get _ field _ from _ name.
(2) Determining the proxy method corresponding to the original method in the original class in the proxy class, and establishing a second association relation between the original method and the proxy method.
The method for determining the proxy method in the proxy class corresponding to the original method in the original class is similar to the method for determining the proxy field in the proxy class corresponding to the original field in the original class; the second association relationship between the original method and the proxy method is established in a similar manner to the second association relationship between the original field and the proxy field, and is not described in detail herein.
In addition, the establishment of the second association relationship between the original method and the proxy method can also be realized through a MonoApimo _ method _ signature.
(3) Determining the proxy attribute corresponding to the original attribute in the original class in the proxy class, and establishing a second association relation between the original attribute and the proxy attribute.
The method comprises the steps that a mode of determining a proxy attribute corresponding to an original attribute in an original class in a proxy class is similar to a mode of determining a proxy field corresponding to an original field in the original class in the proxy class; the second association relationship between the original attribute and the proxy attribute is established in a similar manner to the second association relationship between the original field and the proxy field, and is not described in detail herein.
In addition, the establishment of the second association relationship between the original attribute and the proxy attribute can also be realized through a MonoApimo _ method _ signature.
In one possible implementation, establishing a 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:
(1) and determining an original field corresponding to the proxy field in the original class and the proxy class, and establishing a second association relation between the original field and the proxy field.
(2) And determining an original method corresponding to the proxy method in the proxy class in the original class, and establishing a second association relation between the original method and the proxy method.
(3) And determining an original attribute corresponding to the proxy attribute in the original class and the proxy attribute in the proxy class, and establishing a second association relation between the original attribute and the proxy attribute.
In another possible implementation manner, after establishing the first association relationship between the original class and the proxy class, the method further includes: and responding to the fact that any object is an original object in the original class, creating a proxy object corresponding to the original object in a proxy class corresponding to the original class, and establishing a second incidence relation between the original object and the proxy object. That is, the computer device may also create a proxy object in the proxy class, and then establish a second association relationship between the original object and the proxy object.
For example, the description information of the Mono virtual machine internal object can be acquired through the Mono api Mono _ object _ get _ class, based on the description information, a CLR proxy class corresponding to any Mono original class can be found in the first association relationship created at the system startup, and then a corresponding object is created based on the CLR proxy class and associated with the specified Mono virtual machine object.
106. And the computer equipment receives an access request through the second virtual machine, wherein the access request carries the proxy class in the second virtual machine and the proxy object in the proxy class.
Because the external interfaces of the proxy class and the original class are the same, 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.
Since the access request carries the proxy class in the second virtual machine and the proxy object in the proxy class, the second virtual machine receives the access request, and actually accesses the object inside the second virtual machine according to the access request.
107. And the computer equipment accesses the original object associated with the proxy object in the original class associated with the proxy class according to the first association relation, the second association relation and the access request.
The second virtual machine can access the proxy class and the proxy object in the second virtual machine according to the access request, determine an original class and an original object associated with the proxy class and the proxy object based on the first association relation and the second association relation, and access the original object in the original class according to the access request. That is, the access information is directly forwarded to the original object running inside the first virtual machine.
In one possible implementation manner, accessing, in the original class associated with the proxy class, an original object associated with the proxy object according to the first association relationship, the second association relationship, and the access request includes: converting the access data carried by the access request into a data format supported by the first virtual machine; and accessing the original object according to the converted access request.
In one possible implementation manner, as shown in fig. 4, the accessing, 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 includes at least one of the following:
(1) and accessing the original object in the original class through an access request to acquire corresponding data in the first virtual machine, wherein the access request is used for acquiring the field. Wherein the original object is a field.
As shown in fig. 4, when the access request is used to obtain the field 401, the computer device calls an interface in the first virtual machine through the field binding information of the proxy field to obtain data in the first virtual machine.
For example, the above-described acquisition of corresponding data in the first virtual machine by the access request may be implemented by mono _ field _ get _ value and mono _ field _ static _ get _ value. Among them, mono _ field _ get _ value is used to obtain the normal field, and mono _ field _ static _ get _ value is used to obtain the static field.
(2) And accessing the original object in the original class through an access request, and changing the corresponding field in the first virtual machine, wherein the access request is used for setting the field. Wherein the original object is a field.
As shown in fig. 4, the access request is used to set a field 402, the computer device converts the data in the second virtual machine into a data format supported by the first virtual machine, calls an interface of the first virtual machine through field binding information of the proxy field, and transmits the converted data to the first virtual machine.
Wherein the modification of the corresponding field in the first virtual machine by the access request may be implemented by using mono _ field _ get _ value and mono _ field _ static _ get _ value. Wherein the content of the first and second substances,
(3) and accessing the original object in the original class according to an access request for calling a method or an access attribute, and calling the associated method in the first virtual machine. Wherein the original object is a method or an attribute.
For example, as shown in fig. 4, the access request is used to invoke a method 403, the computer device determines whether the method has a parameter, converts the parameter into a data format supported by the first virtual machine if the method has the parameter, and invokes an interface of the first virtual machine through the method binding information to trigger a method invocation of a corresponding original object in the first virtual machine.
For another example, as shown in fig. 4, the access request is used to access the attribute 404, the computer device calls a method according to the access request, determines whether the method has a parameter, converts the parameter into a data format supported by the first virtual machine if the method has the parameter, and calls an interface of the first virtual machine through the method binding information to trigger a method call of a corresponding original object in the first virtual machine.
The invoking of the corresponding method in the first virtual machine according to the access request may include: acquiring corresponding attributes in the first virtual machine according to the access request; or setting the corresponding attribute in the first virtual machine.
The attribute obtaining is equal to calling a Getter method corresponding to the attribute, the attribute setting is equal to calling a Setter method corresponding to the attribute, and calling the corresponding method in the first virtual machine can be achieved through mono _ runtimeinvoke.
It should be noted that, the foregoing step 106 and step 107 are only exemplary descriptions of accessing the original class through the proxy class, and in another embodiment, the original class associated with the proxy class may also be accessed according to the first association relationship and the access request. In one possible implementation manner, the 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 by the access request into a data format supported by the first virtual machine; and accessing the original class according to the converted access request.
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:
(1) and accessing the original class through the access request to acquire corresponding data in the first virtual machine, wherein the access request is used for acquiring a field.
(2) And accessing the original class through the access request, and changing the corresponding field in the first virtual machine, wherein the access request is used for setting the field.
(3) And accessing the original class according to the access request, and calling a corresponding method in the first virtual machine, wherein the access request is used for calling a method or accessing an attribute.
108. The computer device obtains a return value in response to accessing the original object, and converts a format of the return value into a format supported by the second virtual machine.
If the original object in the first virtual machine is accessed with a return value, the original object needs to be converted into data recognizable by the second virtual machine, that is, the format of the return value is converted into a format supported by the second virtual machine.
Converting the format of the return value into the format supported by the second virtual machine according to the difference of the return value may include the following processing modes:
(1) the return value is Void: that is, there is no return value after the original object is accessed, and the return value of the relevant interface on the second virtual machine end is Void.
(2) The return value is a built-in simple type, such as Boolean, Char, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Enum (enumeration), and the like, and the computer device may directly convert the return value into a corresponding type of the second virtual machine.
(3) The return value is a character string, the character string has a text encoding format in the first virtual machine, and the text encoding format is different from the text encoding format used by the second virtual machine, so that text encoding conversion is required to be performed to produce the character string usable by the second virtual machine.
For example, a String has its own text encoding format in a Mono virtual machine, which is different from the text encoding format used by a CLR virtual machine, and thus it is necessary to perform text transcoding and generate String-type strings available to CLR.
(4) The return value is a structure and the structure supported by the system may be a simple structure using normal byte order distribution. At the moment, the structure body memory area in the first virtual machine is directly provided for the second virtual machine to use, and a structure body is created from the memory area.
For example, a structure memory area inside the Mono virtual machine is provided for the CLR virtual machine to use, and a structure is created from the memory area.
109. And the computer equipment transmits the converted return value to the second virtual machine according to the first incidence relation.
The step that the computer device issues the converted return value to the second virtual machine according to the first association relationship means that: and according to the first incidence relation, the converted return value is issued to the second virtual machine through an external interface of the proxy class. The scheme is equivalent to that the computer equipment accesses the proxy class through an external interface of the proxy class and receives a return value of the proxy class, and the scheme actually calls an original object in an original class through the proxy class, a first incidence relation and a second incidence relation, runs a code in the first virtual machine to obtain the return value and sends the return value to the second virtual machine.
The object access method provided by the embodiment of the application can be applied to the scene of application development, and fig. 5 provides a display interface of an application, wherein the display interface includes a plurality of virtual objects such as a virtual role 501 and an operation key 502. Fig. 6 is a display interface of an editor for application development, in which a map setting option 601, a scene tree option 602, and a property setting option 603 are included, and in which an operation is performed to edit a scene, a play, and the like of an application. Because the editor adopts a Mono virtual machine, the scheme provided by the embodiment of the application can be adopted if the editor runs in a NET framework.
According to the object access method provided by the embodiment of the application, the first association relation between the original class in the first virtual machine and the proxy class in the second virtual machine is obtained, the second virtual machine receives the access request, the access request carries the proxy class in the second virtual machine, and the original class associated with the proxy class is accessed according to the first association relation and the access request. Through the incidence relation between the original class and the proxy class, the original class can be accessed through accessing the proxy class, the first virtual machine and the second virtual machine can be operated simultaneously, and the second virtual machine and the first virtual machine can be interacted through the incidence relation between the proxy class and the original class.
Fig. 7 is a schematic structural diagram of a virtual object control apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus includes:
an obtaining module 701, configured to obtain a first association relationship between an original class in a first virtual machine and an agent class in a second virtual machine;
a receiving module 702, configured to receive an access request through a second virtual machine, where the access request carries an agent class in the second virtual machine;
the accessing module 703 is configured to access the original class associated with the proxy class according to the first association relationship and the access request.
The object access device provided by the embodiment of the application receives an access request through the second virtual machine by acquiring the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine, wherein 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 incidence relation between the original class and the proxy class, the original class can be accessed through accessing the proxy class, the first virtual machine and the second virtual machine can be operated simultaneously, and the second virtual machine and the first virtual machine can be interacted through the incidence relation between the proxy class and the original class.
As shown in fig. 8, in one possible implementation manner, the obtaining module 701 includes:
an obtaining unit 7011, configured to obtain a first program set of a first virtual machine and a second program set of a second virtual machine, where the first program set includes at least one original class, and the second program set includes at least one proxy class;
a determining unit 7012, configured to determine an original class in the first virtual machine, where the original class corresponds to the agent class in the second virtual machine;
the establishing unit 7013 is configured to establish a first association relationship between the original class and the corresponding proxy class.
In a possible implementation manner, the determining unit 7012 is configured to determine, according to the binding information in any one of the agent classes in the second virtual machine, an original class corresponding to the any one of the agent classes.
In one possible implementation, the determining unit 7012 is configured to perform at least one of the following:
in response to that the interface of any proxy class in the second program set is the same as the interface of any original class in the first program set, determining that any original class is an original class corresponding to any proxy class;
in response to that the class name of any proxy class in the second program set is the same as the class name of any original class in the first program set, determining that any original class is an original class corresponding to any proxy class;
and determining any original class as the original class corresponding to any proxy class in the second program set in response to the fact that the name space of any proxy class in the second program set is the same as the name space of any original class in the first program set.
In a possible implementation manner, the establishing unit 7013 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.
In a possible implementation manner, the establishing unit 7013 is further configured to establish a second association relationship between the original object and the proxy object.
In a possible implementation manner, the establishing unit 7013 is further configured to, in response to that any object is an original object in the original class, create a proxy object corresponding to the original object in a proxy class associated with the original class, and establish a second association relationship between the original object and the proxy object.
In a possible implementation manner, the original class includes at least one object of a field, a method, and an attribute, and the establishing unit 7013 is further configured to perform at least one of the following:
determining an agent field corresponding to an original field in the original class in the agent class, and establishing a second association relationship between the original field and the agent field;
determining an agent method corresponding to the original method in the original class in the agent class, and establishing a second association relationship between the original method and the agent method;
determining the proxy attribute corresponding to the original attribute in the original class in the proxy class, and establishing a second association relation between the original attribute and the proxy attribute.
In one possible implementation, the access request carries a proxy object in the proxy class; the accessing module 703 includes:
an obtaining unit 7031, configured to obtain a second association relationship between an original object in the original class and a proxy object in the proxy class;
an accessing unit 7032, 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.
In one possible implementation, the accessing unit 7032 is configured to perform at least one of the following:
accessing the original class through the access request to acquire corresponding data in the first virtual machine, wherein the access request is used for acquiring a field;
accessing the original class through the access request, and changing a corresponding field in the first virtual machine, wherein the access request is used for setting the field;
and accessing the original class according to the access request, and calling a corresponding method in the first virtual machine, wherein the access request is used for calling a method or accessing an attribute.
In one possible implementation, the accessing module 703 includes:
a converting unit 7033, configured to convert the access data carried in the access request into a data format supported by the first virtual machine;
an accessing unit 7032, configured to access the original class according to the converted access request.
In one possible implementation, the apparatus further includes:
a conversion module 704, configured to obtain a return value in response to accessing the original class, and convert a format of the return value into a format supported by the second virtual machine;
the issuing module 705 is configured to issue the converted return value to the second virtual machine according to the first association relationship.
In a possible implementation manner, the obtaining unit 7031 is configured to obtain the first program set, and determine each original class in the first program set; generating a proxy class corresponding to each original class in the second virtual machine; the second set of programs is generated according to each proxy class.
In a possible implementation manner, the obtaining unit 7031 is configured to generate, according to the description information of the original class, a proxy class corresponding to each original class, where an interface of the proxy class is the same as an interface of the corresponding original class.
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.
Fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application, which can implement operations executed by the first terminal, the second terminal, and the third terminal in the foregoing embodiments. The terminal 900 may be a portable mobile terminal such as: the mobile terminal comprises a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, Moving Picture Experts compress standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts compress standard Audio Layer 4), a notebook computer, a desktop computer, a head-mounted device, a smart television, a smart sound box, a smart remote controller, a smart microphone, or any other smart terminal. Terminal 900 may also be referred to by other names such as user equipment, portable terminals, laptop terminals, desktop terminals, and the like.
In general, terminal 900 includes: a processor 901 and a memory 902.
Processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. Memory 902 may include one or more computer-readable storage media, which may be non-transitory, for storing at least one instruction for processor 901 to implement the object access methods provided by method embodiments herein.
In some embodiments, terminal 900 can also optionally include: a peripheral interface 903 and at least one peripheral. The processor 901, memory 902, and peripheral interface 903 may be connected by buses or signal lines. Various peripheral devices may be connected to the peripheral interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 904, a display screen 905, and audio circuitry 906.
The Radio Frequency circuit 904 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 904 communicates with communication networks and other communication devices via electromagnetic signals.
The display screen 905 is used to display a UI (user interface). The UI may include graphics, text, icons, video, and any combination thereof. The display 905 may be a touch display and may also be used to provide virtual buttons and/or a virtual keyboard.
The audio circuitry 906 may include a microphone and a speaker. The microphone is used for collecting audio signals of a user and an environment, converting the audio signals into electric signals, and inputting the electric signals to the processor 901 for processing, or inputting the electric signals to the radio frequency circuit 904 for realizing voice communication. For stereo sound acquisition or noise reduction purposes, the microphones may be multiple and disposed at different locations of the terminal 900. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert the electrical signal from the processor 901 or the radio frequency circuit 904 into an audio signal.
Those skilled in the art will appreciate that the configuration shown in fig. 9 does not constitute a limitation of terminal 900, and may include more or fewer components than those shown, or may combine certain components, or may employ a different arrangement of components.
Fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memory 1002 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1001 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
The server 1000 may be used to perform the object access method described above.
The embodiment of the application also provides a computer device, which comprises a processor and a memory, wherein at least one program code is stored in the memory, and the at least one program code is loaded by the processor and has an object access method for realizing the embodiment.
An embodiment of the present application further 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 has an object access method to implement the above-described embodiment.
The embodiment of the present application further provides a computer program, where at least one program code is stored in the computer program, and the at least one program code is loaded and executed by a processor, so as to implement the object access method of the foregoing embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an alternative embodiment of the present application and should not be construed as limiting the present application, and any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (18)

1. An object access method, characterized in that the method comprises:
acquiring a first association relation between an original class in a first virtual machine and an agent class in a second virtual machine;
receiving an access request through the second virtual machine, wherein the access request carries an agent class in the second virtual machine;
and accessing the original class associated with the proxy class according to the first association relation and the access request.
2. The method of claim 1, wherein obtaining the first association relationship between the original class in the first virtual machine and the proxy class in the second virtual machine comprises:
acquiring a first program set of the first virtual machine and a second program set of the second virtual machine, wherein the first program set comprises at least one original class, and the second program set comprises at least one proxy class;
determining an original class in the first virtual machine corresponding to an agent class in the second virtual machine;
and establishing a first association relation between the original class and the corresponding proxy class.
3. The method of claim 2, wherein the determining the original class in the first virtual machine that corresponds to the proxy class in the second virtual machine comprises:
and determining an original class corresponding to any agent class according to the binding information in any agent class in the second virtual machine.
4. The method of claim 2, wherein the determining the original class in the first virtual machine that corresponds to the proxy class in the second virtual machine comprises at least one of:
in response to that an interface of any proxy class in the second program set is the same as an interface of any original class in the first program set, determining that the any original class is an original class corresponding to the any proxy class;
in response to that the class name of any proxy class in the second program set is the same as the class name of any original class in the first program set, determining that the any original class is an original class corresponding to the any proxy class;
and determining any original class as an original class corresponding to any proxy class in the second program set in response to the fact that the namespace of any proxy class in the second program set is the same as the namespace of any original class in the second program set.
5. The method of claim 2, wherein establishing the first association relationship between the original class and the corresponding proxy class comprises:
and adding description information of the original class into the proxy class, wherein the description information is used for determining the address of the original class.
6. The method of claim 2, wherein after establishing the first association relationship between the original class and the corresponding proxy class, the method further comprises:
and establishing a second association relation 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, wherein the establishing 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 comprises:
and responding to any object as an original object in the original class, creating a proxy object corresponding to the original object in a proxy class associated with the original class, and establishing a second association relation between the original object and the proxy object.
8. The method according to claim 6, wherein the original class includes at least one object of fields, methods and attributes, and the establishing of 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:
determining a proxy field corresponding to an original field in the original class in the proxy class, and establishing a second association relationship between the original field and the proxy field;
determining an agent method corresponding to the original method in the original class in the agent class, and establishing a second association relation between the original method and the agent method;
determining the proxy attribute corresponding to the original attribute in the original class in the proxy class, and establishing a second association relationship between the original attribute and the proxy attribute.
9. The method of claim 1, wherein the access request carries a proxy object in the proxy class; the accessing the original class associated with the proxy class according to the first association relation and the access request includes:
acquiring a second association relation between the original object in the original class and the proxy object in the proxy class;
and accessing the original object associated with the proxy object in the original class associated with the proxy class according to the first association relation, the second association relation and the access request.
10. The method according to claim 9, wherein the accessing, 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 comprises at least one of:
accessing the original class through the access request to acquire corresponding data in the first virtual machine, wherein the access request is used for acquiring a field;
accessing the original class through the access request, and changing a corresponding field in the first virtual machine, wherein the access request is used for setting the field;
and accessing the original class according to the access request, and calling a corresponding method in the first virtual machine, wherein the access request is used for calling a method or accessing an attribute.
11. The method according to claim 1, wherein the accessing the original class associated with the proxy class according to the first association relationship and the access request comprises:
converting the access data carried by the access request into a data format supported by the first virtual machine;
and accessing the original class according to the converted access request.
12. The method according to claim 1, wherein after accessing the original class associated with the proxy class according to the first association relationship and the access request, the method further comprises:
obtaining a return value after responding to the access of the original class, and converting the format of the return value into a format supported by the second virtual machine;
and issuing the converted return value to the second virtual machine according to the first incidence relation.
13. The method of claim 2, wherein the obtaining the first set of programs for the first virtual machine and the second set of programs for the second virtual machine comprises:
acquiring the first program set, and determining each original class in the first program set;
generating a proxy class corresponding to each original class in the second virtual machine;
and generating the second program set according to each proxy class.
14. The method of claim 13, wherein the generating the proxy class corresponding to each original class in the second virtual machine comprises:
and generating the proxy class corresponding to each original class according to the description information of the original classes, wherein the interfaces of the proxy classes are the same as the interfaces of the corresponding original classes.
15. The method of claim 13, wherein the proxy class comprises binding information, and wherein generating the proxy class corresponding to each original class in the second virtual machine comprises:
and generating the binding information of each original class according to the description information of each original class.
16. An object access apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a first association relation between an original class in the first virtual machine and an agent class in the second virtual machine;
a receiving module, configured to receive, by the second virtual machine, an access request, where the access request carries an agent class in the second virtual machine;
and the access module is used for accessing the original class associated with the proxy class according to the first association relation and the access request.
17. A computer device comprising a processor and a memory, the memory having stored therein at least one program code, the at least one program code being loaded and executed by the processor to perform the object access method of any of claims 1 to 15.
18. A computer-readable storage medium having stored therein at least one program code, the at least one program code being loaded and executed by a processor, to implement the object access method of any of claims 1 to 15.
CN202010091143.3A 2020-02-13 2020-02-13 Object access method, device, equipment and storage medium Pending CN111290746A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010091143.3A CN111290746A (en) 2020-02-13 2020-02-13 Object access method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010091143.3A CN111290746A (en) 2020-02-13 2020-02-13 Object access method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111290746A true CN111290746A (en) 2020-06-16

Family

ID=71028490

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010091143.3A Pending CN111290746A (en) 2020-02-13 2020-02-13 Object access method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111290746A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113312120A (en) * 2021-06-17 2021-08-27 武汉斗鱼鱼乐网络科技有限公司 Method, device, electronic equipment and medium for executing C + + task in virtual machine

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030070006A1 (en) * 2001-10-10 2003-04-10 Borland Software Corporation Development system providing extensible remoting architecture
CN103677975A (en) * 2013-12-09 2014-03-26 北京恒华伟业科技股份有限公司 System and method for having access to internal objects of application systems
CN104601428A (en) * 2014-12-23 2015-05-06 广州亦云信息技术有限公司 Communication method of virtual machines
CN106778296A (en) * 2016-11-30 2017-05-31 广东欧珀移动通信有限公司 A kind of access method for accessing object, device and terminal
CN107453971A (en) * 2016-05-30 2017-12-08 北京京东尚科信息技术有限公司 Communication means and system between a kind of multiple virtual machines
CN108427677A (en) * 2017-02-13 2018-08-21 阿里巴巴集团控股有限公司 A kind of object accesses method, apparatus and electronic equipment
CN109254764A (en) * 2018-09-28 2019-01-22 福州大学 The method of software architecture when the acquisition operation of curstomer-oriented end application program
CN109740310A (en) * 2018-12-29 2019-05-10 北京嘉楠捷思信息技术有限公司 Kernel object access method and device for embedded operating system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030070006A1 (en) * 2001-10-10 2003-04-10 Borland Software Corporation Development system providing extensible remoting architecture
CN103677975A (en) * 2013-12-09 2014-03-26 北京恒华伟业科技股份有限公司 System and method for having access to internal objects of application systems
CN104601428A (en) * 2014-12-23 2015-05-06 广州亦云信息技术有限公司 Communication method of virtual machines
CN107453971A (en) * 2016-05-30 2017-12-08 北京京东尚科信息技术有限公司 Communication means and system between a kind of multiple virtual machines
CN106778296A (en) * 2016-11-30 2017-05-31 广东欧珀移动通信有限公司 A kind of access method for accessing object, device and terminal
CN108427677A (en) * 2017-02-13 2018-08-21 阿里巴巴集团控股有限公司 A kind of object accesses method, apparatus and electronic equipment
CN109254764A (en) * 2018-09-28 2019-01-22 福州大学 The method of software architecture when the acquisition operation of curstomer-oriented end application program
CN109740310A (en) * 2018-12-29 2019-05-10 北京嘉楠捷思信息技术有限公司 Kernel object access method and device for embedded operating system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113312120A (en) * 2021-06-17 2021-08-27 武汉斗鱼鱼乐网络科技有限公司 Method, device, electronic equipment and medium for executing C + + task in virtual machine
CN113312120B (en) * 2021-06-17 2022-05-10 武汉斗鱼鱼乐网络科技有限公司 Method, device, electronic equipment and medium for executing C + + task in virtual machine

Similar Documents

Publication Publication Date Title
US7337436B2 (en) System and method for cross platform and configuration build system
CA2796433C (en) Cross-platform application framework
KR101740327B1 (en) Apparatus and system for providing software service using software virtualization and method thereof
WO2022199111A1 (en) Method and apparatus for implementing functions in application program, electronic device and storage medium
CN111506291B (en) Audio data acquisition method, device, computer equipment and storage medium
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
MX2015002906A (en) Generating native code from intermediate language code for an application.
KR20140067018A (en) Describing native application programming interfaces of an operating system with metadata
EP4119207A1 (en) Vibration control method and apparatus, and electronic device and computer-readable storage medium
KR20050010851A (en) System for multimedia rendering in a portable device
CN110221840B (en) Function implementation method and device of application program, equipment and storage medium
EP1445694A2 (en) Modularization for J2ME platform implementation
WO2019226251A1 (en) Code base sharing between standalone and web-based versions of an application via an emulated network communication channel
CN111290746A (en) Object access method, device, equipment and storage medium
CN112988175A (en) Cross-platform application installation package generation method, device, medium and electronic equipment
CN111488286A (en) Method and device for independently developing Android module
CN110399040B (en) Multi-mode interaction method, user terminal equipment, server and system
WO2022078057A1 (en) Method and apparatus for publishing application package, method and apparatus for applying application package, and medium, server and device
KR20090122703A (en) Server and method for providing converting contents
KR20090121949A (en) Method and system for converting mobile contents
CN111782196A (en) MVP architecture-based development method and device
Hu et al. An empirical study of mobile/handheld app development using android platforms
CN117724726B (en) Data processing method and related device
EP4216052A1 (en) Method for developing mvvm architecture-based application, and terminal
CN116991380B (en) Application program construction method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40024095

Country of ref document: HK