harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rana Dasgupta" <rdasg...@gmail.com>
Subject Re: [drlvm] Calling native methods from Java code: implementation details
Date Wed, 18 Oct 2006 15:26:13 GMT
On 10/17/06, Mikhail Fursov <mike.fursov@gmail.com> wrote:
>
> On 10/18/06, Xiao-Feng Li <xiaofeng.li@gmail.com> 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.
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message