Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: tools/dumpobj.ml
- ===================================================================
- --- tools/dumpobj.ml (revision 15644)
- +++ tools/dumpobj.ml (working copy)
- @@ -12,10 +12,8 @@
- (* Disassembler for executable and .cmo object files *)
- -open Asttypes
- open Config
- open Instruct
- -open Lambda
- open Location
- open Opcodes
- open Opnames
- @@ -79,6 +77,9 @@
- else printf "%s." f
- ;;
- +let print_struct_const _ =
- + printf "<strcst>" (* todo... *)
- +(*
- let rec print_struct_const = function
- Const_base(Const_int i) -> printf "%d" i
- | Const_base(Const_float f) -> print_float f
- @@ -104,6 +105,7 @@
- printf "[|";
- List.iter (fun f -> print_float f; printf "; ") a;
- printf "|]"
- +*)
- (* Print an obj *)
- Index: boot/ocamldep
- ===================================================================
- Cannot display: file marked as a binary type.
- svn:mime-type = application/octet-stream
- Index: boot/ocamllex
- ===================================================================
- Cannot display: file marked as a binary type.
- svn:mime-type = application/octet-stream
- Index: boot/ocamlc
- ===================================================================
- Cannot display: file marked as a binary type.
- svn:mime-type = application/octet-stream
- Index: bytecomp/symtable.ml
- ===================================================================
- --- bytecomp/symtable.ml (revision 15644)
- +++ bytecomp/symtable.ml (working copy)
- @@ -13,8 +13,6 @@
- (* To assign numbers to globals and primitives *)
- open Misc
- -open Asttypes
- -open Lambda
- open Cmo_format
- (* Functions for batch linking *)
- @@ -51,7 +49,7 @@
- (* Global variables *)
- let global_table = ref(empty_numtable : Ident.t numtable)
- -and literal_table = ref([] : (int * structured_constant) list)
- +and literal_table = ref([] : (int * Obj.t) list)
- let is_global_defined id =
- Tbl.mem id (!global_table).num_tbl
- @@ -140,12 +138,10 @@
- try List.assoc name Predef.builtin_values
- with Not_found -> fatal_error "Symtable.init" in
- let c = slot_for_setglobal id in
- - let cst = Const_block(Obj.object_tag,
- - [Const_base(Const_string (name, None));
- - Const_base(Const_int (-i-1))
- - ])
- - in
- - literal_table := (c, cst) :: !literal_table)
- + let block = Obj.new_block Obj.object_tag 2 in
- + Obj.set_field block 0 (Obj.repr name);
- + Obj.set_field block 1 (Obj.repr (-i-1));
- + literal_table := (c, block) :: !literal_table)
- Runtimedef.builtin_exceptions;
- (* Initialize the known C primitives *)
- if String.length !Clflags.use_prims > 0 then begin
- @@ -201,34 +197,12 @@
- let patch_object = gen_patch_object Bytes.unsafe_set
- let ls_patch_object = gen_patch_object LongString.set
- -(* Translate structured constants *)
- -
- -let rec transl_const = function
- - Const_base(Const_int i) -> Obj.repr i
- - | Const_base(Const_char c) -> Obj.repr c
- - | Const_base(Const_string (s, _)) -> Obj.repr s
- - | Const_base(Const_float f) -> Obj.repr (float_of_string f)
- - | Const_base(Const_int32 i) -> Obj.repr i
- - | Const_base(Const_int64 i) -> Obj.repr i
- - | Const_base(Const_nativeint i) -> Obj.repr i
- - | Const_pointer i -> Obj.repr i
- - | Const_immstring s -> Obj.repr s
- - | Const_block(tag, fields) ->
- - let block = Obj.new_block tag (List.length fields) in
- - let pos = ref 0 in
- - List.iter
- - (fun c -> Obj.set_field block !pos (transl_const c); incr pos)
- - fields;
- - block
- - | Const_float_array fields ->
- - Obj.repr(Array.of_list(List.map (fun f -> float_of_string f) fields))
- -
- (* Build the initial table of globals *)
- let initial_global_table () =
- let glob = Array.make !global_table.num_cnt (Obj.repr 0) in
- List.iter
- - (fun (slot, cst) -> glob.(slot) <- transl_const cst)
- + (fun (slot, cst) -> glob.(slot) <- cst)
- !literal_table;
- literal_table := [];
- glob
- @@ -250,7 +224,7 @@
- if ng > Array.length(Meta.global_data()) then Meta.realloc_global_data ng;
- let glob = Meta.global_data() in
- List.iter
- - (fun (slot, cst) -> glob.(slot) <- transl_const cst)
- + (fun (slot, cst) -> glob.(slot) <- cst)
- !literal_table;
- literal_table := []
- Index: bytecomp/emitcode.ml
- ===================================================================
- --- bytecomp/emitcode.ml (revision 15644)
- +++ bytecomp/emitcode.ml (working copy)
- @@ -121,8 +121,28 @@
- let enter info =
- reloc_info := (info, !out_position) :: !reloc_info
- +let rec transl_const = function
- + Const_base(Const_int i) -> Obj.repr i
- + | Const_base(Const_char c) -> Obj.repr c
- + | Const_base(Const_string (s, _)) -> Obj.repr s
- + | Const_base(Const_float f) -> Obj.repr (float_of_string f)
- + | Const_base(Const_int32 i) -> Obj.repr i
- + | Const_base(Const_int64 i) -> Obj.repr i
- + | Const_base(Const_nativeint i) -> Obj.repr i
- + | Const_pointer i -> Obj.repr i
- + | Const_immstring s -> Obj.repr s
- + | Const_block(tag, fields) ->
- + let block = Obj.new_block tag (List.length fields) in
- + let pos = ref 0 in
- + List.iter
- + (fun c -> Obj.set_field block !pos (transl_const c); incr pos)
- + fields;
- + block
- + | Const_float_array fields ->
- + Obj.repr(Array.of_list(List.map (fun f -> float_of_string f) fields))
- +
- let slot_for_literal sc =
- - enter (Reloc_literal sc);
- + enter (Reloc_literal (transl_const sc));
- out_int 0
- and slot_for_getglobal id =
- enter (Reloc_getglobal id);
- Index: bytecomp/cmo_format.mli
- ===================================================================
- --- bytecomp/cmo_format.mli (revision 15644)
- +++ bytecomp/cmo_format.mli (working copy)
- @@ -15,7 +15,7 @@
- (* Relocation information *)
- type reloc_info =
- - Reloc_literal of Lambda.structured_constant (* structured constant *)
- + Reloc_literal of Obj.t (* structured constant *)
- | Reloc_getglobal of Ident.t (* reference to a global *)
- | Reloc_setglobal of Ident.t (* definition of a global *)
- | Reloc_primitive of string (* C primitive number *)
- Index: otherlibs/dynlink/Makefile
- ===================================================================
- --- otherlibs/dynlink/Makefile (revision 15644)
- +++ otherlibs/dynlink/Makefile (working copy)
- @@ -38,7 +38,7 @@
- ../../typing/primitive.cmo ../../typing/types.cmo \
- ../../typing/btype.cmo ../../typing/subst.cmo ../../typing/predef.cmo \
- ../../typing/datarepr.cmo ../../typing/cmi_format.cmo ../../typing/env.cmo \
- - ../../bytecomp/lambda.cmo ../../bytecomp/instruct.cmo \
- + ../../bytecomp/instruct.cmo \
- ../../bytecomp/cmo_format.cmi ../../bytecomp/opcodes.cmo \
- ../../bytecomp/runtimedef.cmo ../../bytecomp/bytesections.cmo \
- ../../bytecomp/dll.cmo ../../bytecomp/meta.cmo \
Add Comment
Please, Sign In to add comment