aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-12-23 17:10:23 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-12-23 17:10:23 +0000
commit15ac8b9e6dec8f60879331fe62e62c92e09bfdb6 (patch)
tree436df3a401e4a112bde0cefba8fe68b05e7ef87f /bindings
parent2e855e68d861224c9b61e2bc9cecad1536b1534b (diff)
downloadexternal_llvm-15ac8b9e6dec8f60879331fe62e62c92e09bfdb6.zip
external_llvm-15ac8b9e6dec8f60879331fe62e62c92e09bfdb6.tar.gz
external_llvm-15ac8b9e6dec8f60879331fe62e62c92e09bfdb6.tar.bz2
Fix some Ocaml GC errors noticed upon review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/executionengine/executionengine_ocaml.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index 816c966..03b0f32 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/bindings/ocaml/executionengine/executionengine_ocaml.c
@@ -72,12 +72,15 @@ static value alloc_generic_value(LLVMGenericValueRef Ref) {
/* Llvm.lltype -> float -> t */
CAMLprim value llvm_genericvalue_of_float(LLVMTypeRef Ty, value N) {
- return alloc_generic_value(LLVMCreateGenericValueOfFloat(Ty, Double_val(N)));
+ CAMLparam1(N);
+ CAMLreturn(alloc_generic_value(
+ LLVMCreateGenericValueOfFloat(Ty, Double_val(N))));
}
/* 'a -> t */
CAMLprim value llvm_genericvalue_of_value(value V) {
- return alloc_generic_value(LLVMCreateGenericValueOfPointer(Op_val(V)));
+ CAMLparam1(V);
+ CAMLreturn(alloc_generic_value(LLVMCreateGenericValueOfPointer(Op_val(V))));
}
/* Llvm.lltype -> int -> t */
@@ -87,26 +90,30 @@ CAMLprim value llvm_genericvalue_of_int(LLVMTypeRef Ty, value Int) {
/* Llvm.lltype -> int32 -> t */
CAMLprim value llvm_genericvalue_of_int32(LLVMTypeRef Ty, value Int32) {
- return alloc_generic_value(LLVMCreateGenericValueOfInt(Ty, Int32_val(Int32),
- 1));
+ CAMLparam1(Int32);
+ CAMLreturn(alloc_generic_value(
+ LLVMCreateGenericValueOfInt(Ty, Int32_val(Int32), 1)));
}
/* Llvm.lltype -> nativeint -> t */
CAMLprim value llvm_genericvalue_of_nativeint(LLVMTypeRef Ty, value NatInt) {
- return alloc_generic_value(LLVMCreateGenericValueOfInt(Ty,
- Nativeint_val(NatInt),
- 1));
+ CAMLparam1(NatInt);
+ CAMLreturn(alloc_generic_value(
+ LLVMCreateGenericValueOfInt(Ty, Nativeint_val(NatInt), 1)));
}
/* Llvm.lltype -> int64 -> t */
CAMLprim value llvm_genericvalue_of_int64(LLVMTypeRef Ty, value Int64) {
- return alloc_generic_value(LLVMCreateGenericValueOfInt(Ty, Int64_val(Int64),
- 1));
+ CAMLparam1(Int64);
+ CAMLreturn(alloc_generic_value(
+ LLVMCreateGenericValueOfInt(Ty, Int64_val(Int64), 1)));
}
/* Llvm.lltype -> t -> float */
CAMLprim value llvm_genericvalue_as_float(LLVMTypeRef Ty, value GenVal) {
- return copy_double(LLVMGenericValueToFloat(Ty, Genericvalue_val(GenVal)));
+ CAMLparam1(GenVal);
+ CAMLreturn(copy_double(
+ LLVMGenericValueToFloat(Ty, Genericvalue_val(GenVal))));
}
/* t -> 'a */
@@ -123,23 +130,26 @@ CAMLprim value llvm_genericvalue_as_int(value GenVal) {
/* t -> int32 */
CAMLprim value llvm_genericvalue_as_int32(value GenVal) {
+ CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 32
&& "Generic value too wide to treat as an int32!");
- return copy_int32(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1));
+ CAMLreturn(copy_int32(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
}
/* t -> int64 */
CAMLprim value llvm_genericvalue_as_int64(value GenVal) {
+ CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 64
&& "Generic value too wide to treat as an int64!");
- return copy_int64(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1));
+ CAMLreturn(copy_int64(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
}
/* t -> nativeint */
CAMLprim value llvm_genericvalue_as_nativeint(value GenVal) {
+ CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 8 * sizeof(value)
&& "Generic value too wide to treat as a nativeint!");
- return copy_nativeint(LLVMGenericValueToInt(Genericvalue_val(GenVal),1));
+ CAMLreturn(copy_nativeint(LLVMGenericValueToInt(Genericvalue_val(GenVal),1)));
}