Skip to content
This repository
tag: v1356
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 40 lines (33 sloc) 1.137 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
(*
Copyright © 2011 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/>.
*)
include Lazy


let deep_force obj =
  let stack = Stack.create () in
  let pux obj = Stack.push obj stack in
  let aux obj =
    let obj = Lazy.force (Obj.magic obj) in
    if Obj.is_block obj && Obj.tag obj < Obj.no_scan_tag then
      for i = 0 to Obj.size obj - 1 do
        let sub = Obj.field obj i in
        pux sub
      done
  in
  (Stack.push obj stack;
   try
     while true do
       let first = Stack.pop stack in
       aux first
     done
   with Stack.Empty -> ());
  obj
Something went wrong with that request. Please try again.