A real-time compilation method and apparatus for a computer modeling language

By constructing a real-time compilation method for the X language, generating intermediate representations and mapping them to bytecode, the problem of low simulation efficiency of the X language on hardware platforms is solved, enabling rapid iteration and efficient modeling processes.

CN121501260BActive Publication Date: 2026-04-14BEIJING DINGCHENG ZHIZAO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DINGCHENG ZHIZAO TECH CO LTD
Filing Date
2025-08-06
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

The lack of real-time compilation technology for the X language in the existing technology results in low simulation efficiency on the hardware platform, making it difficult to meet the rapid iteration requirements in the model development process.

Method used

A real-time compilation method for a computer modeling language is adopted. By acquiring the modeling language information set, constructing the transformation model information, including the mapping model and the pattern information set, performing compilation processing, generating intermediate representation information and mapping it into bytecode, and using the pattern information set for matching and similarity calculation to generate the final bytecode set.

Benefits of technology

It enables just-in-time compilation, execution, and debugging capabilities for the X language, improving modeling efficiency, shortening the development-compilation-run verification-modification cycle, increasing engineering application prospects, and improving operating efficiency on hardware platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121501260B_ABST
    Figure CN121501260B_ABST
Patent Text Reader

Abstract

The application discloses a real-time compiling method and device of a computer modeling language, and the method comprises the following steps: obtaining a modeling language information set to be compiled; constructing a conversion model information of the modeling language; the conversion model information comprises a mapping model and a mode information set; based on the conversion model information, the modeling language information set to be compiled is subjected to compiling processing to obtain a bytecode set corresponding to the modeling language information set to be compiled; the bytecode is a program code which can run on a virtual machine or an interpreter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer compilation technology and simulation modeling technology, specifically to a real-time compilation method and apparatus for a computer modeling language. Background Technology

[0002] X language is a next-generation integrated modeling and simulation language supporting MBSE for complex systems. It provides standardized graphical modeling descriptions during the product concept design phase and can automatically compile these graphical models into text-based low-level simulation models. Driven by a simulation engine, it supports seamless integrated simulation across the entire system, the entire process, and multiple perspectives, achieving unified description and simulation from conceptual model design, system architecture design, multi-physics domain models to simulation models. As a newly designed modeling language, its theoretical foundation and methodology are complete, requiring a supporting toolset to move from theory to practice. The compiler is the most crucial component. The compiler's main function is to compile the model code developed using X language into an executable program. During JIT compilation, the first half generates intermediate representations (IRs) for the X language code, and the second half generates interpretable bytecode based on the information contained in the intermediate representations. This bytecode can be interpreted and executed by a virtual machine. JIT compilation is faster than AOT and supports single-step execution, facilitating rapid iteration during model development. It is suitable for scenarios involving frequent compilation and modification during model development, significantly improving modeling efficiency. Currently, JIT compilation technology for the X language is a blank module. Summary of the Invention

[0003] This invention primarily addresses the problem of how to perform real-time compilation of next-generation modeling languages, such as the X language, thereby improving their simulation efficiency on hardware platforms. This invention discloses a real-time compilation method and apparatus for computer modeling languages.

[0004] In a first aspect, this invention discloses a real-time compilation method for a computer modeling language, comprising:

[0005] S1, obtain the set of modeling language information to be compiled;

[0006] S2, construct the transformation model information of the modeling language; the transformation model information includes a mapping model and a pattern information set;

[0007] S3, based on the conversion model information, the set of modeling language information to be compiled is processed to obtain the set of bytecode corresponding to the set of modeling language information to be compiled;

[0008] The step of compiling the modeling language information set to be compiled based on the transformation model information to obtain the bytecode set corresponding to the modeling language information set to be compiled includes:

[0009] S31, Based on the pattern information set, perform matching processing on the modeling language information set to be compiled to obtain intermediate representation information of the modeling language;

[0010] S32, Based on the mapping model, the intermediate representation information of the modeling language is mapped to obtain the bytecode set corresponding to the modeling language information set to be compiled.

[0011] The process of matching the modeling language information set to be compiled based on the pattern information set to obtain intermediate representation information of the modeling language includes:

[0012] S311, for each type of information in the modeling language information set to be compiled, the corresponding class information set of the pattern information set is used for matching processing to obtain the intermediate information corresponding to each type of information;

[0013] S312, using the intermediate information corresponding to all class information in the modeling language information set to be compiled, the intermediate representation information of the modeling language is constructed.

[0014] For each type of information in the modeling language information set to be compiled, the corresponding class information set of the pattern information set is used for matching processing to obtain the intermediate information corresponding to each type of information, including:

[0015] S3111, For each type of information in the modeling language information set to be compiled, calculate the statistical information set;

[0016] S3112, For the corresponding class information set of the pattern information set, calculate the statistical information standard set;

[0017] S3113, Perform similarity calculation on the statistical information set and the statistical information standard set to obtain the intermediate information corresponding to the class information.

[0018] For each type of information in the modeling language information set to be compiled, a statistical information set is calculated, including:

[0019] S31111, Perform probability statistics on the characters contained in each type of information in the modeling language information set to be compiled to obtain a first probability set; the first probability set includes the probability of each type of character in the modeling language information set appearing in the type of information;

[0020] S31112, perform cluster analysis on the character values ​​of each type of information in the modeling language information set to be compiled, and obtain a first cluster analysis result; the first cluster analysis result includes the category information obtained by cluster analysis and the character values ​​contained in each category of information;

[0021] S31113, using the first probability set and the results of the first cluster analysis, a statistical information set is constructed.

[0022] The step of performing similarity calculation between the statistical information set and the statistical information standard set to obtain intermediate information corresponding to the class information includes:

[0023] The probability similarity is calculated between the statistical information set and the statistical information subset of each piece of information in the statistical information standard set to obtain a first similarity value and a first divergence value.

[0024] The category similarity is calculated for each subset of statistical information in the statistical information set and the statistical information standard set to obtain a second similarity value and a second divergence value.

[0025] By performing a fusion weight calculation on all similarity values ​​and divergence values, the similarity value between the statistical information set and the statistical information subset in the statistical information standard set is obtained.

[0026] The corresponding information in the statistical information standard set with the minimum similarity value is determined as the intermediate information corresponding to the class information;

[0027] The expression for calculating the fusion weight is:

[0028]

[0029] Where X represents the calculated similarity value of the information, r i F represents the similarity value of the i-th digit. i This represents the i-th divergence value.

[0030] The probability similarity calculation includes:

[0031] Let the first probability set and the second probability set be represented as a first probability vector and a second probability vector, respectively; the i-th element in the probability vector,

[0032] For the difference vector between the first probability vector and the second probability vector, perform l p Norm calculation yields the first similarity value;

[0033] Statistical parameter estimation is performed on the difference vector between the first probability vector and the second probability vector to obtain the mean μ, variance σ, and median τ of the difference vector.

[0034] The first divergence value is calculated by performing a first divergence calculation on the mean, variance, and median values;

[0035] The expression for calculating the first divergence value is:

[0036]

[0037] Where F1 represents the first divergence value.

[0038] A second aspect of this invention discloses a real-time compilation apparatus for a computer modeling language, the apparatus comprising:

[0039] Memory containing executable program code;

[0040] A processor coupled to the memory;

[0041] The processor calls the executable program code stored in the memory to execute the real-time compilation method of the computer modeling language.

[0042] In a third aspect of this invention, a computer-storable medium is disclosed, the computer-storable medium storing computer instructions, which, when invoked by a computer, are used to execute the real-time compilation method of the computer modeling language.

[0043] A fourth aspect of the present invention discloses an information data processing terminal, which is used to implement the real-time compilation method of the computer modeling language.

[0044] The beneficial effects of this invention are as follows:

[0045] This invention develops an important function in the X language compiler, taking a significant step forward in the development of the new domestically produced complex modeling language X language from theory to practice. It realizes JIT compilation based on the intermediate representation of X language, enabling X language to be compiled, executed, and debugged in real time after development. This can greatly improve the efficiency of modeling with X language, shorten the development-compilation-run verification-modification cycle, and significantly increase the engineering application prospects of X language.

