Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file config.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2013 Hugo Heuzard
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)open!StdlibmoduleFlag=structletoptims=ref[]letavailable()=List.map~f:fst!optimsleto~name~default=letstate=tryList.assocname!optimswithNot_found->letstate=refdefaultinoptims:=(name,state)::!optims;stateinfun()->!stateletdisables=tryList.assocs!optims:=falsewithNot_found->failwith(Printf.sprintf"The option named %S doesn't exist"s)letenables=tryList.assocs!optims:=truewithNot_found->failwith(Printf.sprintf"The option named %S doesn't exist"s)letpretty=o~name:"pretty"~default:falseletstable_var=o~name:"stable_var"~default:falseletdebuginfo=o~name:"debuginfo"~default:falseletdeadcode=o~name:"deadcode"~default:trueletshortvar=o~name:"shortvar"~default:trueletcompact=o~name:"compact"~default:trueletoptcall=o~name:"optcall"~default:trueletinline=o~name:"inline"~default:trueletstaticeval=o~name:"staticeval"~default:trueletshare_constant=o~name:"share"~default:trueletstrictmode=o~name:"strict"~default:trueletdebugger=o~name:"debugger"~default:trueletgenprim=o~name:"genprim"~default:trueletexcwrap=o~name:"excwrap"~default:trueletimproved_stacktrace=o~name:"with-js-error"~default:falseletinclude_cmis=o~name:"withcmi"~default:trueletwarn_unused=o~name:"warn-unused"~default:falseletinline_callgen=o~name:"callgen"~default:falseletsafe_string=o~name:"safestring"~default:trueletcheck_magic=o~name:"check-magic-number"~default:true(* this does not optimize properly *)letcompact_vardecl=o~name:"vardecl"~default:falseendmoduleParam=structletintdefault=default,int_of_stringletenum:(string*'a)list->_=function|(_,v)::_asl->v,funx->List.assocxl|_->assertfalseletparams:(string*_)listref=ref[]letp~name~desc(default,convert)=assert(not(List.mem_assocname~map:!params));letstate=refdefaultinletset:string->unit=funv->trystate:=convertvwith_->warn"Warning: malformed option %s=%s. IGNORE@."namevinparams:=(name,(set,desc))::!params;fun()->!stateletsetsv=tryfst(List.assocs!params)vwithNot_found->failwith(Printf.sprintf"The option named %S doesn't exist"s)letall()=List.map!params~f:(fun(n,(_,d))->n,d)(* V8 "optimize" switches with less than 128 case.
60 seams to perform well. *)letswitch_max_case=p~name:"switch_size"~desc:"set the maximum number of case in a switch"(int60)lettailcall_max_depth=p~name:"tc_depth"~desc:"set the maximum number of recursive tailcalls defore returning a trampoline"(int50)letconstant_max_depth=p~name:"cst_depth"~desc:"set the maximum depth of generated literal JavaScript values"(int10)typetc=|TcNone|TcTrampoline(* | TcWhile *)lettc_default=TcTrampolinelet_tc_all=tc_default::List.filter[TcNone;TcTrampoline]~f:(Poly.(<>)tc_default)lettailcall_optim=p~name:"tc"~desc:"Set tailcall optimisation"(enum["trampoline",TcTrampoline;(* default *)"none",TcNone])end