Permalink
Browse files

started to remove native backend

  • Loading branch information...
1 parent 3b08ce0 commit f18bd1ed7fa2fcef05338c34410d1de1cf50fbde @Aqua-Ye Aqua-Ye committed Oct 3, 2012
Showing with 41 additions and 6,978 deletions.
  1. +3 −3 compiler/_tags
  2. +0 −1 compiler/backend_passes.mllib
  3. +1 −1 compiler/backend_passes/_tags
  4. +0 −254 compiler/backend_passes/qmlflatPasses.ml
  5. +0 −64 compiler/backend_passes/qmlflatPasses.mli
  6. +1 −29 compiler/main.ml
  7. +5 −5 compiler/opa/_tags
  8. +0 −250 compiler/opa/qmlflat.ml
  9. +0 −1 compiler/opa/s3Passes.ml
  10. +1 −1 compiler/opa/s3Warnings.ml
  11. +1 −1 compiler/opalib/_tags
  12. +1 −1 compiler/opalib/opaEnv.ml
  13. +0 −14 compiler/qmlflat/_tags
  14. +0 −8 compiler/qmlflat/flat/_tags
  15. +0 −507 compiler/qmlflat/flat/flat_Bsl.ml
  16. +0 −55 compiler/qmlflat/flat/flat_Bsl.mli
  17. +0 −78 compiler/qmlflat/flat/flat_BypassGeneration.ml
  18. +0 −29 compiler/qmlflat/flat/flat_BypassGeneration.mli
  19. +0 −132 compiler/qmlflat/flat/flat_Common.ml
  20. +0 −146 compiler/qmlflat/flat/flat_Common.mli
  21. +0 −157 compiler/qmlflat/flat/flat_DotGeneration.ml
  22. +0 −46 compiler/qmlflat/flat/flat_DotGeneration.mli
  23. +0 −53 compiler/qmlflat/flat/flat_Env.ml
  24. +0 −57 compiler/qmlflat/flat/flat_Env.mli
  25. +0 −281 compiler/qmlflat/flat/flat_ExprGeneration.ml
  26. +0 −36 compiler/qmlflat/flat/flat_ExprGeneration.mli
  27. +0 −44 compiler/qmlflat/flat/flat_Field.ml
  28. +0 −42 compiler/qmlflat/flat/flat_Field.mli
  29. +0 −895 compiler/qmlflat/flat/flat_MatchGeneration.ml
  30. +0 −89 compiler/qmlflat/flat/flat_MatchGeneration.mli
  31. +0 −50 compiler/qmlflat/flat/flat_Opabsl.ml
  32. +0 −48 compiler/qmlflat/flat/flat_Opabsl.mli
  33. +0 −46 compiler/qmlflat/flat/flat_Options.ml
  34. +0 −35 compiler/qmlflat/flat/flat_Options.mli
  35. +0 −86 compiler/qmlflat/flat/flat_RecordGeneration.ml
  36. +0 −59 compiler/qmlflat/flat/flat_RecordGeneration.mli
  37. +0 −117 compiler/qmlflat/flat/flat_Shared.ml
  38. +0 −84 compiler/qmlflat/flat/flat_Shared.mli
  39. +0 −44 compiler/qmlflat/flat/flat_Simple.ml
  40. +0 −44 compiler/qmlflat/flat/flat_Simple.mli
  41. +0 −51 compiler/qmlflat/flat/flat_VTable.ml
  42. +0 −46 compiler/qmlflat/flat/flat_VTable.mli
  43. +0 −30 compiler/qmlflat/flat/flat_Warnings.ml
  44. +0 −174 compiler/qmlflat/flat_Compiler.ml
  45. +0 −72 compiler/qmlflat/flat_Compiler.mli
  46. +0 −711 compiler/qmlflat/flat_Runtime.ml
  47. +0 −459 compiler/qmlflat/flat_Runtime.mli
  48. +0 −112 compiler/qmlflat/qmlFlatServerLib.ml
  49. +0 −84 compiler/qmlflat/qmlFlatServerLib.mli
  50. +0 −265 compiler/qmlflat/serverLib.ml
  51. +0 −18 compiler/qmlflat/serverLib.mli
  52. +0 −18 compiler/qmlflatcompiler.mllib
  53. +0 −3 compiler/qmlflatserver.mllib
  54. +0 −89 lib/plugins/crypto/bslCrypto.ml
  55. +0 −1 lib/plugins/crypto/crypto.opa_plugin
  56. +0 −18 lib/plugins/iconv/bslIconv.ml
  57. +0 −5 lib/plugins/iconv/iconv.ml
  58. +0 −2 lib/plugins/iconv/iconv.opa_plugin
  59. +0 −320 lib/plugins/mail/bslMail.ml
  60. +0 −1 lib/plugins/mail/bslUtils.ml
  61. +0 −2 lib/plugins/mail/mail.opa_plugin
  62. +0 −166 lib/plugins/socket/bslSocket.ml
  63. +0 −1 lib/plugins/socket/bslUtils.ml
  64. +0 −2 lib/plugins/socket/socket.opa_plugin
  65. +0 −168 lib/plugins/unix/bslFile.ml
  66. +0 −155 lib/plugins/unix/bslSys.ml
  67. +0 −73 lib/plugins/unix/bslUnix.ml
  68. +0 −1 lib/plugins/unix/bslUtils.ml
  69. +0 −4 lib/plugins/unix/unix.opa_plugin
  70. +0 −1 lib/stdlib/qmlflat.exclude
  71. +0 −2 tools/build/build_libs
  72. +7 −8 tools/build/build_rules.ml
  73. +0 −1 tools/build/opa-compile-libs.itarget
  74. +0 −1 tools/build/opa-run-libs.itarget
  75. +21 −21 tools/ocamlall.mltop
