JavaNativeMethod.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 31 Jan 2013 13:45:17 +0000
branchrefactoring-vmdata
changeset 2019 e1291a81f215
parent 2016 6afb298c7403
child 2020 985ca70cdcad
permissions -rw-r--r--
Finished uncached trampoline. Now JavaNativeMethod is not a Java method but Smalltalk methods. When created, a trampoline code is installed so when invoked, it dispatches back to JavaMethod>>nativeMethodInvokation: like before. The next step is to install optimized trampoline after first invocation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     1
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
     3
1155
vranyj1
parents: 1152
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
     5
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     8
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
     9
 This software is furnished under a license and may be used
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    10
 only in accordance with the terms of that license and with the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    12
 be provided or otherwise made available to, or used by, any
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    13
 other person.  No title to or ownership of the software is
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    14
 hereby transferred.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    15
1155
vranyj1
parents: 1152
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
vranyj1
parents: 1152
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
vranyj1
parents: 1152
diff changeset
    18
     see the differences between this version and version stx:libjava
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
    19
     as of 1.9.2010
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    20
"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    22
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    23
JavaMethodWithHandler variableSubclass:#JavaNativeMethod
1749
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
    24
	instanceVariableNames:'nativeImplementation nCalls'
1075
927aeb3649fc Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents: 1073
diff changeset
    25
	classVariableNames:'CacheNativeImplementation Verbose'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    26
	poolDictionaries:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    27
	category:'Languages-Java-Classes'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    28
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    29
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    30
!JavaNativeMethod class methodsFor:'documentation'!
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    31
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    32
copyright
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    33
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    34
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
    35
1155
vranyj1
parents: 1152
diff changeset
    36
 New code and modifications done at SWING Research Group [1]:
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
    37
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    38
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    39
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    40
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    41
 This software is furnished under a license and may be used
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    42
 only in accordance with the terms of that license and with the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    44
 be provided or otherwise made available to, or used by, any
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    45
 other person.  No title to or ownership of the software is
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    46
 hereby transferred.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    47
1155
vranyj1
parents: 1152
diff changeset
    48
 [1] Code written at SWING Research Group contains a signature
vranyj1
parents: 1152
diff changeset
    49
     of one of the above copright owners. For exact set of such code,
vranyj1
parents: 1152
diff changeset
    50
     see the differences between this version and version stx:libjava
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1075
diff changeset
    51
     as of 1.9.2010
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    52
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    53
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 772
diff changeset
    54
! !
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    55
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    56
!JavaNativeMethod class methodsFor:'initialization'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    57
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    58
cacheNativeImplementation
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    59
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    60
    "For details, see #cacheNativeImplementation:"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    61
    
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    62
    ^CacheNativeImplementation
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    63
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    64
    "Created: / 30-04-2011 / 23:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    65
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    66
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    67
cacheNativeImplementation: aBoolean
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    68
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    69
    "If set, native implementations are cached, resulting
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    70
     in better performance when calling native methods.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    71
     Hower, no change in native method implemenetaion will
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    72
     not be visible then, unless #flushAllCachedNativeMethods
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    73
     is explictely called"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    74
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    75
    CacheNativeImplementation := aBoolean
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    76
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    77
    "Created: / 30-04-2011 / 23:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    78
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    79
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    80
initialize
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    81
    "/self flags: ((self flags bitClear: Behavior flagMethod) bitOr: Behavior flagJavaMethod).
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    82
    self flags: ((self flags bitClear: Behavior flagJavaMethod) bitOr: Behavior flagMethod).
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
    83
    "
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    84
    self flags bitAnd: Behavior flagJavaMethod
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    85
    self flags bitAnd: Behavior flagMethod
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    86
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
    87
    "
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
    88
    "By default, do not cache native impls while developing"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    89
    CacheNativeImplementation := Smalltalk isStandAloneApp.
1075
927aeb3649fc Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents: 1073
diff changeset
    90
    Verbose := false.
927aeb3649fc Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents: 1073
diff changeset
    91
    "
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
    92
    Verbose := true.
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
    93
    "
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
    94
1075
927aeb3649fc Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents: 1073
diff changeset
    95
    "Modified (comment): / 03-11-2011 / 10:48:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    96
    "Modified: / 31-01-2013 / 13:41:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    97
! !
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    98
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
    99
!JavaNativeMethod class methodsFor:'instance creation'!
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   100
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   101
new
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   102
    "Redefined again, since since trampoline methods need
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   103
     literals"
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   104
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   105
    ^ self basicNew:1.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   106
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   107
    "Created: / 31-01-2013 / 13:26:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   108
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   109
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   110
!JavaNativeMethod class methodsFor:'cleanup'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   111
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   112
flushAllCachedNativeMethods
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   113
    self allInstancesDo:[:aNativeMethod |
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   114
        aNativeMethod nativeImplementation:nil
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   115
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   116
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   117
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   118
     self flushAllCachedNativeMethods
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   119
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   120
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   121
    "Created: / 24.12.1999 / 03:10:38 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   122
    "Modified: / 24.12.1999 / 03:10:51 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   123
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   124
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   125
!JavaNativeMethod methodsFor:'accessing'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   126
1749
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   127
nCalls
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   128
    ^ nCalls ? 0
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   129
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   130
    "Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   131
!
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   132
1754
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   133
nCallsReset
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   134
    nCalls := 0
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   135
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   136
    "Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   137
!
b3cde0c1c2b1 - do not enforce Java native code optimization off
vranyj1
parents: 1749
diff changeset
   138
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   139
nativeImplementation
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   140
    "return the value of the instance variable 'nativeImplementation' (automatically generated)"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   141
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   142
    ^ nativeImplementation
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   143
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   144
    "Created: / 25.9.1999 / 23:08:00 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   145
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   146
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   147
nativeImplementation:something
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   148
    "set the value of the instance variable 'nativeImplementation' (automatically generated)"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   149
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   150
    nativeImplementation := something.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   151
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   152
    "Created: / 25.9.1999 / 23:08:00 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   153
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   154
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   155
sourceLineNumber
1213
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   156
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   157
    ^super sourceLineNumber
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   158
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   159
"/    ForceByteCodeDisplay == true ifTrue:[ ^ 1].
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   160
"/    lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2].
fc90769151e8 - fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents: 1155
diff changeset
   161
"/    ^1
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   162
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   163
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   164
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   165
    ^ (JavaSourceCodeCache new) 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   166
        findLineForMethod:(self selector)
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   167
        inClass:javaClass.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   168
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   169
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   170
    "Modified: / 13-12-2010 / 13:55:55 / Jan Kurs <kurs.jan@post.cz>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   171
    "Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   172
    "Created: / 17-12-2010 / 10:34:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   173
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   174
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   175
!JavaNativeMethod methodsFor:'private'!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   176
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   177
compileNativeImplementation: sel dispatchingTo: oldSel
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   178
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   179
    | src arg converted header |
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   180
    src := (JavaVM class compiledMethodAt: oldSel) source.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   181
    src := src asStringCollection.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   182
    (src first includesString: 'aJavaContext') ifTrue:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   183
        arg := 'aJavaContext'
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   184
    ] ifFalse:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   185
        (src first includesString: 'nativeContext') ifTrue:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   186
            arg := 'nativeContext'
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   187
        ]
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   188
    ].
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   189
    arg ifNotNil:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   190
        src removeFirst asString.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   191
        converted := true.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   192
    ] ifNil:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   193
        arg := 'nativeContext'.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   194
        src := '    self breakPoint: #jv info: ''Convert it to new-style natives''.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   195
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   196
                ^ self ', oldSel, ' nativeContext'.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   197
        converted := false.            
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   198
    ]. 
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   199
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   200
    header := String streamContents:[:s|
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   201
        sel numArgs == 2 ifTrue:[
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   202
            s nextPutAll: sel; space; nextPutAll: 'this  '.
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   203
        ] ifFalse:[
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   204
            | kw |
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   205
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   206
            kw := sel keywords.            
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   207
            s nextPutAll: kw first.
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   208
            s nextPutAll: ' this '.
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   209
            2 to: kw size - 1 do:[:i|
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   210
                sel nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: i printString; space.
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   211
            ].            
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   212
        ]
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   213
    ].
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   214
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   215
    (JavaVM class 
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   216
        compile:
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   217
            (self nativeMethodTemplate bindWith:header with: arg with: src asString)
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   218
        classified:         
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   219
            'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$. ))
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   220
        package: JavaVM package.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   221
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   222
    converted ifTrue:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   223
        (JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (converted)'
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   224
    ] ifFalse:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   225
       (JavaVM class compiledMethodAt: oldSel) category:  'native - old-style (FAILED to convert)'
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   226
    ]
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   227
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   228
    "Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   229
    "Modified: / 19-01-2013 / 23:29:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   230
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   231
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   232
compileNativeImplementationStub: sel
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   233
    | header |
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   234
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   235
   header := String streamContents:[:s|
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   236
        sel numArgs == 2 ifTrue:[
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   237
            s nextPutAll: sel keywords first.
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   238
        ] ifFalse:[
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   239
            | kw |
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   240
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   241
            kw := sel keywords.            
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   242
            s nextPutAll: kw first.
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   243
            s nextPutAll: ' this '.
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   244
            2 to: kw size - 1 do:[:i|
1990
f37fb2129089 Fixed natives. Java VM boots & Groovy 1+1 works.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1986
diff changeset
   245
                s nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: (i - 1) printString; space.
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   246
            ].            
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   247
        ]
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   248
    ].
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   249
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   250
    (JavaVM natives class 
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   251
        compile:
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   252
            (self nativeMethodTemplate bindWith:header with: 'nativeContext' with:('^ JavaVM unimplementedNativeMethodSignal raise'))
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   253
        classified:         
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   254
            'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.))
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   255
        package: JavaVM package
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   256
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   257
    "Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1990
f37fb2129089 Fixed natives. Java VM boots & Groovy 1+1 works.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1986
diff changeset
   258
    "Modified: / 20-01-2013 / 20:56:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   259
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   260
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   261
installTrampoline: trampoline
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   262
    | l m |
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   263
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   264
    m := trampoline asByteCodeMethod.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   265
    m ~~ trampoline ifTrue:[
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   266
        "Cache it"
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   267
        self class methodDictionary at: trampoline selector put: m.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   268
    ].
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   269
    l := m literals.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   270
    1 to: l size do:[:i|
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   271
        (l at: i) == #__placeholder__ ifTrue:[
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   272
            l at: i put: self.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   273
        ].
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   274
    ].
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   275
    m isNil ifTrue:[
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   276
        self error: 'Cannot find trampoline method'.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   277
    ].
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   278
    self byteCode: m byteCode.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   279
    self literals: l.
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   280
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   281
    "Created: / 31-01-2013 / 13:31:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   282
