JavaContext.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 16 Jan 2013 22:06:41 +0000
branchrefactoring-vmdata
changeset 1977 526315e0a801
parent 1914 6d0f663767ee
child 2069 75d40b7b986f
permissions -rw-r--r--
Fixed JavaNativeMethodImpl_OpenJDK6 class>>invoke:receiver:arguments:context:constructor:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
     1
"
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
     3
1155
vranyj1
parents: 1152
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
     5
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     8
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    14
 hereby transferred.
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    15
1155
vranyj1
parents: 1152
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
vranyj1
parents: 1152
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
vranyj1
parents: 1152
diff changeset
    18
     see the differences between this version and version stx:libjava
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
    19
     as of 1.9.2010
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    20
"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    22
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    23
Context variableSubclass:#JavaContext
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
    24
	instanceVariableNames:'exArg exPC byteCode constPool acqrMonitors'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    25
	classVariableNames:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    26
	poolDictionaries:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    27
	category:'Languages-Java-Support'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    28
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    29
1455
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    30
Object subclass:#FinallyToken
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    31
	instanceVariableNames:'context exception selector value'
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    32
	classVariableNames:''
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    33
	poolDictionaries:''
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    34
	privateIn:JavaContext
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    35
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
    36
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    37
!JavaContext class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    38
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    39
copyright
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    40
"
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    41
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
    42
1155
vranyj1
parents: 1152
diff changeset
    43
 New code and modifications done at SWING Research Group [1]:
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
    44
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    45
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    46
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    47
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    48
 This software is furnished under a license and may be used
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    49
 only in accordance with the terms of that license and with the
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    50
 inclusion of the above copyright notice.   This software may not
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    51
 be provided or otherwise made available to, or used by, any
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    52
 other person.  No title to or ownership of the software is
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    53
 hereby transferred.
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    54
1155
vranyj1
parents: 1152
diff changeset
    55
 [1] Code written at SWING Research Group contains a signature
vranyj1
parents: 1152
diff changeset
    56
     of one of the above copright owners. For exact set of such code,
vranyj1
parents: 1152
diff changeset
    57
     see the differences between this version and version stx:libjava
1152
040cba55a7d2 Copyright fixes
vranyj1
parents: 1122
diff changeset
    58
     as of 1.9.2010
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    59
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    60
"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    61
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    62
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    63
!JavaContext methodsFor:'* As yet uncategorized *'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    64
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    65
markForException
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    66
    "set the exception handler flag in the receiver.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    67
     The JVM needs this to enter an exception handler instead of restarting
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    68
     from the beginning (when the context is restarted).
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    69
     - a highly internal mechanism and not for public use."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    70
