Commit 63efa06e authored by Axel Simon's avatar Axel Simon

remove stale UPDATEdecl constructor

parent 738ebf56
......@@ -829,46 +829,6 @@ structure C1 = struct
])
end
end
| emitDecl s (UPDATEdecl {
updateName = name,
updateArg = arg,
updateFields = fs,
updateType = ty
}) =
let
val recVar = #ret (s : state)
val s = registerSymbol (recVar,s)
val s = foldl registerFSymbol s fs
fun fieldName f = Atom.toString (SymbolTable.getAtom (!SymbolTables.fieldTable,f))
val args = map (fn f => (SymMap.lookup (#fieldTypes s,f), f)) fs @ [(OBJvtype, recVar)]
in
if #onlyDecls s then
let
val fTy = emitFunType s (name, args, ty)
val preDecl = !(#preDeclEmit s)
val _ = (#preDeclEmit s) := []
in
align (
preDecl @ [
seq [str "static", space, fTy, str ";"]
])
end
else
align [
seq [str "static", space, emitFunType s (name, args, ty), space, str "{"],
indent 2 (align ([
seq (str "field_tag_t tags[] = " :: list ("{",str o getFieldTag, fs, "};")),
seq [emitSym s recVar, str " = del_fields(s,tags,sizeof(tags)/sizeof(tags[0]),", emitSym s recVar, str ");"]
] @ map (fn f =>
seq [emitSym s recVar, str " = ",
emitAddField s f, str "(s,", str (getFieldTag f), str ", ",
emitSym s f, str ", ", emitSym s recVar, str ");"]) fs
@ [
seq [str "return ", emitSym s recVar, str ";"]
])),
str "}"
]
end
| emitDecl s (CONdecl {
conName = name,
conTag = tag,
......
......@@ -1215,18 +1215,6 @@ structure TypeRefinement = struct
in
lub (s, symType s name, ty)
end
| visitDecl s (UPDATEdecl {
updateName = name,
updateArg = arg,
updateFields = fs,
updateType = _
}) =
let
val fsTys = map (fieldType s) fs
val reTy = lub (s, OBJstype, symType s arg)
in
lub (s, symType s name, FUNstype (reTy, OBJstype, fsTys @ [reTy]))
end
| visitDecl s (CONdecl {
conName = name,
conTag = _,
......@@ -1266,7 +1254,6 @@ structure TypeRefinement = struct
SOME t => t
| NONE => (case SymMap.find (#origDecls s, sym) of
(SOME (FUNCdecl { funcType = ty, ... })) => ty
| (SOME (UPDATEdecl { updateType = ty, ... })) => ty
| (SOME (CONdecl { conType = ty, ... })) => ty
| (SOME (CLOSUREdecl { closureArgs = ts, ... })) => FUNvtype (OBJvtype,true,ts)
| NONE => (TextIO.print ("origType: no type of " ^ SymbolTable.getString(!SymbolTables.varTable, sym) ^ "\n"); raise TypeOptBug)
......@@ -1275,11 +1262,6 @@ structure TypeRefinement = struct
fun getArgTypes s sym = case SymMap.find (#origDecls s, sym) of
SOME (FUNCdecl { funcArgs = args, ... }) =>
map (fn (t,sym) => (t,symType s sym)) args
| SOME (UPDATEdecl { updateName = sym, updateType = t, ... }) =>
(case (t,inlineSType s (symType s sym)) of
(FUNvtype (_,_,vArgs), FUNstype (_,_,sArgs)) => ListPair.zip (vArgs,sArgs)
| (v,s) => (TextIO.print ("getArgTypes: update function " ^ SymbolTable.getString(!SymbolTables.varTable, sym) ^ " has unequal no of args: " ^ Layout.tostring (Imp.PP.vtype v) ^ " and " ^ showSType s ^ "\n"); raise TypeOptBug)
)
| SOME (CONdecl { conName = name, conArg = (_,arg), ... }) =>
[(origType s arg, symType s arg)]
| SOME (CLOSUREdecl { closureName = name, closureArgs = ts, ... }) =>
......@@ -1381,17 +1363,6 @@ structure TypeRefinement = struct
funcRes = res
}
end
| patchDecl s (UPDATEdecl {
updateName = name,
updateArg = arg,
updateFields = fs,
updateType = vtype
}) = UPDATEdecl {
updateName = name,
updateArg = arg,
updateFields = fs,
updateType = adjustType s (vtype, symType s name)
}
| patchDecl s (CONdecl {
conName = name,
conTag = tag,
......@@ -1632,11 +1603,6 @@ structure TypeRefinement = struct
in
()
end
| setArgsToTop (es,s) (UPDATEdecl {
updateArg = sym,
...
}) =
ignore (lub (s, symType s sym, voidsToTop false (inlineSType s (symType s sym))))
| setArgsToTop (es,s) (CONdecl {
conArg = (_,sym),
...
......@@ -2350,11 +2316,7 @@ structure DeadVariables = struct
})
| visitDecl d = d
fun addPure (UPDATEdecl {
updateName = sym,
...
}) = (pureSet := SymSet.add(!pureSet,sym))
| addPure (CONdecl {
fun addPure (CONdecl {
conName = sym,
...
}) = (pureSet := SymSet.add(!pureSet,sym))
......
......@@ -122,12 +122,6 @@ structure Imp = struct
funcBody : block,
funcRes : sym
}
| UPDATEdecl of {
updateName : sym,
updateArg : sym,
updateFields : sym list, (* field symbols *)
updateType : vtype
}
| CONdecl of {
conName : sym,
conTag : sym, (* constructor symbol *)
......@@ -179,7 +173,6 @@ structure Imp = struct
| CONlit of sym
fun getDeclName (FUNCdecl { funcName = name, ... }) = name
| getDeclName (UPDATEdecl { updateName = name, ... }) = name
| getDeclName (CONdecl { conName = name, ... }) = name
| getDeclName (CLOSUREdecl { closureName = name, ... }) = name
......@@ -235,8 +228,6 @@ structure Imp = struct
),
block funcBody
]
| decl (UPDATEdecl { updateName = name, updateArg = arg, updateFields = fs, updateType = t }) =
seq ([vtype t, space, var name, str ";"] @ args ("[",fld, fs, "]") @ [str "(", var arg, str ")"])
| decl (CONdecl { conName = name, conTag = tag, conArg = conArg, conType = t }) =
seq [vtype t, space, var name, str "(", arg conArg, str ");"]
| decl (CLOSUREdecl { closureName = name, closureArgs = ts,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment