Author: David Malcolm <[email protected]>
Branch: libgccjit-backend
Changeset: r74974:52abcc39fd47
Date: 2014-12-15 11:10 -0500
http://bitbucket.org/pypy/pypy/changeset/52abcc39fd47/
Log: Set _nowrapper=True when creating rffi bindings for libgccjit
diff --git a/rpython/jit/backend/libgccjit/rffi_bindings.py
b/rpython/jit/backend/libgccjit/rffi_bindings.py
--- a/rpython/jit/backend/libgccjit/rffi_bindings.py
+++ b/rpython/jit/backend/libgccjit/rffi_bindings.py
@@ -238,12 +238,13 @@
def add_entrypoint(self, returntype, name, paramtypes):
setattr(self, name,
llexternal(name, paramtypes, returntype,
- compilation_info=self.eci))
+ compilation_info=self.eci,
+ _nowrapper=True))
def make_enum_values(self, lines):
for value, name in enumerate(lines.split(',')):
name = name.strip()
if name:
- setattr(self, name, value)
+ setattr(self, name, r_int(value))
diff --git a/rpython/jit/backend/libgccjit/test/test_rffi_bindings.py
b/rpython/jit/backend/libgccjit/test/test_rffi_bindings.py
--- a/rpython/jit/backend/libgccjit/test/test_rffi_bindings.py
+++ b/rpython/jit/backend/libgccjit/test/test_rffi_bindings.py
@@ -73,42 +73,50 @@
lib.gcc_jit_context_set_bool_option(ctxt,
lib.GCC_JIT_BOOL_OPTION_DUMP_INITIAL_GIMPLE,
- 1)
+ r_int(1))
lib.gcc_jit_context_set_int_option(ctxt,
lib.GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
- 3)
+ r_int(3))
lib.gcc_jit_context_set_bool_option(ctxt,
lib.GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
- 1)
+ r_int(1))
lib.gcc_jit_context_set_bool_option(ctxt,
lib.GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
- 1)
+ r_int(1))
lib.gcc_jit_context_set_bool_option(ctxt,
lib.GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE,
- 1)
+ r_int(1))
t_int = lib.gcc_jit_context_get_type(ctxt, lib.GCC_JIT_TYPE_INT)
+ param_name = str2charp("input")
param = lib.gcc_jit_context_new_param(ctxt,
lib.null_location_ptr,
t_int,
- "input")
+ param_name)
+ free_charp(param_name)
# FIXME: how to build an array of params at this level?
# see liststr2charpp in rffi.py
+ fn_name = str2charp("add_one_to")
param_array = make_param_array(lib, [param])
fn = lib.gcc_jit_context_new_function(ctxt,
lib.null_location_ptr,
lib.GCC_JIT_FUNCTION_EXPORTED,
t_int,
- "add_one_to",
- 1, param_array, 0)
+ fn_name,
+ r_int(1), param_array, r_int(0))
lltype.free(param_array, flavor='raw')
+ free_charp(fn_name)
+ local_name = str2charp("v_res")
v_res = lib.gcc_jit_function_new_local(fn,
lib.null_location_ptr,
t_int,
- "v_res")
- b_initial = lib.gcc_jit_function_new_block(fn, "initial")
- c_one = lib.gcc_jit_context_new_rvalue_from_int(ctxt, t_int, 1)
+ local_name)
+ free_charp(local_name)
+ block_name = str2charp("initial")
+ b_initial = lib.gcc_jit_function_new_block(fn, block_name)
+ free_charp(block_name)
+ c_one = lib.gcc_jit_context_new_rvalue_from_int(ctxt, t_int, r_int(1))
op_add = lib.gcc_jit_context_new_binary_op(ctxt,
lib.null_location_ptr,
lib.GCC_JIT_BINARY_OP_PLUS,
@@ -127,7 +135,9 @@
# FIXME: get error from context
raise Exception("jit_result is NULL")
- fn_ptr = lib.gcc_jit_result_get_code(jit_result, "add_one_to")
+ fn_name = str2charp("add_one_to")
+ fn_ptr = lib.gcc_jit_result_get_code(jit_result, fn_name)
+ free_charp(fn_name)
if not fn_ptr:
raise Exception("fn_ptr is NULL")
print('fn_ptr: %s' % fn_ptr)
@@ -154,7 +164,7 @@
f1 = compile_c(f, [], backendopt=False)
assert f1() == 42
- #assert False # to see stderr
+ assert False # to see stderr
# TODO: test of an error
# should turn it into an exception, and capture the error
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit