752
|
1 |
"
|
877
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
3 |
|
1155
|
4 |
New code and modifications done at SWING Research Group [1]:
|
1152
|
5 |
|
877
|
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
7 |
SWING Research Group, Czech Technical University in Prague
|
|
8 |
|
752
|
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.
|
877
|
15 |
|
1155
|
16 |
[1] Code written at SWING Research Group contains a signature
|
|
17 |
of one of the above copright owners. For exact set of such code,
|
|
18 |
see the differences between this version and version stx:libjava
|
1152
|
19 |
as of 1.9.2010
|
752
|
20 |
"
|
|
21 |
"{ Package: 'stx:libjava' }"
|
|
22 |
|
|
23 |
Object subclass:#JavaExceptionTableEntry
|
|
24 |
instanceVariableNames:'startPC endPC handlerPC catchType'
|
|
25 |
classVariableNames:''
|
|
26 |
poolDictionaries:''
|
|
27 |
category:'Languages-Java-Support'
|
|
28 |
!
|
|
29 |
|
|
30 |
!JavaExceptionTableEntry class methodsFor:'documentation'!
|
|
31 |
|
|
32 |
copyright
|
|
33 |
"
|
877
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
1152
|
35 |
|
1155
|
36 |
New code and modifications done at SWING Research Group [1]:
|
1152
|
37 |
|
877
|
38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
39 |
SWING Research Group, Czech Technical University in Prague
|
|
40 |
|
752
|
41 |
This software is furnished under a license and may be used
|
|
42 |
only in accordance with the terms of that license and with the
|
|
43 |
inclusion of the above copyright notice. This software may not
|
|
44 |
be provided or otherwise made available to, or used by, any
|
|
45 |
other person. No title to or ownership of the software is
|
|
46 |
hereby transferred.
|
877
|
47 |
|
1155
|
48 |
[1] Code written at SWING Research Group contains a signature
|
|
49 |
of one of the above copright owners. For exact set of such code,
|
|
50 |
see the differences between this version and version stx:libjava
|
1152
|
51 |
as of 1.9.2010
|
877
|
52 |
|
|
53 |
"
|
752
|
54 |
! !
|
|
55 |
|
|
56 |
!JavaExceptionTableEntry class methodsFor:'instance creation'!
|
|
57 |
|
|
58 |
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
59 |
^ self new startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
60 |
|
|
61 |
"Created: 16.4.1996 / 12:11:13 / cg"
|
|
62 |
! !
|
|
63 |
|
|
64 |
!JavaExceptionTableEntry methodsFor:'accessing'!
|
|
65 |
|
|
66 |
catchType
|
|
67 |
"return the value of the instance variable 'catchType' (automatically generated)"
|
|
68 |
|
|
69 |
^ catchType
|
|
70 |
|
|
71 |
"Created: 7.2.1997 / 21:01:23 / cg"
|
|
72 |
!
|
|
73 |
|
|
74 |
endPC
|
|
75 |
"return the value of the instance variable 'endPC' (automatically generated)"
|
|
76 |
|
|
77 |
^ endPC
|
|
78 |
|
|
79 |
"Created: 7.2.1997 / 20:53:23 / cg"
|
|
80 |
!
|
|
81 |
|
|
82 |
handlerPC
|
|
83 |
"return the value of the instance variable 'handlerPC' (automatically generated)"
|
|
84 |
|
|
85 |
^ handlerPC
|
|
86 |
|
|
87 |
"Created: 7.2.1997 / 20:06:31 / cg"
|
|
88 |
!
|
|
89 |
|
|
90 |
startPC
|
|
91 |
"return the value of the instance variable 'startPC' (automatically generated)"
|
|
92 |
|
|
93 |
^ startPC
|
|
94 |
|
|
95 |
"Created: 7.2.1997 / 20:53:20 / cg"
|
|
96 |
! !
|
|
97 |
|
|
98 |
!JavaExceptionTableEntry methodsFor:'printing & storing'!
|
|
99 |
|
|
100 |
displayString
|
|
101 |
^ super displayString , '(' , catchType displayString,
|
|
102 |
' in ' , startPC printString , '..' ,
|
|
103 |
endPC printString , '->' ,
|
|
104 |
handlerPC printString , ')'
|
|
105 |
|
|
106 |
"Modified: 15.8.1997 / 03:33:51 / cg"
|
|
107 |
!
|
|
108 |
|
|
109 |
printOn: aStream
|
|
110 |
super printOn: aStream.
|
|
111 |
aStream nextPut:$(.
|
|
112 |
catchType printOn: aStream.
|
|
113 |
aStream nextPutAll:' in ' , startPC printString , '..' ,
|
|
114 |
endPC printString , '->' ,
|
|
115 |
handlerPC printString , ')'
|
|
116 |
|
|
117 |
"Modified: / 15-08-1997 / 03:33:51 / cg"
|
|
118 |
"Created: / 25-02-2011 / 09:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
119 |
! !
|
|
120 |
|
|
121 |
!JavaExceptionTableEntry methodsFor:'private accessing'!
|
|
122 |
|
|
123 |
handlerPCFor:exception at:pc in:aMethod
|
|
124 |
"if there is a handler for exceptionClass, with given pc,
|
|
125 |
return the handler-PC; otherwise, return nil."
|
|
126 |
|
|
127 |
|cls|
|
|
128 |
"JV+MH@2011-02-25: You may wonder why there is endPC - 1:
|
|
129 |
The Java VM Spec, 3rd edition, sec 4.7.3, page 78:
|
|
130 |
|
|
131 |
The fact that end_pc is exclusive is a historical mistake in the design of the
|
|
132 |
Java virtual machine: if the Java virtual machine code for a method is exactly
|
|
133 |
65535 bytes long and ends with an instruction that is 1 byte long, then that
|
|
134 |
instruction cannot be protected by an exception handler. A compiler writer can
|
|
135 |
work around this bug by limiting the maximum size of the generated Java
|
|
136 |
virtual machine code for any method, instance initialization method, or static
|
|
137 |
initializer (the size of any code array) to 65534 bytes.
|
|
138 |
|
|
139 |
"
|
|
140 |
|
|
141 |
(pc between:startPC and:endPC - 1) ifTrue:[
|
|
142 |
(catchType == 0) ifTrue:[^ handlerPC].
|
|
143 |
(catchType isNil) ifTrue:[^ handlerPC].
|
|
144 |
cls := aMethod javaClass.
|
1692
|
145 |
exception notNil ifTrue:[
|
|
146 |
catchType := catchType javaClass.
|
824
|
147 |
|
1692
|
148 |
(catchType isKindOf:JavaClass) ifFalse:[
|
|
149 |
self halt.
|
|
150 |
^ nil
|
|
151 |
].
|
|
152 |
(exception isKindOf:catchType) ifTrue:[
|
|
153 |
^ handlerPC
|
|
154 |
].
|
752
|
155 |
^ nil
|
1692
|
156 |
]
|
752
|
157 |
].
|
|
158 |
^ nil
|
|
159 |
|
|
160 |
"Modified: / 07-01-1998 / 15:30:14 / cg"
|
1692
|
161 |
"Modified: / 03-09-2012 / 18:50:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
752
|
162 |
!
|
|
163 |
|
|
164 |
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
165 |
startPC := start_pc.
|
|
166 |
endPC := end_pc.
|
|
167 |
handlerPC := handler_pc.
|
|
168 |
catchType := catch_type
|
|
169 |
|
|
170 |
"Created: 16.4.1996 / 12:11:45 / cg"
|
|
171 |
! !
|
|
172 |
|
|
173 |
!JavaExceptionTableEntry class methodsFor:'documentation'!
|
|
174 |
|
|
175 |
version
|
1022
|
176 |
^ '$Id$'
|
752
|
177 |
!
|
|
178 |
|
|
179 |
version_SVN
|
1022
|
180 |
^ '$Id$'
|
1152
|
181 |
! !
|