On 10/17/06, Mikhail Fursov <[EMAIL PROTECTED]> wrote:
On 10/18/06, Xiao-Feng Li <[EMAIL PROTECTED]> wrote: >> >> Pavel's looks like more flexible, but I have a question with the >> special interface approach: is it possible that sometimes we want to >> call a library native method in fast way? If possible, shall we >> require all library classes that have the native method implement the >> special interface? >The solution if my proposal is accepted: to call any native method from a >native library user must >1) Create a "header"-like Java file with a static method stub and describe >its parameters >2) Add the "Java header" to the protected by VM classes (e.g. load it with >bootstrap classloader) >3) Create a library that will be loaded by component manager and will >resolve the method by (void* getAddress(name)) request. >I think this is reasonable amount of actions to add unsafe functionality >
This sounds like a good plan to me. The purpose of this design is to make helper invocation fast. Very fast, if posible. Though there are other interesting uses of this mechanism that we are discovering, it may be a good idea to focus on the main reason first. I am assuming that some level of caching will occur since the slow helpers will not change dynamically during a VM running instance. As Pavel pointed out, we may also want to consider a default calling convention like __fastcall, or a custom convention, so that we don't have to annotate every time. Thanks, Rana
into VM.