[0046] Compared to AOT compilation mode, JIT compilation mode is faster. Since bytecode provides more granular information than source code and its structure is not optimized, it supports more intuitive compilation and debugging functions, thus improving the language's running efficiency on hardware platforms. Attached Figure Description

[0047] Figure 1 This is a flowchart illustrating the implementation of the method of the present invention. Detailed Implementation

[0048] To better understand the content of this invention, an embodiment is provided here.

[0049] Figure 1 This is a flowchart illustrating the implementation of the method of the present invention.

[0050] In a first aspect, this invention discloses a real-time compilation method for a computer modeling language, comprising:

[0051] S1, obtain the set of modeling language information to be compiled;

[0052] S2, construct the transformation model information of the modeling language; the transformation model information includes a mapping model and a pattern information set;

[0053] S3, based on the conversion model information, the set of modeling language information to be compiled is processed to obtain the set of bytecode corresponding to the set of modeling language information to be compiled;

[0054] The bytecode is program code that can run on a virtual machine or interpreter;

[0055] The real-time compilation method for the computer modeling language, after executing S3, further includes:

[0056] S4, Deploy the bytecode set on a virtual machine to run it, and obtain the running results of the modeling language information set;

[0057] The pattern information set includes the standard type name set, inheritance relationship set, model type set, imported file path set, member variable definition set, port definition set, equation definition set, state machine definition set, action definition set, and connection relationship definition set defined by the X language; each type of information set in the pattern information set includes several corresponding name information, type information, relationship information, definition information, or file path information.

[0058] The modeling language information set includes the type name, inheritance relationship, model type, imported file path, member variable definition, port definition, equation definition, state machine definition, action definition, and connection relationship definition of the modeling language to be compiled.

[0059] The step of compiling the modeling language information set to be compiled based on the transformation model information to obtain the bytecode set corresponding to the modeling language information set to be compiled includes:

[0060] S31, Based on the pattern information set, perform matching processing on the modeling language information set to be compiled to obtain intermediate representation information of the modeling language;

[0061] S32, Based on the mapping model, the intermediate representation information of the modeling language is mapped to obtain the bytecode set corresponding to the modeling language information set to be compiled.

[0062] The mapping model can be implemented using the lexical analysis and syntax analysis modules in a compiler, such as the corresponding functional modules in the GCC compiler.

[0063] The mapping model records a one-to-one correspondence between all intermediate representation information of the modeling language and the bytecode corresponding to the modeling language information set to be compiled.

[0064] The process of matching the modeling language information set to be compiled based on the pattern information set to obtain intermediate representation information of the modeling language includes:

[0065] S311, for each type of information in the modeling language information set to be compiled, the corresponding class information set of the pattern information set is used for matching processing to obtain the intermediate information corresponding to each type of information;

[0066] S312, using the intermediate information corresponding to all class information in the modeling language information set to be compiled, the intermediate representation information of the modeling language is constructed.

[0067] For each type of information in the modeling language information set to be compiled, the corresponding class information set of the pattern information set is used for matching processing to obtain the intermediate information corresponding to each type of information, including:

[0068] S3111, For each type of information in the modeling language information set to be compiled, calculate the statistical information set;

[0069] S3112, For the corresponding class information set of the pattern information set, calculate the statistical information standard set;

[0070] S3113, Perform similarity calculation on the statistical information set and the statistical information standard set to obtain the intermediate information corresponding to the class information;

[0071] For each type of information in the modeling language information set to be compiled, a statistical information set is calculated, including:

[0072] S31111, Perform probability statistics on the characters contained in each type of information in the modeling language information set to be compiled to obtain a first probability set; the first probability set includes the probability of each type of character in the modeling language information set appearing in the type of information;

[0073] S31112, perform cluster analysis on the character values ​​of each type of information in the modeling language information set to be compiled, and obtain a first cluster analysis result; the first cluster analysis result includes the category information obtained by cluster analysis and the character values ​​contained in each category of information;

[0074] S31113, using the first probability set and the results of the first cluster analysis, a statistical information set is constructed;

[0075] The step of performing similarity calculation between the statistical information set and the statistical information standard set to obtain intermediate information corresponding to the class information includes:

[0076] The probability similarity is calculated between the statistical information set and the statistical information subset of each piece of information in the statistical information standard set to obtain a first similarity value and a first divergence value.

[0077] The category similarity is calculated for each subset of statistical information in the statistical information set and the statistical information standard set to obtain a second similarity value and a second divergence value.

[0078] By performing a fusion weight calculation on all similarity values ​​and divergence values, the similarity value between the statistical information set and the statistical information subset in the statistical information standard set is obtained.

[0079] The corresponding information in the statistical information standard set with the minimum similarity value is determined as the intermediate information corresponding to the class information;

[0080] The expression for calculating the fusion weight is:

[0081]

[0082] Where X represents the calculated similarity value of the information, r i F represents the similarity value of the i-th digit. i This represents the i-th divergence value.

[0083] The probability similarity calculation includes:

[0084] The first probability set and the second probability set are represented as a first probability vector and a second probability vector, respectively; the i-th element in the probability vector is the probability of each i-th type of character appearing in the first probability set or the second probability set;

[0085] For the difference vector between the first probability vector and the second probability vector, perform l p Norm calculation yields the first similarity value;

[0086] Statistical parameter estimation is performed on the difference vector between the first probability vector and the second probability vector to obtain the mean μ, variance σ, and median τ of the difference vector.

[0087] The first divergence value is calculated by performing a first divergence calculation on the mean, variance, and median values;

[0088] The expression for calculating the first divergence value is:

[0089]

[0090] Where F1 represents the first divergence value.

[0091] The expression for calculating the category similarity is:

[0092] For the first clustering analysis result and the second clustering analysis result in the statistical information subset of each piece of information, the category information contained in both is sorted in descending order according to the total number of character values ​​contained, to obtain the corresponding category information sequence; the category information sequence includes category information and corresponding sequence number;

[0093] For the category information with the same index in the first cluster analysis result and the second cluster analysis result, sort the character values ​​contained therein in descending order to obtain the corresponding value sequence;

[0094] For the value sequences of category information with the same index in the first cluster analysis result and the second cluster analysis result, Gram angle field transformation is performed respectively to obtain the corresponding two-dimensional matrix;

[0095] For two two-dimensional matrices containing category information with the same serial number, matrix difference calculation is performed to obtain the difference value of the category information;

[0096] The difference values ​​of all categories of information are used to perform a first fusion calculation to obtain a second similarity value;

[0097] A second fusion calculation is performed on the difference values ​​of all categories of information to obtain the second divergence value;

[0098] The matrix difference calculation can also be performed by taking the difference between two two-dimensional matrices to obtain a difference matrix, finding the largest eigenvalue of the difference matrix, and using the largest eigenvalue as the difference value of the category information.

[0099] The expression for calculating the matrix difference is:

[0100]

[0101] Where cy represents the difference value, N and M are the row and column dimensions of the two-dimensional matrix, respectively, and Q1 iQ1 represents the mean of the i-th row of the two-dimensional matrix corresponding to the first clustering analysis result. ij and Q2 ij Q2 represents the elements in the i-th row and j-th column of the two-dimensional matrix corresponding to the first clustering analysis result and the two-dimensional matrix corresponding to the second clustering analysis result, respectively. i This represents the mean of the i-th row of the two-dimensional matrix corresponding to the second clustering analysis result.

[0102] The expression for the first fusion calculation is:

[0103]

[0104] Among them, T i () denotes the i-th order polynomial of the first kind of Chebyshev polynomial, cy i r1 represents the difference value of the category information of the i-th sequence number, and r2 represents the second similarity value;

[0105] The expression for the second fusion calculation is:

[0106]

[0107] Where F2 is the second divergence value, and θ1, θ2 and θ3 are the mean, median and variance of all difference values, respectively;

[0108] The statistical information standard set is calculated from the corresponding class information set of the pattern information set, including:

[0109] For each piece of information in the corresponding class information set of the pattern information set, perform statistical calculations to obtain the corresponding statistical information subset;

[0110] By utilizing the statistical information subsets of all information, a standard set of statistical information is constructed.

[0111] The statistical calculation process includes: performing probability statistics on the occurrence of characters contained in each piece of information to obtain a second probability set; the first probability set includes the probability of each type of character appearing in the information; performing cluster analysis on the character values ​​of each piece of information to obtain a second cluster analysis result; the second cluster analysis result includes the category information obtained from the cluster analysis and the character values ​​contained in each category of information; and constructing a statistical information subset corresponding to the information using the second probability set and the second cluster analysis result.

[0112] Each type of information in the modeling language information set to be compiled corresponds to a class information set in the pattern information set according to the attributes of the class information. For example, the type name corresponds to the type name set, and the inheritance relationship corresponds to the inheritance relationship set.

[0113] The cluster analysis of the character values ​​of each type of information in the set of modeling language information to be compiled is to take the values ​​of all characters in each type of information in the set of modeling language information to be compiled as numerical values, perform cluster analysis on all numerical values, and obtain cluster analysis results. The cluster analysis results include each type of information and the characters contained in the type.

[0114] The process of processing the intermediate representation information of the modeling language based on the mapping model to obtain the bytecode set corresponding to the modeling language information set to be compiled includes:

[0115] A second aspect of this invention discloses a real-time compilation apparatus for a computer modeling language, the apparatus comprising:

[0116] Memory containing executable program code;

[0117] A processor coupled to the memory;

[0118] The processor calls the executable program code stored in the memory to execute the real-time compilation method of the computer modeling language.

[0119] In a third aspect of this invention, a computer-storable medium is disclosed, the computer-storable medium storing computer instructions, which, when invoked by a computer, are used to execute the real-time compilation method of the computer modeling language.

[0120] A fourth aspect of the present invention discloses an information data processing terminal, which is used to implement the real-time compilation method of the computer modeling language.

[0121] In a fifth aspect of this invention, a real-time compilation method for a computer modeling language is disclosed. During the development of an X language compiler, a bytecode style and a JIT compilation method are invented. Based on the X language intermediate representation (IR), bytecode sets are generated, and these bytecode sets represent the intent of the X language source code.

[0122] The structure of X language bytecode is

opcode

param1

param2

param3

[0123] Based on the characteristics of the X language model, a set of opcodes that can support the interpretation and execution of the X language model is designed, including the interpretation method of the opcodes and their attached parameters.

[0124]

[0125]

[0126]

[0127]

[0128]

[0129]

[0130] XLInstruction is a data structure representing a single bytecode instruction. It is the basic building block of a bytecode instruction set, which consists of multiple bytecode instructions. During execution, the virtual machine interprets and executes these instructions line by line, block by block, to achieve the purpose of running the code. Each function has its own independent bytecode instruction set. When a function is called, the execution jumps to the function's bytecode instruction set for interpretation and execution. After execution, the execution returns to the original instruction set.

[0131] It also includes language type storage containers such as constant string arrays, constant numeric arrays, and global class definition data. When compiling the source code, the constant information used in the source code is stored in the constant array, and the position of the constant in the array is recorded in the bytecode instructions so that it can be accessed at runtime.

[0132] When compiling various definitions or functions, the positions marked in the bytecode instructions are all relative positions. For example, when executing a function, if the available stack position is 15, then when executing the function's instruction set, all marked stack positions are taken as 15+N.

[0133] Based on the intermediate representation definition items of the X language, create mapping rules from intermediate representation to bytecode for model type definition information.

[0134] struct XLModelTypeContext

