diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2017-11-23 14:28:21 +0100 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2018-02-14 16:14:10 +0100 |
commit | 8cd6ddb98c12b6aba002781158180ffb68aba02f (patch) | |
tree | 82a3b98a604149a8ae984cb25986e915d9d155a5 /kernel/csymtable.ml | |
parent | 41893cb647fbdce87b40acd5763e837370d61ece (diff) |
Abstract further the type of VM bytecode compilation.
This reduces the possibility to wreak havoc while making the API nicer.
Diffstat (limited to 'kernel/csymtable.ml')
-rw-r--r-- | kernel/csymtable.ml | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/csymtable.ml b/kernel/csymtable.ml index bbd284bc1..38044071f 100644 --- a/kernel/csymtable.ml +++ b/kernel/csymtable.ml @@ -205,13 +205,12 @@ and slot_for_fv env fv = assert false and eval_to_patch env (buff,pl,fv) = - let patch = function - | Reloc_annot a, pos -> (pos, slot_for_annot a) - | Reloc_const sc, pos -> (pos, slot_for_str_cst sc) - | Reloc_getglobal kn, pos -> (pos, slot_for_getglobal env kn) + let slots = function + | Reloc_annot a -> slot_for_annot a + | Reloc_const sc -> slot_for_str_cst sc + | Reloc_getglobal kn -> slot_for_getglobal env kn in - let patches = List.map_left patch pl in - let buff = patch_int buff patches in + let buff = patch buff pl slots in let vm_env = Array.map (slot_for_fv env) fv in let tc = tcode_of_code buff (length buff) in eval_tcode tc vm_env |