Skip to content

Commit

Permalink
teach F# 4.0 compiler about future 4.0+ native intrinsics
Browse files Browse the repository at this point in the history
Merge pull request dotnet#16 from dsyme/nativeptr-prep
  • Loading branch information
dsyme authored and latkin committed Jan 16, 2015
1 parent 0242e6d commit 481890d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/fsharp/ilxgen.fs
Expand Up @@ -3137,6 +3137,8 @@ and GenAsmCode cenv cgbuf eenv (il,tyargs,args,returnTys,m) sequel =
| I_stobj (a,b,ILType.TypeVar _) ,[tyarg] -> I_stobj (a,b,tyarg)
| I_ldtoken (ILToken.ILType (ILType.TypeVar _)),[tyarg] -> I_ldtoken (ILToken.ILType (tyarg))
| I_sizeof (ILType.TypeVar _) ,[tyarg] -> I_sizeof (tyarg)
| I_cpobj (ILType.TypeVar _) ,[tyarg] -> I_cpobj (tyarg) // currently unused, added for forward compat, see https://visualfsharp.codeplex.com/SourceControl/network/forks/jackpappas/fsharpcontrib/contribution/7134
| I_initobj (ILType.TypeVar _) ,[tyarg] -> I_initobj (tyarg) // currently unused, added for forward compat, see https://visualfsharp.codeplex.com/SourceControl/network/forks/jackpappas/fsharpcontrib/contribution/7134
| I_ldfld (al,vol,fspec) ,_ -> I_ldfld (al,vol,modFieldSpec fspec)
| I_ldflda (fspec) ,_ -> I_ldflda (modFieldSpec fspec)
| I_stfld (al,vol,fspec) ,_ -> I_stfld (al,vol,modFieldSpec fspec)
Expand Down
18 changes: 16 additions & 2 deletions src/fsharp/pickle.fs
Expand Up @@ -1065,6 +1065,10 @@ let [<Literal>] itag_ldelem_any = 59
let [<Literal>] itag_stelem_any = 60
let [<Literal>] itag_unbox_any = 61
let [<Literal>] itag_ldlen_multi = 62
let [<Literal>] itag_initobj = 63 // currently unused, added for forward compat, see https://visualfsharp.codeplex.com/SourceControl/network/forks/jackpappas/fsharpcontrib/contribution/7134
let [<Literal>] itag_initblk = 64 // currently unused, added for forward compat
let [<Literal>] itag_cpobj = 65 // currently unused, added for forward compat
let [<Literal>] itag_cpblk = 66 // currently unused, added for forward compat

let simple_instrs =
[ itag_add, AI_add;
Expand Down Expand Up @@ -1099,7 +1103,11 @@ let simple_instrs =
itag_localloc, I_localloc;
itag_throw, I_throw;
itag_ldlen, I_ldlen;
itag_rethrow, I_rethrow; ]
itag_rethrow, I_rethrow;
itag_rethrow, I_rethrow;
itag_initblk, I_initblk (Aligned,Nonvolatile);
itag_cpblk, I_cpblk (Aligned,Nonvolatile);
]

let encode_table = Dictionary<_,_>(300, HashIdentity.Structural)
let _ = List.iter (fun (icode,i) -> encode_table.[i] <- icode) simple_instrs
Expand Down Expand Up @@ -1135,7 +1143,11 @@ let decoders =
itag_stobj, u_ILType >> (fun c -> I_stobj (Aligned,Nonvolatile,c));
itag_sizeof, u_ILType >> I_sizeof;
itag_ldlen_multi, u_tup2 u_int32 u_int32 >> (fun (a,b) -> EI_ldlen_multi (a,b));
itag_ilzero, u_ILType >> EI_ilzero; ]
itag_ilzero, u_ILType >> EI_ilzero;
itag_ilzero, u_ILType >> EI_ilzero;
itag_initobj, u_ILType >> I_initobj;
itag_cpobj, u_ILType >> I_cpobj;
]

let decode_tab =
let tab = Array.init 256 (fun n -> (fun st -> ufailwith st ("no decoder for instruction "+string n)))
Expand Down Expand Up @@ -1180,6 +1192,8 @@ let p_ILInstr x st =
| I_sizeof ty -> p_byte itag_sizeof st; p_ILType ty st
| EI_ldlen_multi (n,m) -> p_byte itag_ldlen_multi st; p_tup2 p_int32 p_int32 (n,m) st
| EI_ilzero a -> p_byte itag_ilzero st; p_ILType a st
| I_initobj c -> p_byte itag_initobj st; p_ILType c st
| I_cpobj c -> p_byte itag_cpobj st; p_ILType c st
| i -> pfailwith st (sprintf "the IL instruction '%+A' cannot be emitted" i)
#endif

Expand Down

0 comments on commit 481890d

Please sign in to comment.