View
@@ -3,10 +3,10 @@
# COMPILER TAGS
#
-<{backend_passes,buildinfos,compilerlib,jslang,libbsl,libqmlcompil,libtrx,ocamllang,opa,opacapi,opalang,opalib,opatop,passes,passlib,pplib,protocols,qml2js,qml2ocaml,qmlcompilers,qmlcps,qmlflat,qmljsimp,qmlpasses,qmlslicer}>: traverse
+<{backend_passes,buildinfos,compilerlib,jslang,libbsl,libqmlcompil,libtrx,ocamllang,opa,opacapi,opalang,opalib,opatop,passes,passlib,pplib,protocols,qml2js,qml2ocaml,qmlcompilers,qmlcps,qmljsimp,qmlpasses,qmlslicer}>: traverse
-<main.ml>: use_opalib, use_opalang, use_opapasses, use_libqmlcompil, use_qml2ocaml, use_passlib, use_libbsl, use_qml2ocaml, use_qml2js, use_qmlflatcompiler, use_backend_passes, use_opa
+<main.ml>: use_opalib, use_opalang, use_opapasses, use_libqmlcompil, use_qml2ocaml, use_passlib, use_libbsl, use_qml2ocaml, use_qml2js, use_backend_passes, use_opa
-<main.{byte,native}>: thread, use_dynlink, use_graph, use_str, use_cryptokit, use_unix, use_nums, use_zip, use_buildinfos, use_libbase, use_ulex, use_libtrx, use_libqmlcompil, use_libbsl, use_opalib, use_opalang, use_opapasses, use_qmlfakecompiler, use_qmlflatcompiler, use_qml2ocaml, use_qmljsimp, use_qml2js, use_opabsl_for_compiler, use_qmlslicer, use_jslang, use_qmlcpsrewriter, use_ocamllang, use_passlib, use_compilerlib, use_pplib, use_qmlpasses, use_opacapi, use_backend_passes, use_opa
+<main.{byte,native}>: thread, use_dynlink, use_graph, use_str, use_cryptokit, use_unix, use_nums, use_zip, use_buildinfos, use_libbase, use_ulex, use_libtrx, use_libqmlcompil, use_libbsl, use_opalib, use_opalang, use_opapasses, use_qmlfakecompiler, use_qml2ocaml, use_qmljsimp, use_qml2js, use_opabsl_for_compiler, use_qmlslicer, use_jslang, use_qmlcpsrewriter, use_ocamllang, use_passlib, use_compilerlib, use_pplib, use_qmlpasses, use_opacapi, use_backend_passes, use_opa
<main.ml>: with_mlstate_debug
@@ -1,2 +1 @@
compiler/backend_passes/QmljsPasses
-compiler/backend_passes/QmlflatPasses
@@ -4,4 +4,4 @@
<pass_ServerJavascriptOptimization.{ml,mli}>: use_jslang, use_libqmlcompil, use_passlib
-<{qmljsPasses,qmlflatPasses}.{ml,mli}>: use_pplib, use_libqmlcompil, use_opalib, use_qmlslicer, use_passlib, use_opapasses, use_qml2ocaml, use_opalang, use_libbsl, use_qmlfakecompiler, use_ocamllang, use_qmlpasses, use_qml2js, use_jslang, use_qmlflatcompiler, use_opa
+<{qmljsPasses}.{ml,mli}>: use_pplib, use_libqmlcompil, use_opalib, use_qmlslicer, use_passlib, use_opapasses, use_qml2ocaml, use_opalang, use_libbsl, use_qmlfakecompiler, use_ocamllang, use_qmlpasses, use_qml2js, use_jslang, use_opa
@@ -1,254 +0,0 @@
-(*
- Copyright © 2011, 2012 MLstate
-
- This file is part of Opa.
-
- Opa is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License, version 3, as published by
- the Free Software Foundation.
-
- Opa is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
- more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Opa. If not, see <http://www.gnu.org/licenses/>.
-*)
-
-module O = OpaEnv
-module P = Passes
-module PH = PassHandler
-
-type env_QmlCompilation = {
- qmlCompilation_options : Qml2ocamlOptions.argv_options ;
- qmlCompilation_env_ocaml_input : Qml2ocaml.env_ocaml_input ;
-}
-
-type env_OcamlSplitCode = {
- ocamlSplitCode_options : Qml2ocamlOptions.argv_options ;
- ocamlSplitCode_env_ocaml_split : Qml2ocaml.env_ocaml_split ;
-}
-
-type env_OcamlGeneration = {
- ocamlGeneration_options : Qml2ocamlOptions.argv_options ;
- ocamlGeneration_env_ocaml_output : Qml2ocaml.env_ocaml_output ;
-}
-
-type env_OcamlCompilation = {
- ocamlCompilation_returned_code : int ;
-}
-
-let pass_OpaOptionsToQmlOptions ~(options:Passes.opa_options) qml_milkshake =
- (** PASSING OPTIONS TO QML2OCAML : we must absolutly here use the syntax \{ with \} because
- the interface of qmlfake options is unfrozen (and need to stay so) (don't need to update this code) *)
- let argv_options = Qml2ocamlOptions.ArgvOptions.default (OpaEnv.string_of_available_back_end options.OpaEnv.back_end) in
- let argv_options =
- let compilation_directory =
- if options.OpaEnv.build_dir = ""
- then Filename.concat "_build" (File.chop_extension options.OpaEnv.target)
- else options.OpaEnv.build_dir
- in
- let split_ocaml_value =
- let mindeclfile = 20 (* desire *) in
- let maxfiles = 500 (* approximate constraint *) in
- let nb_decl = List.length qml_milkshake.QmlBlender.code in
- let split_for_maxfiles = int_of_float (ceil ((float nb_decl ) /. (float maxfiles))) in
- (* min 2 *) (max mindeclfile split_for_maxfiles)
- in
- let cclib = List.map (Printf.sprintf "-cclib %s") options.OpaEnv.cclib in
- let ccopt = List.map (Printf.sprintf "-ccopt %s") options.OpaEnv.ccopt in
- { argv_options with Qml2ocamlOptions.
- bypass_plugin = options.OpaEnv.bypass_plugin ;
- camlp4o = false ; (* options.OpaEnv.camlp4o *)
- compilation_directory = compilation_directory ; (* options.OpaEnv.build_dir *)
- compile_via_makefile = true; (* not Base.is_windows; *) (** use _build/Makefile except on Windows *)
- cps = options.OpaEnv.cps ;
- cps_toplevel_concurrency = options.OpaEnv.cps_toplevel_concurrency ;
- server_side = true;
- display_schema = options.OpaEnv.dump_dbgen_schema ;
- exe_argv = Option.default [] options.OpaEnv.run_server_options ;
- extra_lib = argv_options.Qml2ocamlOptions.extra_lib @ options.OpaEnv.extralibs ;
- extra_path = OpaEnv.Parameters.server_include_dir @
- (List.map (Filename.concat (Lazy.force InstallDir.getenv)) OpaEnv.Parameters.server_include_mlstate_dir) @
- options.OpaEnv.extrapath ;
- exe_run = Option.is_some options.OpaEnv.run_server_options ;
- hacker_mode = options.OpaEnv.hacker_mode ;
- makefile_rule = options.OpaEnv.makefile_rule ;
- mlcopt = argv_options.Qml2ocamlOptions.mlcopt @ options.OpaEnv.mlcopt @ ccopt ;
- mllopt = argv_options.Qml2ocamlOptions.mllopt @ options.OpaEnv.mllopt @ ccopt @ cclib ;
- no_assert = options.OpaEnv.no_assert ;
- ocamlc = options.OpaEnv.ocamlc ;
- ocamlopt = options.OpaEnv.ocamlopt ;
- profile = options.OpaEnv.profile ;
- qml_closure = options.OpaEnv.closure;
- show_compilation = options.OpaEnv.show_compilation ;
- split_ocaml_value = split_ocaml_value ;
- target = options.OpaEnv.target ;
- (* hack for "cannot generalize"; in rare cases of Opa code helps, and can be complementary with eta_expand *)
- top_magic = true ;
- } in
- argv_options
-
-let pass_QmlCompiler ~(options:Passes.opa_options) (env:Passes.env_NewFinalCompile) : Passes.env_BinaryGeneration =
- let qml_milkshake = env.Passes.newFinalCompile_qml_milkshake in
- let env_bsl = env.Passes.newFinalCompile_bsl in
- let argv_options = pass_OpaOptionsToQmlOptions ~options qml_milkshake in
- (** Choice of back-end *)
- let qml_to_ocaml = Flat_Compiler.qml_to_ocaml in
- (* This pass is splitten in 3 in opas3 *)
- let return = Qml2ocaml.Sugar.for_opa qml_to_ocaml argv_options env_bsl qml_milkshake in
- let out = {
- Passes.binaryGeneration_success = return = 0
- }
- in let () = if return <> 0 then prerr_endline "OCAML COMPILER FAIL"
- in out
-
-let pass_QmlCompilation =
- let transform pass_env =
- let options = pass_env.PH.options in
- let env = pass_env.PH.env in
- (* get env entities *)
- let qml2ocaml_env_bsl = env.Passes.newFinalCompile_bsl in
- let qml2ocaml_qml_milkshake = env.Passes.newFinalCompile_qml_milkshake in
- (* renaming is not used *)
- (* 1) transform options *)
- let qmlCompilation_options = pass_OpaOptionsToQmlOptions ~options qml2ocaml_qml_milkshake in
- (* 2) selection of the back-end *)
- let qml_to_ocaml = Flat_Compiler.qml_to_ocaml in
- (* proceed *)
- let qmlCompilation_env_ocaml_input = qml_to_ocaml qmlCompilation_options qml2ocaml_env_bsl qml2ocaml_qml_milkshake in
- (* build env *)
- let qmlCompilation_env =
- {
- qmlCompilation_options = qmlCompilation_options ;
- qmlCompilation_env_ocaml_input = qmlCompilation_env_ocaml_input
- }
- in
- let empty _ = [] in
- {
- pass_env with PassHandler.
- env = qmlCompilation_env ;
- printers = OcamlTrack.printers (fun env -> env.qmlCompilation_env_ocaml_input.Qml2ocaml.ocaml_code) ;
- trackers = empty
- }
- in
- let invariant =
- [
- (* TODO: add invariants *)
- ] in
- let precond =
- [
- (* TODO: add pre conditions *)
- ] in
- let postcond =
- [
- (* TODO: add pre conditions *)
- ] in
- PassHandler.make_pass ~invariant ~precond ~postcond transform
-
-let pass_OcamlSplitCode =
- let transform pass_env =
- let env = pass_env.PassHandler.env in
- (* get env entities *)
- let ocamlSplitCode_options = env.qmlCompilation_options in
- let qmlCompilation_env_ocaml_input = env.qmlCompilation_env_ocaml_input in
- (* proceed *)
- let ocamlSplitCode_env_ocaml_split =
- Qml2ocaml.OcamlCompilation.ocaml_split_code ocamlSplitCode_options qmlCompilation_env_ocaml_input in
- (* build env *)
- let env = {
- ocamlSplitCode_options = ocamlSplitCode_options ;
- ocamlSplitCode_env_ocaml_split = ocamlSplitCode_env_ocaml_split ;
- }
- in
- let empty _ = [] in
- {
- pass_env with PassHandler.
- env = env ;
- printers = empty ;
- trackers = empty
- }
- in
- let invariant =
- [
- (* TODO: add invariants *)
- ] in
- let precond =
- [
- (* TODO: add pre conditions *)
- ] in
- let postcond =
- [
- (* TODO: add pre conditions *)
- ] in
- PassHandler.make_pass ~invariant ~precond ~postcond transform
-
-let pass_OcamlGeneration =
- let transform pass_env =
- let env = pass_env.PassHandler.env in
- (* get env entities *)
- let ocamlGeneration_options = env.ocamlSplitCode_options in
- let ocamlSplitCode_env_ocaml_split = env.ocamlSplitCode_env_ocaml_split in
- (* proceed *)
- let ocamlGeneration_env_ocaml_output =
- Qml2ocaml.OcamlCompilation.ocaml_generation ocamlGeneration_options ocamlSplitCode_env_ocaml_split in
- (* build env *)
- let ocamlGeneration_env =
- {
- ocamlGeneration_options = ocamlGeneration_options ;
- ocamlGeneration_env_ocaml_output = ocamlGeneration_env_ocaml_output
- }
- in
- let empty _ = [] in
- {
- pass_env with PassHandler.
- env = ocamlGeneration_env ;
- printers = empty ;
- trackers = empty
- }
- in
- let invariant =
- [
- (* TODO: add invariants *)
- ] in
- let precond =
- [
- (* TODO: add pre conditions *)
- ] in
- let postcond =
- [
- (* TODO: add pre conditions *)
- ] in
- PassHandler.make_pass ~invariant ~precond ~postcond transform
-
-let pass_OcamlCompilation =
- let transform pass_env =
- let env = pass_env.PassHandler.env in
- (* get env entities *)
- let ocamlGeneration_options = env.ocamlGeneration_options in
- let ocamlGeneration_env_ocaml_output = env.ocamlGeneration_env_ocaml_output in
- (* proceed *)
- let ocamlCompilation_returned_code =
- Qml2ocaml.OcamlCompilation.ocaml_compilation ocamlGeneration_options ocamlGeneration_env_ocaml_output in
- let empty _ = [] in
- {
- pass_env with PassHandler.
- env = ocamlCompilation_returned_code ;
- printers = empty ;
- trackers = empty ;
- }
- in
- let invariant =
- [
- (* TODO: add invariants *)
- ] in
- let precond =
- [
- (* TODO: add pre conditions *)
- ] in
- let postcond =
- [
- (* TODO: add pre conditions *)
- ] in
- PassHandler.make_pass ~invariant ~precond ~postcond transform
@@ -1,64 +0,0 @@
-(*
- Copyright © 2011, 2012 MLstate
-
- This file is part of Opa.
-
- Opa is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License, version 3, as published by
- the Free Software Foundation.
-
- Opa is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
- more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Opa. If not, see <http://www.gnu.org/licenses/>.
-*)
-
-(* FINAL QMLFLAT COMPILATION *********************)
-
-(**
- Environment returned by the QmlCompilation.
-*)
-type env_QmlCompilation = {
- qmlCompilation_options : Qml2ocamlOptions.argv_options ;
- qmlCompilation_env_ocaml_input : Qml2ocaml.env_ocaml_input ;
-}
-
-(**
- Environment returned after splitting ocaml code into smaller files
-*)
-type env_OcamlSplitCode = {
- ocamlSplitCode_options : Qml2ocamlOptions.argv_options ;
- ocamlSplitCode_env_ocaml_split : Qml2ocaml.env_ocaml_split ;
-}
-
-(**
- Environment returned by the OcamlGeneration.
-*)
-type env_OcamlGeneration = {
- ocamlGeneration_options : Qml2ocamlOptions.argv_options ;
- ocamlGeneration_env_ocaml_output : Qml2ocaml.env_ocaml_output ;
-}
-
-(**
- Environment returned by the OcamlCompilation.
-*)
-type env_OcamlCompilation = {
- ocamlCompilation_returned_code : int ;
-}
-
-val pass_QmlCompilation :
- (Passes.env_NewFinalCompile, env_QmlCompilation) S3Passes.opa_pass
-
-val pass_OcamlSplitCode :
- (env_QmlCompilation, env_OcamlSplitCode) S3Passes.opa_pass
-
-val pass_OcamlGeneration :
- (env_OcamlSplitCode, env_OcamlGeneration) S3Passes.opa_pass
-
-val pass_OcamlCompilation :
- (env_OcamlGeneration, int) S3Passes.opa_pass
-
-(* ***********************************************)
View
@@ -42,34 +42,6 @@ module S2 = Passes
(* S3 implementations. *)
module S3 = S3Passes
-let flat_backend = Compiler.make_backend "qmlflat"
- ~aliases:["native"] (
- PassHandler.make_pass (
- fun e -> e
-
- |> PH.old_if_handler ~if_:If.closure
- "ServerQmlLambdaLifting" (S2.pass_LambdaLifting2 ~typed:false ~side:`server)
-
- |?> (If.constant_sharing,
- "QmlConstantSharing", S3.pass_QmlConstantSharing)
-
- |> PH.old_if_handler ~if_:If.closure
- "ServerQmlUncurry" (S2.pass_QmlUncurry2 ~typed:false ~side:`server)
-
- |?> (If.closure,
- "ServerQmlClosure", S3.pass_ServerQmlClosure)
-
- |+> ("QmlCompilation", QmlflatPasses.pass_QmlCompilation)
-
- |+> ("OcamlSplitCode", QmlflatPasses.pass_OcamlSplitCode)
-
- |+> ("OcamlGeneration", QmlflatPasses.pass_OcamlGeneration)
-
- |+> ("OcamlCompilation", QmlflatPasses.pass_OcamlCompilation)
-
- )
- ) (Some Flat_Compiler.dynloader) BslLanguage.ml Flat_Compiler.register_field_name
-
let js_backend = Compiler.make_backend "qmljs"
~aliases:["node";"js";"nodejs";"node.js"] (
PassHandler.make_pass (
@@ -87,4 +59,4 @@ let js_backend = Compiler.make_backend "qmljs"
)
) None BslLanguage.nodejs ignore
-let () = Compiler.compile([js_backend; flat_backend])
+let () = Compiler.compile([js_backend])
Oops, something went wrong.

0 comments on commit f18bd1e

Please sign in to comment.