!
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   283
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   284
nativeMethodTemplate
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   285
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   286
    ^'%1 %2
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   287
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   288
    <javanative: ''', javaClass name , ''' name: ''', (selector copyWithoutLast:signature size), '''>
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   289
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   290
    %3'
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   291
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   292
    "Created: / 01-05-2011 / 00:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   293
    "Modified: / 19-01-2013 / 22:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   294
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   295
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   296
searchNativeImplementation
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   297
    <resource: #obsolete>
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   298
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   299
    "Returns a SELECTOR of native method implementation.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   300
    For now, two naming schemes are used. The onld one uses
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   301
    just a class name and selector as a name for native method impl.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   302
    The new one uses fully qualified class name.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   303
    "
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   304
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   305
    | nm newStyleSel oldStyleSel |
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   306
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   307
    self error: 'Should no longer be called!!'.
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   308
912
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   309
    nm := selector upTo: $(.
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   310
    newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':') asSymbol.    
1974
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   311
    (JavaVM natives class canUnderstand: newStyleSel) ifTrue:[
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   312
        "Good, a JavaVM understands new style native selectors"
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   313
        ^newStyleSel
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   314
    ].
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   315
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   316
    oldStyleSel := ('_' , (javaClass lastName copyReplaceAll:$$ with:$_) , '_' , nm , ':') asSymbol.
1974
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   317
    (JavaVM natives canUnderstand: oldStyleSel) ifTrue:[
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   318
        "Convert method on the fly only if Im Jan Vrany
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   319
         (to avoid confusion of other developers :-)"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   320
        OperatingSystem getLoginName = 'jv' ifTrue:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   321
            "OK, old style method has not yet been converted to a newstyle one.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   322
            Converts old-style method to a new-style one"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   323
            self compileNativeImplementation: newStyleSel dispatchingTo: oldStyleSel.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   324
            ^newStyleSel
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   325
        ] ifFalse:[
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   326
            ^oldStyleSel
1974
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   327
        ]
9dc799a359ac - JavaTestsLoader
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1971
diff changeset
   328
    ].
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   329
    self compileNativeImplementationStub: newStyleSel.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   330
    ^newStyleSel
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   331
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   332
    "Created: / 30-04-2011 / 23:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   333
    "Modified: / 19-01-2013 / 23:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   334
