Skip to content

Commit

Permalink
Simpler region types (#110)
Browse files Browse the repository at this point in the history
* simplification

* cleanup
  • Loading branch information
melsman authored Sep 15, 2022
1 parent 7a7d66f commit 288073e
Show file tree
Hide file tree
Showing 35 changed files with 7,540 additions and 8,423 deletions.
36 changes: 18 additions & 18 deletions src/Compiler/Backend/CLOS_EXP.sml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ signature CLOS_EXP =
| FNJMP of {opr: ClosExp, args: ClosExp list, clos: ClosExp option}
| FNCALL of {opr: ClosExp, args: ClosExp list, clos: ClosExp option}
| JMP of {opr: label, args: ClosExp list, reg_vec: ClosExp option, reg_args: ClosExp list,
clos: ClosExp option}
clos: ClosExp option}
| FUNCALL of {opr: label, args: ClosExp list, reg_vec: ClosExp option, reg_args: ClosExp list,
clos: ClosExp option}
clos: ClosExp option}
| LETREGION of {rhos: binder list, body: ClosExp}
| LET of {pat: lvar list, bind: ClosExp, scope: ClosExp}
| RAISE of ClosExp
Expand All @@ -95,18 +95,18 @@ signature CLOS_EXP =
| ASSIGN of sma * ClosExp * ClosExp
| DROP of ClosExp
| RESET_REGIONS of {force: bool,
regions_for_resetting: sma list}
regions_for_resetting: sma list}
| CCALL of {name: string,
args: ClosExp list,
rhos_for_result : ClosExp list}
args: ClosExp list,
rhos_for_result : ClosExp list}
| CCALL_AUTO of {name: string,
args: (ClosExp * foreign_type) list,
res: foreign_type}
args: (ClosExp * foreign_type) list,
res: foreign_type}
| EXPORT of {name: string,
clos_lab: label,
arg: ClosExp * foreign_type * foreign_type}
clos_lab: label,
arg: ClosExp * foreign_type * foreign_type}
| FRAME of {declared_lvars: {lvar: lvar, label: label} list,
declared_excons: {excon: excon, label: label} list}
declared_excons: {excon: excon, label: label} list}

and 'a Switch = SWITCH of ClosExp * ('a * ClosExp) list * ClosExp

Expand Down Expand Up @@ -134,20 +134,20 @@ signature CLOS_EXP =
val enrich : env * env -> bool
val match : env * env -> unit
val restrict : env * {lvars:lvar list,
cons:con list,
excons:excon list} -> env
cons:con list,
excons:excon list} -> env

(* restrict0 : Don't include predeclared regions *)
val restrict0 : env * {lvars:lvar list,
cons:con list,
excons:excon list} -> env
cons:con list,
excons:excon list} -> env
val pu : env Pickle.pu

val cc : env * ((place*pp) at, place*phsize, unit)LambdaPgm -> {main_lab:label,
code:ClosPrg,
env:env,
imports:label list * label list,
exports:label list * label list}
code:ClosPrg,
env:env,
imports:label list * label list,
exports:label list * label list}

type StringTree
val layout_clos_exp : ClosExp -> StringTree
Expand Down
3,415 changes: 1,708 additions & 1,707 deletions src/Compiler/Backend/ClosExp.sml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/Compiler/CompBasis.sml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ structure CompBasis: COMP_BASIS =
val mularefmap1 = Mul.restrict_mularefmap(mularefmap,effectvars)
val drop_env1 = DropRegions.restrict(drop_env,lvars)
val psi_env1 = PhysSizeInf.restrict(psi_env,lvars)
val places = DropRegions.drop_places places
in ({NEnv=NEnv1,
TCEnv=TCEnv1,
EqEnv=EqEnv1,
Expand Down
13 changes: 6 additions & 7 deletions src/Compiler/Compile.sml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ structure Compile: COMPILE =
NONE (*SOME(ref[])*) (* reset occurrences *), NONE
), rse)) rse_con declared_lvars
in
foldl (fn ((excon, SOME(Type, place)), rse) => SpreadExp.RegionStatEnv.declareExcon(excon,(Type,place),rse)
foldl (fn ((excon, SOME mu), rse) => SpreadExp.RegionStatEnv.declareExcon(excon,mu,rse)
| _ => die "rse.excon") rse_temp declared_excons

end handle _ => die "cannot form rse'")
Expand Down Expand Up @@ -436,12 +436,11 @@ structure Compile: COMPILE =
(* Warn against dangling pointers (when Garbage Collection is on) *)
(* ---------------------------------------------------------------------- *)

fun warn_dangling_pointers(rse, psi_pgm) =
fun warn_dangling_pointers (rse, psi_pgm) =
let (* warn against dangling references *)
fun get_place_at(AtInf.ATTOP(rho,pp)) = rho
| get_place_at(AtInf.ATBOT(rho,pp)) = rho
| get_place_at(AtInf.SAT(rho,pp)) = rho
| get_place_at(AtInf.IGNORE) = Effect.toplevel_region_withtype_top
fun get_place_at (AtInf.ATTOP(rho,pp)) = rho
| get_place_at (AtInf.ATBOT(rho,pp)) = rho
| get_place_at (AtInf.SAT(rho,pp)) = rho
in
chat "[Checking for dangling pointers...";
Timing.timing_begin();
Expand Down Expand Up @@ -487,7 +486,7 @@ structure Compile: COMPILE =

fun compile fe (CEnv, Basis, strdecs) : res =
let
val _ = RegionExp.printcount:=1;
(* val _ = RegionExp.printcount:=1; *)
val {NEnv,TCEnv,EqEnv,OEnv,rse,mulenv, mularefmap=Psi,drop_env,psi_env} =
CompBasis.de_CompBasis Basis
val BtoLamb = CompBasisToLamb.mk_CompBasis{NEnv=NEnv,TCEnv=TCEnv,EqEnv=EqEnv,OEnv=OEnv}
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Lambda/LambdaStatSem.sml
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ structure LambdaStatSem: LAMBDA_STAT_SEM =
| _ => die "LET.polymorphic let -- Polymorphism only allowed in FIX.")
else (fn _ => ())

fun check_type_scheme(tyvars, tau, tau') =
fun check_type_scheme (tyvars, tau, tau') =
(eqType "LET" (tau,tau');
check_polymorphism tyvars;
tyvars_not_in_env(tyvars, env))
Expand Down
13 changes: 6 additions & 7 deletions src/Compiler/Regions/AT_INF.sml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ signature AT_INF =
and mul
and qmularefset

datatype 'a at = ATTOP of 'a | ATBOT of 'a | SAT of 'a | IGNORE
datatype 'a at = ATTOP of 'a | ATBOT of 'a | SAT of 'a

val sma : (place, place*mul, qmularefset ref)LambdaPgm -> (place at, place*mul, unit)LambdaPgm

(* In the old storage mode analysis an environment was propagated to later
* program units. Since we must assign storage mode attop to regions passed
* to functions declared outside a program unit, the environment is of no
* use. 13/10/96-Martin
*)
* program units. Since we must assign storage mode attop to regions passed
* to functions declared outside a program unit, the environment is of no
* use. 13/10/96-Martin
*)

type StringTree
val layout_pgm : (place at, place*mul, unit)LambdaPgm -> StringTree
val layout_exp_brief : (place at, place*mul, unit)LambdaExp -> StringTree
val layout_pgm_brief : (place at, place*mul, unit)LambdaPgm -> StringTree
val layout_at : ('a -> StringTree) -> 'a at -> StringTree option
val layout_at : ('a -> StringTree) -> 'a at -> StringTree option
end

Loading

0 comments on commit 288073e

Please sign in to comment.