CodePudding user response:
Jit generated machine code can be directly on a real machine operation, namely can directly to the operating system to performFor the JVM, the Java program may be only data, but the JVM parser will translate the data into machine code to the operating system to perform, like a bat file, for the console, it is only the data, but the console will be put inside the content of the reading after sent to the operating system performs in the form of instruction,
CodePudding user response:
The JVM is what API call or interface to make CPU execution of generated machine code? How to get the return value? We ourselves can make up a program will be executed a machine code data to the CPU, and returns the resultCodePudding user response:
This is not clear, or I can write a JVM,But the JVM is written in c, the estimate is called c API or compiled by c calls again,
Want to call a machine code, can not in theory, but direct call CPU instruction set estimation is difficult, after all, in the middle and a layer of operating system, perhaps can also through the API to implement some advanced language, you can refer to the following link
https://blog.csdn.net/bdss58/article/details/83387028
CodePudding user response:
Thank you very much, I guess this principle, and then ask a, interpretation is a pile of if statements?CodePudding user response:
Depends how the specific implementation, the most basic is to use a bunch of if statements, of course, to judge what is input instruction is executed what methodBetter with the map as a mapping, the key is the input command, the value is a function pointer, to obtain a function pointer
CodePudding user response:
Thank you very much!!!!!!!!!!! How to give pointsCodePudding user response:
To ask a question, the open closed principle: function the increase will certainly bring code changes, such as increasing a subclass extending original function, but to use a subclass, or factories have to in the application of changes in code, could you tell me how do you think of the open closed principle? Software development mainly is to want to ensure which part of the code remains the same