rendered paste bodyIndex: ocaml-3.10.2/parsing/lexer.mll===================================================================--- ocaml-3.10.2.orig/parsing/lexer.mll 2005-04-12 01:44:26.000000000 +0900+++ ocaml-3.10.2/parsing/lexer.mll 2008-04-07 04:41:02.000000000 +0900@@ -39,6 +39,7 @@ "as", AS; "assert", ASSERT; "begin", BEGIN;+ "break", BREAK; "class", CLASS; "constraint", CONSTRAINT; "do", DO;Index: ocaml-3.10.2/parsing/parser.mly===================================================================--- ocaml-3.10.2.orig/parsing/parser.mly 2007-11-30 09:53:19.000000000 +0900+++ ocaml-3.10.2/parsing/parser.mly 2008-04-07 04:41:02.000000000 +0900@@ -197,6 +197,7 @@ %token BARBAR %token BARRBRACKET %token BEGIN+%token BREAK %token <char> CHAR %token CLASS %token COLON@@ -919,6 +920,8 @@ { mkexp (Pexp_construct (Lident "()", None, false)) } | BEGIN seq_expr error { unclosed "begin" 1 "end" 3 }+ | BREAK+ { mkexp(Pexp_break) } | LPAREN seq_expr type_constraint RPAREN { let (t, t') = $3 in mkexp(Pexp_constraint($2, t, t')) } | simple_expr DOT label_longidentIndex: ocaml-3.10.2/parsing/parsetree.mli===================================================================--- ocaml-3.10.2.orig/parsing/parsetree.mli 2006-04-05 11:28:13.000000000 +0900+++ ocaml-3.10.2/parsing/parsetree.mli 2008-04-07 04:41:02.000000000 +0900@@ -99,6 +99,7 @@ | Pexp_sequence of expression * expression | Pexp_while of expression * expression | Pexp_for of string * expression * expression * direction_flag * expression+ | Pexp_break | Pexp_constraint of expression * core_type option * core_type option | Pexp_when of expression * expression | Pexp_send of expression * stringIndex: ocaml-3.10.2/parsing/printast.ml===================================================================--- ocaml-3.10.2.orig/parsing/printast.ml 2007-04-26 04:59:29.000000000 +0900+++ ocaml-3.10.2/parsing/printast.ml 2008-04-07 04:41:02.000000000 +0900@@ -264,6 +264,8 @@ expression i ppf e1; expression i ppf e2; expression i ppf e3;+ | Pexp_break ->+ line i ppf "Pexp_break\n"; | Pexp_constraint (e, cto1, cto2) -> line i ppf "Pexp_constraint\n"; expression i ppf e;Index: ocaml-3.10.2/typing/typecore.ml===================================================================--- ocaml-3.10.2.orig/typing/typecore.ml 2008-04-07 04:41:49.000000000 +0900+++ ocaml-3.10.2/typing/typecore.ml 2008-04-07 04:48:39.000000000 +0900@@ -1189,6 +1189,12 @@ exp_loc = sexp.pexp_loc; exp_type = instance Predef.type_unit; exp_env = env }+ | Pexp_break ->+ re {+ exp_desc = Texp_break;+ exp_loc = sexp.pexp_loc;+ exp_type = instance Predef.type_unit;+ exp_env = env } | Pexp_constraint(sarg, sty, sty') -> let (arg, ty') = match (sty, sty') withIndex: ocaml-3.10.2/typing/typedtree.ml===================================================================--- ocaml-3.10.2.orig/typing/typedtree.ml 2008-04-07 04:49:12.000000000 +0900+++ ocaml-3.10.2/typing/typedtree.ml 2008-04-07 04:49:23.000000000 +0900@@ -67,6 +67,7 @@ | Texp_while of expression * expression | Texp_for of Ident.t * expression * expression * direction_flag * expression+ | Texp_break | Texp_when of expression * expression | Texp_send of expression * meth | Texp_new of Path.t * class_declarationIndex: ocaml-3.10.2/typing/typedtree.mli===================================================================--- ocaml-3.10.2.orig/typing/typedtree.mli 2008-04-07 04:49:56.000000000 +0900+++ ocaml-3.10.2/typing/typedtree.mli 2008-04-07 04:50:03.000000000 +0900@@ -66,6 +66,7 @@ | Texp_while of expression * expression | Texp_for of Ident.t * expression * expression * direction_flag * expression+ | Texp_break | Texp_when of expression * expression | Texp_send of expression * meth | Texp_new of Path.t * class_declarationIndex: ocaml-3.10.2/typing/unused_var.ml===================================================================--- ocaml-3.10.2.orig/typing/unused_var.ml 2008-04-07 04:41:12.000000000 +0900+++ ocaml-3.10.2/typing/unused_var.ml 2008-04-07 04:41:25.000000000 +0900@@ -156,6 +156,7 @@ add_vars tbl defined; expression ppf tbl e3; check_rm_vars ppf tbl defined;+ | Pexp_break -> () | Pexp_constraint (e, _, _) -> expression ppf tbl e; | Pexp_when (e1, e2) -> expression ppf tbl e1;Index: ocaml-3.10.2/bytecomp/lambda.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/lambda.ml 2008-04-07 04:53:21.000000000 +0900+++ ocaml-3.10.2/bytecomp/lambda.ml 2008-04-07 05:06:26.000000000 +0900@@ -137,6 +137,7 @@ | Lsequence of lambda * lambda | Lwhile of lambda * lambda | Lfor of Ident.t * lambda * lambda * direction_flag * lambda+ | Lbreak | Lassign of Ident.t * lambda | Lsend of meth_kind * lambda * lambda * lambda list | Levent of lambda * lambda_event@@ -273,6 +274,7 @@ f e1; f e2 | Lfor(v, e1, e2, dir, e3) -> f e1; f e2; f e3+ | Lbreak -> () | Lassign(id, e) -> f e | Lsend (k, met, obj, args) ->@@ -310,7 +312,7 @@ fv := IdentSet.add id !fv | Lvar _ | Lconst _ | Lapply _ | Lprim _ | Lswitch _ | Lstaticraise _- | Lifthenelse _ | Lsequence _ | Lwhile _+ | Lifthenelse _ | Lsequence _ | Lwhile _ | Lbreak | Lsend _ | Levent _ | Lifused _ -> () in free l; !fv @@ -395,6 +397,7 @@ | Lsequence(e1, e2) -> Lsequence(subst e1, subst e2) | Lwhile(e1, e2) -> Lwhile(subst e1, subst e2) | Lfor(v, e1, e2, dir, e3) -> Lfor(v, subst e1, subst e2, dir, subst e3)+ | Lbreak as l -> l | Lassign(id, e) -> Lassign(id, subst e) | Lsend (k, met, obj, args) -> Lsend (k, subst met, subst obj, List.map subst args)Index: ocaml-3.10.2/bytecomp/lambda.mli===================================================================--- ocaml-3.10.2.orig/bytecomp/lambda.mli 2008-04-07 04:52:55.000000000 +0900+++ ocaml-3.10.2/bytecomp/lambda.mli 2008-04-07 04:53:02.000000000 +0900@@ -146,6 +146,7 @@ | Lsequence of lambda * lambda | Lwhile of lambda * lambda | Lfor of Ident.t * lambda * lambda * direction_flag * lambda+ | Lbreak | Lassign of Ident.t * lambda | Lsend of meth_kind * lambda * lambda * lambda list | Levent of lambda * lambda_eventIndex: ocaml-3.10.2/bytecomp/printlambda.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/printlambda.ml 2008-04-07 04:59:41.000000000 +0900+++ ocaml-3.10.2/bytecomp/printlambda.ml 2008-04-07 05:04:28.000000000 +0900@@ -280,6 +280,8 @@ Ident.print param lam lo (match dir with Upto -> "to" | Downto -> "downto") lam hi lam body+ | Lbreak ->+ fprintf ppf "@[<2>(break)@]" | Lassign(id, expr) -> fprintf ppf "@[<2>(assign@ %a@ %a)@]" Ident.print id lam expr | Lsend (k, met, obj, largs) ->Index: ocaml-3.10.2/bytecomp/translcore.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/translcore.ml 2008-04-07 04:50:30.000000000 +0900+++ ocaml-3.10.2/bytecomp/translcore.ml 2008-04-07 04:52:08.000000000 +0900@@ -689,6 +689,7 @@ | Texp_for(param, low, high, dir, body) -> Lfor(param, transl_exp low, transl_exp high, dir, event_before body (transl_exp body))+ | Texp_break -> Lbreak | Texp_when(cond, body) -> event_before cond (Lifthenelse(transl_exp cond, event_before body (transl_exp body),Index: ocaml-3.10.2/bytecomp/simplif.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/simplif.ml 2008-04-07 05:04:57.000000000 +0900+++ ocaml-3.10.2/bytecomp/simplif.ml 2008-04-07 05:08:52.000000000 +0900@@ -73,6 +73,7 @@ | Lfor(v, e1, e2, dir, e3) -> Lfor(v, eliminate_ref id e1, eliminate_ref id e2, dir, eliminate_ref id e3)+ | Lbreak as lam -> lam | Lassign(v, e) -> Lassign(v, eliminate_ref id e) | Lsend(k, m, o, el) ->@@ -140,6 +141,7 @@ | Lsequence(l1, l2) -> count l1; count l2 | Lwhile(l1, l2) -> count l1; count l2 | Lfor(_, l1, l2, dir, l3) -> count l1; count l2; count l3+ | Lbreak -> () | Lassign(v, l) -> (* Lalias-bound variables are never assigned, so don't increase v's refcount *)@@ -249,6 +251,7 @@ | Lwhile(l1, l2) -> Lwhile(simplif l1, simplif l2) | Lfor(v, l1, l2, dir, l3) -> Lfor(v, simplif l1, simplif l2, dir, simplif l3)+ | Lbreak as l -> l | Lassign(v, l) -> Lassign(v, simplif l) | Lsend(k, m, o, ll) -> Lsend(k, simplif m, simplif o, List.map simplif ll) | Levent(l, ev) -> Levent(simplif l, ev)@@ -309,6 +312,7 @@ | Lsequence(l1, l2) -> count l1; count l2 | Lwhile(l1, l2) -> count l1; count l2 | Lfor(_, l1, l2, dir, l3) -> count l1; count l2; count l3+ | Lbreak -> () | Lassign(v, l) -> (* Lalias-bound variables are never assigned, so don't increase v's refcount *)@@ -401,6 +405,7 @@ | Lwhile(l1, l2) -> Lwhile(simplif l1, simplif l2) | Lfor(v, l1, l2, dir, l3) -> Lfor(v, simplif l1, simplif l2, dir, simplif l3)+ | Lbreak as l -> l | Lassign(v, l) -> Lassign(v, simplif l) | Lsend(k, m, o, ll) -> Lsend(k, simplif m, simplif o, List.map simplif ll) | Levent(l, ev) -> Levent(simplif l, ev)Index: ocaml-3.10.2/bytecomp/bytegen.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/bytegen.ml 2008-04-07 05:09:08.000000000 +0900+++ ocaml-3.10.2/bytecomp/bytegen.ml 2008-04-07 05:25:54.000000000 +0900@@ -32,12 +32,13 @@ (**** Operations on compilation environments. ****) let empty_env =- { ce_stack = Ident.empty; ce_heap = Ident.empty; ce_rec = Ident.empty }+ { ce_stack = Ident.empty; ce_blockstack = Stack.create (); ce_heap = Ident.empty; ce_rec = Ident.empty } (* Add a stack-allocated variable *) let add_var id pos env = { ce_stack = Ident.add id pos env.ce_stack;+ ce_blockstack = env.ce_blockstack; ce_heap = env.ce_heap; ce_rec = env.ce_rec } @@ -658,6 +659,8 @@ let lbl_exit = new_label() in let offset = match dir with Upto -> 1 | Downto -> -1 in let comp = match dir with Upto -> Cgt | Downto -> Clt in+ Stack.push lbl_exit env.ce_blockstack;+ let r = comp_expr env start sz (Kpush :: comp_expr env stop (sz+1) (Kpush :: Kpush :: Kacc 2 :: Kintcomp comp :: Kbranchif lbl_exit ::@@ -666,6 +669,12 @@ (Kacc 1 :: Kpush :: Koffsetint offset :: Kassign 2 :: Kacc 1 :: Kintcomp Cneq :: Kbranchif lbl_loop :: Klabel lbl_exit :: add_const_unit (add_pop 2 cont))))+ in+ ignore (Stack.pop env.ce_blockstack);+ r+ | Lbreak ->+ let lbl_exit = Stack.top env.ce_blockstack in+ Kbranch lbl_exit :: cont | Lswitch(arg, sw) -> let (branch, cont1) = make_branch cont in let c = ref (discard_dead_code cont1) in@@ -826,6 +835,7 @@ | id :: rem -> Ident.add id pos (positions (pos + delta) delta rem) in let env = { ce_stack = positions arity (-1) tc.params;+ ce_blockstack = Stack.create (); ce_heap = positions (2 * (tc.num_defs - tc.rec_pos) - 1) 1 tc.free_vars; ce_rec = positions (-2 * tc.rec_pos) 2 tc.rec_vars } in let cont =Index: ocaml-3.10.2/bytecomp/instruct.ml===================================================================--- ocaml-3.10.2.orig/bytecomp/instruct.ml 2008-04-07 05:13:44.000000000 +0900+++ ocaml-3.10.2/bytecomp/instruct.ml 2008-04-07 05:20:02.000000000 +0900@@ -14,8 +14,11 @@ open Lambda +type label = int (* Symbolic code labels *)+ type compilation_env = { ce_stack: int Ident.tbl;+ ce_blockstack: label Stack.t; ce_heap: int Ident.tbl; ce_rec: int Ident.tbl } @@ -45,8 +48,6 @@ | Event_parent of int ref | Event_child of int ref -type label = int (* Symbolic code labels *)- type instruction = Klabel of label | Kacc of intIndex: ocaml-3.10.2/bytecomp/instruct.mli===================================================================--- ocaml-3.10.2.orig/bytecomp/instruct.mli 2008-04-07 05:13:14.000000000 +0900+++ ocaml-3.10.2/bytecomp/instruct.mli 2008-04-07 05:19:22.000000000 +0900@@ -18,8 +18,11 @@ (* Structure of compilation environments *) +type label = int (* Symbolic code labels *)+ type compilation_env = { ce_stack: int Ident.tbl; (* Positions of variables in the stack *)+ ce_blockstack: label Stack.t; ce_heap: int Ident.tbl; (* Structure of the heap-allocated env *) ce_rec: int Ident.tbl } (* Functions bound by the same let rec *) @@ -65,8 +68,6 @@ (* Abstract machine instructions *) -type label = int (* Symbolic code labels *)- type instruction = Klabel of label | Kacc of int