diff options
author | Maxime Dénès <mail@maximedenes.fr> | 2014-04-05 19:51:04 -0400 |
---|---|---|
committer | Maxime Dénès <mail@maximedenes.fr> | 2014-04-09 01:05:48 -0400 |
commit | de61c7d77e49286622c4aebd56f2e87b0df93903 (patch) | |
tree | d7038f72ed54e3cdebae620c458e3ca93294f49f /kernel/retroknowledge.ml | |
parent | 5bcfa8cab56798f2b575b839fd92b0f743c3d453 (diff) |
Had to split Nativelambda in two files because of Retroknowledge
dependencies.
Diffstat (limited to 'kernel/retroknowledge.ml')
-rw-r--r-- | kernel/retroknowledge.ml | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/kernel/retroknowledge.ml b/kernel/retroknowledge.ml index b7fb6956f..1049ab94d 100644 --- a/kernel/retroknowledge.ml +++ b/kernel/retroknowledge.ml @@ -132,8 +132,7 @@ type reactive_end = {(*information required by the compiler of the VM *) int->Cbytecodes.bytecodes->Cbytecodes.bytecodes) option; native_constant_static : - (bool->constr array->Cbytecodes.structured_constant) - option; + (bool -> constr array -> Nativeinstr.lambda) option; native_constant_dynamic : (bool->Cbytecodes.comp_env->Cbytecodes.block array->int-> Cbytecodes.bytecodes->Cbytecodes.bytecodes) @@ -239,7 +238,37 @@ let get_vm_decompile_constant_info knowledge key = | None -> raise Not_found | Some f -> f +let get_native_compiling_info knowledge key = + match (Reactive.find key knowledge.reactive).native_compiling + with + | None -> raise Not_found + | Some f -> f knowledge.flags.fastcomputation + +(* used for compilation of fully applied constructors *) +let get_native_constant_static_info knowledge key = + match (Reactive.find key knowledge.reactive).native_constant_static + with + | None -> raise Not_found + | Some f -> f knowledge.flags.fastcomputation +(* used for compilation of partially applied constructors *) +let get_native_constant_dynamic_info knowledge key = + match (Reactive.find key knowledge.reactive).native_constant_dynamic + with + | None -> raise Not_found + | Some f -> f knowledge.flags.fastcomputation + +let get_native_before_match_info knowledge key = + match (Reactive.find key knowledge.reactive).native_before_match + with + | None -> raise Not_found + | Some f -> f knowledge.flags.fastcomputation + +let get_native_decompile_constant_info knowledge key = + match (Reactive.find key knowledge.reactive).native_decompile_const + with + | None -> raise Not_found + | Some f -> f (* functions manipulating reactive knowledge *) let add_vm_compiling_info knowledge value nfo = @@ -297,5 +326,60 @@ let add_vm_decompile_constant_info knowledge value nfo = knowledge.reactive } +let add_native_compiling_info knowledge value nfo = + {knowledge with reactive = + try + Reactive.add value + {(Reactive.find value (knowledge.reactive)) with native_compiling = Some nfo} + knowledge.reactive + with Not_found -> + Reactive.add value {empty_reactive_end with native_compiling = Some nfo} + knowledge.reactive + } + +let add_native_constant_static_info knowledge value nfo = + {knowledge with reactive = + try + Reactive.add value + {(Reactive.find value (knowledge.reactive)) with native_constant_static = Some nfo} + knowledge.reactive + with Not_found -> + Reactive.add value {empty_reactive_end with native_constant_static = Some nfo} + knowledge.reactive + } + +let add_native_constant_dynamic_info knowledge value nfo = + {knowledge with reactive = + try + Reactive.add value + {(Reactive.find value (knowledge.reactive)) with native_constant_dynamic = Some nfo} + knowledge.reactive + with Not_found -> + Reactive.add value {empty_reactive_end with native_constant_dynamic = Some nfo} + knowledge.reactive + } + +let add_native_before_match_info knowledge value nfo = + {knowledge with reactive = + try + Reactive.add value + {(Reactive.find value (knowledge.reactive)) with native_before_match = Some nfo} + knowledge.reactive + with Not_found -> + Reactive.add value {empty_reactive_end with native_before_match = Some nfo} + knowledge.reactive + } + +let add_native_decompile_constant_info knowledge value nfo = + {knowledge with reactive = + try + Reactive.add value + {(Reactive.find value (knowledge.reactive)) with native_decompile_const = Some nfo} + knowledge.reactive + with Not_found -> + Reactive.add value {empty_reactive_end with native_decompile_const = Some nfo} + knowledge.reactive + } + let clear_info knowledge value = {knowledge with reactive = Reactive.remove value knowledge.reactive} |