!
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   335
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   336
searchNativeImplementation: numArgs
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   337
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   338
    "Returns a SELECTOR of native method implementation."
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   339
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   340
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   341
    | nm newStyleSel args |
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   342
    nm := selector upTo: $(.
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   343
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   344
    args := #(
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   345
        "0"  ''
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   346
        "1"  '_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   347
        "2"  '_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   348
        "3"  '_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   349
        "4"  '_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   350
        "5"  '_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   351
        "6"  '_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   352
        "7"  '_:_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   353
        "8"  '_:_:_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   354
        "9"  '_:_:_:_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   355
        "10" '_:_:_:_:_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   356
        "11" '_:_:_:_:_:_:_:_:_:_:_:'
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   357
        "12" '_:_:_:_:_:_:_:_:_:_:_:_:'
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   358
    ) at: numArgs + 1.
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   359
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   360
    newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':' , args) asSymbol.    
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   361
    (JavaVM natives class canUnderstand: newStyleSel) ifTrue:[
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   362
        "Good, a JavaVM understands new style native selectors"
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   363
        ^newStyleSel
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   364
    ].
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   365
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   366
    self compileNativeImplementationStub: newStyleSel.
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   367
    ^newStyleSel
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   368
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   369
    "Created: / 19-01-2013 / 22:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   370
    "Modified: / 19-01-2013 / 23:39:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   371
! !
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   372
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   373
!JavaNativeMethod methodsFor:'private-compiler interface'!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   374
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   375
numberOfArgs:aNumber
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   376
    | sel m |
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   377
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   378
    super numberOfArgs:aNumber.
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   379
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   380
    (self class flags bitAnd:Behavior flagJavaMethod) ~~ 0 ifTrue:[ ^ self ].
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   381
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   382
    "Now, install the trampoline..."
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   383
    sel := #(
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   384
        "00" #trampolineUncached:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   385
        "01" #trampolineUncached:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   386
        "02" #trampolineUncached:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   387
        "03" #trampolineUncached:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   388
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   389
        "04" #trampolineUncached:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   390
        "05" #trampolineUncached:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   391
        "06" #trampolineUncached:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   392
        "07" #trampolineUncached:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   393
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   394
        "08" #trampolineUncached:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   395
        "09" #trampolineUncached:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   396
        "10" #trampolineUncached:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   397
        "11" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   398
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   399
        "12" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   400
        "13" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   401
        "14" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   402
        "15" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_:_:_:
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   403
    ) at: aNumber + 1.
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   404
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   405
    m := self class compiledMethodAt: sel.
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   406
    self installTrampoline: m.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   407
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   408
    "Created: / 31-01-2013 / 12:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   409
! !
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   410
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   411
!JavaNativeMethod methodsFor:'private-trampolines'!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   412
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   413
trampolineUncached
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   414
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   415
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   416
    "Created: / 31-01-2013 / 12:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   417
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   418
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   419
trampolineUncached: a1
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   420
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   421
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   422
    "Created: / 31-01-2013 / 12:55:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   423
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   424
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   425
trampolineUncached: a1 _: a2
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   426
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   427
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   428
    "Created: / 31-01-2013 / 12:55:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   429
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   430
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   431
trampolineUncached: a1 _: a2 _: a3
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   432
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   433
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   434
    "Created: / 31-01-2013 / 12:55:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   435
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   436
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   437
trampolineUncached: a1 _: a2 _: a3 _: a4
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   438
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   439
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   440
    "Created: / 31-01-2013 / 12:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   441
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   442
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   443
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   444
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   445
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   446
    "Created: / 31-01-2013 / 12:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   447
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   448
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   449
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   450
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   451
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   452
    "Created: / 31-01-2013 / 12:55:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   453
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   454
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   455
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   456
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   457
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   458
    "Created: / 31-01-2013 / 12:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   459
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   460
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   461
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   462
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   463
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   464
    "Created: / 31-01-2013 / 12:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   465
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   466
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   467
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   468
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   469
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   470
    "Created: / 31-01-2013 / 12:56:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   471
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   472
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   473
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   474
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   475
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   476
    "Created: / 31-01-2013 / 12:56:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   477
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   478
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   479
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   480
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   481
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   482
    "Created: / 31-01-2013 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   483
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   484
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   485
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   486
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   487
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   488
    "Created: / 31-01-2013 / 12:56:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   489
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   490
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   491
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   492
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   493
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   494
    "Created: / 31-01-2013 / 12:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   495
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   496
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   497
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   498
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   499
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   500
    "Created: / 31-01-2013 / 12:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   501
