Skip to content

Commit

Permalink
Fix bad idea in uniqueness system.
Browse files Browse the repository at this point in the history
  • Loading branch information
skaller committed Feb 18, 2024
1 parent f8faed4 commit 148f0e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
13 changes: 8 additions & 5 deletions src/compiler/flx_frontend/flx_getset.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ print_endline ("Find once for expresssion " ^ Flx_print.sbe bsym_table e ^ ", ty
if j = i then
if Flx_list.has_prefix prefix path then
begin
(*
print_endline (" ** Found variable " ^ Flx_print.sbe bsym_table e );
*)
if BidSet.mem ix !b then raise (DuplicateGet (i,path))
else b := BidSet.add ix !b
end
Expand All @@ -107,28 +110,25 @@ print_endline ("Find once for expresssion " ^ Flx_print.sbe bsym_table e ^ ", ty
| BEXPR_coerce ((_,BTYP_uniq t1), BTYP_borrowed t2),_
when t1 = t2
->
(*
begin
if t1 = t2 then
print_endline ("Skipping expression type " ^Flx_print.sbt bsym_table t1 ^ " coerced to borrowed: " ^ Flx_print.sbe bsym_table e)
else
print_endline ("Skipping WEIRD expression coerced to borrowed or shared")
end;
*)
()
(*
| BEXPR_coerce ((_,BTYP_uniq t1), t2),_
when t1 = t2
->
(*
begin
if t1 = t2 then
print_endline ("Skipping expression type uniq " ^Flx_print.sbt bsym_table t1 ^ " coerced to shared: " ^ Flx_print.sbe bsym_table e)
else
print_endline ("Skipping WEIRD expression coerced to borrowed or shared")
end;
*)
()

*)
(*
| BEXPR_apply_prim (i,_,(_,argt)),_
| BEXPR_apply_stack (i,_,(_,argt)),_
Expand Down Expand Up @@ -307,6 +307,9 @@ let share_get_sets bsym_table chain2ix ix2chain bexe =
!bidset

let once_get_gets bsym_table chain2ix ix2chain bexe =
(*
print_endline ("\nGet gets in Instruction " ^ Flx_print.string_of_bexe bsym_table 0 bexe);
*)
let bidset = ref BidSet.empty in
let f_bexpr e =
match e with
Expand Down
1 change: 0 additions & 1 deletion src/test/perf/list_append.fdoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ begin
elapsed2 = time() - start;
eprintln$ "Unique append " + elapsed2.str;
println$ x.len.str;
kill(x); // NOTE: BUG THIS SHOULD NOT BE NEEDED, previous line should kill x.
collect();
end

Expand Down
1 change: 0 additions & 1 deletion src/test/perf/list_rev.fdoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ begin
elapsed2 = time() - start;
eprintln$ "Unique rev " + elapsed2.str;
println$ x.len.str;
kill x; //??????????? Shouldn't the len function kill it?
collect();
end

Expand Down
16 changes: 7 additions & 9 deletions vtest.flx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ begin

fun pNode (var px:&<<Node) =>
(px*.a).str + ", " +
match /* C_hack::cast[opt[&Node]] */ px*.next with
match px*.next with
| None => ";"
| Some px => pNode px
endmatch
Expand All @@ -28,19 +28,17 @@ begin
println$ px.pNode;
end

begin
noinline proc g () {
struct X { x:int; py: &Y; }
struct Y { y:int; }
var py = unbox$ new Y(42);
var px = unbox$ new X (99, py);

var pw = new Y(42);
var px = unbox$ new X (99, pw);
println$ px -> py -> y;
px -> py . y <- 44;
println$ px -> py -> y;

var vpx : &<<X = px; // coerce to vire pointer
var vpx : &<<X = px; // coerce to view pointer
//vpx -> py . y <- 48; // FAILS
end


}
g();

0 comments on commit 148f0e7

Please sign in to comment.