[jruby~main:0cb3e3c5] Fix JRUBY-4660 by reverting commit 1312e2915c5f0fcce07fa844acd11d3398d93f
- From: nicksieger@kenai.com
- To: commits@jruby.kenai.com
- Subject: [jruby~main:0cb3e3c5] Fix JRUBY-4660 by reverting commit 1312e2915c5f0fcce07fa844acd11d3398d93f
- Date: Wed, 17 Mar 2010 19:08:12 +0000
Project: jruby
Repository: main
Revision: 0cb3e3c5ad590ccb5b1510ed67d091a8b2d15e87
Author: nicksieger
Date: 2010-03-17 18:50:27 UTC
Link:
Log Message:
------------
Fix JRUBY-4660 by reverting commit 1312e2915c5f0fcce07fa844acd11d3398d93faa.
Revisions:
----------
0cb3e3c5ad590ccb5b1510ed67d091a8b2d15e87
Modified Paths:
---------------
build_lib/jaffl.jar
build_lib/jffi.jar
maven/jruby-complete/pom.xml
maven/jruby/pom.xml
src/org/jruby/ext/ffi/ArrayMemoryIO.java
src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
src/org/jruby/ext/ffi/jffi/FastLongMethodFactory.java
Diffs:
------
diff --git a/build_lib/jaffl.jar b/build_lib/jaffl.jar
index 5e3dfb7..b4d1930 100644
Binary files a/build_lib/jaffl.jar and b/build_lib/jaffl.jar differ
diff --git a/build_lib/jffi.jar b/build_lib/jffi.jar
index 6c531ff..13cfc40 100644
Binary files a/build_lib/jffi.jar and b/build_lib/jffi.jar differ
diff --git a/maven/jruby-complete/pom.xml b/maven/jruby-complete/pom.xml
index 3f21bc5..d3d95f0 100644
--- a/maven/jruby-complete/pom.xml
+++ b/maven/jruby-complete/pom.xml
@@ -84,13 +84,13 @@
<dependency>
<groupId>org.jruby.extras</groupId>
<artifactId>jffi</artifactId>
- <version>1.0.2</version>
+ <version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jruby.extras</groupId>
<artifactId>jaffl</artifactId>
- <version>0.5.2</version>
+ <version>0.5.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/maven/jruby/pom.xml b/maven/jruby/pom.xml
index df4e6c8..c702715 100644
--- a/maven/jruby/pom.xml
+++ b/maven/jruby/pom.xml
@@ -84,13 +84,13 @@
<dependency>
<groupId>org.jruby.extras</groupId>
<artifactId>jffi</artifactId>
- <version>1.0.2</version>
+ <version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jruby.extras</groupId>
<artifactId>jaffl</artifactId>
- <version>0.5.2</version>
+ <version>0.5.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/src/org/jruby/ext/ffi/ArrayMemoryIO.java
b/src/org/jruby/ext/ffi/ArrayMemoryIO.java
index 672c47d..05fc5b9 100644
--- a/src/org/jruby/ext/ffi/ArrayMemoryIO.java
+++ b/src/org/jruby/ext/ffi/ArrayMemoryIO.java
@@ -431,7 +431,7 @@ public final class ArrayMemoryIO implements MemoryIO {
}
private static final class LE32ArrayIO extends LittleEndianArrayIO {
public final long getAddress(byte[] buffer, int offset) {
- return getInt32(buffer, offset);
+ return ((long) getInt32(buffer, offset)) & 0xffffffffL;
}
public final void putAddress(byte[] buffer, int offset, long value) {
putInt32(buffer, offset, (int) value);
@@ -447,7 +447,7 @@ public final class ArrayMemoryIO implements MemoryIO {
}
private static final class BE32ArrayIO extends BigEndianArrayIO {
public final long getAddress(byte[] buffer, int offset) {
- return getInt32(buffer, offset);
+ return ((long) getInt32(buffer, offset)) & 0xffffffffL;
}
public final void putAddress(byte[] buffer, int offset, long value) {
putInt32(buffer, offset, (int) value);
diff --git a/src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
b/src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
index 35e9fde..490f19c 100644
--- a/src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
+++ b/src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
@@ -233,17 +233,21 @@ public class FastIntMethodFactory extends MethodFactory
{
}
}
static final class PointerResultConverter implements IntResultConverter {
+ static final long ADDRESS_MASK =
Platform.getPlatform().addressSize() == 32
+ ? 0xffffffffL : 0xffffffffffffffffL;
public static final IntResultConverter INSTANCE = new
PointerResultConverter();
-
public final IRubyObject fromNative(ThreadContext context, int
value) {
- return new Pointer(context.getRuntime(),
NativeMemoryIO.wrap(context.getRuntime(), value));
+ final long address = ((long) value) & ADDRESS_MASK;
+ return new Pointer(context.getRuntime(),
NativeMemoryIO.wrap(context.getRuntime(), address));
}
}
static final class StringResultConverter implements IntResultConverter {
+ private static final com.kenai.jffi.MemoryIO IO =
com.kenai.jffi.MemoryIO.getInstance();
public static final IntResultConverter INSTANCE = new
StringResultConverter();
public final IRubyObject fromNative(ThreadContext context, int
value) {
- return FFIUtil.getString(context.getRuntime(), value);
+ long address = ((long) value) &
PointerResultConverter.ADDRESS_MASK;
+ return FFIUtil.getString(context.getRuntime(), address);
}
}
static abstract class BaseParameterConverter implements
IntParameterConverter {
diff --git a/src/org/jruby/ext/ffi/jffi/FastLongMethodFactory.java
b/src/org/jruby/ext/ffi/jffi/FastLongMethodFactory.java
index 5bf1b34..8b5e1af 100644
--- a/src/org/jruby/ext/ffi/jffi/FastLongMethodFactory.java
+++ b/src/org/jruby/ext/ffi/jffi/FastLongMethodFactory.java
@@ -233,17 +233,22 @@ public class FastLongMethodFactory {
}
static final class PointerResultConverter implements LongResultConverter
{
+ static final long ADDRESS_MASK =
Platform.getPlatform().addressSize() == 32
+ ? 0xffffffffL : 0xffffffffffffffffL;
public static final LongResultConverter INSTANCE = new
PointerResultConverter();
public final IRubyObject fromNative(ThreadContext context, long
value) {
- return new Pointer(context.getRuntime(),
NativeMemoryIO.wrap(context.getRuntime(), value));
+ final long address = ((long) value) & ADDRESS_MASK;
+ return new Pointer(context.getRuntime(),
+ NativeMemoryIO.wrap(context.getRuntime(), address));
}
}
static final class StringResultConverter implements LongResultConverter {
+ private static final com.kenai.jffi.MemoryIO IO =
com.kenai.jffi.MemoryIO.getInstance();
public static final LongResultConverter INSTANCE = new
StringResultConverter();
-
public final IRubyObject fromNative(ThreadContext context, long
value) {
- return FFIUtil.getString(context.getRuntime(), value);
+ long address = value & PointerResultConverter.ADDRESS_MASK;
+ return FFIUtil.getString(context.getRuntime(), address);
}
}
static abstract class BaseParameterConverter implements
LongParameterConverter {
|
[jruby~main:0cb3e3c5] Fix JRUBY-4660 by reverting commit 1312e2915c5f0fcce07fa844acd11d3398d93f |
nicksieger | 03/17/2010 |