"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    71
%{  /* NOCONTEXT */
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    72
#ifdef __JAVA_EX_PEND
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    73
     /* actually no longer - only a non-nil exPC is now used as marker */
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    74
     __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND));
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    75
#endif
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    76
%}
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    77
"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    78
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    79
    "Modified: / 13-12-1995 / 19:05:22 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    80
    "Modified: / 25-10-2010 / 17:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1461
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    81
!
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    82
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    83
shouldExecuteFinallyOnUnwind
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    84
    "Return true, if a finally block should be executed
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    85
     upon force unwind"
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    86
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    87
    | m pc |
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    88
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    89
    m := self method.
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    90
    pc := self pc.
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    91
    self assert: m notNil.
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    92
    m hasFinally ifFalse:[ ^ false ].
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    93
    ^(method handlerFor: nil at: pc) notNil.
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    94
34a9c99d0295 - test cleanup
vranyj1
parents: 1459
diff changeset
    95
    "Created: / 10-04-2012 / 11:09:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    96
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    97
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    98
!JavaContext methodsFor:'ST context mimicri'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    99
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   100
arg1Index
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   101
    "the java stack contains the receiver in a non-static
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   102
     method, as slot 0. Therefore, the first arg is found at slot2
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   103
     if this is for a non-static method"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   104
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   105
    self method isStatic ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   106
	^ 1
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   107
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   108
    ^ 2
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   109
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   110
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   111
argAt:n
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   112
    "return the i'th argument (1..nArgs)"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   113
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   114
    ^ self at:(self arg1Index - 1 + n)
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   115
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   116
    "Created: / 2.1.1998 / 17:54:13 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   117
    "Modified: / 2.1.1998 / 21:39:30 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   118
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   119
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   120
argAt:n put:value
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   121
    "change the i'th argument (1..nArgs)"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   122
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   123
    ^ super argAt:(self arg1Index - 1 + n) put:value
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   124
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   125
    "Created: / 2.1.1998 / 17:54:34 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   126
    "Modified: / 2.1.1998 / 21:35:19 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   127
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   128
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   129
args
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   130
    "return an array filled with the arguments of this context"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   131
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   132
    |n|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   133
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   134
    n := self numArgs.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   135
    n == 0 ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   136
	"/ little optimization here - avoid creating empty containers
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   137
	^ #()
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   138
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   139
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   140
    ^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index).
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   141
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   142
    "Created: / 2.1.1998 / 17:54:57 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   143
    "Modified: / 2.1.1998 / 21:34:44 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   144
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   145
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   146
argsAndVars
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   147
    "return an array filled with the arguments and variables of this context"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   148
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   149
    |n|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   150
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   151
    n := self numArgs + self numVars.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   152
    n == 0 ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   153
	"/ little optimization here - avoid creating empty containers
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   154
	^ #()
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   155
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   156
    ^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index).
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   157
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   158
    "Created: / 2.1.1998 / 17:55:14 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   159
    "Modified: / 13.1.1998 / 15:44:56 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   160
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   161
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   162
lineNumber
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   163
    |nr pc|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   164
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   165
    pc := self pc.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   166
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   167
"/ 'ask line for pc:' print. pc printCR.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   168
    pc isNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   169
	nr := self lineNumberFromMethod.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   170
	nr notNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   171
	    ^ nr
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   172
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   173
	" '-> 0 [a]' printCR. "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   174
	^0
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   175
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   176
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   177
    nr := self method lineNumberForPC:pc.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   178
    nr isNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   179
	nr := self lineNumberFromMethod.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   180
	nr notNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   181
	    ^ nr
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   182
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   183
	" '-> 0 [b]' printCR. "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   184
	^ 0
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   185
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   186
"/ '-> ' print. nr printCR.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   187
     ^ nr.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   188
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   189
    "Created: / 1.5.1996 / 15:05:47 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   190
    "Modified: / 15.1.1998 / 15:25:29 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   191
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   192
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   193
lineNumberFromMethod
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   194
    |m|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   195
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   196
    m := self method.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   197
    m notNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   198
	^ m lineNumber
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   199
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   200
    ^ nil
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   201
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   202
    "Created: / 4.1.1998 / 23:34:45 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   203
    "Modified: / 4.1.1998 / 23:35:55 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   204
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   205
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   206
method
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   207
    "the method may be found in the interpreter temps ..."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   208
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   209
    method isJavaMethod ifTrue:[^ method].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   210
    ^ super method
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   211
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   212
    "Created: / 1.5.1996 / 15:03:43 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   213
    "Modified: / 25.9.1999 / 23:26:40 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   214
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   215
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   216
numArgs
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   217
    "return the number of args.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   218
     Redefined since Java keeps the receiver of a non-static method
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   219
     at local slot 1."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   220
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   221
    |n|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   222
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   223
    n := super numArgs.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   224
    self method isStatic ifFalse:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   225
	n := n - 1
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   226
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   227
    ^ n
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   228
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   229
    "Created: / 2.1.1998 / 22:21:24 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   230
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   231
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   232
numTemps
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   233
    "return the number of temporary variables of the Method.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   234
     Redefined since Java keeps the receiver of a non-static method
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   235
     at local slot 1."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   236
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   237
    |n|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   238
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   239
    n := self size - super numVars - super numArgs.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   240
    ^ n
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   241
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   242
    "Created: / 13.1.1998 / 16:52:32 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   243
    "Modified: / 13.1.1998 / 17:23:27 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   244
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   245
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   246
pc
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   247
    lineNr isNil ifTrue:[^ nil].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   248
    ^ lineNr bitAnd:16rFFFF
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   249
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   250
    "Created: / 4.1.1998 / 23:33:48 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   251
    "Modified: / 10.11.1998 / 13:20:12 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   252
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   253
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   254
quickLineNumber
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   255
    "the lineNumber - without decompiling"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   256
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   257
    ^ self method quickLineNumberForPC:self pc
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   258
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   259
    "Created: / 10.11.1998 / 14:20:30 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   260
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   261
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   262
selector
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   263
    "the selector can be extracted from the method.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   264
     the method may be found in the interpreter temps ..."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   265
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   266
    |s m|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   267
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   268
    selector isNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   269
	m := self method.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   270
	m notNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   271
	    ^ m name
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   272
	]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   273
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   274
    ^ super selector
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   275
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   276
    "Modified: / 30.12.1997 / 17:22:06 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   277
    "Created: / 30.12.1997 / 17:23:47 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   278
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   279
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   280
setPC:newPC
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   281
    lineNr := newPC
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   282
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   283
    "Created: / 5.1.1998 / 00:09:02 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   284
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   285
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   286
temporaries
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   287
    "return an array filled with the arguments and variables of this context"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   288
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   289
    |n nSkipped|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   290
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   291
    "/ the flas-numVars includes the receiver and args
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   292
    nSkipped := super numVars "self numArgs + self numVars".
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   293
    "/ but my context setup is args+numvars.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   294
    nSkipped := super numArgs + super numVars.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   295
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   296
    n := self size - nSkipped.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   297
    n == 0 ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   298
	"/ little optimization here - avaoid creating empty containers
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   299
	^ #()
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   300
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   301
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   302
    ^ (Array new:n) replaceFrom:1 to:n with:self startingAt:nSkipped+1.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   303
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   304
    "Created: / 13.1.1998 / 15:44:12 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   305
    "Modified: / 13.1.1998 / 17:22:54 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   306
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   307
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   308
vars
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   309
    "return an array filled with the local variables of this context"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   310
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   311
    |nonVars mySize|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   312
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   313
    mySize := self numVars.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   314
    mySize == 0 ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   315
	"/ little optimization here - avaoid creating empty containers
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   316
	^ #()
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   317
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   318
    nonVars := (self arg1Index-1) + self numArgs.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   319
    ^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonVars+1
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   320
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   321
    "Created: / 13.1.1998 / 16:48:16 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   322
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   323
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   324
!JavaContext methodsFor:'accessing'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   325
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   326
acquiredMonitors
1691
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   327
    ^acqrMonitors
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   328
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   329
    "Created: / 08-11-2011 / 12:23:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1691
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   330
    "Modified (format): / 27-08-2012 / 16:46:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   331
