Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/compiler/ElabData/prim/primop.sig
ViewVC logotype

Diff of /sml/trunk/compiler/ElabData/prim/primop.sig

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

sml/trunk/compiler/FLINT/kernel/primop.sig revision 4419, Mon Sep 18 21:53:44 2017 UTC sml/trunk/compiler/Semant/prim/primop.sig revision 4428, Tue Sep 19 17:42:58 2017 UTC
# Line 137  Line 137 
137  datatype cmpop = > | >= | < | <= | LEU | LTU | GEU | GTU | EQL | NEQ  datatype cmpop = > | >= | < | <= | LEU | LTU | GEU | GTU | EQL | NEQ
138                                  | FSGN (* floating point only *)                                  | FSGN (* floating point only *)
139    
140  (*  (* datatype primop:
141   * Various primitive operations.  Those that are designated "inline" are   * Various primitive operations. Those that are designated "inline" (L:) in
142   * expanded into lambda code in terms of other operators,   * the comments are expanded into lambda code in terms of other operators,
143   * as is the "checked=true" version of NUMSUBSCRIPT or NUMUPDATE.   * as are the "checked=true" versions of NUMSUBSCRIPT and NUMUPDATE (L?:).
144   * NUMSUBSCRIPT and NUMUPDATE are for arrays of floats or integers   * "Environmental" primops (occurring in the InLine structure) are indicated
145   * stored WITHOUT boxing or tags.   * by "E:" in the comment.
146   *)   *)
147  datatype primop  datatype primop
148    = ARITH of {oper: arithop, overflow: bool, kind: numkind}    = ARITH of {oper: arithop, overflow: bool, kind: numkind}  (* E: arithmetic ops *)
149    | INLLSHIFT of numkind    | INLLSHIFT of numkind       (* E: left shift *)
150    | INLRSHIFT of numkind    | INLRSHIFT of numkind       (* E: right shift *)
151    | INLRSHIFTL of numkind    | INLRSHIFTL of numkind      (* E: right shift logical *)
152    | CMP of {oper: cmpop, kind: numkind}    | CMP of {oper: cmpop, kind: numkind}  (* generic compare *)
153    
154    | TESTU of int * int    | TESTU of int * int         (* E: conversions to int, e.g. testu_31_31 *)
155    | TEST of int * int    | TEST of int * int          (* E: conversions to int, e.g. test_32_31_w *)
156    | TRUNC of int * int    | TRUNC of int * int         (* E: truncations to smaller int/word, e.g. trunc_32_31_i *)
157    | EXTEND of int * int    | EXTEND of int * int        (* E: extensions to int32, word32 *)
158    | COPY of int * int    | COPY of int * int          (* E: conversions, e.g. copy_32_32_ii *)
159    
160    | TEST_INF of int                     (* inf -> i *)    | TEST_INF of int            (* E: intinf conversions, e.g. test_inf_31 *)
161    | TRUNC_INF of int                    (* inf -> i *)    | TRUNC_INF of int           (* E: intinf truncations, e.g. trunc_inf_31 *)
162    | EXTEND_INF of int                   (* i -> inf *)    | EXTEND_INF of int          (* E: intinf extensions, e.g. extend_8_inf *)
163    | COPY_INF of int                     (* i -> inf *)    | COPY_INF of int            (* E: conversions to intinf, e.g. copy_8_inf *)
164    
165    | ROUND of {floor: bool, fromkind: numkind, tokind: numkind}    | ROUND of {floor: bool, fromkind: numkind, tokind: numkind}       (* E: floor, round *)
166    | REAL of {fromkind: numkind, tokind: numkind}    | REAL of {fromkind: numkind, tokind: numkind}                     (* E: real, real32 *)
167    
168    | NUMSUBSCRIPT of {kind: numkind, checked: bool, immutable: bool}    | NUMSUBSCRIPT of {kind: numkind, checked: bool, immutable: bool}  (* E: L?: ordof, etc. *)
169    | NUMUPDATE of {kind: numkind, checked: bool}    | NUMUPDATE of {kind: numkind, checked: bool}                      (* E: L?: store, etc. *)
170    
171    | SUBSCRIPT                  (* polymorphic array subscript *)    | SUBSCRIPT                  (* E: polymorphic array subscript *)
172    | SUBSCRIPTV                 (* poly vector subscript *)    | SUBSCRIPTV                 (* E: poly vector subscript *)
173    | INLSUBSCRIPT               (* inline poly array subscript *)    | INLSUBSCRIPT               (* E: L: poly array subscript *)
174    | INLSUBSCRIPTV              (* inline poly vector subscript *)    | INLSUBSCRIPTV              (* E: L: poly vector subscript *)
175    | INLMKARRAY                 (* inline poly array creation *)    | INLMKARRAY                 (* E: L: poly array creation *)
176    
177    | PTREQL | PTRNEQ            (* pointer equality *)    | PTREQL | PTRNEQ            (* E: pointer equality *)
178    | POLYEQL | POLYNEQ          (* polymorphic equality *)    | POLYEQL | POLYNEQ          (* E: polymorphic equality *)
179    | BOXED | UNBOXED            (* boxity tests *)    | BOXED | UNBOXED            (* E: boxity tests *)
180    | LENGTH                     (* vector, string, array, ... length *)    | LENGTH                     (* E: vector, string, array, ... length *)
181    | OBJLENGTH                  (* length of arbitrary heap object *)    | OBJLENGTH                  (* E: length of arbitrary heap object *)
182    | CAST    | CAST                       (* E: cast *)
183    | WCAST    | GETHDLR | SETHDLR          (* E: get/set exn handler pointer *)
184    | MARKEXN                    (* mark an exception value with a string *)    | GETVAR | SETVAR            (* E: get/set var register *)
185    | GETHDLR | SETHDLR          (* get/set exn handler pointer *)    | GETPSEUDO | SETPSEUDO      (* E: get/set pseudo registers *)
186    | GETVAR | SETVAR            (* get/set var register *)    | SETMARK | DISPOSE          (* E: capture/dispose frames *)
187    | GETPSEUDO | SETPSEUDO      (* get/set pseudo registers *)    | MAKEREF                    (* E: allocate a ref cell *)
188    | SETMARK | DISPOSE          (* capture/dispose frames *)    | CALLCC | CAPTURE | THROW   (* E: continuation operations *)
189    | MAKEREF                    (* allocate a ref cell *)    | ISOLATE                    (* E: isolating a function *)
190    | CALLCC | CAPTURE | THROW   (* continuation operations *)    | DEREF                      (* E: dereferencing *)
191    | ISOLATE                    (* isolating a function *)    | ASSIGN                     (* E: assignment *)
192    | DEREF                      (* dereferencing *)    | UPDATE                     (* E: array or reference update (maybe boxed) *)
193    | ASSIGN                     (* assignment *)    | INLUPDATE                  (* E: L: array update (maybe boxed) *)
194    | UNBOXEDASSIGN              (* assignment to integer reference *)    | UNBOXEDUPDATE              (* E: update array of integers WITH tags
195    | UPDATE                     (* array update (maybe boxed, so will allocate store-list item) *)                                  * removed by Zhong, put back by Matthias (see FLINT/trans/primopmap.sml) *)
196    | INLUPDATE                  (* inline array update (maybe boxed) *)    | GETTAG                     (* E: extract the tag portion of an
197    | UNBOXEDUPDATE              (* update array of integers WITH tags *)                                  * object's descriptor as an ML int *)
198      | MKSPECIAL                  (* E: make a special object *)
199    | GETTAG                     (* extract the tag portion of an *)    | SETSPECIAL                 (* E: set the state of a special object *)
200                                 (* object's descriptor as an ML int *)    | GETSPECIAL                 (* E: get the state of a special object *)
201    | MKSPECIAL                  (* make a special object *)    | INLMIN of numkind          (* E: L: min *)
202    | SETSPECIAL                 (* set the state of a special object *)    | INLMAX of numkind          (* E: L: max *)
203    | GETSPECIAL                 (* get the state of a special object *)    | INLABS of numkind          (* E: L: abs *)
204    | INLMIN of numkind          (* inline min *)    | INLNOT                     (* E: L: bool not operator *)
205    | INLMAX of numkind          (* inline max *)    | INLCOMPOSE                 (* E: L: compose "op o"  operator *)
206    | INLABS of numkind          (* inline abs *)    | INLBEFORE                  (* E: L: "before" operator *)
207    | INLNOT                     (* inline bool not operator *)    | INLIGNORE                  (* E: L: "ignore" function *)
208    | INLCOMPOSE                 (* inline compose "op o"  operator *)  
209    | INLBEFORE                  (* inline "before" operator *)  (* primops to support new array representations *)
210    | INLIGNORE                  (* inline "ignore" function *)    | NEW_ARRAY0                 (* E: allocate zero-length array header *)
211    | INL_ARRAY                  (* inline polymorphic array allocation *)    | GET_SEQ_DATA               (* E: get data pointer from arr/vec header *)
212    | INL_VECTOR                 (* inline polymorphic vector allocation *)    | SUBSCRIPT_REC              (* E: record subscript operation *)
213    | INL_MONOARRAY of numkind   (* inline monomorphic array allocation *)    | SUBSCRIPT_RAW64            (* E: raw64 subscript operation *)
214    | INL_MONOVECTOR of numkind  (* inline monomorphic vector allocation *)  
215      | INLIDENTITY                (* E: polymorphic identity *)
216    
217      | CVT64                      (* E: convert between external and
218                                    * internal representation of compiler
219                                    * simulated 64-bit scalars, e.g. w64p *)
220    
   | MKETAG                     (* make a new exception tag *)  
   | WRAP                       (* box a value by wrapping it *)  
   | UNWRAP                     (* unbox a value by unwrapping it *)  
 (* Primops to support new array representations *)  
   | NEW_ARRAY0                  (* allocate zero-length array header *)  
   | GET_SEQ_DATA                (* get data pointer from arr/vec header *)  
   | SUBSCRIPT_REC               (* record subscript operation *)  
   | SUBSCRIPT_RAW64             (* raw64 subscript operation *)  
221  (* Primops to support new experimental C FFI. *)  (* Primops to support new experimental C FFI. *)
222    | RAW_LOAD of numkind         (* load from arbitrary memory location *)    | RAW_LOAD of numkind         (* E: load from arbitrary memory location *)
223    | RAW_STORE of numkind        (* store to arbitrary memory location *)    | RAW_STORE of numkind        (* E: store to arbitrary memory location *)
224      (* make a call to a C-function;      (* make a call to a C-function;
225       * The primop carries C function prototype information and specifies       * The primop carries C function prototype information and specifies
226       * which of its (ML-) arguments are floating point. C prototype       * which of its (ML-) arguments are floating point. C prototype
# Line 233  Line 230 
230                     ml_args: ccall_type list,                     ml_args: ccall_type list,
231                     ml_res_opt: ccall_type option,                     ml_res_opt: ccall_type option,
232                     reentrant : bool                     reentrant : bool
233                   } option                   } option  (* E: *)
234     (* Allocate uninitialized storage on the heap.     (* Allocate uninitialized storage on the heap.
235      * The record is meant to hold short-lived C objects, i.e., they      * The record is meant to hold short-lived C objects, i.e., they
236      * are not ML pointers.  The representation is      * are not ML pointers.  The representation is
237      * the same as RECORD with tag tag_raw32 (fblock = false),      * the same as RECORD with tag tag_raw32 or tag_fblock.
     * or tag_fblock (fblock = true).  
238      *)      *)
239    | RAW_RECORD of { fblock: bool }    | RAW_RECORD of { fblock: bool }  (* E: *)
240    
241    (* non-environmental primops (not found in InLine) *)
242    
243    | INLIDENTITY                         (* polymorphic identity *)    | UNBOXEDASSIGN              (* assignment to integer reference *)
244    
245    | CVT64                               (* convert between external and    | WCAST                      (* ? *)
246                                           * internal representation of    | MARKEXN                    (* mark an exception value with a string *)
247                                           * simulated 64-bit scalars *)  
248      | INL_ARRAY                  (* L: polymorphic array allocation *)
249      | INL_VECTOR                 (* L: polymorphic vector allocation *)
250      | INL_MONOARRAY of numkind   (* L: monomorphic array allocation *)
251      | INL_MONOVECTOR of numkind  (* L: monomorphic vector allocation *)
252    
253      | MKETAG                     (* make a new exception tag *)
254      | WRAP                       (* box a value by wrapping it *)
255      | UNWRAP                     (* unbox a value by unwrapping it *)
256    
257  and ccall_type =  and ccall_type =
258      CCI32 |                             (* passed as int32 *)      CCI32 |                             (* passed as int32 *)

Legend:
Removed from v.4419  
changed lines
  Added in v.4428

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0