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