Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code #14589

Merged
merged 10 commits into from
Jan 13, 2023
57 changes: 0 additions & 57 deletions src/Compiler/AbstractIL/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ let _ =
if logging then
dprintn "* warning: Il.logging is on"

let int_order = LanguagePrimitives.FastGenericComparer<int>

let notlazy v = Lazy<_>.CreateFromValue v

/// A little ugly, but the idea is that if a data structure does not
Expand Down Expand Up @@ -99,8 +97,6 @@ let rec splitNamespaceAux (nm: string) =
let splitNamespace nm =
memoizeNamespaceTable.GetOrAdd(nm, splitNamespaceAux)

let splitNamespaceMemoized nm = splitNamespace nm

// ++GLOBAL MUTABLE STATE (concurrency-safe)
let memoizeNamespaceArrayTable = ConcurrentDictionary<string, string[]>()

Expand Down Expand Up @@ -152,11 +148,6 @@ splitILTypeNameWithPossibleStaticArguments "Foo.Bar,\"1.0\"" = ([| "Foo" |], "Ba
splitILTypeNameWithPossibleStaticArguments "Foo.Bar.Bar,\"1.0\"" = ([| "Foo"; "Bar" |], "Bar,\"1.0\"")
*)

let unsplitTypeName (ns, n) =
match ns with
| [] -> String.concat "." ns + "." + n
| _ -> n

let splitTypeNameRightAux (nm: string) =
let idx = nm.LastIndexOf '.'

Expand Down Expand Up @@ -434,8 +425,6 @@ type AssemblyRefData =
/// Global state: table of all assembly references keyed by AssemblyRefData.
let AssemblyRefUniqueStampGenerator = UniqueStampGenerator<AssemblyRefData>()

let isMscorlib data = data.assemRefName = "mscorlib"

[<Sealed>]
type ILAssemblyRef(data) =
let pkToken key =
Expand Down Expand Up @@ -3249,9 +3238,6 @@ let mkILMethods xs =
let mkILMethodsComputed f = ILMethodDefs f
let emptyILMethods = mkILMethodsFromArray [||]

let filterILMethodDefs f (mdefs: ILMethodDefs) =
ILMethodDefs(fun () -> mdefs.AsArray() |> Array.filter f)

// --------------------------------------------------------------------
// Operations and defaults for modules, assemblies etc.
// --------------------------------------------------------------------
Expand Down Expand Up @@ -3460,11 +3446,6 @@ let mkLdcInt32 i =
else
AI_ldc(DT_I4, ILConst.I4 i)

let tname_CompilerGeneratedAttribute =
"System.Runtime.CompilerServices.CompilerGeneratedAttribute"

let tname_DebuggableAttribute = "System.Diagnostics.DebuggableAttribute"

(* NOTE: ecma_ prefix refers to the standard "mscorlib" *)
let ecmaPublicKey =
PublicKeyToken(Bytes.ofInt32Array [| 0xde; 0xad; 0xbe; 0xef; 0xca; 0xfe; 0xfa; 0xce |])
Expand Down Expand Up @@ -3819,14 +3800,6 @@ let mkILClassCtor impl =
body = notlazy impl
)

// --------------------------------------------------------------------
// Make a virtual method, where the overriding is simply the default
// (i.e. overrides by name/signature)
// --------------------------------------------------------------------

let mk_ospec (ty: ILType, callconv, nm, genparams, formal_args, formal_ret) =
OverridesSpec(mkILMethRef (ty.TypeRef, callconv, nm, genparams, formal_args, formal_ret), ty)

let mkILGenericVirtualMethod (nm, callconv: ILCallingConv, access, genparams, actual_args, actual_ret, impl) =
let attributes =
convertMemberAccess access
Expand Down Expand Up @@ -3953,11 +3926,6 @@ let cdef_cctorCode2CodeOrCreate tag imports f (cd: ILTypeDef) =

