JavaFieldRef2.st
author Marcel Hlopko <marcel.hlopko@gmail.com>
Sat, 12 Oct 2013 18:10:18 +0200
branchdevelopment
changeset 2820 1ab75f8aa9de
parent 2819 76893aac6a7e
child 2824 6d2d593cb29e
permissions -rw-r--r--
small cleanup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     1
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
     3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
     5
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     8
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    14
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    15
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    18
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    19
     as of 1.9.2010
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    20
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    22
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    23
JavaClassContentRef2 subclass:#JavaFieldRef2
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2752
diff changeset
    24
	instanceVariableNames:'offset type'
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    25
	classVariableNames:'T_LONG T_DOUBLE'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    26
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    27
	category:'Languages-Java-Reader-Support-new'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    28
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    29
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    30
!JavaFieldRef2 class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    31
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    32
copyright
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    33
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    34
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    35
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    36
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    37
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    38
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    39
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    40
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    41
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    46
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    47
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    48
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    49
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    50
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    51
     as of 1.9.2010
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    52
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    53
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    54
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    55
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    56
!JavaFieldRef2 class methodsFor:'initialization'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
initialize
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
    T_LONG := 1.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
    T_DOUBLE := 2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
    "Created: / 15-05-2011 / 22:31:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
!JavaFieldRef2 methodsFor:'accessing'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
isJavaFieldRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
^true.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
    "Created: / 11-04-2011 / 21:47:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
offset
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
    ^ offset.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
    "Created: / 15-05-2011 / 22:26:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
    ^ type.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
    "Created: / 15-05-2011 / 22:29:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2799
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
    83
    "Modified: / 05-10-2013 / 23:57:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
!JavaFieldRef2 methodsFor:'private - resolving'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    88
findInstOffset
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    89
    "fieldRef must be resolved before calling me"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    90
    self assert: classCache notNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    91
    self assert: valueCache notNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    92
    ^ classCache instVarOffsetOf: self name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    93
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    94
    "Created: / 07-12-2011 / 13:44:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    95
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    96
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
findResolvedStaticValue
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    98
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
    99
self findResolvedValue.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
    "Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   102
    "Modified: / 03-12-2011 / 12:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   103
    "Modified: / 08-12-2011 / 13:37:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   106
findResolvedValue: doClassInit
2748
fa96e547c9a5 set cleanCacheFlag in JavaFieldRef when multiple java class versions present
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
   107
    "
fa96e547c9a5 set cleanCacheFlag in JavaFieldRef when multiple java class versions present
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
   108
    Stores resolved field in valueCache field, fills offset and 
2820
1ab75f8aa9de small cleanup
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2819
diff changeset
   109
    type fields.
2748
fa96e547c9a5 set cleanCacheFlag in JavaFieldRef when multiple java class versions present
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
   110
    "
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
    valueCache := JavaResolver uniqueInstance 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
                resolveFieldIndentifiedByRef: self.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   113
    valueCache isStatic ifTrue: [ classCache := valueCache javaClass ] ifFalse: [
2820
1ab75f8aa9de small cleanup
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2819
diff changeset
   114
        classCache := self classRef resolve: doClassInit.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   115
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   116
    classCache isNil ifTrue: [ self breakPoint: #mh ].
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
    self resolveOffset.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
    nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
    self resolveType.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   120
    nameAndTypeCache isNil ifTrue: [ self breakPoint: #mh ].
2745
d82859be4462 remove findResolvedStaticValue from JavaFieldRef2, not used anymore
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
   121
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   122
    "Modified: / 07-12-2011 / 21:52:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   123
    "Created: / 09-02-2012 / 23:09:18 / mh <hlopik@gmail.com>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   124
    "Modified: / 16-10-2012 / 10:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2820
1ab75f8aa9de small cleanup
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2819
diff changeset
   125
    "Modified: / 12-10-2013 / 17:54:48 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   126
!
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   128
findStaticOffset
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   129
    "fieldRef must be resolved before calling me"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   130
    self assert: classCache notNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   131
    self assert: valueCache notNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   132
    ^ classCache class instVarOffsetOf: self name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   133
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   134
    "Created: / 07-12-2011 / 13:45:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   135
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   136
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   137
preResolve
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   138
    self resolveType
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   139
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   140
    "Created: / 16-10-2012 / 10:45:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
2819
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   143
reresolveForVersion: javaClass
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   144
    "
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   145
    Reresolves fieldRef with class cache set to given javaClass. This is the 
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   146
    way VM tells us which class version to use. This method is called only when
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   147
    there are multiple class versions present.
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   148
    "
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   149
    self classRef javaClass: javaClass.
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   150
    self findResolvedValue: true.
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   151
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   152
    "Created: / 12-10-2013 / 15:44:04 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   153
!
76893aac6a7e add JavaFieldRef>>reresolveForVersion: javaClass
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2802
diff changeset
   154
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
resolveOffset
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
    "fieldRef must be resolved before calling me"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
    
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   158
    self assert: valueCache notNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   159
    self assert: classCache isJavaClass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   160
    valueCache isStatic ifTrue: [ offset := self findStaticOffset. ] ifFalse: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   161
        offset := self findInstOffset.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   162
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   163
    self assert: offset notNil.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   165
    "Modified: / 07-12-2011 / 21:47:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
resolveStaticOffset
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
    "fieldRef must be resolved before calling me"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
    | currentClass |
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   172
    currentClass := classCache.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   173
    self assert: (currentClass class instVarNames includes: self name).
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   174
    offset := currentClass class instVarOffsetOf: self name.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   176
    "Modified: / 07-12-2011 / 13:38:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
resolveType
2799
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   180
    | descriptor |
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   181
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   182
    descriptor := (constantPool at: nameAndTypeIndex) descriptor.
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   183
    type := 0.
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   184
    descriptor = 'J' ifTrue:[
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
        type := T_LONG.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
    ] ifFalse:[
2801
62c767616a13 Fixed stupid bug in JavaFieldRef2 (did not correctly set type to R_DOUBLE for double fields)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2799
diff changeset
   187
        descriptor = 'D' ifTrue:[
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
            type := T_DOUBLE
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
        ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
    "Created: / 15-05-2011 / 22:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2799
b2fa940b8184 Fixed tests JavaFieldRefTests>>testCorrectResolving
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   193
    "Modified: / 05-10-2013 / 23:56:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
!JavaFieldRef2 class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   198
version_CVS
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
   199
    ^ '$Header: /cvs/stx/stx/libjava/JavaFieldRef2.st,v 1.6 2013-09-06 00:41:23 vrany Exp $'
2273
4320d6d1081e fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2234
diff changeset
   200
!
4320d6d1081e fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2234
diff changeset
   201
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   202
version_HG
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   203
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   204
    ^ '$Changeset: <not expanded> $'
2234
5596ea14dfbb added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   205
!
5596ea14dfbb added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   206
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
version_SVN
2731
13f5be2bf83b Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2711 2678
diff changeset
   208
    ^ 'Id'
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2273
diff changeset
   211
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   212
JavaFieldRef2 initialize!