author | vranyj1 |
Tue, 26 Jul 2011 16:31:02 +0000 | |
branch | jk_new_structure |
changeset 877 | f5a5b93e1c78 |
parent 819 | d95b67600835 |
child 1152 | 040cba55a7d2 |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
4 |
SWING Research Group, Czech Technical University in Prague |
|
5 |
||
6 |
Parts of the code written by Claus Gittinger are under following |
|
7 |
license: |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
17 |
||
18 |
Permission is hereby granted, free of charge, to any person |
|
19 |
obtaining a copy of this software and associated documentation |
|
20 |
files (the 'Software'), to deal in the Software without |
|
21 |
restriction, including without limitation the rights to use, |
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
23 |
copies of the Software, and to permit persons to whom the |
|
24 |
Software is furnished to do so, subject to the following |
|
25 |
conditions: |
|
26 |
||
27 |
The above copyright notice and this permission notice shall be |
|
28 |
included in all copies or substantial portions of the Software. |
|
29 |
||
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
37 |
OTHER DEALINGS IN THE SOFTWARE. |
|
38 |
||
39 |
[1] Code written at SWING Research Group contain a signature |
|
40 |
of one of the above copright owners. |
|
41 |
" |
|
752 | 42 |
"{ Package: 'stx:libjava' }" |
43 |
||
44 |
JavaClassContentRef2 subclass:#JavaFieldRef2 |
|
792 | 45 |
instanceVariableNames:'offset type' |
46 |
classVariableNames:'T_LONG T_DOUBLE' |
|
752 | 47 |
poolDictionaries:'' |
48 |
category:'Languages-Java-Reader-Support-new' |
|
49 |
! |
|
50 |
||
877 | 51 |
!JavaFieldRef2 class methodsFor:'documentation'! |
52 |
||
53 |
copyright |
|
54 |
" |
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
57 |
SWING Research Group, Czech Technical University in Prague |
|
58 |
||
59 |
Parts of the code written by Claus Gittinger are under following |
|
60 |
license: |
|
61 |
||
62 |
This software is furnished under a license and may be used |
|
63 |
only in accordance with the terms of that license and with the |
|
64 |
inclusion of the above copyright notice. This software may not |
|
65 |
be provided or otherwise made available to, or used by, any |
|
66 |
other person. No title to or ownership of the software is |
|
67 |
hereby transferred. |
|
68 |
||
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
70 |
||
71 |
Permission is hereby granted, free of charge, to any person |
|
72 |
obtaining a copy of this software and associated documentation |
|
73 |
files (the 'Software'), to deal in the Software without |
|
74 |
restriction, including without limitation the rights to use, |
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
76 |
copies of the Software, and to permit persons to whom the |
|
77 |
Software is furnished to do so, subject to the following |
|
78 |
conditions: |
|
79 |
||
80 |
The above copyright notice and this permission notice shall be |
|
81 |
included in all copies or substantial portions of the Software. |
|
82 |
||
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
90 |
OTHER DEALINGS IN THE SOFTWARE. |
|
91 |
||
92 |
[1] Code written at SWING Research Group contain a signature |
|
93 |
of one of the above copright owners. |
|
94 |
||
95 |
" |
|
96 |
! ! |
|
752 | 97 |
|
792 | 98 |
!JavaFieldRef2 class methodsFor:'initialization'! |
99 |
||
100 |
initialize |
|
101 |
T_LONG := 1. |
|
102 |
T_DOUBLE := 2. |
|
103 |
||
104 |
"Created: / 15-05-2011 / 22:31:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
105 |
! ! |
|
106 |
||
761 | 107 |
!JavaFieldRef2 methodsFor:'accessing'! |
108 |
||
109 |
isJavaFieldRef |
|
110 |
^true. |
|
111 |
||
112 |
"Created: / 11-04-2011 / 21:47:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
791 | 113 |
! |
114 |
||
115 |
offset |
|
116 |
^ offset. |
|
117 |
||
118 |
"Created: / 15-05-2011 / 22:26:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
792 | 119 |
! |
120 |
||
121 |
type |
|
122 |
type == T_LONG ifTrue: [ ^ #long. ]. |
|
123 |
type == T_DOUBLE ifTrue: [ ^ #double ]. |
|
124 |
^ type. |
|
125 |
||
126 |
"Created: / 15-05-2011 / 22:29:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
761 | 127 |
! ! |
128 |
||
758 | 129 |
!JavaFieldRef2 methodsFor:'private - resolving'! |
130 |
||
761 | 131 |
findResolvedStaticValue |
791 | 132 |
valueCache := JavaResolver uniqueInstance |
761 | 133 |
resolveStaticFieldIndentifiedByRef: self. |
819 | 134 |
"/Use javaClass of the field, not the class ref!! |
135 |
classCache := valueCache javaClass. |
|
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
136 |
classCache ifNil: [ self breakPoint: #mh ]. |
806 | 137 |
self resolveStaticOffset. |
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
138 |
nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve. |
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
139 |
self resolveType. |
806 | 140 |
nameAndTypeCache ifNil: [ self breakPoint: #mh ]. |
761 | 141 |
|
142 |
"Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
143 |
"Modified: / 18-05-2011 / 12:44:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
819 | 144 |
"Modified: / 24-05-2011 / 14:05:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 145 |
! |
146 |
||
758 | 147 |
findResolvedValue |
791 | 148 |
valueCache := JavaResolver uniqueInstance |
149 |
resolveFieldIndentifiedByRef: self. |
|
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
150 |
classCache := (constantPool at: classRefIndex) resolve. |
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
151 |
classCache ifNil: [ self breakPoint: #mh ]. |
806 | 152 |
self resolveOffset. |
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
153 |
nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve. |
793 | 154 |
self resolveType. |
806 | 155 |
nameAndTypeCache ifNil: [ self breakPoint: #mh ]. |
791 | 156 |
|
794
9635f32d1723
implemented deeper caching in new resolving refs to help keeping C-code lean and clean
hlopkmar
parents:
793
diff
changeset
|
157 |
"Modified: / 18-05-2011 / 12:44:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
792 | 158 |
! |
159 |
||
806 | 160 |
resolveOffset |
161 |
"fieldRef must be resolved before calling me" |
|
162 |
||
163 |
| currentClass | |
|
164 |
||
165 |
currentClass := classCache. |
|
166 |
||
807
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
167 |
[ offset := currentClass instVarOffsetOf: self name. |
806 | 168 |
offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ]. |
169 |
||
807
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
170 |
"Modified: / 20-05-2011 / 20:36:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
806 | 171 |
! |
172 |
||
173 |
resolveStaticOffset |
|
174 |
"fieldRef must be resolved before calling me" |
|
807
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
175 |
|
806 | 176 |
| currentClass | |
177 |
||
178 |
currentClass := classCache. |
|
807
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
179 |
|
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
180 |
[ offset := currentClass class instVarOffsetOf: self name. |
806 | 181 |
offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ]. |
182 |
||
807
b9dde0678965
I should not be committing anything when I'm in hurry.. swapped resolveOffset and resolveStaticOffset
hlopkmar
parents:
806
diff
changeset
|
183 |
"Modified: / 20-05-2011 / 20:36:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
806 | 184 |
! |
185 |
||
792 | 186 |
resolveType |
187 |
type := JavaMethod typeFromSignature:((constantPool at: nameAndTypeIndex) descriptor) in:nil. |
|
188 |
type == #long ifTrue:[ |
|
189 |
type := T_LONG. |
|
190 |
] ifFalse:[ |
|
191 |
type == #double ifTrue:[ |
|
192 |
type := T_DOUBLE |
|
193 |
] |
|
194 |
]. |
|
195 |
||
196 |
"Created: / 15-05-2011 / 22:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
758 | 197 |
! ! |
198 |
||
752 | 199 |
!JavaFieldRef2 class methodsFor:'documentation'! |
200 |
||
201 |
version_SVN |
|
202 |
^ '$Id$' |
|
203 |
! ! |
|
792 | 204 |
|
205 |
JavaFieldRef2 initialize! |