Skip to content

Commit

Permalink
Cosmetic changes in fix to PR#3825: keep using Uprim(Pgetglobal) inst…
Browse files Browse the repository at this point in the history
…ead of the new Ugetglobal

git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.09@7258 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Dec 11, 2005
1 parent 921d4ea commit af0ba3a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
7 changes: 7 additions & 0 deletions Changes
@@ -1,3 +1,10 @@
Objective Caml 3.09.1:
----------------------

Native-code compiler (ocamlopt):
-


Objective Caml 3.09.0:
----------------------

Expand Down
1 change: 0 additions & 1 deletion asmcomp/clambda.ml
Expand Up @@ -41,7 +41,6 @@ type ulambda =
| Ufor of Ident.t * ulambda * ulambda * direction_flag * ulambda
| Uassign of Ident.t * ulambda
| Usend of meth_kind * ulambda * ulambda * ulambda list
| Ugetglobal of string

and ulambda_switch =
{ us_index_consts: int array;
Expand Down
1 change: 0 additions & 1 deletion asmcomp/clambda.mli
Expand Up @@ -41,7 +41,6 @@ type ulambda =
| Ufor of Ident.t * ulambda * ulambda * direction_flag * ulambda
| Uassign of Ident.t * ulambda
| Usend of meth_kind * ulambda * ulambda * ulambda list
| Ugetglobal of string

and ulambda_switch =
{ us_index_consts: int array;
Expand Down
19 changes: 11 additions & 8 deletions asmcomp/closure.ml
Expand Up @@ -36,6 +36,15 @@ let rec build_closure_env env_param pos = function
Tbl.add id (Uprim(Pfield pos, [Uvar env_param]))
(build_closure_env env_param (pos+1) rem)

(* Auxiliary for accessing globals. We change the name of the global
to the name of the corresponding asm symbol. This is done here
and no longer in Cmmgen so that approximations stored in .cmx files
contain the right names if the -for-pack option is active. *)

let getglobal id =
Uprim(Pgetglobal (Ident.create_persistent (Compilenv.symbol_for_global id)),
[])

(* Check if a variable occurs in a [clambda] term. *)

let occurs_var var u =
Expand Down Expand Up @@ -64,7 +73,6 @@ let occurs_var var u =
| Uassign(id, u) -> id = var || occurs u
| Usend(_, met, obj, args) ->
occurs met || occurs obj || List.exists occurs args
| Ugetglobal _ -> false
and occurs_array a =
try
for i = 0 to Array.length a - 1 do
Expand Down Expand Up @@ -131,8 +139,6 @@ let lambda_smaller lam threshold =
| Uprim(prim, args) ->
size := !size + prim_size prim args;
lambda_list_size args
| Ugetglobal _ ->
incr size
| Uswitch(lam, cases) ->
if Array.length cases.us_actions_consts > 1 then size := !size + 5 ;
if Array.length cases.us_actions_blocks > 1 then size := !size + 5 ;
Expand Down Expand Up @@ -175,7 +181,6 @@ let rec is_pure_clambda = function
Pccall _ | Praise | Poffsetref _ | Pstringsetu | Pstringsets |
Parraysetu _ | Parraysets _ | Pbigarrayset _), _) -> false
| Uprim(p, args) -> List.for_all is_pure_clambda args
| Ugetglobal _ -> true
| _ -> false

(* Simplify primitive operations on integers *)
Expand Down Expand Up @@ -327,7 +332,6 @@ let rec substitute sb ulam =
Uassign(id', substitute sb u)
| Usend(k, u1, u2, ul) ->
Usend(k, substitute sb u1, substitute sb u2, List.map (substitute sb) ul)
| Ugetglobal _ -> ulam

(* Perform an inline expansion *)

Expand Down Expand Up @@ -534,7 +538,7 @@ let rec close fenv cenv = function
end
| Lprim(Pgetglobal id, []) as lam ->
check_constant_result lam
(Ugetglobal (Compilenv.symbol_for_global id))
(getglobal id)
(Compilenv.global_approx id)
| Lprim(Pmakeblock(tag, mut) as prim, lams) ->
let (ulams, approxs) = List.split (List.map (close fenv cenv) lams) in
Expand All @@ -553,8 +557,7 @@ let rec close fenv cenv = function
| Lprim(Psetfield(n, _), [Lprim(Pgetglobal id, []); lam]) ->
let (ulam, approx) = close fenv cenv lam in
(!global_approx).(n) <- approx;
(Uprim(Psetfield(n, false),
[Ugetglobal (Compilenv.symbol_for_global id); ulam]),
(Uprim(Psetfield(n, false), [getglobal id; ulam]),
Value_unknown)
| Lprim(p, args) ->
simplif_prim p (close_list_approx fenv cenv args)
Expand Down
4 changes: 1 addition & 3 deletions asmcomp/cmmgen.ml
Expand Up @@ -850,12 +850,10 @@ let rec transl = function
transl_letrec bindings (transl body)

(* Primitives *)
| Ugetglobal id ->
Cconst_symbol id
| Uprim(prim, args) ->
begin match (simplif_primitive prim, args) with
(Pgetglobal id, []) ->
assert false
Cconst_symbol (Ident.name id)
| (Pmakeblock(tag, mut), []) ->
transl_constant(Const_block(tag, []))
| (Pmakeblock(tag, mut), args) ->
Expand Down

0 comments on commit af0ba3a

Please sign in to comment.