Few fixes in proxy compilation. More for overloads will come
--- a/src/experiments/JavaLookup.st Sun Jan 01 17:03:10 2012 +0000
+++ b/src/experiments/JavaLookup.st Sun Jan 01 17:04:23 2012 +0000
@@ -196,7 +196,7 @@
cls := cls superclass.
].
- "Pass 1: Search for explicitly annotated method"
+ "Pass 2: Search for method with matching name"
cls := initialSearchClass.
[ cls notNil ] whileTrue:[
cls methodDictionary keysAndValuesDo:[:sel :mthd|
@@ -286,9 +286,7 @@
"/ self halt.
"/ JK: Skip for now
- Class withoutUpdatingChangesDo:[
- receiver class addSelector: selector withMethod: m.
- ].
+ self addSelector: selector withMethod: m toClass: receiver class.
^m.
].
@@ -300,6 +298,7 @@
"Modified (format): / 25-09-2011 / 21:08:45 / Jan Kurs <kursjan@fit.cvut.cz>"
"Created: / 19-11-2011 / 13:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-12-2011 / 15:28:19 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 01-01-2012 / 17:41:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaLookup::Smalltalk2Java methodsFor:'lookup (old)'!
@@ -445,7 +444,7 @@
!JavaLookup::Smalltalk2Java methodsFor:'utilities'!
-addSelector:selector withMethod:proxy toClasS:class
+addSelector:selector withMethod:proxy toClass:class
ProxyMethod installProxies ifTrue:[
Class withoutUpdatingChangesDo:[
@@ -454,6 +453,7 @@
]
"Modified: / 23-12-2011 / 13:09:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 01-01-2012 / 17:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compileProxyWithSelector:selector in:class calling:methods
@@ -473,15 +473,21 @@
self assert:methods size == 1.
body := compiler newJavaMethodInvocation:methods anyOne.
] ifFalse:[
- "For every method, create a guard and add it"
- body := fallback.
- methods do:[:method |
- invocation := compiler newGuard.
- invocation condition:method descriptor guardCondition.
- invocation action:(compiler newJavaMethodInvocation:method).
- invocation fallback:body.
- body := invocation.
- ].
+ "JV@2012-01-01: Based on discussion with JK, if there is no overloaded method
+ DO NOT compile guard, call the method directly. We'll see..."
+ methods size == 1 ifTrue:[
+ body := (compiler newJavaMethodInvocation:methods anElement).
+ ] ifFalse:[
+ "For every method, create a guard and add it"
+ body := fallback.
+ methods do:[:method |
+ invocation := compiler newGuard.
+ invocation condition:method descriptor guardCondition.
+ invocation action:(compiler newJavaMethodInvocation:method).
+ invocation fallback:body.
+ body := invocation.
+ ].
+ ]
].
"/Create and install proxy
@@ -501,6 +507,7 @@
"Created: / 16-12-2011 / 23:21:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-12-2011 / 14:44:11 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 01-01-2012 / 17:48:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaLookup::Smalltalk2Java methodsFor:'utilities (old)'!
--- a/src/experiments/LookupIntegrationTestsResource.st Sun Jan 01 17:03:10 2012 +0000
+++ b/src/experiments/LookupIntegrationTestsResource.st Sun Jan 01 17:04:23 2012 +0000
@@ -1,28 +1,22 @@
"
- Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
- SWING Research Group, Czech Technical University
- in Prague
+ COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
+ COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+ SWING Research Group, Czech Technical University in Prague
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
+ [1] Code written at SWING Research Group contains a signature
+ of one of the above copright owners. For exact set of such code,
+ see the differences between this version and version stx:libjava
+ as of 1.9.2010
"
"{ Package: 'stx:libjava/experiments' }"
@@ -30,7 +24,7 @@
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
- category:'Languages-Java-Experiments-Lookup-Tests'
+ category:'Languages-Java-Experiments-Tests'
!
LookupIntegrationTestsResource class instanceVariableNames:'projectDir projectBuilded'
@@ -48,30 +42,24 @@
copyright
"
- Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
- SWING Research Group, Czech Technical University
- in Prague
+ COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
+ COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
+ SWING Research Group, Czech Technical University in Prague
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
+ [1] Code written at SWING Research Group contains a signature
+ of one of the above copright owners. For exact set of such code,
+ see the differences between this version and version stx:libjava
+ as of 1.9.2010
"
! !
@@ -109,6 +97,13 @@
projectDir
^ projectDir
+!
+
+resources
+
+ ^ { JavaInitializedResource }
+
+ "Created: / 01-01-2012 / 17:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LookupIntegrationTestsResource class methodsFor:'running'!
--- a/src/experiments/ProxyMethodJavaMethodInvocationNode.st Sun Jan 01 17:03:10 2012 +0000
+++ b/src/experiments/ProxyMethodJavaMethodInvocationNode.st Sun Jan 01 17:04:23 2012 +0000
@@ -112,22 +112,28 @@
].
method programmingLanguage isJava ifTrue:[
+ | returnType |
method isStatic ifTrue:[
self error:'Not yet implemented, should user valueWithReceiver:arguments:...'.
^nil
].
+ returnType := descriptor return javaClass.
invocation := super generate: compiler.
- "(descriptor return javaClass isJavaWrapperClass)"true ifTrue:[
-"/ invocation := MessageNode
-"/ receiver: invocation
-"/ selector: #javaUnwrap:
-"/ arg: (super generate: compiler).
+
+ returnType isJavaWrapperClass ifTrue:[
invocation := MessageNode
+ receiver: (ConstantNode value: returnType)
+ selector: #javaUnwrap:
+ arg: (super generate: compiler).
+ ] ifFalse:[returnType == Boolean ifTrue:[
+ "Special hack for booleans, as they are represented as
+ int in {0,1}"
+ invocation := MessageNode
receiver: invocation
- selector: #javaUnwrapFrom:
- arg: (ConstantNode value: descriptor return javaClassName).
- ].
+ selector: #==
+ arg: (ConstantNode value: 1).
+ ]].
^invocation
].
@@ -159,6 +165,7 @@
"Created: / 22-12-2011 / 09:27:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 30-12-2011 / 15:20:08 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 01-01-2012 / 17:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ProxyMethodJavaMethodInvocationNode methodsFor:'testing'!