diff -r ab9bb9d8ff4d -r fa7400d022a0 JavaFieldRef2.st --- a/JavaFieldRef2.st Sat Feb 02 01:23:18 2013 +0100 +++ b/JavaFieldRef2.st Sat Feb 16 19:08:45 2013 +0100 @@ -1,11 +1,11 @@ " 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 - Parts of the code written by Claus Gittinger are under following - license: - 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 @@ -13,31 +13,10 @@ other person. No title to or ownership of the software is hereby transferred. - Parts of the code written at SWING Reasearch Group [1] are MIT licensed: - - 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: - - 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 contain a signature - of one of the above copright owners. + [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' }" @@ -53,12 +32,12 @@ copyright " 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 - Parts of the code written by Claus Gittinger are under following - license: - 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 @@ -66,31 +45,10 @@ other person. No title to or ownership of the software is hereby transferred. - Parts of the code written at SWING Reasearch Group [1] are MIT licensed: - - 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: - - 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 contain a signature - of one of the above copright owners. + [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 " ! ! @@ -128,59 +86,78 @@ !JavaFieldRef2 methodsFor:'private - resolving'! +findInstOffset + "fieldRef must be resolved before calling me" + self assert: classCache notNil. + self assert: valueCache notNil. + ^ classCache instVarOffsetOf: self name. + + "Created: / 07-12-2011 / 13:44:59 / Marcel Hlopko " +! + findResolvedStaticValue - valueCache := JavaResolver uniqueInstance - resolveStaticFieldIndentifiedByRef: self. - "/Use javaClass of the field, not the class ref!! - classCache := valueCache javaClass. - classCache ifNil: [ self breakPoint: #mh ]. - self resolveStaticOffset. - nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve. - self resolveType. - nameAndTypeCache ifNil: [ self breakPoint: #mh ]. + +self findResolvedValue. "Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko " - "Modified: / 18-05-2011 / 12:44:13 / Marcel Hlopko " - "Modified: / 24-05-2011 / 14:05:13 / Jan Vrany " + "Modified: / 03-12-2011 / 12:16:48 / Jan Vrany " + "Modified: / 08-12-2011 / 13:37:05 / Marcel Hlopko " ! -findResolvedValue +findResolvedValue: doClassInit valueCache := JavaResolver uniqueInstance resolveFieldIndentifiedByRef: self. - classCache := (constantPool at: classRefIndex) resolve. - classCache ifNil: [ self breakPoint: #mh ]. + 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 ifNil: [ self breakPoint: #mh ]. + nameAndTypeCache isNil ifTrue: [ self breakPoint: #mh ]. + + "Modified: / 07-12-2011 / 21:52:23 / Marcel Hlopko " + "Created: / 09-02-2012 / 23:09:18 / mh " + "Modified: / 16-10-2012 / 10:46:51 / Jan Vrany " +! - "Modified: / 18-05-2011 / 12:44:17 / Marcel Hlopko " +findStaticOffset + "fieldRef must be resolved before calling me" + self assert: classCache notNil. + self assert: valueCache notNil. + ^ classCache class instVarOffsetOf: self name. + + "Created: / 07-12-2011 / 13:45:15 / Marcel Hlopko " +! + +preResolve + self resolveType + + "Created: / 16-10-2012 / 10:45:17 / Jan Vrany " ! resolveOffset "fieldRef must be resolved before calling me" - | currentClass | + self assert: valueCache notNil. + self assert: classCache isJavaClass. + valueCache isStatic ifTrue: [ offset := self findStaticOffset. ] ifFalse: [ + offset := self findInstOffset. + ]. + self assert: offset notNil. - currentClass := classCache. - - [ offset := currentClass instVarOffsetOf: self name. - offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ]. - - "Modified: / 20-05-2011 / 20:36:17 / Marcel Hlopko " + "Modified: / 07-12-2011 / 21:47:43 / Marcel Hlopko " ! resolveStaticOffset "fieldRef must be resolved before calling me" | currentClass | + currentClass := classCache. + self assert: (currentClass class instVarNames includes: self name). + offset := currentClass class instVarOffsetOf: self name. - currentClass := classCache. - - [ offset := currentClass class instVarOffsetOf: self name. - offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ]. - - "Modified: / 20-05-2011 / 20:36:11 / Marcel Hlopko " + "Modified: / 07-12-2011 / 13:38:03 / Marcel Hlopko " ! resolveType @@ -198,16 +175,18 @@ !JavaFieldRef2 class methodsFor:'documentation'! -version - ^ '$Header: /cvs/stx/stx/libjava/JavaFieldRef2.st,v 1.3 2011-11-24 11:53:46 cg Exp $' +version_CVS + ^ '$Header: /cvs/stx/stx/libjava/JavaFieldRef2.st,v 1.4 2013-02-16 18:08:32 vrany Exp $' ! -version_CVS - ^ '$Header: /cvs/stx/stx/libjava/JavaFieldRef2.st,v 1.3 2011-11-24 11:53:46 cg Exp $' +version_HG + + ^ '$Changeset: $' ! version_SVN - ^ '§Id: JavaFieldRef2.st,v 1.1 2011/08/18 19:06:53 vrany Exp §' + ^ '§Id§' ! ! + JavaFieldRef2 initialize!