* ext/fiddle/closure.c (dealloc): refix workaround r28300.
don't use ffi_closure_alloc, ffi_prep_closure_loc and ffi_closure_free on MACOSX and __linux__. [ruby-dev:41483] [ruby-dev:41214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
065b574bdd
commit
7eec027f06
@ -1,3 +1,10 @@
|
|||||||
|
Mon Jun 14 04:03:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/fiddle/closure.c (dealloc): refix workaround r28300.
|
||||||
|
don't use ffi_closure_alloc, ffi_prep_closure_loc and
|
||||||
|
ffi_closure_free on MACOSX and __linux__.
|
||||||
|
[ruby-dev:41483] [ruby-dev:41214]
|
||||||
|
|
||||||
Sun Jun 13 15:46:07 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
Sun Jun 13 15:46:07 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* test/ruby/test_rubyoptions.rb: add a simple test for __END__ and
|
* test/ruby/test_rubyoptions.rb: add a simple test for __END__ and
|
||||||
|
@ -10,19 +10,19 @@ typedef struct {
|
|||||||
ffi_type **argv;
|
ffi_type **argv;
|
||||||
} fiddle_closure;
|
} fiddle_closure;
|
||||||
|
|
||||||
|
#if defined(MACOSX) || defined(__linux)
|
||||||
|
#define DONT_USE_FFI_CLOSURE_ALLOC
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dealloc(void * ptr)
|
dealloc(void * ptr)
|
||||||
{
|
{
|
||||||
fiddle_closure * cls = (fiddle_closure *)ptr;
|
fiddle_closure * cls = (fiddle_closure *)ptr;
|
||||||
/*
|
#ifndef DONT_USE_FFI_CLOSURE_ALLOC
|
||||||
#ifndef MACOSX
|
|
||||||
ffi_closure_free(cls->pcl);
|
ffi_closure_free(cls->pcl);
|
||||||
#else
|
#else
|
||||||
*/
|
|
||||||
munmap(cls->pcl, sizeof(cls->pcl));
|
munmap(cls->pcl, sizeof(cls->pcl));
|
||||||
/*
|
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
xfree(cls->cif);
|
xfree(cls->cif);
|
||||||
if (cls->argv) xfree(cls->argv);
|
if (cls->argv) xfree(cls->argv);
|
||||||
xfree(cls);
|
xfree(cls);
|
||||||
@ -142,7 +142,7 @@ allocate(VALUE klass)
|
|||||||
VALUE i = TypedData_Make_Struct(klass, fiddle_closure,
|
VALUE i = TypedData_Make_Struct(klass, fiddle_closure,
|
||||||
&closure_data_type, closure);
|
&closure_data_type, closure);
|
||||||
|
|
||||||
#ifndef MACOSX
|
#ifndef DONT_USE_FFI_CLOSURE_ALLOC
|
||||||
closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code);
|
closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code);
|
||||||
#else
|
#else
|
||||||
closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
|
closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
|
||||||
@ -195,7 +195,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
|
|||||||
if (FFI_OK != result)
|
if (FFI_OK != result)
|
||||||
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
|
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
|
||||||
|
|
||||||
#ifndef MACOSX
|
#ifndef DONT_USE_FFI_CLOSURE_ALLOC
|
||||||
result = ffi_prep_closure_loc(pcl, cif, callback,
|
result = ffi_prep_closure_loc(pcl, cif, callback,
|
||||||
(void *)self, cl->code);
|
(void *)self, cl->code);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user