Subject: | bind_function CODEREF pointer on 64bit systems |
Hello,
On 64bit systems (at least on OSX), the marshaling applied to "SV *code" in
"V8Context::bind_function" to a V8 Integer (32bits) corrupts the 64bit pointer, leading
to segmentation faults in corresponding tests.
Please find attached a patch fixing this issue and using External::Wrap and
External::Unwrap to get the job done.
Regards,
--
Rémy
Subject: | patch-CODEREF.diff |
diff -Nur JavaScript-V8-0.02.orig/V8Context.cpp JavaScript-V8-0.02/V8Context.cpp
--- JavaScript-V8-0.02.orig/V8Context.cpp 2009-12-30 13:51:02.000000000 +0100
+++ JavaScript-V8-0.02/V8Context.cpp 2011-02-07 16:31:25.000000000 +0100
@@ -64,7 +64,8 @@
PUTBACK;
- count = call_sv(INT2PTR(SV*,args.Data()->Int32Value()),G_SCALAR);
+ SV *code = (SV *) External::Unwrap(args.Data());
+ count = call_sv(code, G_SCALAR);
SPAGAIN;
@@ -96,7 +97,7 @@
context->Global()->Set(
String::New(name),
FunctionTemplate::New(_perl_method,
- Integer::New(PTR2IV(code)))->GetFunction()
+ External::Wrap((void *) code))->GetFunction()
);
}
SV* V8Context::eval(const char* source) {