!
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   332
1096
c543f127c67a fixed some stupid mistakes, but still not working
hlopkmar
parents: 1095
diff changeset
   333
acquiredMonitorsDo: aBlock 
1691
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   334
"/    acqrMonitors isNil ifTrue: [ ^self ].
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   335
"/    acqrMonitors copy reverseDo: aBlock.
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   336
    aBlock value: self receiver.
1094
68b154263d74 fixes in monitors, still not working
hlopkmar
parents: 1093
diff changeset
   337
68b154263d74 fixes in monitors, still not working
hlopkmar
parents: 1093
diff changeset
   338
    "Created: / 08-11-2011 / 15:03:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1691
826f8d7dc0df thinlocks reintegrated
vranyj1
parents: 1476
diff changeset
   339
    "Modified: / 26-08-2012 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1094
68b154263d74 fixes in monitors, still not working
hlopkmar
parents: 1093
diff changeset
   340
!
68b154263d74 fixes in monitors, still not working
hlopkmar
parents: 1093
diff changeset
   341
1095
6d0bfccd9ae7 tiny logging of monitors
hlopkmar
parents: 1094
diff changeset
   342
addMonitor: mon 
1100
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   343
    self assert: (acqrMonitors isNil or: [ acqrMonitors isOrderedCollection ]).
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   344
    acqrMonitors ifNil: [ acqrMonitors := Stack new ].
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   345
    acqrMonitors push: mon.
1122
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   346
    self markForUnwind.
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   347
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   348
    "Created: / 08-11-2011 / 14:19:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1098
vranyj1
parents: 1097
diff changeset
   349
    "Modified: / 08-11-2011 / 21:40:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1122
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   350
    "Modified: / 17-11-2011 / 19:13:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   351
!
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   352
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   353
programmingLanguage
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   354
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   355
    ^JavaLanguage instance
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   356
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   357
    "Created: / 17-03-2011 / 10:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   358
!
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   359
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   360
removeMonitor: mon 
1122
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   361
    | poppedObject |
1095
6d0bfccd9ae7 tiny logging of monitors
hlopkmar
parents: 1094
diff changeset
   362
    acqrMonitors isNil ifTrue: [
1100
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   363
        Logger 
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   364
            log: ('removeMonitor: called but no monitors in acqrMonitors (%1)' 
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   365
                    bindWith: self)
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   366
            severity: #warn
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   367
            facility: #JVM.
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   368
        self breakPoint: #mh.
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   369
        ^ self.
1094
68b154263d74 fixes in monitors, still not working
hlopkmar
parents: 1093
diff changeset
   370
    ].
1100
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   371
    poppedObject := acqrMonitors top.
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   372
    self assert: (poppedObject == mon).
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   373
    acqrMonitors remove: mon
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   374
        ifAbsent: [
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   375
            Logger 
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   376
                log: ('removeMonitor: called but no such monitor in acqrMonitors (%1)' 
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   377
                        bindWith: self)
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   378
                severity: #warn
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   379
                facility: #JVM.
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   380
            self breakPoint: #mh.
1405b1485a66 fixes and guards for monitors
hlopkmar
parents: 1098
diff changeset
   381
            ^ self.
1122
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   382
        ].
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   383
        acqrMonitors isEmpty ifTrue: [self unmarkForUnwind].
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   384
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   385
    "Created: / 08-11-2011 / 14:19:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1098
vranyj1
parents: 1097
diff changeset
   386
    "Modified: / 08-11-2011 / 21:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1122
2f8e947cfda2 in-the-middle-of-work commit
hlopkmar
parents: 1102
diff changeset
   387
    "Modified: / 17-11-2011 / 19:14:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   388
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   389
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   390
!JavaContext methodsFor:'exception handler support'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   391
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   392
exceptionArg:aJavaException
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   393
    exArg := aJavaException.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   394
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   395
    "Created: / 7.1.1998 / 21:36:56 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   396
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   397
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   398
exceptionArg:aJavaException pc:newPc
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   399
    exArg := aJavaException.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   400
    exPC := newPc.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   401
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   402
    "Created: / 7.1.1998 / 21:36:56 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   403
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   404
1098
vranyj1
parents: 1097
diff changeset
   405
!JavaContext methodsFor:'non local control flow'!
vranyj1
parents: 1097
diff changeset
   406
vranyj1
parents: 1097
diff changeset
   407
unwindAndRestartForJavaException
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   408
1098
vranyj1
parents: 1097
diff changeset
   409
    "Called by JavaVM>>throwException: unwinds the stack
vranyj1
parents: 1097
diff changeset
   410
     up to this context and restarts it so an exception handler
