--- a/JavaMethod.st Sat Sep 25 20:22:24 1999 +0000
+++ b/JavaMethod.st Sat Sep 25 20:58:01 1999 +0000
@@ -17,7 +17,8 @@
classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
- A_BREAKPOINT R_VOID R_LONG R_DOUBLE A_HASHANDLER'
+ A_BREAKPOINT R_VOID R_LONG R_DOUBLE A_HASHANDLER
+ NativeMethodCache'
poolDictionaries:''
category:'Java-Classes'
!
@@ -1618,26 +1619,36 @@
!JavaMethod methodsFor:'vm support'!
nativeMethodInvokation
- |nm sel|
+ |nm sel mthd|
+
+ NativeMethodCache notNil ifTrue:[
+ mthd := NativeMethodCache at:self ifAbsent:nil.
+ mthd notNil ifTrue:[
+ ^ mthd
+ valueWithReceiver:JavaVM
+ arguments:(Array with:thisContext sender)
+ selector:selector
+ search:JavaVM class
+ sender:nil
+ ]
+ ] ifFalse:[
+ NativeMethodCache := IdentityDictionary new.
+ ].
nm := selector copyWithoutLast:signature size.
sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.
-"/ (JavaVM respondsTo:sel) ifTrue:[
- ^ JavaVM
- perform:sel
- with:thisContext sender.
-"/ ].
-"/
-"/ self error:('unimplemented nativeMethod: ' , javaClass name , ' ' , self name).
- ^ nil
+ NativeMethodCache at:self put:(JavaVM class compiledMethodAt:sel).
+
+ ^ JavaVM
+ perform:sel
+ with:thisContext sender.
- "Created: / 1.1.1998 / 15:16:14 / cg"
- "Modified: / 23.12.1998 / 18:57:08 / cg"
+ "Modified: / 25.9.1999 / 22:57:54 / cg"
! !
!JavaMethod class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.86 1999/08/21 10:53:24 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.87 1999/09/25 20:58:01 cg Exp $'
! !
JavaMethod initialize!