CN110018816A - A kind of virtual machine control system and its control method based on C/C++ compiling system - Google Patents

A kind of virtual machine control system and its control method based on C/C++ compiling system Download PDF

Info

Publication number
CN110018816A
CN110018816A CN201910294766.8A CN201910294766A CN110018816A CN 110018816 A CN110018816 A CN 110018816A CN 201910294766 A CN201910294766 A CN 201910294766A CN 110018816 A CN110018816 A CN 110018816A
Authority
CN
China
Prior art keywords
virtual machine
code
data
segment data
machine control
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.)
Granted
Application number
CN201910294766.8A
Other languages
Chinese (zh)
Other versions
CN110018816B (en
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201910294766.8A priority Critical patent/CN110018816B/en
Publication of CN110018816A publication Critical patent/CN110018816A/en
Application granted granted Critical
Publication of CN110018816B publication Critical patent/CN110018816B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of virtual machine control system and its control method based on C/C++ compiling system, the system comprises lexical analyzer, syntax analyzer, type definition program module, code generator, virutal machine memory management module and virtual machine process management module, source codes to enter in virtual machine control system through lexical analyzer.Advantage is: virtual machine control system can be compatible with the application program of the User Priority by C/C++ exploitation;For the system application of operating system, run under kernel priority, virtual machine control system also it is compatible with C/C++ develop system application;It for running on the driver of interior nuclear state, runs under kernel priority, the virtual machine control system of the invention also compatible driver developed with C/C++;Virtual machine control system of the invention simultaneously can update in process operation, increase, delete code snippet data according to source code.

Description

A kind of virtual machine control system and its control method based on C/C++ compiling system
Technical field
The present invention relates to computer system software field more particularly to a kind of virtual machine controls based on C/C++ compiling system System and its control method processed.
Background technique
Currently, existing Java Virtual Machine technology, solve the problems, such as cross-platform, i.e., once mounting, compiling, User space are answered Can be run in the operating systems such as Windows, Linux with program, however, its cannot enough Java compilers compiling Java it is virtual The application program of machine operating system grade, such as by xorg organization development xserver graphical interfaces server-side journey on linux system Sequence can not remove developing operation driver more higher than system application priority level with Java compiler virtual machine.Cause This, continues a kind of virtual machine control system, realizes developing operation driver more higher than system application priority level.
Summary of the invention
The purpose of the present invention is to provide a kind of virtual machine control system and its controlling party based on C/C++ compiling system Method, to solve foregoing problems existing in the prior art.
To achieve the goals above, The technical solution adopted by the invention is as follows:
A kind of virtual machine control system based on C/C++ compiling system, the system comprises
Lexical analyzer, for receiving source code, and the lexical analyzer be internally provided with operation precedence grade table and Source code can be converted into syntax tree according to the standard analyzer of operation precedence grade by symbolic analysis stack;
Syntax analyzer, the syntax analyzer are used to extract variable, constant, function, type, name sky from syntax tree Between, structural body, association, character string, template, expression formula, conditional statement and node data, and these data classifications are stored It is sent into code generator into type definition data module, and by function, expression formula and conditional statement;The syntax analyzer It is also responsible for the transformation of scope;
Type definition program module, for generating type definition data, with decision variable, constant, function, type, structure The storage location of body, association, character string and template in virutal machine memory management module;
Code generator, it is virtual for the conversion of the function extracted from syntax tree, expression formula and conditional statement to be generated as Machine process manager module can identify received first code segment data;
Virutal machine memory management module receives type definition data for identification, is laid out in datarams, establishes data Model and/or for calling virtual machine process management module, to be laid out in code memory, establishes process model;
Virtual machine process management module receives code snippet data for identification, is laid out in code memory, foundation can transport Capable process model, the virtual machine control system run specified process model, traverse each code snippet node, and utilize fortune Broker's storehouse calculates the result that the operation of first code segment data generates in current process model;The virtual machine process manages mould Block is for calling the virutal machine memory management module, to modify type definition data.
Preferably, the source code is the C/C++ source code file for meeting 14882 standard of ISO/IEC.
Preferably, the first code segment data uses tree construction, each code in the first code segment data Segment node all has variable name, function name, operation encoded information and the pointer for being directed toward all child nodes;Or described first Code snippet data use list structure, all include to be directed toward in each code snippet node in the first code segment data The pointer of the next item down first code segment data.
The object of the invention is also to provide a kind of control method based on C/C++ compiling system, the control method is used In any of the above-described virtual machine control system, after the virtual machine process management module receives first code segment data, The control method is executed to first code segment data, the control method includes updating code snippet data, increasing code Segment data and deletion code snippet data.
Preferably, the update code snippet data include the following steps,
A1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program mould Block and the code generator, to generate second code segment data corresponding with source code;
Whether A2, virtual machine process management module detection first code segment data reach critical condition, if so, Virtual machine control system prompts first code segment data to update failure;If it is not, then virtual machine control system deletes current process In first code segment data, and execute A3;
A3, increase second code segment data in current process.
Preferably, the increase code snippet includes the following steps,
B1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program mould Block and the code generator, to generate second code segment data corresponding with source code;
B2, the virtual machine process management module detection second code segment data whether with the first generation existing in process Chip is disconnected to be re-defined;If so, virtual machine control system prompt first code segment data increases failure;If it is not, then working as Increase second code segment data in preceding process.
Preferably, the deletion code snippet data include the following steps, virtual machine process management module detection the Whether one code snippet data reach critical condition, if so, virtual machine control system prompt first code segment data is deleted Failure;If it is not, then deleting the first code segment data in current process.
Preferably, the critical condition is whether first code segment data is in current process by other code snippets Data are shared, if so, indicating to reach critical condition, if not, then it represents that not up to critical condition.
The beneficial effects of the present invention are: the virtual machine control system in the 1, present invention can be compatible with the use developed by C/C++ The application program of family priority.2, it for the system application of operating system, runs under kernel priority, void of the invention Quasi- machine control system also it is compatible with C/C++ develop system application.3, for running on the driver of interior nuclear state, Run under kernel priority, virtual machine control system of the invention also it is compatible with C/C++ develop driver.4, this hair Bright virtual machine control system can update in process operation, increase, delete code snippet data according to source code.
Detailed description of the invention
Fig. 1 is the schematic diagram of virtual machine control system in the embodiment of the present invention;
Fig. 2 is the flow diagram that code snippet is updated in the embodiment of the present invention;
Fig. 3 is the flow diagram for increasing code snippet in the embodiment of the present invention;
Fig. 4 is the flow diagram that code snippet is deleted in the embodiment of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing, to the present invention into Row is further described.It should be appreciated that the specific embodiments described herein are only used to explain the present invention, it is not used to Limit the present invention.
Embodiment one
As shown in Figure 1, the present invention provides a kind of virtual machine control system based on C/C++ compiling system, the system Including
Lexical analyzer, for receiving source code, and the lexical analyzer be internally provided with operation precedence grade table and Source code can be converted into syntax tree according to the standard analyzer of operation precedence grade by symbolic analysis stack;
Syntax analyzer, the syntax analyzer are used to extract variable, constant, function, type, name sky from syntax tree Between, structural body, association, character string, template, expression formula, conditional statement and node data, and these data classifications are stored It is sent into code generator into type definition data module, and by function, expression formula and conditional statement;The syntax analyzer It is also responsible for the transformation of scope;
Type definition program module, for generating type definition data, with decision variable, constant, function, type, structure The storage location of body, association, character string and template in virutal machine memory management module;
Code generator, it is virtual for the conversion of the function extracted from syntax tree, expression formula and conditional statement to be generated as Machine process manager module can identify received first code segment data;
Virutal machine memory management module receives type definition data for identification, is laid out in datarams, establishes data Model and/or for calling virtual machine process management module, to be laid out in code memory, establishes process model;
Virtual machine process management module receives code snippet data for identification, is laid out in code memory, foundation can transport Capable process model, the virtual machine control system run specified process model, traverse each code snippet node, and utilize fortune Broker's storehouse calculates the result that the operation of first code segment data generates in current process model;The virtual machine process manages mould Block is for calling the virutal machine memory management module, to modify type definition data.
In the present embodiment, the lexical analyzer is the lexical analyzer with preprocessor.The hair washing analyzer connects Source code is received, the source code is the C/C++ source code file for meeting 14882 standard of ISO/IEC.
In the present embodiment, the lexical analyzer is connected with the syntax analyzer, the syntax analyzer and the class Type defines program module and is connected, and the type definition module is connected with the code generator, the type definition module and institute It states virutal machine memory management module to be connected, and the type definition data generated are transferred to the virutal machine memory management mould Block;The code generator is connected with the virtual machine process management module, and the first code fragment data of generation is transmitted Virtual machine process management module is given, is counted between the virutal machine memory management module and the virtual machine process management module According to transmission, mutually call between the two.
In the present embodiment, the lexical analyzer, the syntax analyzer, the type definition program module and the generation Code generator constitutes the compiling system of virtual machine control system, the virtual machine process management module and the lexical analyzer It is connected, for calling the compiling system in virtual machine control system.
In the present embodiment, the first code segment data uses tree construction, each in the first code segment data Code snippet node all has variable name, function name, operation encoded information and the pointer for being directed toward all child nodes;Or it is described First code segment data uses list structure, all includes in each code snippet node in the first code segment data It is directed toward the pointer of the next item down first code segment data.And the first code fragment data is not limited only to binary tree.
Embodiment two
As shown in Figures 2 to 4, the present invention also provides a kind of control method based on C/C++ compiling system, the controlling parties Method receives first code segment data for any of the above-described virtual machine control system, the virtual machine process management module Afterwards, the control method is executed to first code segment data, the control method includes updating code snippet data, increasing generation Code segment data and deletion code snippet data.
As shown in Fig. 2, the update code snippet data include the following steps in the present embodiment,
A1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program mould Block and the code generator, to generate second code segment data corresponding with source code;
Whether A2, virtual machine process management module detection first code segment data reach critical condition, if so, Virtual machine control system prompts first code segment data to update failure;If it is not, then virtual machine control system deletes current process In first code segment data, and execute A3;
A3, increase second code segment data in current process.
As shown in figure 3, the increase code snippet includes the following steps in the present embodiment,
B1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program mould Block and the code generator, to generate second code segment data corresponding with source code;
B2, the virtual machine process management module detection second code segment data whether with the first generation existing in process Chip is disconnected to be re-defined;If so, virtual machine control system prompt first code segment data increases failure;If it is not, then working as Increase second code segment data in preceding process.
As shown in figure 4, the deletion code snippet data include the following steps, the virtual machine process in the present embodiment Whether management module detection first code segment data reaches critical condition, if so, virtual machine control system prompts the first generation Code segment data deletes failure;If it is not, then deleting the first code segment data in current process.
In the present embodiment, the critical condition is whether first code segment data is in current process by other codes Segment data is shared, if so, indicating to reach critical condition, if not, then it represents that not up to critical condition.
By using above-mentioned technical proposal disclosed by the invention, following beneficial effect has been obtained:
The present invention is realized by providing a kind of virtual machine control system and its control method based on C/C++ compiling system To the compatibility of the application program for the User Priority developed by C/C++;For the system application of operating system, run on interior Under core priority, virtual machine control system of the invention also it is compatible with C/C++ develop system application;For running on The driver of interior nuclear state is run under kernel priority, and virtual machine control system of the invention is also compatible to be opened with C/C++ The driver of hair;The present invention has the combined use of matching virtual machine by improvement C/C++ compiling system, and design simultaneously, makes The virtual machine control system can run user application, system program, driver, and can in application program, be When system program, driver operation, the code snippet data in virtual machine control system range of management are updated or increase or delete.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered Depending on protection scope of the present invention.

Claims (8)

1. a kind of virtual machine control system based on C/C++ compiling system, it is characterised in that: the system comprises
Lexical analyzer, for receiving source code, and the lexical analyzer is internally provided with operation precedence grade table and symbol Stack is analyzed, source code can be converted into syntax tree according to the standard analyzer of operation precedence grade;
Syntax analyzer, the syntax analyzer be used for from syntax tree extract variable, constant, function, type, NameSpace, Structural body, association, character string, template, expression formula, conditional statement and node data, and these data classification storages are arrived In type definition data module, and function, expression formula and conditional statement are sent into code generator;The syntax analyzer is also It is responsible for the transformation of scope;
Type definition program module, for generating type definition data, with decision variable, constant, function, type, structural body, connection The storage location of zoarium, character string and template in virutal machine memory management module;
Code generator, for by the function extracted from syntax tree, expression formula and conditional statement conversion be generated as virtual machine into Thread management module can identify received first code segment data;
Virutal machine memory management module receives type definition data for identification, is laid out in datarams, establishes data model And/or for calling virtual machine process management module, to be laid out in code memory, process model is established;
Virtual machine process management module receives code snippet data for identification, is laid out in code memory, what foundation can be run Process model, the virtual machine control system run specified process model, traverse each code snippet node, and utilize operation Stack calculates the result that the operation of first code segment data generates in current process model;The virtual machine process management module For calling the virutal machine memory management module, to modify type definition data.
2. the virtual machine control system according to claim 1 based on C/C++ compiling system, it is characterised in that: the source Code is the C/C++ source code file for meeting 14882 standard of ISO/IEC.
3. the virtual machine control system according to claim 1 based on C/C++ compiling system, it is characterised in that: described One code snippet data use tree construction, each code snippet node in the first code segment data all have variable name, Function name, operation encoded information and the pointer for being directed toward all child nodes;Or the first code segment data uses chained list Structure all includes to be directed toward the next item down first code segment number in each code snippet node in the first code segment data According to pointer.
4. a kind of control method based on C/C++ compiling system, it is characterised in that: the control method is used for the claims 1 to 3 any virtual machine control system, it is right after the virtual machine process management module receives first code segment data First code segment data executes the control method, and the control method includes updating code snippet data, increasing code piece Disconnected data and deletion code snippet data.
5. the virtual machine control method according to claim 4 based on C/C++ compiling system, it is characterised in that: it is described more Fresh code segment data includes the following steps,
A1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program module and The code generator, to generate second code segment data corresponding with source code;
Whether A2, virtual machine process management module detection first code segment data reach critical condition, if so, virtually Machine control system prompts first code segment data to update failure;If it is not, then virtual machine control system is deleted in current process First code segment data, and execute A3;
A3, increase second code segment data in current process.
6. the virtual machine control method according to claim 4 based on C/C++ compiling system, it is characterised in that: the increasing Code snippet is added to include the following steps,
B1, virtual machine control system call the lexical analyzer, the syntax analyzer, the type definition program module and The code generator, to generate second code segment data corresponding with source code;
B2, the virtual machine process management module detection second code segment data whether with first generation chip existing in process It is disconnected to re-define;If so, virtual machine control system prompt first code segment data increases failure;If it is not, then when advance Increase second code segment data in journey.
7. the virtual machine control method according to claim 4 based on C/C++ compiling system, it is characterised in that: described to delete Except code snippet data include the following steps, whether the virtual machine process management module detection first code segment data reaches Critical condition, if so, virtual machine control system prompt first code segment data deletes failure;If it is not, then deleting when advance First code segment data in journey.
8. the virtual machine control method according to claim 5 based on C/C++ compiling system, it is characterised in that: described to face Boundary's condition is whether first code segment data is shared in current process by other code snippet data, if so, indicating Reach critical condition, if not, then it represents that not up to critical condition.
CN201910294766.8A 2019-04-12 2019-04-12 Virtual machine control system based on C/C + + compiling system and control method thereof Active CN110018816B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910294766.8A CN110018816B (en) 2019-04-12 2019-04-12 Virtual machine control system based on C/C + + compiling system and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910294766.8A CN110018816B (en) 2019-04-12 2019-04-12 Virtual machine control system based on C/C + + compiling system and control method thereof

Publications (2)

Publication Number Publication Date
CN110018816A true CN110018816A (en) 2019-07-16
CN110018816B CN110018816B (en) 2022-04-22

Family

ID=67191252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910294766.8A Active CN110018816B (en) 2019-04-12 2019-04-12 Virtual machine control system based on C/C + + compiling system and control method thereof

Country Status (1)

Country Link
CN (1) CN110018816B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724804A (en) * 2023-12-19 2024-03-19 万物镜像(北京)计算机系统有限公司 Virtual machine instruction set generation method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7150010B1 (en) * 2000-07-06 2006-12-12 Microsoft Corporation Unification of a programming language and a definition language
CN104750533A (en) * 2013-12-31 2015-07-01 上海海尔集成电路有限公司 C program compiling method and C program compiler
CN106371887A (en) * 2016-11-08 2017-02-01 西安电子科技大学 System and method for MSVL compiling
CN106406828A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Method and apparatus for modifying business tool function of JAVA system
CN107102888A (en) * 2017-04-25 2017-08-29 华中科技大学 A kind of shared library insulation blocking method and system based on hardware virtualization technology

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7150010B1 (en) * 2000-07-06 2006-12-12 Microsoft Corporation Unification of a programming language and a definition language
CN104750533A (en) * 2013-12-31 2015-07-01 上海海尔集成电路有限公司 C program compiling method and C program compiler
CN106406828A (en) * 2015-07-28 2017-02-15 阿里巴巴集团控股有限公司 Method and apparatus for modifying business tool function of JAVA system
CN106371887A (en) * 2016-11-08 2017-02-01 西安电子科技大学 System and method for MSVL compiling
CN107102888A (en) * 2017-04-25 2017-08-29 华中科技大学 A kind of shared library insulation blocking method and system based on hardware virtualization technology

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724804A (en) * 2023-12-19 2024-03-19 万物镜像(北京)计算机系统有限公司 Virtual machine instruction set generation method, device and equipment

Also Published As

Publication number Publication date
CN110018816B (en) 2022-04-22

Similar Documents

Publication Publication Date Title
CN105845137B (en) A kind of speech dialog management system
Cooper et al. Embedding dynamic dataflow in a call-by-value language
CN102033748B (en) Method for generating data processing flow codes
Glabbeek et al. Progress, justness, and fairness
CN112100054A (en) Data management and control oriented program static analysis method and system
CN109523383A (en) A kind of intelligence contract converting system and method
US11379200B2 (en) Method for applying graph-specific compiler optimizations to graph analysis programs
CN104932905A (en) Automatic code generation method from AADL to C language
Damm et al. A discrete-time UML semantics for concurrency and communication in safety-critical applications
CN110162474A (en) A kind of intelligent contract reentry leak detection method based on abstract syntax tree
CN110354503B (en) Event triggering method and device and terminal
US20080127128A1 (en) Type Validation for Applications Incorporating A Weakly-Typed Language
CN110018816A (en) A kind of virtual machine control system and its control method based on C/C++ compiling system
Mateescu et al. Translating pi-calculus into lotos nt
Orlov et al. FINCH: A system for evolving Java (bytecode)
CN102799462B (en) Based on the script engine device of Eclipse platform and the collocation method of Eclipse platform
Johnsen et al. Intra-object versus inter-object: Concurrency and reasoning in creol
CN115168838A (en) Script language operation management method and system based on virtual machine safety sandbox
WO2001006357A1 (en) Meta-language for c++ business applications
EP4204960A1 (en) Thread-local return structure for asynchronous state machine
Penninckx et al. Abstract I/O Specification
US20240241702A1 (en) Compile-time link type object management
Schrijvers et al. Translating constraint handling rules into action rules
Kaplan et al. An architecture for tool integration
Peschanski et al. A stackless runtime environment for a pi-calculus

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
GR01 Patent grant
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: No. 5, Minzu University South Road, Haidian District, Beijing 100086

Patentee after: Wang Chen

Address before: 201108 Room 401, No. 18, Lane 3536, Yindu Road, Minhang District, Shanghai

Patentee before: Wang Chen