Skip to content

Commit

Permalink
[enhance] qmlCpsRewriter: @atomic ensures a computation is atomic or …
Browse files Browse the repository at this point in the history
…fails at compile time

CHANGELOG The directive @atomic(expr) now checks that the compiler is able to emit an atomic expression computation
  • Loading branch information
OpaOnWindowsNow committed Apr 18, 2012
1 parent cb9930e commit db992a7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions qmlcps/qmlCpsRewriter.ml
Expand Up @@ -918,10 +918,13 @@ let il_of_qml ?(can_skip_toplvl=false) (env:env) (private_env:private_env) (expr
| _ -> assert false (* cannot be parsed *) | _ -> assert false (* cannot be parsed *)
end end


| Q.Directive (_, `atomic, exprs, tys) -> | Q.Directive (_, `atomic, [expr], []) ->
let expr = List.get_only_element exprs in begin match aux_can_skip expr context with
let expr = aux expr context in | (IL.Skip _) as r -> r
IL.Directive (`atomic, [expr], tys) | _ -> QmlError.error (QmlError.Context.expr expr) "The expression cannot be guaranteed to be atomic"
end

| Q.Directive (_, `atomic, _ , _) -> assert false


| Q.Directive (_, `callcc, [expr], _) -> | Q.Directive (_, `callcc, [expr], _) ->
let c = IL.fresh_c () and f_callcc = IL.fresh_v () in let c = IL.fresh_c () and f_callcc = IL.fresh_v () in
Expand Down

0 comments on commit db992a7

Please sign in to comment.