Ignore:
Timestamp:
Mar 21, 2013, 8:11:50 PM (6 years ago)
Author:
sacerdot
Message:

New extraction, several bug fixed. RTL_semantics fixed by hand, will be fixed
automatically when Paolo commits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extracted/joint_semantics.ml

    r2890 r2933  
    19991999  match seq with
    20002000  | Joint.COMMENT x ->
     2001prerr_endline "COMMENT";
    20012002    Obj.magic (Monad.m_return0 (Monad.max_def Errors.res0) st)
    20022003  | Joint.MOVE dst_src ->
     2004prerr_endline "MOVE";
    20032005    Obj.magic
    20042006      (pair_reg_move (Joint.stmt_pars__o__uns_pars__o__u_pars p.spp)
    20052007        p.msu_pars st dst_src)
    20062008  | Joint.POP dst ->
     2009prerr_endline "POP";
    20072010    Obj.magic
    20082011      (Monad.m_bind2 (Monad.max_def Errors.res0)
     
    20122015            p.msu_pars dst v st')))
    20132016  | Joint.PUSH src ->
     2017prerr_endline "PUSH";
    20142018    Obj.magic
    20152019      (Monad.m_bind0 (Monad.max_def Errors.res0)
     
    20192023        Obj.magic (push (msu_pars__o__st_pars p) st v)))
    20202024  | Joint.ADDRESS (id, ldest, hdest) ->
     2025prerr_endline "ADDRESS";
    20212026    let addr_block =
    20222027      Option.opt_safe
     
    20582063                  p.msu_pars dacc_b_reg v2' st'))))))
    20592064  | Joint.OP1 (op, dacc_a, sacc_a) ->
     2065prerr_endline "OP1";
    20602066    Obj.magic
    20612067      (Monad.m_bind0 (Monad.max_def Errors.res0)
     
    20692075              p.msu_pars dacc_a v' st))))
    20702076  | Joint.OP2 (op, dacc_a, sacc_a, src) ->
     2077prerr_endline "OP2";
    20712078    Obj.magic
    20722079      (Monad.m_bind0 (Monad.max_def Errors.res0)
     
    20812088            (Obj.magic (BackEndOps.be_op2 st.carry op v1 v2))
    20822089            (fun v' carry0 ->
     2090(if op = BackEndOps.Sub then
     2091(if carry0 = ByteValues.BBbit Bool.True then prerr_endline "CARRY = 1" else prerr_endline "CARRY = 0"));
    20832092            Monad.m_bind0 (Monad.max_def Errors.res0)
    20842093              (Obj.magic
     
    20882097                (set_carry p.msu_pars.st_pars carry0 st'))))))
    20892098  | Joint.CLEAR_CARRY ->
     2099prerr_endline "CLEAR_CARRY";
    20902100    Obj.magic
    20912101      (Monad.m_return0 (Monad.max_def Errors.res0)
    20922102        (set_carry (msu_pars__o__st_pars p) (ByteValues.BBbit Bool.False) st))
    20932103  | Joint.SET_CARRY ->
     2104prerr_endline "SET_CARRY";
    20942105    Obj.magic
    20952106      (Monad.m_return0 (Monad.max_def Errors.res0)
    20962107        (set_carry (msu_pars__o__st_pars p) (ByteValues.BBbit Bool.True) st))
    20972108  | Joint.LOAD (dst, addrl, addrh) ->
     2109prerr_endline "LOAD";
    20982110    Obj.magic
    20992111      (Monad.m_bind0 (Monad.max_def Errors.res0)
     
    21172129                  p.msu_pars dst v st))))))
    21182130  | Joint.STORE (addrl, addrh, src) ->
     2131prerr_endline "STORE";
    21192132    Obj.magic
    21202133      (Monad.m_bind0 (Monad.max_def Errors.res0)
     
    23112324    __ **)
    23122325let eval_return p globals ge0 curr_id curr_ret st =
     2326prerr_endline "eval_return";
    23132327  Monad.m_bind0 (Monad.max_def Errors.res0)
    23142328    (Obj.magic (p.msu_pars.pop_frame globals ge0 curr_id curr_ret st))
     
    23732387    (match s0 with
    23742388     | Joint.COST_LABEL x ->
     2389prerr_endline "COST";
    23752390       Obj.magic
    23762391         (Monad.m_return0 (Monad.max_def IOMonad.iOMonad) (next p nxt st))
    23772392     | Joint.CALL (f, args, dest) ->
     2393prerr_endline "CALL";
    23782394       Obj.magic (eval_call p g ge0 f args dest nxt st)
    23792395     | Joint.COND (a, l) ->
     2396prerr_endline "COND";
    23802397       IOMonad.err_to_io
    23812398         (Obj.magic
     
    24012418    (match s0 with
    24022419     | Joint.GOTO l ->
     2420prerr_endline "GOTO";
    24032421       IOMonad.err_to_io
    24042422         (goto p g
    24052423           (let p0 = p.spp in let globals = g in let g0 = ge0 in g0.ge) l st)
    24062424     | Joint.RETURN ->
     2425prerr_endline "RETURN";
    24072426       IOMonad.err_to_io
    24082427         (Obj.magic (eval_return p g ge0 curr_id curr_ret st.st_no_pc))
    24092428     | Joint.TAILCALL (f, args) ->
     2429prerr_endline "TAILCALL";
    24102430       Obj.magic (eval_tailcall p g ge0 f args curr_id curr_ret st))
    24112431  | Joint.FCOND (a, lbltrue, lblfalse) ->
     2432prerr_endline "FCOND";
    24122433    IOMonad.err_to_io
    24132434      (Obj.magic
     
    24432464       in
    24442465      Obj.magic x) (fun id fn s ->
     2466prerr_endline ("ID == " ^ string_of_int (Glue.int_of_matitapos id));
     2467       let res =
    24452468      Monad.m_bind0 (Monad.max_def IOMonad.iOMonad)
    24462469        (let x =
     
    24502473        Obj.magic x) (fun st' ->
    24512474        let st'' = set_no_pc (msu_pars__o__st_pars p) st' st in
    2452         Obj.magic (eval_statement_advance p globals ge0 id fn s st''))))
     2475        Obj.magic (eval_statement_advance p globals ge0 id fn s st''))
     2476    in
     2477     match Obj.magic res with
     2478     | Wrong e ->
     2479        print_string "fun_";
     2480        print_int (Glue.int_of_matitapos id);
     2481        print_string ":";
     2482        let point = pc_offset (pc (msu_pars__o__st_pars p) st) in
     2483        print_int (Glue.int_of_matitapos point);
     2484        print_string ":";
     2485        res
     2486     | _ -> res))
    24532487
    24542488(** val is_final :
     
    24862520           | Joint.TAILCALL (x0, x1) -> Obj.magic (Errors.Error List.Nil))
    24872521        | Joint.FCOND (x0, x1, x2) -> Obj.magic (Errors.Error List.Nil))))
    2488 
Note: See TracChangeset for help on using the changeset viewer.