JavaByteCodeInterpreter.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Nov 2011 12:54:59 +0100
changeset 2305 c11e70f81f74
parent 2303 f02352bc0228
permissions -rw-r--r--
fixed: #version_SVN ($ to §)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     1
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     5
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     7
 license:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     8
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    14
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    15
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    17
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    19
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    20
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    21
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    23
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    24
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    25
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    26
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    27
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    28
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    29
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    38
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    40
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    41
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    43
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    44
JavaByteCodeProcessor subclass:#JavaByteCodeInterpreter
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    45
	instanceVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    46
	classVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    47
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    48
	category:'Languages-Java-Bytecode'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    49
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    50
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    51
!JavaByteCodeInterpreter class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    52
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    53
copyright
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    54
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    55
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    56
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
 license:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    83
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    88
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    89
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    90
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    91
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    92
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    93
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    94
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    95
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    96
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    98
documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    99
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
    Base class for intepreting Java bytecode.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
    This class is based on NewCompiler::JavaByteCodeInterpreter
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   102
    written originally by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   103
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
    [author:]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   106
        Jan Vrany (jan.vrany@fit.cvut.cz)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   107
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   108
    [instance variables:]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   109
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   110
    [class variables:]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
    [see also:]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   113
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   114
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   115
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   116
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
!JavaByteCodeInterpreter class methodsFor:'interpretation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
interpret:aMethod receiver:aReceiver arguments:argArray
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   120
    ^ self new interpret:aMethod receiver:aReceiver arguments:argArray
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   121
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   122
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   123
!JavaByteCodeInterpreter methodsFor:'instructions'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   124
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   125
aaload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   126
    "loads onto the stack a reference from an array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
     stack: arrayref, index -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   128
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   129
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   130
    | arrayref  index |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   131
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   132
    index := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   133
    arrayref := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   134
    arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   135
    ^ self pushRef: (arrayref at: index + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   136
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   137
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   138
     The arrayref must be of type reference and must refer to an array whose
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   139
     components are of type reference. The index must be of type int. Both arrayref
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   140
     and index are popped from the operand stack. The reference value in the component
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
     of the array at index is retrieved and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   143
     If arrayref is null, aaload throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   144
     Otherwise, if index is not within the bounds of the array referenced by arrayref,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   145
     the aaload instruction throws an ArrayIndexOutOfBoundsException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   146
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   147
    "Modified: / 16-03-2011 / 15:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   148
    "Modified: / 21-03-2011 / 17:20:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   149
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   150
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   151
aastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   152
    "stores into a reference in an array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   153
     stack: arrayref, index, value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   154
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
    | arrayref  index  value |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
    value := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   158
    index := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   159
    arrayref := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   160
    arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   161
    arrayref at: index + 1 put: value.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   162
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   163
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
     The arrayref must be of type reference and must refer to an array whose components are of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   165
     type reference. The index must be of type int and value must be of type reference. The arrayref,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
     index, and value are popped from the operand stack. The reference value is stored as the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
     component of the array at index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
     The type of value must be assignment compatible (§2.6.7) with the type of the components
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
     of the array referenced by arrayref. Assignment of a value of reference type S (source)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
     to a variable of reference type T (target) is allowed only when the type S supports all
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   172
     the operations defined on type T. The detailed rules follow:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   173
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   174
     If S is a class type, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
     If T is a class type, then S must be the same class (§2.8.1) as T, or S must be a subclass of T;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   176
     If T is an interface type, S must implement (§2.13) interface T.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
     If S is an interface type, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
     If T is a class type, then T must be Object (§2.4.7).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
     If T is an interface type, then T must be the same interface as S or a superinterface of S (§2.13.2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   180
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   181
     If S is an array type, namely, the type SC[], that is, an array of components of type SC, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   182
     If T is a class type, then T must be Object (§2.4.7).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   183
     If T is an array type TC[], that is, an array of components of type TC, then one of the following must be true:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   184
     TC and SC are the same primitive type (§2.4.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
     TC and SC are reference types (§2.4.6), and type SC is assignable to TC by these runtime rules.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
     If T is an interface type, T must be one of the interfaces implemented by arrays (§2.15).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   187
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
     If arrayref is null, aastore throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
     Otherwise, if index is not within the bounds of the array referenced by arrayref,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
     the aastore instruction throws an ArrayIndexOutOfBoundsException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
     Otherwise, if arrayref is not null and the actual type of value is not assignment
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   193
     compatible (§2.6.7) with the actual type of the components of the array, aastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
     throws an ArrayStoreException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
    "Modified: / 22-03-2011 / 12:27:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   198
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   199
aconst_null
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   200
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   201
     Push null
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   202
     stack: nothing -> null
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   203
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   204
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   205
    self pushConstant: nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   206
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   208
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
Push the null object reference onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   211
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   212
The Java virtual machine does not mandate a concrete
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   213
value for null."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   214
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   215
    "Created: / 24-02-2011 / 22:40:50 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   216
    "Modified: / 24-02-2011 / 22:07:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   217
    "Modified: / 14-03-2011 / 20:55:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   218
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   219
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   220
aload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   221
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   222
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   223
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   224
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   225
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   226
aload: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   227
    "Load reference from local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   228
     nothing -> objectRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   229
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   230
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   231
    self pushRef: (context at: idx + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   232
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   233
    "Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   234
     The index is an unsigned byte that must be an index into the local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   235
     variable array of the current frame (§3.6). The local variable at
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   236
     index must contain a reference. The objectref in the local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   237
     at index is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   238
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   239
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   240
     The aload instruction cannot be used to load a value of type returnAddress
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   241
     from a local variable onto the operand stack. This asymmetry with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   242
     astore instruction is intentional.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   243
     The aload opcode can be used in conjunction with the wide instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   244
     to access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   245
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   246
    "Modified: / 13-03-2011 / 20:59:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   247
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   248
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   249
anewarray
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   250
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   251
       Create new array of reference
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   252
       stack: count -> arrayRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   253
       args: arrayType"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   254
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   255
    | type  size |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   256
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   257
    type := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   258
    size := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   259
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   260
    self pushNewArrayOf: type sized: size.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   261
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   262
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   263
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   264
     The count must be of type int. It is popped off the operand stack. The count
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   265
     represents the number of components of the array to be created. The unsigned
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   266
     indexbyte1 and indexbyte2 are used to construct an index into the runtime
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   267
     constant pool of the current class (§3.6), where the value of the index is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   268
     (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   269
     must be a symbolic reference to a class, array, or interface type. The named
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   270
     class, array, or interface type is resolved (§5.4.3.1). A new array with components
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   271
     of that type, of length count, is allocated from the garbage-collected heap,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   272
     and a reference arrayref to this new array object is pushed onto the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   273
     stack. All components of the new array are initialized to null, the default
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   274
     value for reference types (§2.5.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   275
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   276
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   277
     During resolution of the symbolic reference to the class, array, or interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   278
     type, any of the exceptions documented in §5.4.3.1 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   279
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   280
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   281
     Otherwise, if count is less than zero, the anewarray instruction throws a
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   282
     NegativeArraySizeException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   283
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   284
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   285
     The anewarray instruction is used to create a single dimension of an array of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   286
     object references or part of a multidimensional array."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   287
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   288
    "Created: / 14-03-2011 / 18:24:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   289
    "Modified: / 27-03-2011 / 21:12:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   290
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   291
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   292
areturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   293
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   294
     Return reference from method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   295
     stack: objectRef -> empty
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   296
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   297
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   298
    self leaveProcessorWith: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   299
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   300
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   301
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   302
     The objectref must be of type reference and must refer to an object of a type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   303
     that is assignment compatible (§2.6.7) with the type represented by the return
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   304
     descriptor (§4.3.3) of the current method. If the current method is a synchronized
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   305
     method, the monitor acquired or reentered on invocation of the method is released
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   306
     or exited (respectively) as if by execution of a monitorexit instruction. If no
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   307
     exception is thrown, objectref is popped from the operand stack of the current
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   308
     frame (§3.6) and pushed onto the operand stack of the frame of the invoker. Any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   309
     other values on the operand stack of the current method are discarded.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   310
     The interpreter then reinstates the frame of the invoker and returns control to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   311
     the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   312
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   313
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   314
     If the current method is a synchronized method and the current thread is not the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   315
     owner of the monitor acquired or reentered on invocation of the method, areturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   316
     throws an IllegalMonitorStateException. This can happen, for example, if a synchronized
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   317
     method contains a monitorexit instruction, but no monitorenter instruction, on the object
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   318
     on which the method is synchronized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   319
     Otherwise, if the virtual machine implementation enforces the rules on structured use
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   320
     of locks described in §8.13 and if the first of those rules is violated during invocation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   321
     of the current method, then areturn throws an IllegalMonitorStateException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   322
    "Created: / 14-03-2011 / 13:45:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   323
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   324
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   325
arraylength
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   326
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   327
     Get length of array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   328
     stack: arrayRef -> length
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   329
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   330
    self pushInt: self pop size.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   331
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   332
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   333
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   334
     The arrayref must be of type reference and must refer to an array. It is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   335
     popped from the operand stack. The length of the array it references is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   336
     determined. That length is pushed onto the operand stack as an int.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   337
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   338
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   339
     If the arrayref is null, the arraylength instruction throws a NullPointerException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   340
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   341
    "Created: / 14-03-2011 / 18:41:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   342
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   343
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   344
astore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   345
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   346
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   347
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   348
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   349
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   350
astore: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   351
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   352
     stores a reference into a local variable #index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   353
     stack: objectref -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   354
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   355
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   356
    context at: idx + 1 put: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   357
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   358
    "Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   359
     The index is an unsigned byte that must be an index into the local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   360
     variable array of the current frame (§3.6). The objectref on the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   361
     top of the operand stack must be of type returnAddress or of type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   362
     reference. It is popped from the operand stack, and the value of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   363
     the local variable at index is set to objectref.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   364
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   365
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   366
     The astore instruction is used with an objectref of type returnAddress
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   367
     when implementing the finally clauses of the Java programming language
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   368
     (see Section 7.13, Compiling finally). The aload instruction cannot be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   369
     used to load a value of type returnAddress from a local variable onto
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   370
     he operand stack. This asymmetry with the astore instruction is intentional.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   371
     The astore opcode can be used in conjunction with the wide instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   372
     to access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   373
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   374
    "Modified: / 13-03-2011 / 16:57:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   375
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   376
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   377
athrow
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   378
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   379
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   380
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   381
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   382
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   383
baload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   384
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   385
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   386
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   387
bastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   388
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   389
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   390
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   391
bipush
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   392
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   393
     pushes a byte onto the stack as an integer value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   394
     stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   395
     args: byte"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   396
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   397
    self pushInt: (self fetchByte).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   398
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   399
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   400
     The immediate byte is sign-extended to an int value. That value is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   401
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   402
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   403
    "Modified: / 13-03-2011 / 16:58:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   404
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   405
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   406
breakpoint
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   407
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   408
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   409
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   410
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   411
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   412
caload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   413
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   414
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   415
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   416
castore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   417
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   418
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   419
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   420
checkcast
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   421
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   422
     Check whether object is of given type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   423
     stack: objref -> objRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   424
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   425
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   426
    | ref  objRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   427
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   428
    ref := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   429
    ref isUnresolved 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   430
        ifTrue: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   431
            [ ref := ref javaClass 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   432
                 ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   433
    objRef := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   434
    (objRef isNil or: [ (JavaVM canCast: objRef class to: ref) ]) 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   435
        ifTrue: [ self pushRef: objRef. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   436
        ifFalse: [ JavaVM throwClassCastException ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   437
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   438
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   439
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   440
     The objectref must be of type reference. The unsigned indexbyte1 and indexbyte2 are used to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   441
     construct an index into the runtime constant pool of the current class (§3.6), where the value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   442
     of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at the index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   443
     must be a symbolic reference to a class, array, or interface type. The named class, array,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   444
     or interface type is resolved (§5.4.3.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   445
     If objectref is null or can be cast to the resolved class, array, or interface type, the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   446
     operand stack is unchanged; otherwise, the checkcast instruction throws a ClassCastException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   447
     The following rules are used to determine whether an objectref that is not null can be cast
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   448
     to the resolved type: if S is the class of the object referred to by objectref and T is the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   449
     resolved class, array, or interface type, checkcast determines whether objectref can be cast
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   450
     to type T as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   451
     If S is an ordinary (nonarray) class, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   452
     If T is a class type, then S must be the same class (§2.8.1) as T, or a subclass of T.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   453
     If T is an interface type, then S must implement (§2.13) interface T.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   454
     If S is an interface type, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   455
     If T is a class type, then T must be Object (§2.4.7).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   456
     If T is an interface type, then T must be the same interface as S or a superinterface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   457
     of S (§2.13.2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   458
     If S is a class representing the array type SC[], that is, an array of components of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   459
     type SC, then:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   460
     If T is a class type, then T must be Object (§2.4.7).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   461
     If T is an array type TC[], that is, an array of components of type TC, then one of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   462
     following must be true:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   463
     TC and SC are the same primitive type (§2.4.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   464
     TC and SC are reference types (§2.4.6), and type SC can be cast to TC by recursive
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   465
     application of these rules.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   466
     If T is an interface type, T must be one of the interfaces implemented by arrays (§2.15).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   467
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   468
     During resolution of the symbolic reference to the class, array, or interface type, any of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   469
     exceptions documented in Section 5.4.3.1 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   470
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   471
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   472
     Otherwise, if objectref cannot be cast to the resolved class, array, or interface type,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   473
     the checkcast instruction throws a ClassCastException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   474
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   475
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   476
     The checkcast instruction is very similar to the instanceof instruction. It differs in
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   477
     its treatment of null, its behavior when its test fails (checkcast throws an exception,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   478
     instanceof pushes a result code), and its effect on the operand stack."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   479
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   480
    "Modified: / 21-03-2011 / 18:15:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   481
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   482
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   483
d2f
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   484
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   485
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   486
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   487
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   488
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   489
d2i
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   490
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   491
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   492
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   493
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   494
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   495
d2l
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   496
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   497
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   498
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   499
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   500
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   501
dadd
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   502
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   503
     adds two doubles together
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   504
     stack: value1, value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   505
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   506
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   507
    self pushDouble: (self pop + self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   508
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   509
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   510
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   511
Both value1 and value2 must be of type double. The values are popped from the operand 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   512
stack and undergo value set conversion (§3.8.3), resulting in value1' and value2'. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   513
The double result is value1' + value2'. The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   514
The result of a dadd instruction is governed by the rules of IEEE arithmetic:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   515
If either value1' or value2' is NaN, the result is NaN.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   516
The sum of two infinities of opposite sign is NaN.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   517
The sum of two infinities of the same sign is the infinity of that sign.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   518
The sum of an infinity and any finite value is equal to the infinity.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   519
The sum of two zeroes of opposite sign is positive zero.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   520
The sum of two zeroes of the same sign is the zero of that sign.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   521
The sum of a zero and a nonzero finite value is equal to the nonzero value.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   522
The sum of two nonzero finite values of the same magnitude and opposite sign is 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   523
positive zero.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   524
In the remaining cases, where neither operand is an infinity, a zero, or NaN and 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   525
the values have the same sign or have different magnitudes, the sum is computed 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   526
and rounded to the nearest representable value using IEEE 754 round to nearest mode. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   527
If the magnitude is too large to represent as a double, we say the operation overflows; 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   528
the result is then an infinity of appropriate sign. If the magnitude is too small to 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   529
represent as a double, we say the operation underflows; the result is then a zero of 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   530
appropriate sign.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   531
The Java virtual machine requires support of gradual underflow as defined by IEEE 754. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   532
Despite the fact that overflow, underflow, or loss of precision may occur, execution 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   533
of a dadd instruction never throws a runtime exception.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   534
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   535
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   536
    "Created: / 14-03-2011 / 20:53:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   537
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   538
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   539
daload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   540
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   541
     Load double from array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   542
     stack: arrayRef index -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   543
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   544
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   545
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   546
    self pushDouble: (self pop at: (self pop + 1)).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   547
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   548
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   549
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   550
The arrayref must be of type reference and must refer to an array whose components are of 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   551
type double. The index must be of type int. Both arrayref and index are popped from the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   552
operand stack. The double value in the component of the array at index is retrieved and 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   553
pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   554
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   555
Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   556
If arrayref is null, daload throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   557
Otherwise, if index is not within the bounds of the array referenced by arrayref, the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   558
daload instruction throws an ArrayIndexOutOfBoundsException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   559
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   560
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   561
    "Modified: / 14-03-2011 / 20:52:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   562
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   563
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   564
dastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   565
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   566
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   567
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   568
dcmpg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   569
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   570
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   571
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   572
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   573
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   574
dcmpl
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   575
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   576
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   577
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   578
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   579
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   580
dconst: arg 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   581
    self pushDouble: arg.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   582
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   583
    "Created: / 14-03-2011 / 18:01:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   584
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   585
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   586
ddiv
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   587
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   588
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   589
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   590
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   591
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   592
dload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   593
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   594
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   595
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   596
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   597
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   598
dload: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   599
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   600
Load double from local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   601
stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   602
args: index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   603
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   604
    self pushDouble: (context at: idx + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   605
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   606
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   607
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   608
The index is an unsigned byte. Both index and index + 1 must be indices into the local 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   609
variable array of the current frame (§3.6). The local variable at index must contain a 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   610
double. The value of the local variable at index is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   611
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   612
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   613
The dload opcode can be used in conjunction with the wide instruction to access a local 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   614
variable using a two-byte unsigned index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   615
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   616
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   617
    "Modified: / 13-03-2011 / 16:59:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   618
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   619
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   620
dmul
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   621
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   622
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   623
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   624
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   625
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   626
dneg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   627
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   628
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   629
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   630
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   631
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   632
drem
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   633
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   634
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   635
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   636
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   637
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   638
dreturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   639
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   640
     Return double from method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   641
     stack: value -> empty
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   642
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   643
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   644
    self leaveProcessorWith: (self popDouble).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   645
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   646
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   647
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   648
     The current method must have return type double. The value must be of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   649
     type double. If the current method is a synchronized method, the monitor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   650
     acquired or reentered on invocation of the method is released or exited
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   651
     (respectively) as if by execution of a monitorexit instruction. If no
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   652
     exception is thrown, value is popped from the operand stack of the current
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   653
     frame (§3.6) and undergoes value set conversion (§3.8.3), resulting in
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   654
     value'. The value' is pushed onto the operand stack of the frame of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   655
     invoker. Any other values on the operand stack of the current method are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   656
     discarded.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   657
     The interpreter then returns control to the invoker of the method,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   658
     reinstating the frame of the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   659
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   660
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   661
     If the current method is a synchronized method and the current thread
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   662
     is not the owner of the monitor acquired or reentered on invocation of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   663
     the method, dreturn throws an IllegalMonitorStateException. This can
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   664
     happen, for example, if a synchronized method contains a monitorexit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   665
     instruction, but no monitorenter instruction, on the object on which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   666
     the method is synchronized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   667
     Otherwise, if the virtual machine implementation enforces the rules
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   668
     on structured use of locks described in §8.13 and if the first of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   669
     those rules is violated during invocation of the current method,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   670
     then dreturn throws an IllegalMonitorStateException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   671
    "Created: / 14-03-2011 / 13:33:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   672
    "Modified: / 14-03-2011 / 18:04:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   673
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   674
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   675
dstore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   676
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   677
     Store double into local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   678
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   679
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   680
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   681
    context at: self fetchIndex put: (self popDouble).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   682
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   683
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   684
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   685
     The index is an unsigned byte. Both index and index + 1 must be indices
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   686
     into the local variable array of the current frame (§3.6). The value on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   687
     the top of the operand stack must be of type double. It is popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   688
     the operand stack and undergoes value set conversion (§3.8.3), resulting
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   689
     in value'. The local variables at index and index + 1 are set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   690
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   691
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   692
     The dstore opcode can be used in conjunction with the wide instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   693
     to access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   694
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   695
    "Created: / 14-03-2011 / 18:04:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   696
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   697
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   698
dstore: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   699
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   700
     Store double into local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   701
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   702
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   703
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   704
    context at: idx + 1 put: (self popDouble).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   705
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   706
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   707
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   708
     The index is an unsigned byte. Both index and index + 1 must be indices
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   709
     into the local variable array of the current frame (§3.6). The value on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   710
     the top of the operand stack must be of type double. It is popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   711
     the operand stack and undergoes value set conversion (§3.8.3), resulting
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   712
     in value'. The local variables at index and index + 1 are set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   713
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   714
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   715
     The dstore opcode can be used in conjunction with the wide instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   716
     to access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   717
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   718
    "Modified: / 14-03-2011 / 18:04:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   719
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   720
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   721
dsub
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   722
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   723
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   724
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   725
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   726
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   727
dup
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   728
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   729
Duplicate the top operand stack value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   730
stack: value -> value value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   731
args: nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   732
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   733
self pushRef: self tos.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   734
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   735
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   736
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   737
Duplicate the top value on the operand stack and push the duplicated value onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   738
The dup instruction must not be used unless value is a value of a category 1 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   739
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   740
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   741
    "Modified: / 27-03-2011 / 21:19:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   742
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   743
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   744
dup2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   745
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   746
Duplicate the top one or two operand stack values
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   747
stack v 1: value2 value1 -> value2 value 1 value2 value1            where both value1 and value2 are values of a category 1 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   748
stack v 2: value1 -> value1 value1                                  where value is a value of a category 2 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   749
args: nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   750
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   751
    | tos |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   752
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   753
    tos := self popLong.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   754
    self pushLong: tos.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   755
    self pushLong: tos.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   756
    self breakPoint:#mh_instructions.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   757
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   758
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   759
Duplicate the top one or two values on the operand stack and 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   760
push the duplicated value or values back onto the operand 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   761
stack in the original order.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   762
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   763
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   764
    "Modified: / 13-03-2011 / 17:03:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   765
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   766
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   767
dup2_x1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   768
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   769
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   770
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   771
dup2_x2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   772
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   773
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   774
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   775
dup_x1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   776
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   777
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   778
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   779
dup_x2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   780
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   781
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   782
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   783
f2d
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   784
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   785
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   786
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   787
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   788
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   789
f2i
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   790
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   791
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   792
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   793
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   794
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   795
f2l
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   796
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   797
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   798
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   799
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   800
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   801
fadd
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   802
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   803
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   804
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   805
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   806
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   807
faload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   808
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   809
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   810
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   811
fastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   812
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   813
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   814
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   815
fcmpg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   816
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   817
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   818
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   819
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   820
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   821
fcmpl
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   822
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   823
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   824
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   825
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   826
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   827
fconst: arg 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   828
    self pushFloat: arg.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   829
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   830
    "Created: / 14-03-2011 / 17:57:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   831
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   832
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   833
fdiv
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   834
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   835
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   836
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   837
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   838
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   839
fload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   840
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   841
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   842
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   843
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   844
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   845
fload: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   846
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   847
Load float from local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   848
stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   849
args: index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   850
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   851
    self pushFloat: (context at: idx + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   852
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   853
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   854
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   855
The index is an unsigned byte that must be an index into the local 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   856
variable array of the current frame (§3.6). The local variable at 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   857
index must contain a float. The value of the local variable at index 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   858
is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   859
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   860
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   861
The fload opcode can be used in conjunction with the wide instruction 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   862
to access a local variable using a two-byte unsigned index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   863
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   864
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   865
    "Modified: / 13-03-2011 / 17:05:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   866
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   867
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   868
fmul
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   869
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   870
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   871
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   872
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   873
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   874
fneg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   875
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   876
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   877
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   878
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   879
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   880
frem
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   881
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   882
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   883
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   884
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   885
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   886
freturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   887
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   888
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   889
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   890
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   891
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   892
fstore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   893
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   894
     Store float into local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   895
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   896
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   897
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   898
    self fstore: self fetchIndex.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   899
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   900
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   901
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   902
     The index is an unsigned byte that must be an index into the local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   903
     variable array of the current frame (§3.6). The value on the top of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   904
     the operand stack must be of type float. It is popped from the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   905
     stack and undergoes value set conversion (§3.8.3), resulting in value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   906
     The value of the local variable at index is set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   907
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   908
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   909
     The fstore opcode can be used in conjunction with the wide instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   910
     to access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   911
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   912
    "Created: / 14-03-2011 / 18:01:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   913
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   914
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   915
fstore: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   916
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   917
Store float into local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   918
stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   919
args: index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   920
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   921
    context at: idx + 1 put: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   922
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   923
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   924
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   925
The index is an unsigned byte that must be an index into the local 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   926
variable array of the current frame (§3.6). The value on the top of 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   927
the operand stack must be of type float. It is popped from the operand 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   928
stack and undergoes value set conversion (§3.8.3), resulting in value'. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   929
The value of the local variable at index is set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   930
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   931
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   932
The fstore opcode can be used in conjunction with the wide instruction 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   933
to access a local variable using a two-byte unsigned index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   934
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   935
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   936
    "Modified: / 13-03-2011 / 17:06:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   937
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   938
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   939
fsub
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   940
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   941
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   942
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   943
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   944
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   945
getfield
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   946
    "gets a field value of an object objectref, where the field is 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   947
     identified by field reference in the constant pool index (index1 << 8 + index2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   948
     stack: objectRef -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   949
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   950
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   951
    | fieldref  fieldOwner |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   952
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   953
    fieldOwner := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   954
    fieldref := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   955
fieldref resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   956
    self pushConstant: (fieldref offset).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   957
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   958
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   959
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   960
     The objectref, which must be of type reference, is popped from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   961
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   962
     runtime constant pool of the current class (§3.6), where the value of the index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   963
     is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   964
     must be a symbolic reference to a field (§5.1), which gives the name and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   965
     descriptor of the field as well as a symbolic reference to the class in which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   966
     the field is to be found. The referenced field is resolved (§5.4.3.2). The value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   967
     of the referenced field in objectref is fetched and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   968
     The class of objectref must not be an array. If the field is protected (§4.6),
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   969
     and it is either a member of the current class or a member of a superclass of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   970
     the current class, then the class of objectref must be either the current class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   971
     or a subclass of the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   972
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   973
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   974
     During resolution of the symbolic reference to the field, any of the errors
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   975
     pertaining to field resolution documented in Section 5.4.3.2 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   976
     Otherwise, if the resolved field is a static field, getfield throws an
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   977
     IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   978
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   979
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   980
     Otherwise, if objectref is null, the getfield instruction throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   981
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   982
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   983
     The getfield instruction cannot be used to access the length field of an array.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   984
     The arraylength instruction is used instead."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   985
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   986
    "Created: / 10-03-2011 / 23:34:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   987
    "Modified: / 16-03-2011 / 15:22:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   988
    "Modified: / 04-06-2011 / 18:12:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   989
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   990
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   991
getstatic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   992
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   993
     Get static field from class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   994
     stack: .. -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   995
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   996
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   997
    | fieldref |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   998
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   999
    fieldref := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1000
    fieldref resolveStatic.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1001
    self pushConstant: (fieldref offset).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1002
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1003
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1004
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1005
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1006
     runtime constant pool of the current class (§3.6), where the value of the index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1007
     is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1008
     must be a symbolic reference to a field (§5.1), which gives the name and descriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1009
     of the field as well as a symbolic reference to the class or interface in which the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1010
     field is to be found. The referenced field is resolved (§5.4.3.2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1011
     On successful resolution of the field, the class or interface that declared the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1012
     resolved field is initialized (§5.5) if that class or interface has not already
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1013
     been initialized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1014
     The value of the class or interface field is fetched and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1015
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1016
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1017
     During resolution of the symbolic reference to the class or interface field,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1018
     any of the exceptions pertaining to field resolution documented in Section 5.4.3.2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1019
     can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1020
     Otherwise, if the resolved field is not a static (class) field or an interface field,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1021
     getstatic throws an IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1022
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1023
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1024
     Otherwise, if execution of this getstatic instruction causes initialization of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1025
     referenced class or interface, getstatic may throw an Error as detailed in Section 2.17.5."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1026
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1027
    "Modified: / 04-06-2011 / 18:15:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1028
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1029
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1030
goto
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1031
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1032
     Branch always
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1033
     stack: nothing -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1034
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1035
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1036
    self relativeJump: self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1037
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1038
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1039
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1040
     The unsigned bytes branchbyte1 and branchbyte2 are used to construct a signed 16-bit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1041
     branchoffset, where branchoffset is (branchbyte1 << 8) | branchbyte2. Execution proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1042
     at that offset from the address of the opcode of this goto instruction. The target
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1043
     address must be that of an opcode of an instruction within the method that contains
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1044
     this goto instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1045
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1046
    "Created: / 14-03-2011 / 20:21:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1047
    "Modified: / 21-03-2011 / 18:20:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1048
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1049
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1050
goto_w
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1051
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1052
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1053
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1054
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1055
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1056
i2d
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1057
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1058
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1059
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1060
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1061
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1062
i2f
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1063
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1064
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1065
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1066
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1067
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1068
i2l
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1069
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1070
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1071
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1072
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1073
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1074
i_dup
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1075
    self pushInt: (self tos).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1076
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1077
    "Modified: / 13-03-2011 / 16:40:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1078
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1079
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1080
iadd
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1081
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1082
     adds two ints together
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1083
     stack: value1, value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1084
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1085
    self pushInt: (self pop + self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1086
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1087
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1088
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1089
     Both value1 and value2 must be of type int. The values are popped
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1090
     from the operand stack. The int result is value1 + value2. The result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1091
     is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1092
     The result is the 32 low-order bits of the true mathematical result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1093
     in a sufficiently wide two's-complement format, represented as a value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1094
     of type int. If overflow occurs, then the sign of the result may not be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1095
     the same as the sign of the mathematical sum of the two values.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1096
     Despite the fact that overflow may occur, execution of an iadd instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1097
     never throws a runtime exception."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1098
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1099
    "Created: / 06-03-2011 / 21:23:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1100
    "Modified: / 13-03-2011 / 21:51:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1101
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1102
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1103
iaload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1104
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1105
     Load int from array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1106
     stack: arrayRef index -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1107
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1108
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1109
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1110
    self pushInt: (self pop at: (self pop + 1)).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1111
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1112
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1113
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1114
     The arrayref must be of type reference and must refer to an array whose
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1115
     components are of type int. The index must be of type int. Both arrayref
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1116
     and index are popped from the operand stack. The int value in the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1117
     component of the array at index is retrieved and pushed onto the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1118
     stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1119
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1120
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1121
     If arrayref is null, iaload throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1122
     Otherwise, if index is not within the bounds of the array referenced by
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1123
     arrayref, the iaload instruction throws an ArrayIndexOutOfBoundsException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1124
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1125
    "Modified: / 14-03-2011 / 20:20:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1126
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1127
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1128
iand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1129
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1130
Boolean AND int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1131
stack: val1 val2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1132
args: nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1133
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1134
self pushInt:(self pop bitAnd: self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1135
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1136
Both value1 and value2 must be of type int. They are popped from the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1137
operand stack. An int result is calculated by taking the bitwise AND 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1138
(conjunction) of value1 and value2. The result is pushed onto the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1139
operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1140
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1141
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1142
    "Created: / 14-03-2011 / 17:10:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1143
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1144
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1145
iastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1146
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1147
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1148
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1149
iconst: arg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1150
    self pushInt: arg.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1151
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1152
    "Created: / 20-03-2011 / 23:35:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1153
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1154
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1155
idiv
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1156
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1157
     Divide int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1158
     stack: value1 value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1159
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1160
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1161
    self pushInt: (self pop // self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1162
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1163
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1164
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1165
     Both value1 and value2 must be of type int. The values are popped from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1166
     The int result is the value of the Java programming language expression value1 / value2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1167
     The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1168
     An int division rounds towards 0; that is, the quotient produced for int values in n/d is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1169
     an int value q whose magnitude is as large as possible while satisfying . Moreover, q is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1170
     positive when  and n and d have the same sign, but q is negative when  and n and d have
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1171
     opposite signs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1172
     There is one special case that does not satisfy this rule: if the dividend is the negative
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1173
     integer of largest possible magnitude for the int type, and the divisor is -1, then overflow
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1174
     occurs, and the result is equal to the dividend. Despite the overflow, no exception is thrown
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1175
     in this case.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1176
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1177
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1178
     If the value of the divisor in an int division is 0, idiv throws an ArithmeticException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1179
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1180
    "Created: / 14-03-2011 / 17:50:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1181
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1182
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1183
ifacmpeq
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1184
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1185
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1186
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1187
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1188
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1189
ifacmpne
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1190
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1191
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1192
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1193
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1194
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1195
ifeq
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1196
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1197
     if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1198
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1199
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1200
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1201
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1202
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1203
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1204
    self pop = 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1205
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1206
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1207
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1208
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1209
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1210
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1211
     ne succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1212
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1213
     le succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1214
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1215
     ge succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1216
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1217
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1218
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1219
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1220
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1221
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1222
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1223
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1224
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1225
    "Created: / 14-03-2011 / 18:47:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1226
    "Modified: / 21-03-2011 / 18:20:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1227
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1228
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1229
ifge
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1230
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1231
     if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1232
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1233
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1234
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1235
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1236
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1237
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1238
    self pop >= 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1239
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1240
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1241
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1242
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1243
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1244
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1245
     ne succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1246
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1247
     le succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1248
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1249
     ge succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1250
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1251
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1252
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1253
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1254
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1255
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1256
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1257
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1258
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1259
    "Created: / 14-03-2011 / 18:48:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1260
    "Modified: / 21-03-2011 / 18:20:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1261
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1262
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1263
ifgt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1264
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1265
     if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1266
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1267
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1268
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1269
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1270
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1271
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1272
    self pop > 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1273
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1274
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1275
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1276
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1277
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1278
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1279
     ne succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1280
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1281
     le succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1282
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1283
     ge succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1284
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1285
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1286
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1287
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1288
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1289
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1290
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1291
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1292
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1293
    "Created: / 14-03-2011 / 18:48:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1294
    "Modified: / 21-03-2011 / 18:20:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1295
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1296
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1297
ificmpeq
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1298
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1299
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1300
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1301
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1302
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1303
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1304
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1305
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1306
    (self pop = self pop) ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1307
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1308
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1309
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1310
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1311
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1312
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1313
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1314
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1315
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1316
     le succeeds if and only if value1  value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1317
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1318
     ge succeeds if and only if value1  value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1319
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1320
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1321
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1322
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1323
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1324
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1325
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1326
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1327
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1328
    "Created: / 14-03-2011 / 18:49:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1329
    "Modified: / 21-03-2011 / 18:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1330
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1331
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1332
ificmpge
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1333
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1334
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1335
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1336
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1337
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1338
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1339
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1340
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1341
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1342
    (self pop >= self pop) ifTrue: [ self relativeJump: dest ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1343
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1344
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1345
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1346
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1347
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1348
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1349
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1350
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1351
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1352
     le succeeds if and only if value1 <= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1353
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1354
     ge succeeds if and only if value1 >= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1355
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1356
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1357
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1358
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1359
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1360
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1361
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1362
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1363
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1364
    "Created: / 14-03-2011 / 18:52:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1365
    "Modified: / 21-03-2011 / 18:20:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1366
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1367
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1368
ificmpgt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1369
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1370
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1371
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1372
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1373
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1374
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1375
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1376
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1377
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1378
    (self pop > self pop) ifTrue: [ self relativeJump: dest ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1379
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1380
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1381
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1382
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1383
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1384
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1385
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1386
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1387
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1388
     le succeeds if and only if value1 <= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1389
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1390
     ge succeeds if and only if value1 >= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1391
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1392
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1393
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1394
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1395
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1396
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1397
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1398
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1399
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1400
    "Created: / 14-03-2011 / 21:00:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1401
    "Modified: / 21-03-2011 / 18:20:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1402
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1403
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1404
ificmple
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1405
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1406
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1407
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1408
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1409
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1410
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1411
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1412
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1413
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1414
    (self pop <= self pop) ifTrue: [ self relativeJump: dest ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1415
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1416
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1417
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1418
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1419
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1420
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1421
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1422
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1423
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1424
     le succeeds if and only if value1 <= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1425
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1426
     ge succeeds if and only if value1 >= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1427
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1428
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1429
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1430
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1431
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1432
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1433
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1434
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1435
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1436
    "Created: / 14-03-2011 / 21:00:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1437
    "Modified: / 21-03-2011 / 18:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1438
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1439
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1440
ificmplt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1441
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1442
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1443
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1444
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1445
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1446
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1447
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1448
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1449
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1450
    (self pop < self pop) ifTrue: [ self relativeJump: dest ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1451
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1452
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1453
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1454
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1455
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1456
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1457
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1458
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1459
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1460
     le succeeds if and only if value1 <= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1461
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1462
     ge succeeds if and only if value1 >= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1463
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1464
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1465
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1466
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1467
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1468
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1469
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1470
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1471
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1472
    "Created: / 14-03-2011 / 21:00:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1473
    "Modified: / 21-03-2011 / 18:20:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1474
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1475
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1476
ificmpne
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1477
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1478
     Branch if int comparison succeeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1479
     stack: value1 value2 -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1480
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1481
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1482
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1483
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1484
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1485
    (self pop ~= self pop) ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1486
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1487
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1488
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1489
     Both value1 and value2 must be of type int. They are both popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1490
     the operand stack and compared. All comparisons are signed. The results
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1491
     of the comparison are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1492
     eq succeeds if and only if value1 = value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1493
     ne succeeds if and only if value1 ~= value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1494
     lt succeeds if and only if value1 < value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1495
     le succeeds if and only if value1  value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1496
     gt succeeds if and only if value1 > value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1497
     ge succeeds if and only if value1  value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1498
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1499
     used to construct a signed 16-bit offset, where the offset is calculated
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1500
     to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1501
     offset from the address of the opcode of this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1502
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1503
     method that contains this if_icmp<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1504
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1505
     this if_icmp<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1506
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1507
    "Created: / 14-03-2011 / 20:59:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1508
    "Modified: / 21-03-2011 / 18:20:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1509
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1510
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1511
ifle
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1512
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1513
     if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1514
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1515
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1516
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1517
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1518
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1519
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1520
    self pop <= 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1521
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1522
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1523
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1524
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1525
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1526
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1527
     ne succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1528
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1529
     le succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1530
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1531
     ge succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1532
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1533
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1534
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1535
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1536
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1537
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1538
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1539
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1540
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1541
    "Created: / 14-03-2011 / 18:48:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1542
    "Modified: / 21-03-2011 / 18:20:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1543
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1544
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1545
iflt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1546
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1547
     if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1548
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1549
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1550
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1551
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1552
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1553
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1554
    self pop < 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1555
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1556
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1557
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1558
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1559
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1560
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1561
     ne succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1562
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1563
     le succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1564
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1565
     ge succeeds if and only if value  0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1566
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1567
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1568
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1569
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1570
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1571
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1572
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1573
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1574
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1575
    "Created: / 14-03-2011 / 18:47:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1576
    "Modified: / 21-03-2011 / 18:20:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1577
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1578
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1579
ifne
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1580
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1581
     if value is not 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1582
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1583
     args: branchByte1 branchByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1584
    "/ -1 in block - because we already increased pc to point to the next instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1585
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1586
    | dest |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1587
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1588
    dest := self fetchBytes2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1589
    self pop ~= 0 ifTrue: [ self relativeJump: dest ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1590
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1591
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1592
     The value must be of type int. It is popped from the operand stack and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1593
     compared against zero. All comparisons are signed. The results of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1594
     comparisons are as follows:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1595
     eq succeeds if and only if value = 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1596
     ne succeeds if and only if value ~= 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1597
     lt succeeds if and only if value < 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1598
     le succeeds if and only if value <= 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1599
     gt succeeds if and only if value > 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1600
     ge succeeds if and only if value >= 0
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1601
     If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1602
     are used to construct a signed 16-bit offset, where the offset is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1603
     calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1604
     at that offset from the address of the opcode of this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1605
     The target address must be that of an opcode of an instruction within the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1606
     method that contains this if<cond> instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1607
     Otherwise, execution proceeds at the address of the instruction following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1608
     this if<cond> instruction."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1609
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1610
    "Created: / 06-03-2011 / 22:57:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1611
    "Modified: / 21-03-2011 / 18:20:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1612
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1613
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1614
ifnonnull
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1615
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1616
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1617
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1618
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1619
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1620
ifnull
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1621
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1622
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1623
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1624
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1625
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1626
iinc
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1627
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1628
Increment local variable by constant
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1629
stack: nothing -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1630
args: index const
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1631
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1632
| index  const |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1633
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1634
    index := self fetchIndex.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1635
    const := self fetchByte.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1636
    context at: index + 1 put: ((context at: index + 1) + const).    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1637
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1638
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1639
The index is an unsigned byte that must be an index into the local variable 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1640
array of the current frame (§3.6). The const is an immediate signed byte. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1641
The local variable at index must contain an int. The value const is first 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1642
sign-extended to an int, and then the local variable at index is incremented 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1643
by that amount.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1644
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1645
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1646
The iinc opcode can be used in conjunction with the wide instruction to access 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1647
a local variable using a two-byte unsigned index and to increment it by a two-byte 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1648
immediate value.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1649
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1650
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1651
    "Created: / 14-03-2011 / 17:22:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1652
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1653
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1654
iload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1655
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1656
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1657
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1658
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1659
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1660
iload: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1661
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1662
     loads an int value from a local variable #index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1663
     stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1664
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1665
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1666
    self pushInt: (context at: idx + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1667
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1668
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1669
     The index is an unsigned byte that must be an index into the local variable array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1670
     of the current frame (§3.6). The local variable at index must contain an int.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1671
     The value of the local variable at index is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1672
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1673
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1674
     The iload opcode can be used in conjunction with the wide instruction to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1675
     access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1676
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1677
    "Modified: / 17-03-2011 / 17:33:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1678
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1679
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1680
imul
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1681
    "multiply two integers
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1682
     stack: value1, value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1683
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1684
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1685
    self pushInt: (self pop * self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1686
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1687
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1688
Both value1 and value2 must be of type int. The values are popped
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1689
from the operand stack. The int result is value1 * value2. The result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1690
is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1691
The result is the 32 low-order bits of the true mathematical result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1692
in a sufficiently wide two's-complement format, represented as a value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1693
of type int. If overflow occurs, then the sign of the result may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1694
be the same as the sign of the mathematical sum of the two values.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1695
Despite the fact that overflow may occur, execution of an imul
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1696
instruction never throws a runtime exception."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1697
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1698
    "Created: / 06-03-2011 / 22:42:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1699
    "Modified: / 13-03-2011 / 17:24:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1700
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1701
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1702
ineg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1703
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1704
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1705
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1706
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1707
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1708
instanceof
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1709
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1710
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1711
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1712
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1713
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1714
int2byte
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1715
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1716
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1717
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1718
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1719
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1720
int2char
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1721
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1722
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1723
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1724
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1725
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1726
int2short
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1727
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1728
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1729
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1730
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1731
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1732
invinterface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1733
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1734
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1735
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1736
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1737
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1738
invnonvirt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1739
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1740
     Invoke instance method; special handling for superclass, private, and instance initialization method invocations
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1741
     stack: objRef [args] -> ..
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1742
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1743
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1744
    | methodToBeInvoked  methodReceiver  methodNumArgs  methodArgs  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1745
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1746
    methodToBeInvoked := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1747
    methodReceiver := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1748
    methodNumArgs := methodToBeInvoked javaNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1749
    methodArgs := Array new: methodNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1750
    methodNumArgs to: 1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1751
        by: -1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1752
        do: [:index | methodArgs at: index put: self pop ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1753
    result := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1754
                interpretInner: methodToBeInvoked
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1755
                receiver: methodReceiver
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1756
                arguments: methodArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1757
    self pushRef: result.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1758
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1759
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1760
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1761
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1762
     of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1763
     runtime constant pool item at that index must be a symbolic reference to a method (§5.1), which gives
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1764
     the name and descriptor (§4.3.3) of the method as well as a symbolic reference to the class in which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1765
     the method is to be found. The named method is resolved (§5.4.3.3). Finally, if the resolved method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1766
     is protected (§4.6), and it is either a member of the current class or a member of a superclass of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1767
     the current class, then the class of objectref must be either the current class or a subclass of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1768
     current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1769
     Next, the resolved method is selected for invocation unless all of the following conditions are true:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1770
     The ACC_SUPER flag (see Table 4.1, Class access and property modifiers) is set for the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1771
     The class of the resolved method is a superclass of the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1772
     The resolved method is not an instance initialization method (§3.9).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1773
     If the above conditions are true, the actual method to be invoked is selected by the following lookup
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1774
     procedure. Let C be the direct superclass of the current class:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1775
     If C contains a declaration for an instance method with the same name and descriptor as the resolved
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1776
     method, then this method will be invoked. The lookup procedure terminates.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1777
     Otherwise, if C has a superclass, this same lookup procedure is performed recursively using the direct
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1778
     superclass of C. The method to be invoked is the result of the recursive invocation of this lookup
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1779
     procedure.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1780
     Otherwise, an AbstractMethodError is raised.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1781
     The objectref must be of type reference and must be followed on the operand stack by nargs argument
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1782
     values, where the number, type, and order of the values must be consistent with the descriptor of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1783
     selected instance method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1784
     If the method is synchronized, the monitor associated with objectref is acquired or reentered.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1785
     If the method is not native, the nargs argument values and objectref are popped from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1786
     A new frame is created on the Java virtual machine stack for the method being invoked. The objectref
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1787
     and the argument values are consecutively made the values of local variables of the new frame, with
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1788
     objectref in local variable 0, arg1 in local variable 1 (or, if arg1 is of type long or double, in
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1789
     local variables 1 and 2), and so on. Any argument value that is of a floating-point type undergoes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1790
     value set conversion (§3.8.3) prior to being stored in a local variable. The new frame is then made
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1791
     current, and the Java virtual machine pc is set to the opcode of the first instruction of the method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1792
     to be invoked. Execution continues with the first instruction of the method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1793
     If the method is native and the platform-dependent code that implements it has not yet been bound (§5.6)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1794
     into the Java virtual machine, that is done. The nargs argument values and objectref are popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1795
     the operand stack and are passed as parameters to the code that implements the method. Any argument
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1796
     value that is of a floating-point type undergoes value set conversion (§3.8.3) prior to being passed
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1797
     as a parameter. The parameters are passed and the code is invoked in an implementation-dependent
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1798
     manner. When the platform-dependent code returns, the following take place:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1799
     If the native method is synchronized, the monitor associated with objectref is released or exited as
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1800
     if by execution of a monitorexit instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1801
     If the native method returns a value, the return value of the platform-dependent code is converted in
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1802
     an implementation-dependent way to the return type of the native method and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1803
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1804
     During resolution of the symbolic reference to the method, any of the exceptions pertaining to method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1805
     resolution documented in Section 5.4.3.3 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1806
     Otherwise, if the resolved method is an instance initialization method, and the class in which it is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1807
     declared is not the class symbolically referenced by the instruction, a NoSuchMethodError is thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1808
     Otherwise, if the resolved method is a class (static) method, the invokespecial instruction throws an
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1809
     IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1810
     Otherwise, if no method matching the resolved name and descriptor is selected, invokespecial throws
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1811
     an AbstractMethodError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1812
     Otherwise, if the selected method is abstract, invokespecial throws an AbstractMethodError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1813
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1814
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1815
     Otherwise, if objectref is null, the invokespecial instruction throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1816
     Otherwise, if the selected method is native and the code that implements the method cannot be bound,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1817
     invokespecial throws an UnsatisfiedLinkError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1818
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1819
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1820
     The difference between the invokespecial and the invokevirtual instructions is that invokevirtual
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1821
     invokes a method based on the class of the object. The invokespecial instruction is used to invoke
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1822
     instance initialization methods (§3.9) as well as private methods and methods of a superclass of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1823
     the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1824
     The invokespecial instruction was named invokenonvirtual prior to Sun's JDK release 1.0.2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1825
     The nargs argument values and objectref are not one-to-one with the first nargs + 1 local variables.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1826
     Argument values of types long and double must be stored in two consecutive local variables, thus more
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1827
     than nargs local variables may be required to pass nargs argument values to the invoked method."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1828
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1829
    "Modified: / 31-03-2011 / 16:34:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1830
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1831
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1832
invstatic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1833
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1834
     Invoke a class (static) method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1835
     stack: [arg1 [args2 ...]] -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1836
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1837
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1838
    | methodToBeInvoked  methodNumArgs  args  argSignatures  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1839
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1840
    methodToBeInvoked := (constantPool at: self fetchIndex2) resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1841
    methodToBeInvoked ifNil: [self halt].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1842
    methodNumArgs := methodToBeInvoked javaNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1843
    argSignatures := methodToBeInvoked argSignature.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1844
    args := Array new: methodNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1845
    methodNumArgs to: 1 by: -1 do: [
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1846
        :index | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1847
        args at: index put: self pop
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1848
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1849
    result := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1850
                interpretInner: methodToBeInvoked
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1851
                receiver: receiver
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1852
                arguments: args.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1853
    methodToBeInvoked returnsVoid ifFalse: [
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1854
        self pushConstant: result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1855
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1856
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1857
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1858
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1859
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1860
     runtime constant pool of the current class (§3.6), where the value of the index is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1861
     (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index must
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1862
     be a symbolic reference to a method (§5.1), which gives the name and descriptor (§4.3.3)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1863
     of the method as well as a symbolic reference to the class in which the method is to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1864
     be found. The named method is resolved (§5.4.3.3). The method must not be the class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1865
     or interface initialization method (§3.9). It must be static, and therefore cannot be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1866
     abstract.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1867
     On successful resolution of the method, the class that declared the resolved field is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1868
     initialized (§5.5) if that class has not already been initialized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1869
     The operand stack must contain nargs argument values, where the number, type, and order
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1870
     of the values must be consistent with the descriptor of the resolved method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1871
     If the method is synchronized, the monitor associated with the resolved class is acquired
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1872
     or reentered.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1873
     If the method is not native, the nargs argument values are popped from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1874
     A new frame is created on the Java virtual machine stack for the method being invoked.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1875
     The nargs argument values are consecutively made the values of local variables of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1876
     new frame, with arg1 in local variable 0 (or, if arg1 is of type long or double, in local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1877
     variables 0 and 1) and so on. Any argument value that is of a floating-point type undergoes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1878
     value set conversion (§3.8.3) prior to being stored in a local variable. The new frame is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1879
     then made current, and the Java virtual machine pc is set to the opcode of the first
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1880
     nstruction of the method to be invoked. Execution continues with the first instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1881
     of the method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1882
     If the method is native and the platform-dependent code that implements it has not yet
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1883
     been bound (§5.6) into the Java virtual machine, that is done. The nargs argument values
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1884
     are popped from the operand stack and are passed as parameters to the code that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1885
     implements the method. Any argument value that is of a floating-point type undergoes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1886
     value set conversion (§3.8.3) prior to being passed as a parameter. The parameters are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1887
     passed and the code is invoked in an implementation-dependent manner. When the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1888
     platform-dependent code returns, the following take place:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1889
     If the native method is synchronized, the monitor associated with the resolved class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1890
     is released or exited as if by execution of a monitorexit instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1891
     If the native method returns a value, the return value of the platform-dependent code
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1892
     is converted in an implementation-dependent way to the return type of the native
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1893
     method and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1894
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1895
     During resolution of the symbolic reference to the method, any of the exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1896
     pertaining to method resolution documented in Section 5.4.3.3 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1897
     Otherwise, if the resolved method is an instance method, the invokestatic instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1898
     throws an IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1899
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1900
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1901
     Otherwise, if execution of this invokestatic instruction causes initialization of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1902
     referenced class, invokestatic may throw an Error as detailed in Section 2.17.5.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1903
     Otherwise, if the resolved method is native and the code that implements the method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1904
     cannot be bound, invokestatic throws an UnsatisfiedLinkError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1905
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1906
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1907
     The nargs argument values are not one-to-one with the first nargs local variables.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1908
     Argument values of types long and double must be stored in two consecutive local variables,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1909
     thus more than nargs local variables may be required to pass nargs argument values to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1910
     the invoked method."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1911
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1912
    "Created: / 24-02-2011 / 10:37:05 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1913
    "Modified: / 25-02-2011 / 00:18:30 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1914
    "Modified: / 24-02-2011 / 22:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1915
    "Modified: / 04-06-2011 / 18:13:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1916
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1917
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1918
invvirt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1919
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1920
     Invoke instance method; dispatch based on class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1921
     stack: objRef args -> ..
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1922
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1923
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1924
    | methodOwner  methodRef  resolvedMethod  methodNumArgs  args  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1925
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1926
    methodRef := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1927
    methodOwner := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1928
    resolvedMethod := methodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1929
    methodNumArgs := resolvedMethod javaNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1930
    args := Array new: methodNumArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1931
    methodNumArgs to: 1 by: -1 do: [
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1932
        :index | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1933
        args at: index put: self pop
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1934
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1935
    result := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1936
                interpretInner: (methodOwner class lookupMethodFor: resolvedMethod selector)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1937
                receiver: methodOwner
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1938
                arguments: args.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1939
    resolvedMethod returnsVoid ifFalse: [
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1940
        self pushConstant: result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1941
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1942
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1943
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1944
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1945
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1946
     runtime constant pool of the current class (§3.6), where the value of the index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1947
     is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1948
     must be a symbolic reference to a method (§5.1), which gives the name and descriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1949
     (§4.3.3) of the method as well as a symbolic reference to the class in which the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1950
     method is to be found. The named method is resolved (§5.4.3.3). The method must
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1951
     not be an instance initialization method (§3.9) or the class or interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1952
     initialization method (§3.9). Finally, if the resolved method is protected (§4.6),
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1953
     and it is either a member of the current class or a member of a superclass of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1954
     current class, then the class of objectref must be either the current class or a
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1955
     subclass of the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1956
     Let C be the class of objectref. The actual method to be invoked is selected by
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1957
     the following lookup procedure:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1958
     If C contains a declaration for an instance method with the same name and descriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1959
     as the resolved method, and the resolved method is accessible from C, then this is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1960
     the method to be invoked, and the lookup procedure terminates.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1961
     Otherwise, if C has a superclass, this same lookup procedure is performed recursively
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1962
     using the direct superclass of C ; the method to be invoked is the result of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1963
     recursive invocation of this lookup procedure.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1964
     Otherwise, an AbstractMethodError is raised.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1965
     The objectref must be followed on the operand stack by nargs argument values,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1966
     where the number, type, and order of the values must be consistent with the descriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1967
     of the selected instance method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1968
     If the method is synchronized, the monitor associated with objectref is acquired or
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1969
     reentered.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1970
     If the method is not native, the nargs argument values and objectref are popped from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1971
     the operand stack. A new frame is created on the Java virtual machine stack for the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1972
     method being invoked. The objectref and the argument values are consecutively made
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1973
     the values of local variables of the new frame, with objectref in local variable 0,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1974
     arg1 in local variable 1 (or, if arg1 is of type long or double, in local variables 1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1975
     and 2), and so on. Any argument value that is of a floating-point type undergoes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1976
     value set conversion (§3.8.3) prior to being stored in a local variable. The new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1977
     frame is then made current, and the Java virtual machine pc is set to the opcode
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1978
     of the first instruction of the method to be invoked. Execution continues with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1979
     first instruction of the method.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1980
     If the method is native and the platform-dependent code that implements it has not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1981
     yet been bound (§5.6) into the Java virtual machine, that is done. The nargs argument
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1982
     values and objectref are popped from the operand stack and are passed as parameters
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1983
     to the code that implements the method. Any argument value that is of a floating-point
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1984
     type undergoes value set conversion (§3.8.3) prior to being passed as a parameter. The
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1985
     parameters are passed and the code is invoked in an implementation-dependent manner.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1986
     When the platform-dependent code returns, the following take place:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1987
     If the native method is synchronized, the monitor associated with objectref is released
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1988
     or exited as if by execution of a monitorexit instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1989
     If the native method returns a value, the return value of the platform-dependent code
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1990
     is converted in an implementation-dependent way to the return type of the native method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1991
     and pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1992
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1993
     During resolution of the symbolic reference to the method, any of the exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1994
     pertaining to method resolution documented in Section 5.4.3.3 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1995
     Otherwise, if the resolved method is a class (static) method, the invokevirtual instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1996
     throws an IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1997
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1998
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  1999
     Otherwise, if objectref is null, the invokevirtual instruction throws a NullPointerException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2000
     Otherwise, if no method matching the resolved name and descriptor is selected, invokevirtual
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2001
     throws an AbstractMethodError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2002
     Otherwise, if the selected method is abstract, invokevirtual throws an AbstractMethodError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2003
     Otherwise, if the selected method is native and the code that implements the method cannot
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2004
     be bound, invokevirtual throws an UnsatisfiedLinkError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2005
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2006
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2007
     The nargs argument values and objectref are not one-to-one with the first nargs + 1 local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2008
     variables. Argument values of types long and double must be stored in two consecutive local
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2009
     variables, thus more than nargs local variables may be required to pass nargs argument
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2010
     values to the invoked method."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2011
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2012
    "Modified: / 04-06-2011 / 18:13:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2013
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2014
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2015
ior
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2016
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2017
     Boolean OR int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2018
     stack: val1 val2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2019
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2020
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2021
    self pushInt: (self pop bitOr: self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2022
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2023
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2024
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2025
Both value1 and value2 must be of type int. They are popped from the operand stack. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2026
An int result is calculated by taking the bitwise inclusive OR of value1 and value2. 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2027
The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2028
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2029
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2030
    "Created: / 14-03-2011 / 18:20:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2031
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2032
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2033
irem
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2034
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2035
     Remainder int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2036
     stack: value1 value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2037
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2038
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2039
    | value1  value2 |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2040
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2041
    value2 := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2042
    value1 := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2043
    self pushInt: (value1 - ((value1 // value2) * value2)).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2044
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2045
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2046
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2047
     Both value1 and value2 must be of type int. The values are popped from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2048
     The int result is value1 - (value1 / value2) * value2. The result is pushed onto the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2049
     operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2050
     The result of the irem instruction is such that (a/b)*b + (a%b) is equal to a. This identity
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2051
     holds even in the special case in which the dividend is the negative int of largest possible
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2052
     magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2053
     that the result of the remainder operation can be negative only if the dividend is negative
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2054
     and can be positive only if the dividend is positive. Moreover, the magnitude of the result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2055
     is always less than the magnitude of the divisor.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2056
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2057
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2058
     If the value of the divisor for an int remainder operator is 0, irem throws an ArithmeticException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2059
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2060
    "Modified: / 14-03-2011 / 17:32:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2061
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2062
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2063
ireturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2064
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2065
     Return int from method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2066
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2067
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2068
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2069
    self leaveProcessorWith: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2070
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2071
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2072
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2073
     The current method must have return type boolean, byte, short,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2074
     char, or int. The value must be of type int. If the current method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2075
     is a synchronized method, the monitor acquired or reentered on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2076
     invocation of the method is released or exited (respectively) as
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2077
     if by execution of a monitorexit instruction. If no exception is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2078
     thrown, value is popped from the operand stack of the current frame
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2079
     (§3.6) and pushed onto the operand stack of the frame of the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2080
     Any other values on the operand stack of the current method are discarded.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2081
     The interpreter then returns control to the invoker of the method,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2082
     reinstating the frame of the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2083
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2084
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2085
     If the current method is a synchronized method and the current thread
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2086
     is not the owner of the monitor acquired or reentered on invocation of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2087
     the method, ireturn throws an IllegalMonitorStateException. This can
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2088
     happen, for example, if a synchronized method contains a monitorexit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2089
     instruction, but no monitorenter instruction, on the object on which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2090
     the method is synchronized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2091
     Otherwise, if the virtual machine implementation enforces the rules
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2092
     on structured use of locks described in Section 8.13 and if the first
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2093
     of those rules is violated during invocation of the current method,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2094
     then ireturn throws an IllegalMonitorStateException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2095
    "Created: / 06-03-2011 / 21:24:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2096
    "Modified: / 13-03-2011 / 17:42:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2097
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2098
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2099
ishl
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2100
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2101
     Shift left int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2102
     stack: val1 val2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2103
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2104
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2105
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2106
    self pushInt: (self pop bitShift32: self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2107
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2108
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2109
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2110
     Both value1 and value2 must be of type int. The values are popped from the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2111
     stack. An int result is calculated by shifting value1 left by s bit positions, where
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2112
     s is the value of the low 5 bits of value2. The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2113
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2114
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2115
     This is equivalent (even if overflow occurs) to multiplication by 2 to the power s.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2116
     The shift distance actually used is always in the range 0 to 31, inclusive, as if
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2117
     value2 were subjected to a bitwise logical AND with the mask value 0x1f."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2118
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2119
    "Created: / 14-03-2011 / 17:12:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2120
    "Modified: / 14-03-2011 / 19:01:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2121
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2122
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2123
ishr
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2124
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2125
     Shift right int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2126
     stack: val1 val2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2127
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2128
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2129
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2130
    self pushInt: (self pop rightShift: (self pop bitAnd: 2r11111)).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2131
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2132
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2133
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2134
     Both value1 and value2 must be of type int. The values are popped from the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2135
     stack. An int result is calculated by shifting value1 right by s bit positions,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2136
     with sign extension, where s is the value of the low 5 bits of value2. The result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2137
     is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2138
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2139
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2140
     The resulting value is , where s is value2 & 0x1f. For nonnegative value1, this
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2141
     is equivalent to truncating int division by 2 to the power s. The shift distance
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2142
     actually used is always in the range 0 to 31, inclusive, as if value2 were
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2143
     subjected to a bitwise logical AND with the mask value 0x1f."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2144
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2145
    "Created: / 14-03-2011 / 17:19:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2146
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2147
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2148
istore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2149
    "superclass JavaByteCodeProcessor says that I am responsible to implement this method"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2150
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2151
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2152
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2153
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2154
istore: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2155
    "store int value into variable #index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2156
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2157
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2158
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2159
    context at: (idx + 1) put: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2160
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2161
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2162
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2163
     The index is an unsigned byte that must be an index into the local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2164
     array of the current frame (§3.6). The value on the top of the operand stack
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2165
     must be of type int. It is popped from the operand stack, and the value of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2166
     the local variable at index is set to value.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2167
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2168
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2169
     The istore opcode can be used in conjunction with the wide instruction to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2170
     access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2171
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2172
    "Modified: / 14-03-2011 / 20:03:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2173
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2174
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2175
isub
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2176
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2177
     int substract
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2178
     stack: value1, value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2179
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2180
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2181
    self pushInt: (0 - self pop + self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2182
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2183
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2184
     Both value1 and value2 must be of type int. The values are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2185
     popped from the operand stack. The int result is value1 - value2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2186
     The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2187
     For int subtraction, a - b produces the same result as a + (-b).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2188
     For int values, subtraction from zero is the same as negation.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2189
     The result is the 32 low-order bits of the true mathematical result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2190
     in a sufficiently wide two's-complement format, represented
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2191
     as a value of type int. If overflow occurs, then the sign of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2192
     the result may not be the same as the sign of the mathematical
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2193
     sum of the two values.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2194
     Despite the fact that overflow may occur, execution of an isub
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2195
     instruction never throws a runtime exception."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2196
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2197
    "Created: / 06-03-2011 / 23:14:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2198
    "Modified: / 13-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2199
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2200
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2201
iushr
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2202
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2203
     Logical shift right int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2204
     stack: value1 value2 -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2205
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2206
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2207
    self swap.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2208
    self pushInt: (self pop unsignedBitShift32: self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2209
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2210
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2211
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2212
     Both value1 and value2 must be of type int. The values are popped from the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2213
     operand stack. An int result is calculated by shifting value1 right by s
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2214
     bit positions, with zero extension, where s is the value of the low 5 bits
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2215
     of value2. The result is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2216
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2217
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2218
     If value1 is positive and s is value2 & 0x1f, the result is the same as
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2219
     that of value1 >> s; if value1 is negative, the result is equal to the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2220
     value of the expression (value1 >> s) + (2 << ~s). The addition of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2221
     (2 << ~s) term cancels out the propagated sign bit. The shift distance
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2222
     actually used is always in the range 0 to 31, inclusive."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2223
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2224
    "Created: / 14-03-2011 / 18:58:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2225
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2226
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2227
ixor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2228
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2229
     Boolean XOR int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2230
     stack: value1 value -> result
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2231
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2232
                        
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2233
    self pushInt: (self pop bitXor: self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2234
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2235
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2236
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2237
     Both value1 and value2 must be of type int. They are popped from the operand
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2238
     stack. An int result is calculated by taking the bitwise exclusive OR of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2239
     value1 and value2. The result is pushed onto the operand stack."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2240
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2241
    "Created: / 14-03-2011 / 18:07:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2242
    "Modified: / 17-03-2011 / 17:35:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2243
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2244
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2245
jsr
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2246
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2247
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2248
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2249
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2250
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2251
jsr_w
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2252
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2253
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2254
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2255
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2256
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2257
l2d
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2258
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2259
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2260
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2261
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2262
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2263
l2f
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2264
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2265
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2266
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2267
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2268
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2269
l2i
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2270
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2271
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2272
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2273
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2274
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2275
ladd
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2276
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2277
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2278
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2279
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2280
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2281
laload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2282
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2283
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2284
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2285
land
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2286
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2287
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2288
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2289
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2290
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2291
lastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2292
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2293
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2294
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2295
lcmp
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2296
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2297
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2298
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2299
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2300
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2301
lconst: arg 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2302
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2303
     Push long constant
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2304
     stack: nothing -> const
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2305
     arg: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2306
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2307
    self pushLong: arg.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2308
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2309
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2310
     Push the long constant <l> (0 or 1) onto the operand stack."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2311
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2312
    "Created: / 17-03-2011 / 15:31:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2313
    "Modified: / 17-03-2011 / 17:03:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2314
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2315
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2316
ldc1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2317
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2318
     Push item from runtime constant pool
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2319
     stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2320
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2321
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2322
    self pushRef: (constantPool at: self fetchIndex).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2323
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2324
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2325
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2326
     The index is an unsigned byte that must be a valid index into the runtime constant
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2327
     pool of the current class (§3.6). The runtime constant pool entry at index either
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2328
     must be a runtime constant of type int or float, or must be a symbolic reference
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2329
     to a string literal (§5.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2330
     If the runtime constant pool entry is a runtime constant of type int or float, the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2331
     numeric value of that runtime constant is pushed onto the operand stack as an int
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2332
     or float, respectively.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2333
     Otherwise, the runtime constant pool entry must be a reference to an instance of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2334
     class String representing a string literal (§5.1). A reference to that instance,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2335
     value, is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2336
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2337
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2338
     The ldc instruction can only be used to push a value of type float taken from the float value set (§3.3.2) because a constant of type float in the constant pool (§4.4.4) must be taken from the float value set."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2339
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2340
    "Modified: / 14-03-2011 / 16:04:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2341
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2342
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2343
ldc2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2344
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2345
     push item from runtime constant pool (wide index)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2346
     stack: .. -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2347
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2348
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2349
    self pushRef: (constantPool at: self fetchIndex2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2350
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2351
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2352
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2353
     The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2354
     index into the runtime constant pool of the current class (§3.6), where the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2355
     value of the index is calculated as (indexbyte1 << 8) | indexbyte2. The index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2356
     must be a valid index into the runtime constant pool of the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2357
     The runtime constant pool entry at the index either must be a runtime constant
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2358
     of type int or float, or must be a symbolic reference to a string literal (§5.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2359
     If the runtime constant pool entry is a runtime constant of type int or float,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2360
     the numeric value of that runtime constant is pushed onto the operand stack as
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2361
     an int or float, respectively.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2362
     Otherwise, the runtime constant pool entry must be a reference to an instance
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2363
     of class String representing a string literal (§5.1). A reference to that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2364
     instance, value, is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2365
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2366
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2367
     The ldc_w instruction is identical to the ldc instruction except for its wider
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2368
     runtime constant pool index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2369
     The ldc_w instruction can only be used to push a value of type float taken from
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2370
     the float value set (§3.3.2) because a constant of type float in the constant
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2371
     pool (§4.4.4) must be taken from the float value set."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2372
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2373
    "Modified: / 28-03-2011 / 18:04:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2374
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2375
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2376
ldc2w
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2377
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2378
Push long or double from runtime constant pool (wide index)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2379
stack: .. -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2380
args: indexByte1 indexByte2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2381
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2382
self ldc2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2383
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2384
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2385
The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit index 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2386
into the runtime constant pool of the current class (§3.6), where the value of the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2387
index is calculated as (indexbyte1 << 8) | indexbyte2. The index must be a valid 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2388
index into the runtime constant pool of the current class. The runtime constant pool 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2389
entry at the index must be a runtime constant of type long or double (§5.1). The 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2390
numeric value of that runtime constant is pushed onto the operand stack as a long 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2391
or double, respectively.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2392
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2393
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2394
Only a wide-index version of the ldc2_w instruction exists; there is no ldc2 instruction 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2395
that pushes a long or double with a single-byte index.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2396
The ldc2_w instruction can only be used to push a value of type double taken from the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2397
double value set (§3.3.2) because a constant of type double in the constant pool (§4.4.5) 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2398
must be taken from the double value set.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2399
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2400
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2401
    "Modified: / 27-03-2011 / 21:12:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2402
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2403
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2404
ldiv
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2405
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2406
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2407
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2408
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2409
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2410
lload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2411
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2412
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2413
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2414
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2415
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2416
lload: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2417
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2418
Load long from local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2419
stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2420
args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2421
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2422
    self pushLong: (context at: idx + 1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2423
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2424
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2425
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2426
     The index is an unsigned byte. Both index and index + 1 must be indices
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2427
     into the local variable array of the current frame (§3.6). The local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2428
     at index must contain a long. The value of the local variable at index is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2429
     pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2430
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2431
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2432
     The lload opcode can be used in conjunction with the wide instruction to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2433
     access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2434
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2435
    "Modified: / 13-03-2011 / 17:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2436
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2437
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2438
lmul
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2439
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2440
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2441
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2442
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2443
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2444
lneg
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2445
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2446
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2447
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2448
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2449
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2450
lookupswtch
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2451
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2452
     Access jump table by key match and jump
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2453
     stack: key -> ..
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2454
     args: insane"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2455
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2456
    | key  jmpDest  default  npairs   result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2457
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2458
    key := self pop asInteger.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2459
    self skipPadding.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2460
    default := self fetchBytes4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2461
    npairs := self fetchBytes4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2462
    npairs
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2463
        timesRepeat: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2464
            [ 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2465
            key = self fetchBytes4
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2466
                ifTrue: [ jmpDest := self fetchBytes4 ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2467
                ifFalse: [ self fetchBytes4 ] ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2468
    jmpDest ifNil: [ jmpDest := default. ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2469
        self relativeJump: jmpDest.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2470
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2471
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2472
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2473
     A lookupswitch is a variable-length instruction. Immediately after the lookupswitch
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2474
     opcode, between zero and three null bytes (zeroed bytes, not the null object) are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2475
     inserted as padding. The number of null bytes is chosen so that the defaultbyte1 begins
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2476
     at an address that is a multiple of four bytes from the start of the current method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2477
     (the opcode of its first instruction). Immediately after the padding follow a series
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2478
     of signed 32-bit values: default, npairs, and then npairs pairs of signed 32-bit values.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2479
     The npairs must be greater than or equal to 0. Each of the npairs pairs consists of an
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2480
     int match and a signed 32-bit offset. Each of these signed 32-bit values is constructed
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2481
     from four unsigned bytes as (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2482
     The table match-offset pairs of the lookupswitch instruction must be sorted in increasing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2483
     numerical order by match.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2484
     The key must be of type int and is popped from the operand stack. The key is compared
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2485
     against the match values. If it is equal to one of them, then a target address is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2486
     calculated by adding the corresponding offset to the address of the opcode of this
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2487
     lookupswitch instruction. If the key does not match any of the match values, the target
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2488
     address is calculated by adding default to the address of the opcode of this lookupswitch
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2489
     instruction. Execution then continues at the target address.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2490
     The target address that can be calculated from the offset of each match-offset pair, as
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2491
     well as the one calculated from default, must be the address of an opcode of an instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2492
     within the method that contains this lookupswitch instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2493
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2494
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2495
     The alignment required of the 4-byte operands of the lookupswitch instruction guarantees
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2496
     4-byte alignment of those operands if and only if the method that contains the lookupswitch
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2497
     is positioned on a 4-byte boundary.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2498
     The match-offset pairs are sorted to support lookup routines that are quicker than linear
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2499
     search."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2500
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2501
    "Modified: / 21-03-2011 / 18:38:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2502
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2503
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2504
lor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2505
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2506
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2507
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2508
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2509
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2510
lrem
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2511
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2512
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2513
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2514
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2515
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2516
lreturn
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2517
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2518
     Return long from method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2519
     stack: value -> empty
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2520
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2521
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2522
    self leaveProcessorWith: (self pop).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2523
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2524
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2525
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2526
     The current method must have return type long. The value must be of type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2527
     long. If the current method is a synchronized method, the monitor acquired
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2528
     or reentered on invocation of the method is released or exited (respectively)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2529
     as if by execution of a monitorexit instruction. If no exception is thrown,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2530
     value is popped from the operand stack of the current frame (§3.6) and pushed
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2531
     onto the operand stack of the frame of the invoker. Any other values on the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2532
     operand stack of the current method are discarded.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2533
     The interpreter then returns control to the invoker of the method, reinstating
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2534
     the frame of the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2535
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2536
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2537
     If the current method is a synchronized method and the current thread is not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2538
     the owner of the monitor acquired or reentered on invocation of the method,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2539
     lreturn throws an IllegalMonitorStateException. This can happen, for example,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2540
     if a synchronized method contains a monitorexit instruction, but no monitorenter
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2541
     instruction, on the object on which the method is synchronized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2542
     Otherwise, if the virtual machine implementation enforces the rules on structured
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2543
     use of locks described in Section 8.13 and if the first of those rules is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2544
     violated during invocation of the current method, then lreturn throws an
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2545
     IllegalMonitorStateException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2546
    "Created: / 14-03-2011 / 13:40:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2547
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2548
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2549
lshl
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2550
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2551
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2552
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2553
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2554
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2555
lshr
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2556
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2557
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2558
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2559
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2560
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2561
lstore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2562
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2563
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2564
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2565
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2566
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2567
lstore: idx 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2568
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2569
     Store long into local variable
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2570
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2571
     args: index"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2572
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2573
    self istore: idx.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2574
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2575
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2576
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2577
     The index is an unsigned byte. Both index and index + 1 must be indices
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2578
     into the local variable array of the current frame (§3.6). The value on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2579
     the top of the operand stack must be of type long. It is popped from the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2580
     operand stack, and the local variables at index and index + 1 are set to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2581
     value.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2582
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2583
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2584
     The lstore opcode can be used in conjunction with the wide instruction to
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2585
     access a local variable using a two-byte unsigned index."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2586
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2587
    "Modified: / 14-03-2011 / 17:55:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2588
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2589
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2590
lsub
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2591
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2592
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2593
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2594
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2595
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2596
lushr
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2597
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2598
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2599
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2600
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2601
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2602
lxor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2603
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2604
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2605
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2606
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2607
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2608
monenter
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2609
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2610
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2611
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2612
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2613
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2614
monexit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2615
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2616
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2617
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2618
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2619
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2620
multianewarray
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2621
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2622
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2623
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2624
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2625
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2626
new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2627
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2628
     Create new object
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2629
     stack: nothing -> objectRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2630
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2631
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2632
    | classRef  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2633
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2634
    classRef := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2635
    self breakPoint:#mh_instructions.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2636
    result := (JavaVM classForName: classRef name) new.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2637
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2638
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2639
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2640
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2641
     the runtime constant pool of the current class (§3.6), where the value of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2642
     the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2643
     at the index must be a symbolic reference to a class, array, or interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2644
     type. The named class, array, or interface type is resolved (§5.4.3.1) and
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2645
     should result in a class type (it should not result in an array or interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2646
     type). Memory for a new instance of that class is allocated from the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2647
     garbage-collected heap, and the instance variables of the new object are
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2648
     initialized to their default initial values (§2.5.1). The objectref, a reference
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2649
     to the instance, is pushed onto the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2650
     On successful resolution of the class, it is initialized (§5.5) if it has not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2651
     already been initialized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2652
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2653
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2654
     During resolution of the symbolic reference to the class, array, or interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2655
     type, any of the exceptions documented in Section 5.4.3.1 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2656
     Otherwise, if the symbolic reference to the class, array, or interface type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2657
     resolves to an interface or is an abstract class, new throws an InstantiationError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2658
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2659
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2660
     Otherwise, if execution of this new instruction causes initialization of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2661
     referenced class, new may throw an Error as detailed in Section 2.17.5.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2662
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2663
     Note
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2664
     The new instruction does not completely create a new instance; instance creation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2665
     is not completed until an instance initialization method has been invoked on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2666
     the uninitialized instance."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2667
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2668
    "Created: / 25-02-2011 / 00:17:39 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2669
    "Modified: / 24-02-2011 / 22:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2670
    "Modified: / 13-03-2011 / 17:18:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2671
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2672
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2673
newarray
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2674
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2675
     Create new array
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2676
     stack: count -> arrayRef
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2677
     args: arrayType"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2678
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2679
    | type  size |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2680
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2681
    type := self fetchByte.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2682
    size := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2683
    type = 4 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'boolean' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2684
    type = 5 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'char' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2685
    type = 6 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'float' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2686
    type = 7 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'double' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2687
    type = 8 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'byte' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2688
    type = 9 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'short' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2689
    type = 10 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'int' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2690
    type = 11 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'long' sized: size ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2691
    self halt: 'Type not recognized - tell mh'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2692
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2693
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2694
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2695
The count must be of type int. It is popped off the operand stack. The count represents 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2696
the number of elements in the array to be created.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2697
The atype is a code that indicates the type of array to create. It must take one of the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2698
following values:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2699
Array Type   atype
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2700
T_BOOLEAN    4
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2701
T_CHAR   5
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2702
T_FLOAT  6
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2703
T_DOUBLE     7
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2704
T_BYTE   8
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2705
T_SHORT  9
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2706
T_INT    10
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2707
T_LONG   11
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2708
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2709
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2710
A new array whose components are of type atype and of length count is allocated 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2711
from the garbage-collected heap. A reference arrayref to this new array object is pushed 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2712
into the operand stack. Each of the elements of the new array is initialized to the 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2713
default initial value for the type of the array (§2.5.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2714
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2715
Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2716
If count is less than zero, newarray throws a NegativeArraySizeException.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2717
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2718
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2719
In Sun's implementation of the Java virtual machine, arrays of type boolean (atype 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2720
is T_BOOLEAN) are stored as arrays of 8-bit values and are manipulated using the baload 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2721
and bastore instructions, instructions that also access arrays of type byte. Other 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2722
implementations may implement packed boolean arrays; the baload and bastore instructions 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2723
must still be used to access those arrays.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2724
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2725
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2726
    "Created: / 14-03-2011 / 18:24:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2727
    "Modified: / 27-03-2011 / 21:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2728
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2729
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2730
nop
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2731
"Do nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2732
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2733
    "Created: / 14-03-2011 / 18:52:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2734
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2735
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2736
pop1
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2737
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2738
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2739
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2740
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2741
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2742
pop2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2743
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2744
     Pop the top one or two operand stack values
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2745
    stack v1: value2 value1 -> nothing                      where each of value1 and value2 is a value of a category 1 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2746
    stack v2: value -> nothing                              where value is a value of a category 2 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2747
    args: nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2748
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2749
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2750
    sp := sp - 2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2751
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2752
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2753
Pop the top one or two values from the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2754
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2755
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2756
    "Modified: / 13-03-2011 / 17:20:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2757
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2758
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2759
putfield
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2760
    "Set field in object
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2761
     stack: objectRef value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2762
     args: indexbyte1 indexbyte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2763
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2764
    | newValue  fieldOwner  fieldref |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2765
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2766
    newValue := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2767
    fieldOwner := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2768
    fieldref := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2769
    fieldref resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2770
    fieldOwner instVarAt: fieldref offset put: newValue.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2771
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2772
    "Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2773
     The unsigned indexbyte1 and indexbyte2 are used to construct an index
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2774
     into the runtime constant pool of the current class (§3.6), where the value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2775
     of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2776
     item at that index must be a symbolic reference to a field (§5.1), which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2777
     gives the name and descriptor of the field as well as a symbolic reference
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2778
     to the class in which the field is to be found. The class of objectref must
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2779
     not be an array. If the field is protected (§4.6), and it is either a member
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2780
     of the current class or a member of a superclass of the current class, then
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2781
     the class of objectref must be either the current class or a subclass of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2782
     the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2783
         The referenced field is resolved (§5.4.3.2). The type of a value stored
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2784
     by a putfield instruction must be compatible with the descriptor of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2785
     referenced field (§4.3.2). If the field descriptor type is boolean, byte,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2786
     char, short, or int, then the value must be an int. If the field descriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2787
     type is float, long, or double, then the value must be a float, long, or
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2788
     double, respectively. If the field descriptor type is a reference type, then
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2789
     the value must be of a type that is assignment compatible (§2.6.7) with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2790
     field descriptor type. If the field is final, it should be declared in the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2791
     current class. Otherwise, an IllegalAccessError is thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2792
         The value and objectref are popped from the operand stack. The objectref
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2793
     must be of type reference. The value undergoes value set conversion (§3.8.3),
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2794
     resulting in value', and the referenced field in objectref is set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2795
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2796
         Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2797
         During resolution of the symbolic reference to the field, any of the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2798
     exceptions pertaining to field resolution documented in Section 5.4.3.2 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2799
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2800
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2801
         Otherwise, if the resolved field is a static field, putfield throws
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2802
     an IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2803
         Otherwise, if the field is final, it must be declared in the current
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2804
     class. Otherwise, an IllegalAccessError is thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2805
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2806
         Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2807
         Otherwise, if objectref is null, the putfield instruction throws a NullPointerException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2808
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2809
    "Modified: / 04-06-2011 / 18:14:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2810
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2811
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2812
putstatic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2813
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2814
     Set static field in class
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2815
     stack: value -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2816
     args: indexByte1 indexByte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2817
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2818
    | newValue  fieldref |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2819
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2820
    newValue := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2821
    fieldref := constantPool at: self fetchIndex2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2822
    fieldref resolveStatic.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2823
    fieldref owner instVarAt: fieldref offset put: newValue.  
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2824
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2825
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2826
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2827
     The unsigned indexbyte1 and indexbyte2 are used to construct an index into
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2828
     the runtime constant pool of the current class (§3.6), where the value of
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2829
     the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2830
     item at that index must be a symbolic reference to a field (§5.1), which
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2831
     gives the name and descriptor of the field as well as a symbolic reference
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2832
     to the class or interface in which the field is to be found. The referenced
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2833
     field is resolved (§5.4.3.2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2834
     On successful resolution of the field the class or interface that declared
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2835
     the resolved field is initialized (§5.5) if that class or interface has not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2836
     already been initialized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2837
     The type of a value stored by a putstatic instruction must be compatible with
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2838
     the descriptor of the referenced field (§4.3.2). If the field descriptor type
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2839
     is boolean, byte, char, short, or int, then the value must be an int. If the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2840
     field descriptor type is float, long, or double, then the value must be a float,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2841
     long, or double, respectively. If the field descriptor type is a reference type,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2842
     then the value must be of a type that is assignment compatible (§2.6.7) with
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2843
     the field descriptor type. If the field is final, it should be declared in
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2844
     the current class. Otherwise, an IllegalAccessError is thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2845
     The value is popped from the operand stack and undergoes value set conversion
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2846
     (§3.8.3), resulting in value'. The class field is set to value'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2847
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2848
     Linking Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2849
     During resolution of the symbolic reference to the class or interface field,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2850
     any of the exceptions pertaining to field resolution documented in Section
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2851
     5.4.3.2 can be thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2852
     Otherwise, if the resolved field is not a static (class) field or an interface
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2853
     field, putstatic throws an IncompatibleClassChangeError.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2854
     Otherwise, if the field is final, it must be declared in the current class.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2855
     Otherwise, an IllegalAccessError is thrown.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2856
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2857
     Runtime Exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2858
     Otherwise, if execution of this putstatic instruction causes initialization
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2859
     of the referenced class or interface, putstatic may throw an Error as detailed
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2860
     in Section 2.17.5.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2861
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2862
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2863
     A putstatic instruction may be used only to set the value of an interface field
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2864
     on the initialization of that field. Interface fields may be assigned to only
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2865
     once, on execution of an interface variable initialization expression when the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2866
     interface is initialized (§2.17.4)."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2867
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2868
    "Created: / 24-02-2011 / 23:21:16 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2869
    "Modified: / 24-02-2011 / 22:14:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2870
    "Modified: / 04-06-2011 / 18:14:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2871
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2872
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2873
ret
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2874
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2875
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2876
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2877
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2878
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2879
ret_w
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2880
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2881
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2882
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2883
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2884
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2885
return
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2886
    "Return void from method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2887
     stack: nothing -> nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2888
     args: nothing"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2889
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2890
    self leaveProcessorWith: nil.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2891
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2892
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2893
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2894
     The current method must have return type void. If the current method is a synchronized
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2895
     method, the monitor acquired or reentered on invocation of the method is released or
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2896
     exited (respectively) as if by execution of a monitorexit instruction. If no exception
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2897
     is thrown, any values on the operand stack of the current frame (§3.6) are discarded.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2898
     The interpreter then returns control to the invoker of the method, reinstating the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2899
     frame of the invoker.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2900
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2901
     Runtime Exceptions
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2902
     If the current method is a synchronized method and the current thread is not the owner
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2903
     of the monitor acquired or reentered on invocation of the method, return throws an
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2904
     IllegalMonitorStateException. This can happen, for example, if a synchronized method
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2905
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2906
     contains a monitorexit instruction, but no monitorenter instruction, on the object on
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2907
     which the method is synchronized.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2908
     Otherwise, if the virtual machine implementation enforces the rules on structured use
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2909
     of locks described in Section 8.13 and if the first of those rules is violated during
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2910
     invocation of the current method, then return throws an IllegalMonitorStateException."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2911
    "Created: / 24-02-2011 / 11:38:13 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2912
    "Modified: / 24-02-2011 / 23:10:54 / Marcel Hlopko <hlopik@gmail.com>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2913
    "Modified: / 13-03-2011 / 17:22:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2914
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2915
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2916
saload
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2917
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2918
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2919
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2920
sastore
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2921
    self halt
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2922
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2923
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2924
sipush
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2925
    "pushes a short onto the stack
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2926
     stack: nothing -> value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2927
     args: byte1 byte2"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2928
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2929
    self pushInt: (self fetchBytes2).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2930
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2931
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2932
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2933
     The immediate unsigned byte1 and byte2 values are assembled
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2934
     into an intermediate short where the value of the short is (byte1 << 8) | byte2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2935
     The intermediate value is then sign-extended to an int value. That value is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2936
     pushed onto the operand stack."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2937
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2938
    "Modified: / 17-03-2011 / 17:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2939
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2940
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2941
swap
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2942
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2943
Swap the top two operand stack values
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2944
stack: value2 value1 -> value1 value2
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2945
args: nothing
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2946
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2947
    | v1  v2 |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2948
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2949
    v1 := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2950
    v2 := self pop.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2951
    self pushInt: v1.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2952
    self pushInt: v2.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2953
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2954
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2955
Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2956
Swap the top two values on the operand stack.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2957
The swap instruction must not be used unless value1 and value2 are both 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2958
values of a category 1 computational type (§3.11.1).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2959
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2960
Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2961
The Java virtual machine does not provide an instruction implementing a 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2962
swap on operands of category 2 computational types.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2963
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2964
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2965
    "Modified: / 13-03-2011 / 17:24:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2966
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2967
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2968
tableswtch
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2969
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2970
     Access jump table by index and jump
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2971
     stack: index -> ..
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2972
     args: insane :)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2973
    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2974
    | index  jmpDest  default  low  high  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2975
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2976
    index := self pop asInteger.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2977
    self skipPadding.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2978
    default := self fetchBytes4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2979
    low := self fetchBytes4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2980
    high := self fetchBytes4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2981
    low to: high
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2982
        do: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2983
            [:idx | 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2984
            idx = index 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2985
                ifTrue: [ jmpDest := self fetchBytes4 ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2986
                ifFalse: [ self fetchBytes4 ] ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2987
    jmpDest ifNil: [ jmpDest := default. ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2988
    self relativeJump: jmpDest.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2989
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2990
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2991
     Description
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2992
     A tableswitch is a variable-length instruction. Immediately after the tableswitch opcode,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2993
     between 0 and 3 null bytes (zeroed bytes, not the null object) are inserted as padding.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2994
     The number of null bytes is chosen so that the following byte begins at an address that
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2995
     is a multiple of 4 bytes from the start of the current method (the opcode of its first
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2996
     instruction). Immediately after the padding follow bytes constituting three signed 32-bit
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2997
     values: default, low, and high. Immediately following those bytes are bytes constituting a
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2998
     series of high - low + 1 signed 32-bit offsets. The value low must be less than or equal
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  2999
     to high. The high - low + 1 signed 32-bit offsets are treated as a 0-based jump table.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3000
     Each of these signed 32-bit values is constructed as (byte1 << 24) | (byte2 << 16) |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3001
     (byte3 << 8) | byte4.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3002
     The index must be of type int and is popped from the operand stack. If index is less than
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3003
     low or index is greater than high, then a target address is calculated by adding default
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3004
     to the address of the opcode of this tableswitch instruction. Otherwise, the offset at
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3005
     position index - low of the jump table is extracted. The target address is calculated by
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3006
     adding that offset to the address of the opcode of this tableswitch instruction. Execution
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3007
     then continues at the target address.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3008
     The target address that can be calculated from each jump table offset, as well as the ones
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3009
     that can be calculated from default, must be the address of an opcode of an instruction
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3010
     within the method that contains this tableswitch instruction.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3011
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3012
     Notes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3013
     The alignment required of the 4-byte operands of the tableswitch instruction guarantees 4-byte
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3014
     alignment of those operands if and only if the method that contains the tableswitch starts
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3015
     on a 4-byte boundary."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3016
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3017
    "Modified: / 21-03-2011 / 18:35:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3018
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3019
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3020
wide
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3021
    "raise an error: must be redefined in concrete subclass(es)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3022
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3023
    ^ self shouldImplement
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3024
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3025
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3026
!JavaByteCodeInterpreter methodsFor:'interpretation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3027
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3028
handleAbstractMethod
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3029
self halt: 'Is it allowed to interpret abstract method? I dont think so :)'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3030
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3031
    "Created: / 22-03-2011 / 14:50:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3032
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3033
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3034
interpret: aMethod receiver: aReceiver arguments: args 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3035
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3036
        log: ('Invoking method ' , aMethod name , ' on ' , aReceiver printString
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3037
                , ' with ' , args printString).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3038
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3039
    ^ self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3040
        process: aMethod
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3041
        receiver: aReceiver
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3042
        arguments: args.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3043
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3044
    "Created: / 17-03-2011 / 17:25:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3045
    "Modified: / 28-03-2011 / 18:03:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3046
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3047
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3048
interpretInner: aJavaMethod receiver: aReceiver arguments: anArgs 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3049
    ^ aJavaMethod interpretWithReceiver: aReceiver arguments: anArgs.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3050
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3051
    "Created: / 31-03-2011 / 16:29:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3052
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3053
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3054
!JavaByteCodeInterpreter class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3055
2303
f02352bc0228 fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  3056
version
f02352bc0228 fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  3057
    ^ '$Header: /cvs/stx/stx/libjava/Attic/JavaByteCodeInterpreter.st,v 1.3 2011-11-24 11:54:55 cg Exp $'
f02352bc0228 fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  3058
!
f02352bc0228 fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  3059
2188
e5a515f85710 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
  3060
version_CVS
2303
f02352bc0228 fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  3061
    ^ '$Header: /cvs/stx/stx/libjava/Attic/JavaByteCodeInterpreter.st,v 1.3 2011-11-24 11:54:55 cg Exp $'
2188
e5a515f85710 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
  3062
!
e5a515f85710 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
  3063
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
  3064
version_SVN
2188
e5a515f85710 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
  3065
    ^ '§Id: JavaByteCodeInterpreter.st,v 1.1 2011/08/18 19:06:53 vrany Exp §'
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
  3066
! !