File: INTCODECONSSIG.sml

package info (click to toggle)
polyml 5.8.1-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 57,736 kB
  • sloc: cpp: 44,918; ansic: 26,921; asm: 13,495; sh: 4,670; makefile: 610; exp: 525; python: 253; awk: 91
file content (215 lines) | stat: -rw-r--r-- 7,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
(*
    Copyright (c) 2016-18 David C.J. Matthews

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License version 2.1 as published by the Free Software Foundation.
    
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*)

signature INTCODECONSSIG =
sig
    type machineWord = Address.machineWord
    type address = Address.address
    type code
    type opcode
    type labels
    type closureRef

    val opcode_notBoolean: opcode
    val opcode_isTagged: opcode
    and opcode_cellLength: opcode
    and opcode_cellFlags: opcode
    and opcode_clearMutable: opcode
    and opcode_atomicIncr: opcode
    and opcode_atomicDecr: opcode
    and opcode_atomicReset: opcode
    and opcode_longWToTagged: opcode
    and opcode_signedToLongW: opcode
    and opcode_unsignedToLongW: opcode
    and opcode_realAbs: opcode
    and opcode_realNeg: opcode
    and opcode_fixedIntToReal: opcode
    and opcode_fixedIntToFloat: opcode
    and opcode_floatToReal: opcode
    and opcode_floatAbs: opcode
    and opcode_floatNeg: opcode
    
    val opcode_equalWord: opcode
    and opcode_lessSigned: opcode
    and opcode_lessUnsigned: opcode
    and opcode_lessEqSigned: opcode
    and opcode_lessEqUnsigned: opcode
    and opcode_greaterSigned: opcode
    and opcode_greaterUnsigned: opcode
    and opcode_greaterEqSigned: opcode
    and opcode_greaterEqUnsigned: opcode

    val opcode_fixedAdd: opcode
    val opcode_fixedSub: opcode
    val opcode_fixedMult: opcode
    val opcode_fixedQuot: opcode
    val opcode_fixedRem: opcode
    val opcode_fixedDiv: opcode
    val opcode_fixedMod: opcode
    val opcode_wordAdd: opcode
    val opcode_wordSub: opcode
    val opcode_wordMult: opcode
    val opcode_wordDiv: opcode
    val opcode_wordMod: opcode
    val opcode_wordAnd: opcode
    val opcode_wordOr: opcode
    val opcode_wordXor: opcode
    val opcode_wordShiftLeft: opcode
    val opcode_wordShiftRLog: opcode
    val opcode_wordShiftRArith: opcode
    val opcode_allocByteMem: opcode
    val opcode_lgWordEqual: opcode
    val opcode_lgWordLess: opcode
    val opcode_lgWordLessEq: opcode
    val opcode_lgWordGreater: opcode
    val opcode_lgWordGreaterEq: opcode
    val opcode_lgWordAdd: opcode
    val opcode_lgWordSub: opcode
    val opcode_lgWordMult: opcode
    val opcode_lgWordDiv: opcode
    val opcode_lgWordMod: opcode
    val opcode_lgWordAnd: opcode
    val opcode_lgWordOr: opcode
    val opcode_lgWordXor: opcode
    val opcode_lgWordShiftLeft: opcode
    val opcode_lgWordShiftRLog: opcode
    val opcode_lgWordShiftRArith: opcode
    val opcode_realEqual: opcode
    val opcode_realLess: opcode
    val opcode_realLessEq: opcode
    val opcode_realGreater: opcode
    val opcode_realGreaterEq: opcode
    val opcode_realUnordered: opcode
    val opcode_realAdd: opcode
    val opcode_realSub: opcode
    val opcode_realMult: opcode
    val opcode_realDiv: opcode
    val opcode_floatEqual: opcode
    val opcode_floatLess: opcode
    val opcode_floatLessEq: opcode
    val opcode_floatGreater: opcode
    val opcode_floatGreaterEq: opcode
    val opcode_floatUnordered: opcode
    val opcode_floatAdd: opcode
    val opcode_floatSub: opcode
    val opcode_floatMult: opcode
    val opcode_floatDiv: opcode
    val opcode_getThreadId: opcode
    val opcode_allocWordMemory: opcode
    val opcode_alloc_ref: opcode
    val opcode_loadMLWord: opcode
    val opcode_loadMLByte: opcode
    val opcode_loadC8: opcode
    val opcode_loadC16: opcode
    val opcode_loadC32: opcode
    val opcode_loadC64: opcode
    val opcode_loadCFloat: opcode
    val opcode_loadCDouble: opcode
    val opcode_loadUntagged: opcode
    val opcode_storeMLWord: opcode
    val opcode_storeMLByte: opcode
    val opcode_storeC8: opcode
    val opcode_storeC16: opcode
    val opcode_storeC32: opcode
    val opcode_storeC64: opcode
    val opcode_storeCFloat: opcode
    val opcode_storeCDouble: opcode
    val opcode_storeUntagged: opcode
    val opcode_blockMoveWord: opcode
    val opcode_blockMoveByte: opcode
    val opcode_blockEqualByte: opcode
    val opcode_blockCompareByte: opcode
    val opcode_deleteHandler: opcode

    val codeCreate: string * Universal.universal list -> code  (* makes the initial segment. *)

    (* GEN- routines all put a value at the instruction counter and add
      an appropriate amount to it. *)
      
   (* gen... - put instructions and their operands. *)
   val genCallClosure : code -> unit
   val genRaiseEx     : code -> unit
   val genLock        : code -> unit
   val genLdexc       : code -> unit
   val genPushHandler : code -> unit
      
   val genReturn      : int * code -> unit
   val genLocal       : int * code -> unit
   val genIndirect    : int * code -> unit
   val genMoveToVec   : int * code -> unit
   val genSetStackVal : int * code -> unit
   val genCase        : int * code -> labels list
   val genTuple       : int * code -> unit
   val genTailCall    : int * int * code -> unit
   
   val genDoubleToFloat: IEEEReal.rounding_mode option * code -> unit
   and genRealToInt:   IEEEReal.rounding_mode * code -> unit
   and genFloatToInt:  IEEEReal.rounding_mode * code -> unit

   val genRTSCallFast:    int * code -> unit
   val genRTSCallFull:    int * code -> unit
   val genRTSCallFastRealtoReal: code -> unit
   val genRTSCallFastRealRealtoReal: code -> unit
   val genRTSCallFastGeneraltoReal: code -> unit
   val genRTSCallFastRealGeneraltoReal: code -> unit
   val genRTSCallFastFloattoFloat: code -> unit
   val genRTSCallFastFloatFloattoFloat: code -> unit
   val genRTSCallFastGeneraltoFloat: code -> unit
   val genRTSCallFastFloatGeneraltoFloat: code -> unit
   
   val genOpcode: opcode * code -> unit

   (* genEnter instructions are only needed when machine-code routines
      can call interpreted routines or vice-versa. The enterInt instruction
      causes the interpreter to be entered and the argument indicates the
      reason. *)
      
   val genEnterIntCatch : code -> unit
   val genEnterIntCall  : code * int -> unit
      
   (* pushConst - Generates code to push a constant. *)
   val pushConst        : machineWord * code -> unit

   (* Create a container on the stack *)
   val genContainer : int * code -> unit

   (* Create a tuple from a container. *)
   val genTupleFromContainer : int * code -> unit
      
   (* copyCode - Finish up after compiling a function. *)
   val copyCode : code * int * closureRef -> unit
   
   (* putBranchInstruction puts in an instruction which involves
      a forward reference. *)
   datatype jumpTypes = Jump | JumpFalse | SetHandler
   val putBranchInstruction: jumpTypes * labels * code -> unit
   
   val createLabel: unit -> labels
   
   (* Define the position of a label. *)
   val setLabel: labels * code -> unit
   
   val resetStack: int * bool * code -> unit (* Set a pending reset *)
   
    structure Sharing:
    sig
        type code = code
        type opcode = opcode
        type labels = labels
        type closureRef = closureRef
    end
end ;