!
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   502
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   503
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14 _: a15
2019
e1291a81f215 Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2016
diff changeset
   504
    ^#__placeholder__ nativeMethodInvokation: thisContext.
2016
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   505
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   506
    "Created: / 31-01-2013 / 12:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   507
! !
6afb298c7403 Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2010
diff changeset
   508
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   509
!JavaNativeMethod methodsFor:'vm support'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   510
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   511
nativeMethodInvokation
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   512
    "Called by the VM when a native method is
1748
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   513
     to be executed - old (slow) implementation"
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   514
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   515
    ^self nativeMethodInvokation: thisContext sender.    
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   516
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   517
    "
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   518
     JavaNativeMethod flushAllCachedNativeMethods"
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   519
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   520
    "Modified: / 27-01-2000 / 13:34:53 / cg"
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   521
    "Modified: / 03-11-2011 / 10:47:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   522
    "Modified: / 27-10-2012 / 15:15:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   523
!
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   524
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   525
nativeMethodInvokation: context
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   526
    "Called by the VM when a native method is
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   527
     to be executed. 
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   528
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   529
     'context' is the context of being-invoked native method"
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   530
    
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   531
    | sel  mthd  sender nArgs receiverAndArgsAndContext |
1749
2a942f354a94 - JavaNativeMethod
vranyj1
parents: 1748
diff changeset
   532
    nCalls := (nCalls ? 0) + 1.
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   533
    receiverAndArgsAndContext := Array new: (nArgs := context numArgs) + 1"receiver".
1993
6cb676a913a8 Native methods now use arguments instead of fetching them from context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1990
diff changeset
   534
    receiverAndArgsAndContext replaceFrom:2 to:1 + nArgs with: context startingAt: context arg1Index.
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   535
    receiverAndArgsAndContext at: 1 put: context receiver.
2010
9bacff8c53de The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1993
diff changeset
   536
    
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   537
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   538
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   539
    (mthd := nativeImplementation) isNil ifTrue: [
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   540
        sel := self searchNativeImplementation: nArgs.
1971
e75c1790521c Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1864
diff changeset
   541
        mthd := (JavaVM natives class compiledMethodAt: sel).
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   542
        (mthd isNil or: [ mthd isLazyMethod ]) ifTrue: [
1748
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   543
            sender := context.
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   544
            sender sender selector == #noByteCode ifTrue: [
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   545
                sender := sender sender.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   546
                sender := sender sender.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   547
                sender := sender sender.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   548
            ].
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   549
            ^ JavaVM natives perform: sel withArguments: receiverAndArgsAndContext 
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   550
        ].
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   551
        CacheNativeImplementation ifTrue: [ nativeImplementation := mthd. ]
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   552
    ].
1075
927aeb3649fc Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents: 1073
diff changeset
   553
    Verbose ifTrue: [Logger log: 'Native method invokation: ' , sel severity: #debug facility: #JVM].
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   554
    ^ mthd 
1971
e75c1790521c Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1864
diff changeset
   555
        valueWithReceiver: JavaVM natives
1986
9e63ab553922 JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1985
diff changeset
   556
        arguments: receiverAndArgsAndContext 
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   557
        selector: selector
1971
e75c1790521c Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1864
diff changeset
   558
        search: JavaVM natives class
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   559
        sender: nil
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   560
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   561
    "
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1022
diff changeset
   562
     JavaNativeMethod flushAllCachedNativeMethods"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   563
1748
ff89096bf12f - JavaNativeMethod
vranyj1
parents: 1213
diff changeset
   564
    "Created: / 27-10-2012 / 15:13:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1993
6cb676a913a8 Native methods now use arguments instead of fetching them from context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1990
diff changeset
   565
    "Modified: / 21-01-2013 / 17:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   566
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   567
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   568
!JavaNativeMethod class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   569
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   570
version
1864
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   571
    ^ '$Header$'
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   572
!
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   573
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   574
version_HG
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   575
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   576
    ^ '$Changeset: <not expanded> $'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   577
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   578
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   579
version_SVN
1864
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   580
    ^ '§Id§'
923
b922537eea2a Merged with CVS version
vranyj1
parents: 912
diff changeset
   581
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   582
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   583
1985
7c5a14d663ba Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1974
diff changeset
   584
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   585
JavaNativeMethod initialize!