[0135] {

[0136] XLModelTypeContext()

[0137] :className("")

[0138] ,type(XLanguage::UNKOWN)

[0139] isDefineEncapsuate(false)

[0140] isDefinePartial(false)

[0141] isFinished(false)

[0142] {

[0143] sequence=0;

[0144] };

[0145] int sequence;

[0146] / / / <summary> Has the parsing of the class declaration ended?< / summary>

[0147] XLANGUAGECOMPILETYPES_EXPORT bool IsClosed(); / / / <summary> Has the parsing been completed?< / summary>

[0148] bool isFinished;

[0149] / / / <summary> Model type< / summary>

[0150] XLModelType type;

[0151] / / / <summary> Should the encapsuate keyword be defined?< / summary> boolisDefineEncapsuate;

[0152] / / / <summary> Class Name< / summary>

[0153] std::string className;

[0154] / / / <summary> Should the Partial keyword be defined?< / summary>

[0155] bool isDefinePartial;

[0156] / / / <summary> Import type< / summary>

[0157] std::vector <std::string>ImportTypes;

[0158] / / / <summary> Parent class name< / summary>

[0159] std::vector <std::string>parentClassNames;

[0160] / / / <summary> Parent class collection< / summary>

[0161] std::vector <xlmodeltypecontextptr>parentClass;

[0162] / / / <summary> When this class is defined in other classes, the pointer is not null.< / summary>

[0163] XLModelTypeContextPtr outClass;

[0164] / / / <summary> Other arrays of classes defined in this class< / summary>

[0165] std::vector <xlmodeltypecontextptr>innerClasses;

[0166] / / / <summary> Arrays imported into this class< / summary>

[0167] std::vector <xlmodeltypecontextptr>importClasses;

[0168] / / / <summary> An array of enumeration types defined in this class< / summary>

[0169] std::vector <xlenumcontextptr>innerEnums;

[0170] / / / <summary> The parameter defines a member variable whose key is the variable name and whose value is the context.< / summary>

[0171] std::map<std::string,XLParameterContextPtr> parameters;

[0172] / / / <summary> The `portParameters` member variable has the key: variable name, and the value: port property context.< / summary>

[0173] std::map<std::string,XLPortContextPtr> portParameters;

[0174] / / / <summary> The `partParameters` member variables have the key: variable name, and the value: the context of the `part` property.< / summary>

[0175] std::map<std::string,XLPartContextPtr> partParameters;

[0176] / / / <summary> The `partParameters` member variables have the following key and value attributes: `key`: variable name, `value`: context of the `value` property.< / summary>

[0177] std::map<std::string,XLPartContextPtr> valueParameters;

[0178] / / / <summary> planDefinition context< / summary>

[0179] XLPlanDefContextPtr planCtx;

[0180] / / / <summary> ibdSection context< / summary>

[0181] std::vector <xlconnectcontextptr>ibdSection;

[0182] / / / <summary> state machine stateSections context< / summary>

[0183] std::vector <xlstatedefcontextptr>stateSection;

[0184] / / / <summary> Equation, Parametric Diagram, Parsection Context< / summary>

[0185] XLParSectionContextPtr parSectionCtx;

[0186] / / / <summary> Initialization equations, parameter graphs, and parsection context< / summary>

[0187] XLParSectionContextPtr InitParSectionCtx;

[0188] / / / <summary> Activity graph actSection context< / summary>

[0189] std::vector <xlstatementcontextptr>actSection;

[0190] };

[0191] Note: The intermediate representation information is the result of the first half of the compilation and is directly consumed and used in this invention. The intermediate representation of the X language contains all the information of an X language model and is an important intermediate result obtained after lexical analysis, syntax analysis, inclusion relation analysis, and semantic analysis of the X language source code. The mapping model in S32 is shown below.

[0192] Example illustration: The following is an example of a mapping model for an X language model, in the first implementation:

[0193]

[0194]

[0195] The intermediate section represents the model type definition information in the IR, which includes model type, model name, inheritance relationship, etc. The bytecode set generated after compilation is shown below:

[0196] continuous Vehicle

[0197] For example, in the code example above, a contiguous class named Vehicle is declared. The following is an expansion and comment of the bytecode instruction set.

[0198] XL_OpC_LOAD 0 1 0 0 / / Retrieve the constant string value "Vehicle" from position 0 of the character dictionary and place it into position 1 of the virtual stack.

[0199] XL_OpC_CLASS1 2 0 0 / / The first parameter represents the position of the class name in the stack, the second parameter 2 represents the newly created type being stored in stack position 2, and the third parameter 0 represents the model being XL_Continuous.

[0200] The intermediate information represents the model member variable definition information in IR, including member variable type, member variable name, and whether it is a port variable, etc. The bytecode instruction set generated after compilation is shown below:

[0201] real Rfd = 3.23; #reduction ratio

[0202] The compiled bytecode instruction set of the above code segment is shown below:

[0203] XL_OpC_LOAD 2 3 0 0 / / Push the constant string Rfd from position 2 of the string dictionary onto the stack at position 3.

[0204] XL_OpC_LOADFLOAT 0 4 0 0 / / Push 3.23 onto the stack from position 0 in the constant floating-point value dictionary to position 4.

[0205] XL_OpC_NEWMEMBER 2 3 4 0 / / Retrieve variable name Rfd from the stack, initialized to 3.23, and add member variable information to the class definition at position 2. The variable name is Rfd, and the initial value is 3.23.

[0206] The intermediate representation indicates that the equation definition information in the IR includes equation primitives, calculation methods, etc. The bytecode instruction set generated after compilation is shown below:

[0207] mph=2*PI*VehicleSpeed*Rw*k;

[0208] XL_OpC_LOAD 3 3 0 0 / / Push the constant string PI from the string dictionary at position 3 onto the stack at position 3.

[0209] XL_OpC_LOAD 3 0 0 3 / / Push the string variable value PI from the stack at position 3, read the value of PI from the global variable, and store it in position 3 on the stack.

[0210] XL_OpC_LOADINT 4 4 0 0 / / Push the constant value 4 onto the stack at position 4.

[0211] XL_OpC_MUL 5 3 4 0 / / Multiply the values ​​at positions 3 and 4 on the stack, and store the result on stack 5.

[0212] XL_OpC_LOAD 6 4 0 0 / / Push the constant string "VehicleSpeed" from the string dictionary at position 4 onto the stack at position 6.

[0213] XL_OpC_LOAD 6 2 6 0 / / Push the string variable value VehicleSpeed ​​from position 6 on the stack, read the value of the variable VehicleSpeed ​​from the class at position 2, and store it on position 6 of the stack.

[0214] XL_OpC_MUL 5 5 6 0 / / Multiply the values ​​at positions 5 and 6 on the stack, and store the result on stack 5.

[0215] XL_OpC_LOAD 6 5 0 0 / / Push the constant string Rw from position 5 of the string dictionary onto position 6 of the stack.

[0216] XL_OpC_LOAD 6 2 6 0 / / Push the string variable value Rw from position 6 on the stack, read the value of variable Rw from the class at position 2, and store it on position 6 of the stack.

[0217] XL_OpC_MUL 5 5 6 0 / / Multiply the values ​​at positions 5 and 6 on the stack, and store the result on stack 5.

[0218] XL_OpC_LOAD 6 6 0 0 / / Push the constant string k from the string dictionary at position 6 onto the stack at position 6.

[0219] XL_OpC_LOAD 6 2 6 0 / / Push the string variable value k from position 6 on the stack, read the value of variable k from position 2, and store it on position 6 of the stack.

[0220] XL_OpC_MUL 5 5 6 0 / / Multiply the values ​​at positions 5 and 6 on the stack, and store the result on stack 5.

[0221] XL_OpC_LOAD 6 6 0 0 / / Push the constant string k from the string dictionary at position 6 onto the stack at position 6.

[0222] XL_OpC_LOAD 6 2 6 0 / / Push the string variable value k from position 6 on the stack, read the value of variable k from position 2, and store it on position 6 of the stack.

[0223] XL_OpC_MUL 5 5 6 0 / / Multiply the values ​​at positions 5 and 6 on the stack, and store the result on stack 5.

[0224] XL_OpC_LOAD 6 7 0 0 / / Push the constant string mph from the string dictionary at position 6 onto the stack at position 6.

[0225] XL_OpC_SET 2 6 5 0 / / Sets the value at position 5 on the stack to the variable named at position 6 (mph) in the class at position 2.

[0226] Once all the information in the intermediate representation has been compiled into a bytecode instruction set, the JIT compilation process is complete.

[0227] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.< / xlstatementcontextptr> < / xlstatedefcontextptr> < / xlconnectcontextptr> < / xlenumcontextptr> < / xlmodeltypecontextptr> < / xlmodeltypecontextptr> < / xlmodeltypecontextptr> < / std::string> < / std::string>

Claims

