Care for more than 14 arguments to a native method (sigh).
In that case, no trampoline is generated and eventual invocation
will trigger an error since this is not supported by the VM.
--- a/JavaNativeMethod.st Tue Feb 12 15:31:26 2013 +0000
+++ b/JavaNativeMethod.st Tue Feb 12 15:33:11 2013 +0000
@@ -363,6 +363,8 @@
| nm newStyleSel args |
nm := selector upTo: $(.
+ numArgs > 14 ifTrue:[ ^ nil ].
+
args := #(
"0" ''
"1" '_:'
@@ -377,6 +379,8 @@
"10" '_:_:_:_:_:_:_:_:_:_:'
"11" '_:_:_:_:_:_:_:_:_:_:_:'
"12" '_:_:_:_:_:_:_:_:_:_:_:_:'
+ "13" '_:_:_:_:_:_:_:_:_:_:_:_:_:'
+ "14" '_:_:_:_:_:_:_:_:_:_:_:_:_:_:'
) at: numArgs + 1.
newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':' , args) asSymbol.
@@ -403,7 +407,7 @@
^newStyleSel
"Created: / 19-01-2013 / 22:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 08-02-2013 / 09:34:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2013 / 15:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaNativeMethod methodsFor:'private-compiler interface'!
@@ -412,6 +416,10 @@
| args trampolineTree compiler trampoline |
super numberOfArgs:aNumber.
+
+ aNumber > 14 ifTrue:[
+ ^self.
+ ].
(self class flags bitAnd:Behavior flagJavaMethod) ~~ 0 ifTrue:[ ^ self ].
javaClass isNil ifTrue:[
self error: 'Cannot install trampoline - no Java class yet'.
@@ -447,7 +455,7 @@
self literals: trampoline literals.
"Created: / 31-01-2013 / 12:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 31-01-2013 / 15:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2013 / 15:28:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaNativeMethod methodsFor:'private-trampolines'!