vranyj1
parents: 1097
diff changeset
   411
     executes"
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   412
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   413
    | con wasMarked |
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   414
1098
vranyj1
parents: 1097
diff changeset
   415
    "Each context that has a monitor acquired has
vranyj1
parents: 1097
diff changeset
   416
     and unwind action that release all monitors acquired.
vranyj1
parents: 1097
diff changeset
   417
     However, we DONT want my monitors to be released,
vranyj1
parents: 1097
diff changeset
   418
     so we temporarily unmark this context for unwind and
vranyj1
parents: 1097
diff changeset
   419
     then mark it again, eventually"
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   420
1098
vranyj1
parents: 1097
diff changeset
   421
    wasMarked := self isUnwindContext.
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   422
    wasMarked ifTrue:[self unmarkForUnwind].    
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   423
    self senderIsNil ifFalse:[
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   424
        con := thisContext evaluateUnwindActionsUpTo:self.
1098
vranyj1
parents: 1097
diff changeset
   425
    ].
1476
1f960ed67758 Fixes for monitors
vranyj1
parents: 1461
diff changeset
   426
    wasMarked ifTrue:[self markForUnwind].
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   427
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   428
    "oops, if nil, I am not on the calling chain;
1098
vranyj1
parents: 1097
diff changeset
   429
     (bad bad, unwind action have already been performed.
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   430
      should we check for this situation first and NOT evaluate
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   431
      the unwind actions in this case ?)
1098
vranyj1
parents: 1097
diff changeset
   432
    "
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   433
    con isNil ifTrue:[
1098
vranyj1
parents: 1097
diff changeset
   434
        "
vranyj1
parents: 1097
diff changeset
   435
         tried to return to a context which is already dead
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   436
         (i.e. the method/block has already executed a return)
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   437
        "
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   438
        ^ self invalidReturnOrRestartError:#'unwindAndRestart:' with:nil
1098
vranyj1
parents: 1097
diff changeset
   439
    ].
1102
df54d5b34c6b i broke something important in last commit - quickly reverting back :)
hlopkmar
parents: 1101
diff changeset
   440
    "
1098
vranyj1
parents: 1097
diff changeset
   441
     now, that all unwind-actions are done, I can use the
vranyj1
parents: 1097
diff changeset
   442
     low-level restart ...
vranyj1
parents: 1097
diff changeset
   443
    "
vranyj1
parents: 1097
diff changeset
   444
    ^ self restart
vranyj1
parents: 1097
diff changeset
   445
vranyj1
parents: 1097
diff changeset
   446
    "Created: / 08-11-2011 / 22:00:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
vranyj1
parents: 1097
diff changeset
   447