1. A real-time compilation method for a computer modeling language, characterized in that, include: S1, obtain the set of modeling language information to be compiled; S2, construct the conversion model information of the modeling language; The transformation model information includes a mapping model and a set of pattern information; S3, based on the transformation model information, the set of modeling language information to be compiled is processed to obtain the bytecode set corresponding to the set of modeling language information to be compiled, including: S31, based on the pattern information set, perform matching processing on the modeling language information set to be compiled to obtain intermediate representation information of the modeling language, including: S311, for each type of information in the modeling language information set to be compiled, perform matching processing using the corresponding class information set of the pattern information set to obtain intermediate information corresponding to each type of information, including: S3111, For each type of information in the modeling language information set to be compiled, calculate the statistical information set; S3112, For the corresponding class information set of the pattern information set, calculate the statistical information standard set; S3113, Perform similarity calculation on the statistical information set and the statistical information standard set to obtain the intermediate information corresponding to the class information; S312, using the intermediate information corresponding to all class information in the modeling language information set to be compiled, intermediate representation information of the modeling language is constructed; the bytecode is program code that can run on a virtual machine or interpreter; S32, Based on the mapping model, the intermediate representation information of the modeling language is mapped to obtain the bytecode set corresponding to the modeling language information set to be compiled.

2. The real-time compilation method for computer modeling languages ​​as described in claim 1, characterized in that, The statistical information standard set includes a statistical information subset of all information; the statistical information subset includes a second probability set and the results of the second cluster analysis.

3. The real-time compilation method for computer modeling languages ​​as described in claim 2, characterized in that, For each type of information in the modeling language information set to be compiled, a statistical information set is calculated, including: S31111, Perform probability statistics on the characters contained in each type of information in the modeling language information set to be compiled to obtain a first probability set; the first probability set includes the probability of each type of character in the modeling language information set appearing in the type of information; S31112, perform cluster analysis on the character values ​​of each type of information in the modeling language information set to be compiled, and obtain a first cluster analysis result; the first cluster analysis result includes the category information obtained by cluster analysis and the character values ​​contained in each category of information; S31113, using the first probability set and the results of the first cluster analysis, a statistical information set is constructed.

4. The real-time compilation method for a computer modeling language as described in claim 3, characterized in that, The step of performing similarity calculation between the statistical information set and the statistical information standard set to obtain intermediate information corresponding to the class information includes: The probability similarity is calculated between the statistical information set and the statistical information subset of each piece of information in the statistical information standard set to obtain a first similarity value and a first divergence value. The category similarity is calculated for each subset of statistical information in the statistical information set and the statistical information standard set to obtain a second similarity value and a second divergence value. By performing a fusion weight calculation on all similarity values ​​and divergence values, the similarity value between the corresponding information in the statistical information set and the statistical information subset in the statistical information standard set is obtained; The corresponding information in the statistical information standard set with the minimum similarity value is determined as the intermediate information corresponding to the class information; The expression for calculating the fusion weight is: , in, X This represents the similarity value of the calculated information. This represents the similarity value of the i-th digit. This represents the i-th divergence value.

5. The real-time compilation method for a computer modeling language as described in claim 4, characterized in that, The probability similarity calculation includes: The first probability set and the second probability set are represented as a first probability vector and a second probability vector, respectively; Perform the operation on the difference vector between the first probability vector and the second probability vector. Norm calculation yields the first similarity value; Statistical parameter estimation is performed on the difference vector between the first probability vector and the second probability vector to obtain the mean of the difference vector. ,variance and median value ; The first divergence value is calculated by performing a first divergence calculation on the mean, variance, and median values; The expression for calculating the first divergence value is: , in, This represents the first divergence value.

6. A real-time compilation device for a computer modeling language, characterized in that, The device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the real-time compilation method of the computer modeling language as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, which, when invoked by a computer, are used to execute a real-time compilation method for the computer modeling language as described in any one of claims 1 to 5.

8. An information data processing terminal, characterized in that, The information data processing terminal is used to implement the real-time compilation method of the computer modeling language as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Domain-specific language compiler optimization method and system based on multi-layer intermediate representation

    CN119512557A

  • Java compiler and device for generating compiler information used by the java compiler

    JP2003202994A