cd.With(methods = methods)

let codeOfMethodDef (md: ILMethodDef) =
match md.Code with
| Some x -> x
| None -> failwith "codeOfmdef: not IL"

let mkRefToILMethod (tref, md: ILMethodDef) =
mkILMethRef (tref, md.CallingConv, md.Name, md.GenericParams.Length, md.ParameterTypes, md.Return.Type)

Expand Down Expand Up @@ -4363,10 +4331,6 @@ let computeILEnumInfo (mdName, mdFields: ILFieldDefs) =

let sigptr_get_byte bytes sigptr = Bytes.get bytes sigptr, sigptr + 1

let sigptr_get_bool bytes sigptr =
let b0, sigptr = sigptr_get_byte bytes sigptr
(b0 = 0x01), sigptr

let sigptr_get_u8 bytes sigptr =
let b0, sigptr = sigptr_get_byte bytes sigptr
byte b0, sigptr
Expand Down Expand Up @@ -4490,11 +4454,6 @@ let mkRefToILAssembly (m: ILAssemblyManifest) =
m.Locale
)

let z_unsigned_int_size n =
if n <= 0x7F then 1
elif n <= 0x3FFF then 2
else 3

let z_unsigned_int n =
if n >= 0 && n <= 0x7F then
[| byte n |]
Expand Down Expand Up @@ -4555,8 +4514,6 @@ let ieee32AsBytes i = i32AsBytes (bitsOfSingle i)

let ieee64AsBytes i = i64AsBytes (bitsOfDouble i)

let et_END = 0x00uy
let et_VOID = 0x01uy
let et_BOOLEAN = 0x02uy
let et_CHAR = 0x03uy
let et_I1 = 0x04uy
Expand All @@ -4570,22 +4527,8 @@ let et_U8 = 0x0Buy
let et_R4 = 0x0Cuy
let et_R8 = 0x0Duy
let et_STRING = 0x0Euy
let et_PTR = 0x0Fuy
let et_BYREF = 0x10uy
let et_VALUETYPE = 0x11uy
let et_CLASS = 0x12uy
let et_VAR = 0x13uy
let et_ARRAY = 0x14uy
let et_WITH = 0x15uy
let et_TYPEDBYREF = 0x16uy
let et_I = 0x18uy
let et_U = 0x19uy
let et_FNPTR = 0x1Buy
let et_OBJECT = 0x1Cuy
let et_SZARRAY = 0x1Duy
let et_MVAR = 0x1Euy
let et_CMOD_REQD = 0x1Fuy
let et_CMOD_OPT = 0x20uy

let formatILVersion (version: ILVersionInfo) =
sprintf "%d.%d.%d.%d" (int version.Major) (int version.Minor) (int version.Build) (int version.Revision)
Expand Down
5 changes: 0 additions & 5 deletions src/Compiler/AbstractIL/ilmorph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ and callsig_scoref2scoref_tyvar2ty f x =
and tys_scoref2scoref_tyvar2ty f i =
List.map (ty_scoref2scoref_tyvar2ty f) i

and gparams_scoref2scoref_tyvar2ty f i =
List.map (gparam_scoref2scoref_tyvar2ty f) i

and gparam_scoref2scoref_tyvar2ty _f i = i

and morphILScopeRefsInILTypeRef fscope (tref: ILTypeRef) =
ILTypeRef.Create(scope = fscope tref.Scope, enclosing = tref.Enclosing, name = tref.Name)

Expand Down
3 changes: 0 additions & 3 deletions src/Compiler/AbstractIL/ilnativeres.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ type WCHAR = Char
type WORD = uint16

let inline WORD s = uint16 s
let inline DWORD s = uint32 s
let inline WCHAR s = char s
let inline BYTE s = byte s

type ResourceException(name: string, ?inner: Exception MaybeNull) =
inherit Exception(name, Option.toObj inner)
Expand Down
Loading