! !
vranyj1
parents: 1097
diff changeset
   448
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   449
!JavaContext methodsFor:'printing & storing'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   450
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   451
receiverPrintString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   452
    "return a string describing the receiver of the context"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   453
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   454
    |receiverClass receiverClassName newString implementorClass searchClass|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   455
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   456
"/ %{
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   457
"/     /*
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   458
"/      * special handling for (invalid) free objects.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   459
"/      * these only appear if some primitiveCode does not correctly use SEND macros,
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   460
"/      * which may lead to sends to free objects. In normal operation, this 'cannot' happen.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   461
"/      */
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   462
"/     if (__isNonNilObject(__INST(receiver)) && (__qClass(__INST(receiver))==nil)) {
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   463
"/         receiverClassName = __MKSTRING("FreeObject");
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   464
"/     }
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   465
"/ %}.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   466
"/    receiverClassName notNil ifTrue:[^ receiverClassName].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   467
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   468
    receiverClass := receiver class.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   469
    "/ java has no class-methods ...
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   470
    receiverClass := receiverClass theNonMetaclass.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   471
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   472
    receiverClassName := receiverClass nameInBrowser.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   473
    (receiverClass == SmallInteger) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   474
	newString := '(' , receiver printString , ') ' , receiverClassName
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   475
    ] ifFalse:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   476
	newString := receiverClassName
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   477
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   478
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   479
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   480
     kludge to avoid slow search for containing class
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   481
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   482
    (selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   483
	implementorClass := self methodClass.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   484
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   485
    implementorClass notNil ifTrue: [
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   486
	(implementorClass ~~ receiverClass) ifTrue: [
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   487
	    newString := newString , '>>>',
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   488
			 implementorClass nameInBrowser printString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   489
	]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   490
    ] ifFalse:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   491
	searchClass := self searchClass.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   492
	searchClass ~~ receiverClass ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   493
	    newString := newString , '>>>' , searchClass nameInBrowser
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   494
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   495
"/        "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   496
"/         kludge for doIt - these unbound methods are not
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   497
"/         found in the classes methodDictionary
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   498
"/        "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   499
"/        (selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   500
"/            newString := newString , '>>>**NONE**'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   501
"/        ]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   502
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   503
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   504
    ^ newString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   505
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   506
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   507
!JavaContext methodsFor:'queries'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   508
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   509
hasStackToShow
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   510
    "private interface to the debugger.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   511
     Smalltalk contexts return false here - other language frames
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   512
     (i.e. Java frames) may want to show the evaluation stack"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   513
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   514
    ^ true
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   515
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   516
    "Modified: / 13.5.1997 / 16:31:12 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   517
    "Created: / 7.5.1998 / 01:23:57 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   518
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   519
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   520
isJavaContext
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   521
    "return true, if this is a javaContext."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   522
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   523
    ^ true
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   524
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   525
    "Created: / 8.5.1998 / 21:23:47 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   526
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   527
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   528
stackFrame
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   529
    "private interface to the debugger."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   530
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   531
    ^ (1 to:self size) collect:[:i | self at:i]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   532
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   533
    "Created: / 7.5.1998 / 01:26:19 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   534
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   535
1455
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   536
!JavaContext::FinallyToken methodsFor:'accessing'!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   537
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   538
context
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   539
    ^ context
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   540
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   541
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   542
context:something
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   543
    context := something.
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   544
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   545
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   546
exception
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   547
    ^ exception
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   548
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   549
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   550
exception:something
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   551
    exception := something.
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   552
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   553
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   554
selector
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   555
    ^ selector
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   556
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   557
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   558
selector:something
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   559
    selector := something.
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   560
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   561
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   562
value
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   563
    ^ value
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   564
!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   565
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   566
value:something
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   567
    value := something.
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   568
! !
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   569
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   570
!JavaContext::FinallyToken methodsFor:'actions'!
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   571
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   572
pass
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   573
1459
9e24f4337d78 Tests for finally
vranyj1
parents: 1455
diff changeset
   574
    "First, release all leftover acquired monitors"
9e24f4337d78 Tests for finally
vranyj1
parents: 1455
diff changeset
   575
    JavaVM releaseMonitorsOfUnwindingContext: context.
9e24f4337d78 Tests for finally
vranyj1
parents: 1455
diff changeset
   576
1455
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   577
    selector == #return ifTrue:[
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   578
        exception return
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   579
    ].
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   580
    selector == #return: ifTrue:[
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   581
        exception return: value
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   582
    ].
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   583
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   584
    self error:'Should never be reached'.
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   585
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   586
    "Created: / 04-04-2012 / 20:24:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   587
! !
0bd5fedc1d2c Temporary commit - some more finally support
vranyj1
parents: 1452
diff changeset
   588
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   589
!JavaContext class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   590
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   591
version
1864
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   592
    ^ '$Header$'
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   593
!
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   594
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   595
version_HG
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   596
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   597
    ^ '$Changeset: <not expanded> $'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   598
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   599
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   600
version_SVN
1864
60a8dc26c8c6 Updated from HG
vranyj1
parents: 1818
diff changeset
   601
    ^ '§Id§'
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   602
! !