[js-of-ocaml] +BR menhir.
Richard W.M. Jones
rjones at fedoraproject.org
Tue Aug 19 16:10:33 UTC 2014
commit 043b738eee32d0ada755998602d3494326efc0c0
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Tue Aug 19 17:04:33 2014 +0100
+BR menhir.
Add 0001-Compiler-fix-with-latest-4.02.patch
0001-Compiler-fix-with-latest-4.02.patch | 203 ++++++++++++++++++++++++++++++
js-of-ocaml.spec | 12 ++-
2 files changed, 214 insertions(+), 1 deletions(-)
---
diff --git a/0001-Compiler-fix-with-latest-4.02.patch b/0001-Compiler-fix-with-latest-4.02.patch
new file mode 100644
index 0000000..270dcb1
--- /dev/null
+++ b/0001-Compiler-fix-with-latest-4.02.patch
@@ -0,0 +1,203 @@
+From 9721f9394e221849555fa64ff0aa57bbd1ee8d73 Mon Sep 17 00:00:00 2001
+From: Hugo Heuzard <hugo.heuzard at gmail.com>
+Date: Thu, 14 Aug 2014 16:52:28 +0200
+Subject: [PATCH] Compiler: fix with latest 4.02
+
+---
+ compiler/instr.ml | 47 ++++++++++++++++++++++++++--------------------
+ compiler/instr.mli | 10 +++++++---
+ compiler/parse_bytecode.ml | 4 ++++
+ runtime/stdlib.js | 7 +++++++
+ 4 files changed, 45 insertions(+), 23 deletions(-)
+
+diff --git a/compiler/instr.ml b/compiler/instr.ml
+index 641456a..1dc80ee 100644
+--- a/compiler/instr.ml
++++ b/compiler/instr.ml
+@@ -19,7 +19,7 @@
+ *)
+
+ type t =
+- ACC0
++ | ACC0
+ | ACC1
+ | ACC2
+ | ACC3
+@@ -111,8 +111,6 @@ type t =
+ | PUSHTRAP
+ | POPTRAP
+ | RAISE
+- | RERAISE
+- | RAISE_NOTRACE
+ | CHECK_SIGNALS
+ | C_CALL1
+ | C_CALL2
+@@ -165,6 +163,12 @@ type t =
+ | GETPUBMET
+ | GETDYNMET
+ | STOP
++ | EVENT
++ | BREAK
++ | RERAISE
++ | RAISE_NOTRACE
++ | FIRST_UNIMPLEMENTED_OP
++
+
+ type kind =
+ | KNullary
+@@ -177,12 +181,18 @@ type kind =
+ | KClosurerec
+ | KClosure
+ | KStop of int
++ | K_will_not_append
+
+ type desc = { code : t; kind : kind; name : string; opcode : int }
+
+ let ops,ops_rev =
+ let ops_rev = Hashtbl.create 17 in
+- let block1 =
++ let if_v4 =
++ match Util.Version.v with
++ `V3 -> (fun _ default -> default)
++ | `V4_02 -> (fun k _ -> k)
++ in
++ let instrs =
+ [| ACC0, KNullary, "ACC0";
+ ACC1, KNullary, "ACC1";
+ ACC2, KNullary, "ACC2";
+@@ -274,12 +284,8 @@ let ops,ops_rev =
+ BOOLNOT, KNullary, "BOOLNOT";
+ PUSHTRAP, KCond_jump, "PUSHTRAP";
+ POPTRAP, KNullary, "POPTRAP";
+- RAISE, KStop 0, "RAISE" |]
+- and block2 =
+- [| RERAISE, KStop 0, "RERAISE";
+- RAISE_NOTRACE, KStop 0, "RAISE_NOTRACE" |]
+- and block3 =
+- [| CHECK_SIGNALS, KNullary, "CHECK_SIGNALS";
++ RAISE, KStop 0, "RAISE";
++ CHECK_SIGNALS, KNullary, "CHECK_SIGNALS";
+ C_CALL1, KUnary, "C_CALL1";
+ C_CALL2, KUnary, "C_CALL2";
+ C_CALL3, KUnary, "C_CALL3";
+@@ -330,19 +336,18 @@ let ops,ops_rev =
+ BUGEINT, KCmp_jump, "BUGEINT";
+ GETPUBMET, KBinary, "GETPUBMET";
+ GETDYNMET, KNullary, "GETDYNMET";
+- STOP, KStop 0, "STOP"|]
+- in
+- let instrs =
+- match Util.Version.v with
+- `V3 -> [block1; block3]
+- | `V4_02 -> [block1; block2; block3]
+- in
++ STOP, KStop 0, "STOP";
++ EVENT, K_will_not_append, "EVENT";
++ BREAK, K_will_not_append, "BREAK";
++ RERAISE, if_v4 (KStop 0) K_will_not_append, "RERAISE";
++ RAISE_NOTRACE, if_v4 (KStop 0) K_will_not_append, "RAISE_NOTRACE";
++ FIRST_UNIMPLEMENTED_OP, K_will_not_append, "FIRST_UNIMPLEMENTED_OP"|] in
+ let ops =
+ Array.mapi
+ (fun i (c, k, n) ->
+ Hashtbl.add ops_rev c i;
+- {code = c; kind = k; name = n; opcode = i})
+- (Array.concat instrs)
++ {code = c; kind = k; name = n; opcode = i}
++ ) instrs
+ in
+ ops,ops_rev
+
+@@ -391,7 +396,9 @@ exception Bad_instruction of int
+ let get_instr code pc =
+ let i = getu code pc in
+ if i < 0 || i >= Array.length ops then raise (Bad_instruction i);
+- ops.(i)
++ let ins = ops.(i) in
++ if ins.kind = K_will_not_append then raise (Bad_instruction i);
++ ins
+
+ (****)
+
+diff --git a/compiler/instr.mli b/compiler/instr.mli
+index ee6eab2..e774be8 100644
+--- a/compiler/instr.mli
++++ b/compiler/instr.mli
+@@ -19,7 +19,7 @@
+ *)
+
+ type t =
+- ACC0
++ | ACC0
+ | ACC1
+ | ACC2
+ | ACC3
+@@ -111,8 +111,6 @@ type t =
+ | PUSHTRAP
+ | POPTRAP
+ | RAISE
+- | RERAISE
+- | RAISE_NOTRACE
+ | CHECK_SIGNALS
+ | C_CALL1
+ | C_CALL2
+@@ -165,6 +163,11 @@ type t =
+ | GETPUBMET
+ | GETDYNMET
+ | STOP
++ | EVENT
++ | BREAK
++ | RERAISE
++ | RAISE_NOTRACE
++ | FIRST_UNIMPLEMENTED_OP
+
+ type kind =
+ | KNullary
+@@ -177,6 +180,7 @@ type kind =
+ | KClosurerec
+ | KClosure
+ | KStop of int
++ | K_will_not_append
+
+ type desc = { code : t; kind : kind; name : string; opcode : int }
+
+diff --git a/compiler/parse_bytecode.ml b/compiler/parse_bytecode.ml
+index 1075611..44d42e6 100644
+--- a/compiler/parse_bytecode.ml
++++ b/compiler/parse_bytecode.ml
+@@ -73,6 +73,7 @@ end = struct
+ scan blocks code (pc + 3) len
+ | KStop n ->
+ scan blocks code (pc + n + 1) len
++ | K_will_not_append -> assert false
+ end
+ else blocks
+
+@@ -1577,6 +1578,9 @@ and compile blocks code limit pc state instrs =
+ Let (meths, Field (obj, 0)) :: instrs)
+ | STOP ->
+ (instrs, Stop, state)
++ | EVENT
++ | BREAK
++ | FIRST_UNIMPLEMENTED_OP -> assert false
+ end
+
+ (****)
+diff --git a/runtime/stdlib.js b/runtime/stdlib.js
+index 72f7628..a5a5f69 100644
+--- a/runtime/stdlib.js
++++ b/runtime/stdlib.js
+@@ -906,3 +906,10 @@ function caml_set_oo_id (b) {
+
+ //Provides: caml_install_signal_handler const
+ function caml_install_signal_handler(){return 0}
++
++
++//Provides: caml_convert_raw_backtrace_slot
++//Requires: caml_failwith
++function caml_convert_raw_backtrace_slot(){
++ caml_failwith("caml_convert_raw_backtrace_slot");
++}
+--
+2.0.4
+
diff --git a/js-of-ocaml.spec b/js-of-ocaml.spec
index 5c3ce3b..1e58d11 100644
--- a/js-of-ocaml.spec
+++ b/js-of-ocaml.spec
@@ -5,7 +5,7 @@
Name: js-of-ocaml
Version: 2.4
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: An OCaml to Javascript compiler
License: LGPLv2+ with exceptions
@@ -15,11 +15,15 @@ Source0: https://github.com/ocsigen/js_of_ocaml/archive/%{commit}/js_of_o
# Allow examples to be built with the distro packaged js-of-ocaml
Source1: Makefile.common.js-of-ocaml.examples
+# Upstream patch to fix build against OCaml 4.02.
+Patch1: 0001-Compiler-fix-with-latest-4.02.patch
+
BuildRequires: ocaml
BuildRequires: ocaml-findlib-devel
BuildRequires: ocaml-ocamldoc
BuildRequires: ocaml-camlp4-devel
BuildRequires: ocaml-lwt >= 2.3.0
+BuildRequires: ocaml-menhir-devel
BuildRequires: chrpath
%description
@@ -47,6 +51,8 @@ reference and examples for %{name}.
%prep
%setup -q -n js_of_ocaml-%{commit}
+%patch1 -p1
+
%build
# Hack to enable debug symbol generation.
@@ -88,6 +94,10 @@ cp -p %{SOURCE1} examples/Makefile.common
%changelog
+* Tue Aug 19 2014 Richard W.M. Jones <rjones at redhat.com> - 2.4-2
+- +BR menhir.
+- Add upstream patch to fix build against OCaml 4.02.
+
* Mon Aug 18 2014 Scott Tsai <scottt.tw at gmail.com> 2.4-1
- New upstream release 2.4
More information about the scm-commits
mailing list