JavaNativeMethod.st
author cg
Sat, 25 Sep 1999 21:13:24 +0000
changeset 611 490fbaed2257
child 616 53bf2ec50346
permissions -rw-r--r--
faster nativeMethod invocation

'From Smalltalk/X, Version:3.5.4 on 25-sep-1999 at 11:12:45 pm'                 !

JavaMethodWithHandler variableSubclass:#JavaNativeMethod
	instanceVariableNames:'nativeImplementation'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Classes'
!


!JavaNativeMethod methodsFor:'accessing'!

nativeImplementation
    "return the value of the instance variable 'nativeImplementation' (automatically generated)"

    ^ nativeImplementation

    "Created: / 25.9.1999 / 23:08:00 / cg"
!

nativeImplementation:something
    "set the value of the instance variable 'nativeImplementation' (automatically generated)"

    nativeImplementation := something.

    "Created: / 25.9.1999 / 23:08:00 / cg"
! !

!JavaNativeMethod methodsFor:'vm support'!

nativeMethodInvokation
    |nm sel|

    nativeImplementation isNil ifTrue:[
        nm := selector copyWithoutLast:signature size.
        sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.

        nativeImplementation := (JavaVM class compiledMethodAt:sel).
        nativeImplementation isNil ifTrue:[
            ^ JavaVM 
                perform:sel
                with:thisContext sender.
        ].
    ].

    ^ nativeImplementation
        valueWithReceiver:JavaVM
        arguments:(Array with:thisContext sender)
        selector:selector
        search:JavaVM class
        sender:nil

    "Modified: / 25.9.1999 / 23:10:29 / cg"
! !

!JavaNativeMethod class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaNativeMethod.st,v 1.1 1999/09/25 21:13:24 cg Exp $'
! !