Mikhail Fursov wrote:
On 10/19/06, Alex Astapchuk <[EMAIL PROTECTED]> wrote:

Pavel,

One more note.

> b) About call of java method during compilation time. Jit now make
class loading during compilation.
> It means that Jit make call of java method.
> So I don't think that it's the other case.

It is different.
The JIT itself does not call Java code.
All what JIT does is calling VM's resolve_{anything}. It's VM who may
execute the Java code during the resolution.

The JIT itself neither has a way to call an arbitrary Java method during
the compilation, neither has an access to JNI functionality.


Sounds reasonable. And this solution joins mine and Pavel's proposals: JIT
calls a VM method to resolve native address for direct call. JIT does not

I would also add that we can not use any Java-based resolution schemes at all. (Here I mean anything that implies execution of managed code during compilation in order to resolve the things).

Doing so we would dig a huuuuge grave for ourselves: we'll get a number of dead lock issues, as such a scheme will add a sporadic and random locks inside a normal Java control flow. Exactly the same issue as we had with mixing native and Java locks in the same control flow.


care how the address is resolved in VM.
Alex, Pavel, what do you think about this interface?

In order to think anything meaningful, it would be nice to see something like a pseudo-code example. Something like a piece of Java code for the helper.
Would you be so kind, please?

Let me presume several things - are you talking about anything like the following?

//
// JIT side
//
ByteCodeTranslator::handleInvokeStatic() {

MethodDesc md = getMethodToInvoke();
ClassDesc klass = md.getClass();
if (klass.implements(NativeCallProvider) && /and what's here??/) {

// So, the VM is smart enough to find all the needed only by the name. Right?

void* addr = vm_get_special_native_method_address(md.get_fully_qualified_name())
        insert_a_native_call(addr);
}
else {
        proceed_as_usual_java_call();
}
}

The JIT side becomes simple, indeed.
What about the 'helper writer's' side?
What should be placed in the helper's Java code in order to make this special call?

//
// Java side
//
package org.apache.hy.drvm.gc.helpers;
public class GCHelpers /*implements anything? */ {

        /** it's fast path - will be inlined by JIT. */
private static Address fast_alloc(Address classHandle, int size) {
        ...
        if (fast_path_succeeded) return allocated_address();
        return perform_slow_path(classHandle, size);
}

        /** it's slow path - implemented by gc.dll*/
// What's here? annotation? anything else?
private static Address perform_slow_path(Address classHandle, int size);

}



--
Thanks,
  Alex


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to