--- a/JavaClass.st Tue Sep 10 00:14:14 2013 +0200
+++ b/JavaClass.st Thu Sep 12 23:47:35 2013 +0200
@@ -2852,6 +2852,15 @@
!JavaClass methodsFor:'versions'!
+hasMultipleVersions
+ "
+ return true if this java class has multiple coexisting versions
+ "
+ ^ self versions notNil and: [self versions size > 1].
+
+ "Created: / 12-09-2013 / 23:33:32 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+!
+
mergeVersionsWith: aJavaClass
"
take both self and aJavaClass and ensure that:
--- a/JavaFieldRef2.st Tue Sep 10 00:14:14 2013 +0200
+++ b/JavaFieldRef2.st Thu Sep 12 23:47:35 2013 +0200
@@ -21,7 +21,7 @@
"{ Package: 'stx:libjava' }"
JavaClassContentRef2 subclass:#JavaFieldRef2
- instanceVariableNames:'offset type'
+ instanceVariableNames:'offset type cleanCacheFlag'
classVariableNames:'T_LONG T_DOUBLE'
poolDictionaries:''
category:'Languages-Java-Reader-Support-new'
@@ -97,42 +97,40 @@
findResolvedStaticValue
- self findResolvedValue.
+self findResolvedValue.
"Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 03-12-2011 / 12:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-12-2011 / 13:37:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified (format): / 09-09-2013 / 23:39:33 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
findResolvedValue: doClassInit
- |class|
+ "
+ Stores resolved field in valueCache field, fills offset and
+ type fields. In case of multiple coexisting java class versions
+ sets cleanCacheFlag recognized by the vm, which causes the
+ caches to be cleaned after the use.
+ "
valueCache := JavaResolver uniqueInstance
- resolveFieldIndentifiedByRef: self.
+ resolveFieldIndentifiedByRef: self.
valueCache isStatic ifTrue: [ classCache := valueCache javaClass ] ifFalse: [
classCache := (constantPool at: classRefIndex) resolve: doClassInit.
- ].
+ ].
classCache isNil ifTrue: [ self breakPoint: #mh ].
self resolveOffset.
nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
self resolveType.
nameAndTypeCache isNil ifTrue: [ self breakPoint: #mh ].
-
- class := self classRef resolve: false.
- class canCacheReferences ifTrue: [ ^ valueCache] ifFalse: [
- "references to class cannot be cached, returning resolved value
- and invalidating the reference so it has to be resolved again
- next time"
- |resolvedValue|
- resolvedValue := valueCache.
- self invalidate.
- ^ resolvedValue.
- ]
+ classCache javaClass hasMultipleVersions ifTrue: [
+ cleanCacheFlag := true.
+ ] ifFalse: [
+ cleanCacheFlag := false.
+ ].
"Modified: / 07-12-2011 / 21:52:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Created: / 09-02-2012 / 23:09:18 / mh <hlopik@gmail.com>"
"Modified: / 16-10-2012 / 10:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 10-09-2013 / 00:06:44 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+ "Modified (comment): / 12-09-2013 / 23:37:38 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
!
findStaticOffset