Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialisation des objets #3803

Closed
vicuna opened this issue Oct 5, 2005 · 3 comments
Closed

Serialisation des objets #3803

vicuna opened this issue Oct 5, 2005 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 5, 2005

Original bug ID: 3803
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello,

Ce bout de code:

Marshal.to_string (object method x = 2 method y = 3 method z = 4 end)
[Marshal.Closures];;

provoque:

Fatal error: exception Invalid_argument("output_value: abstract value
(outside heap)")

avec ocamlc et ocamlopt. Le programme suivant:

for i = 0 to 65 do
let oc = open_out "bugger.ml" in
Printf.fprintf oc "Marshal.to_string (object ";
for j = 1 to i do
Printf.fprintf oc "method x%i = () " j;
done;
Printf.fprintf oc "end) [Marshal.Closures];;";
close_out oc;
ignore (Sys.command "ocamlc -o bugger bugger.ml");
if (Sys.command "./bugger 2&>1 > /dev/null" = 0) then Printf.eprintf
"i=%i\n" i; flush stderr;
done

permet de conjecturer que ça marche si et seulement le nombre de
méthodes est une puissance de 2.

-- Alain

@vicuna
Copy link
Author

vicuna commented Oct 5, 2005

Comment author: administrator

La table des methodes contient des pointeurs null a la fin (null_item
dans camlinternalOO.ml), c'est peut-etre ca ?

type item;;

type item

let null_item : item = Obj.obj (Obj.field (Obj.repr 0n) 1) ;;

val null_item : item =

Marshal.to_string null_item [];;

Exception: Invalid_argument "output_value: abstract value (outside heap)".

  • Fabrice

Le 05/10/05, Alain.Frisch@inria.frAlain.Frisch@inria.fr a écrit :

Hello,

Ce bout de code:

Marshal.to_string (object method x = 2 method y = 3 method z = 4 end)
[Marshal.Closures];;

provoque:

Fatal error: exception Invalid_argument("output_value: abstract value
(outside heap)")

avec ocamlc et ocamlopt. Le programme suivant:

for i = 0 to 65 do
let oc = open_out "bugger.ml" in
Printf.fprintf oc "Marshal.to_string (object ";
for j = 1 to i do
Printf.fprintf oc "method x%i = () " j;
done;
Printf.fprintf oc "end) [Marshal.Closures];;";
close_out oc;
ignore (Sys.command "ocamlc -o bugger bugger.ml");
if (Sys.command "./bugger 2&>1 > /dev/null" = 0) then Printf.eprintf
"i=%i\n" i; flush stderr;
done

permet de conjecturer que ça marche si et seulement le nombre de
méthodes est une puissance de 2.

-- Alain


Caml-devel mailing list
Caml-devel@yquem.inria.fr
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-devel

@vicuna
Copy link
Author

vicuna commented Oct 6, 2005

Comment author: administrator

Fatal error: exception Invalid_argument("output_value: abstract value
(outside heap)")
avec ocamlc et ocamlopt. Le programme suivant:
[..]
permet de conjecturer que ça marche si et seulement le nombre de
méthodes est une puissance de 2.

Comme le remarque Fabrice, le code de serialisation ne semble pas aimer NULL.
J'ai modifie' en CVS pour utiliser une fermeture.

Jacques

@vicuna
Copy link
Author

vicuna commented Oct 6, 2005

Comment author: administrator

Fixed by JG in camlinternalOO.ml (2005-10-06)

@vicuna vicuna closed this as completed Oct 6, 2005
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant