| author | wenzelm | 
| Tue, 13 Aug 2024 18:53:24 +0200 | |
| changeset 80701 | 39cd50407f79 | 
| parent 77765 | 8db468bd1ec6 | 
| permissions | -rw-r--r-- | 
| 62508 
d0b68218ea55
discontinued RAW session: bootstrap directly from isabelle_process RAW_ML_SYSTEM;
 wenzelm parents: 
62468diff
changeset | 1 | (* Title: Pure/ML/ml_heap.ML | 
| 62467 | 2 | Author: Makarius | 
| 3 | ||
| 4 | ML heap operations. | |
| 5 | *) | |
| 6 | ||
| 7 | signature ML_HEAP = | |
| 8 | sig | |
| 62825 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 9 | val obj_size: 'a -> int | 
| 77692 | 10 | val sizeof1: 'a -> int | 
| 77765 | 11 | val sizeof_list: 'a list -> int | 
| 77692 | 12 | val sizeof: 'a list -> int | 
| 67622 | 13 | val full_gc: unit -> unit | 
| 69826 
1bea05713dde
physical vs. logical events, the latter takes GC time into account;
 wenzelm parents: 
67622diff
changeset | 14 | val gc_now: unit -> Time.time | 
| 62467 | 15 | val share_common_data: unit -> unit | 
| 62825 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 16 | val save_child: string -> unit | 
| 62467 | 17 | end; | 
| 18 | ||
| 19 | structure ML_Heap: ML_HEAP = | |
| 20 | struct | |
| 62825 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 21 | |
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 22 | val obj_size = PolyML.objSize; | 
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 23 | |
| 77692 | 24 | fun sizeof1 x = obj_size x * ML_System.platform_obj_size; | 
| 77765 | 25 | |
| 26 | fun sizeof_list xs = 3 * length xs * ML_System.platform_obj_size; | |
| 27 | fun sizeof xs = obj_size xs * ML_System.platform_obj_size - sizeof_list xs; | |
| 77692 | 28 | |
| 67622 | 29 | val full_gc = PolyML.fullGC; | 
| 30 | ||
| 69826 
1bea05713dde
physical vs. logical events, the latter takes GC time into account;
 wenzelm parents: 
67622diff
changeset | 31 | fun gc_now () = #timeGCReal (PolyML.Statistics.getLocalStats ()); | 
| 
1bea05713dde
physical vs. logical events, the latter takes GC time into account;
 wenzelm parents: 
67622diff
changeset | 32 | |
| 62825 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 33 | fun share_common_data () = PolyML.shareCommonData PolyML.rootFunction; | 
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 34 | |
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 35 | fun save_child name = | 
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 36 | PolyML.SaveState.saveChild (name, List.length (PolyML.SaveState.showHierarchy ())); | 
| 
e6e80a8bf624
structure PolyML is sealed after bootstrap: all ML system access is managed by Isabelle;
 wenzelm parents: 
62630diff
changeset | 37 | |
| 62467 | 38 | end; |