mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
enable use of Android class library on 64-bit systems
This involved patching libcore.git to make it 64-bit safe.
This commit is contained in:
parent
1310fbbe4f
commit
0bb0b1ec0e
4
makefile
4
makefile
@ -167,7 +167,9 @@ ifneq ($(android),)
|
|||||||
-fno-exceptions \
|
-fno-exceptions \
|
||||||
-DHAVE_SYS_UIO_H \
|
-DHAVE_SYS_UIO_H \
|
||||||
-D_FILE_OFFSET_BITS=64 \
|
-D_FILE_OFFSET_BITS=64 \
|
||||||
-g3
|
-g3 \
|
||||||
|
-Werror \
|
||||||
|
-fPIC
|
||||||
classpath-lflags := $(android)/icu4c/lib/libicuuc.a \
|
classpath-lflags := $(android)/icu4c/lib/libicuuc.a \
|
||||||
$(android)/icu4c/lib/libicui18n.a \
|
$(android)/icu4c/lib/libicui18n.a \
|
||||||
$(android)/icu4c/lib/libicudata.a \
|
$(android)/icu4c/lib/libicudata.a \
|
||||||
|
@ -401,10 +401,10 @@ class MyClasspath : public Classpath {
|
|||||||
object instance = makeNew(t, c);
|
object instance = makeNew(t, c);
|
||||||
PROTECT(t, instance);
|
PROTECT(t, instance);
|
||||||
|
|
||||||
object constructor = resolveMethod(t, c, "<init>", "(II)V");
|
object constructor = resolveMethod(t, c, "<init>", "(JI)V");
|
||||||
|
|
||||||
t->m->processor->invoke
|
t->m->processor->invoke
|
||||||
(t, constructor, instance, reinterpret_cast<int>(p),
|
(t, constructor, instance, reinterpret_cast<int64_t>(p),
|
||||||
static_cast<int>(capacity));
|
static_cast<int>(capacity));
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
@ -416,10 +416,10 @@ class MyClasspath : public Classpath {
|
|||||||
PROTECT(t, b);
|
PROTECT(t, b);
|
||||||
|
|
||||||
object field = resolveField
|
object field = resolveField
|
||||||
(t, objectClass(t, b), "effectiveDirectAddress", "I");
|
(t, objectClass(t, b), "effectiveDirectAddress", "J");
|
||||||
|
|
||||||
return reinterpret_cast<void*>
|
return reinterpret_cast<void*>
|
||||||
(fieldAtOffset<int32_t>(b, fieldOffset(t, field)));
|
(fieldAtOffset<int64_t>(b, fieldOffset(t, field)));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int64_t
|
virtual int64_t
|
||||||
@ -1536,65 +1536,84 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
Avian_libcore_io_Memory_pokeLong
|
Avian_libcore_io_Memory_pokeLong
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int64_t v; memcpy(&v, arguments + 1, 8);
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
if (arguments[3]) {
|
int64_t v; memcpy(&v, arguments + 2, 8);
|
||||||
|
if (arguments[4]) {
|
||||||
v = swapV8(v);
|
v = swapV8(v);
|
||||||
}
|
}
|
||||||
memcpy(reinterpret_cast<void*>(arguments[0]), &v, 8);
|
memcpy(reinterpret_cast<void*>(address), &v, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
Avian_libcore_io_Memory_peekLong
|
Avian_libcore_io_Memory_peekLong
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int64_t v; memcpy(&v, reinterpret_cast<void*>(arguments[0]), 8);
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
return arguments[1] ? swapV8(v) : v;
|
int64_t v; memcpy(&v, reinterpret_cast<void*>(address), 8);
|
||||||
|
return arguments[2] ? swapV8(v) : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Avian_libcore_io_Memory_pokeInt
|
Avian_libcore_io_Memory_pokeInt
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int32_t v = arguments[2] ? swapV4(arguments[1]) : arguments[1];
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
memcpy(reinterpret_cast<void*>(arguments[0]), &v, 4);
|
int32_t v = arguments[3] ? swapV4(arguments[2]) : arguments[2];
|
||||||
|
memcpy(reinterpret_cast<void*>(address), &v, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
Avian_libcore_io_Memory_peekInt
|
Avian_libcore_io_Memory_peekInt
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int32_t v; memcpy(&v, reinterpret_cast<void*>(arguments[0]), 4);
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
return arguments[1] ? swapV4(v) : v;
|
int32_t v; memcpy(&v, reinterpret_cast<void*>(address), 4);
|
||||||
|
return arguments[2] ? swapV4(v) : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Avian_libcore_io_Memory_pokeShort
|
Avian_libcore_io_Memory_pokeShort
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int16_t v = arguments[2] ? swapV2(arguments[1]) : arguments[1];
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
memcpy(reinterpret_cast<void*>(arguments[0]), &v, 2);
|
int16_t v = arguments[3] ? swapV2(arguments[2]) : arguments[2];
|
||||||
|
memcpy(reinterpret_cast<void*>(address), &v, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
Avian_libcore_io_Memory_peekShort
|
Avian_libcore_io_Memory_peekShort
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
int16_t v; memcpy(&v, reinterpret_cast<void*>(arguments[0]), 2);
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
return arguments[1] ? swapV2(v) : v;
|
int16_t v; memcpy(&v, reinterpret_cast<void*>(address), 2);
|
||||||
|
return arguments[2] ? swapV2(v) : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Avian_libcore_io_Memory_pokeByte
|
Avian_libcore_io_Memory_pokeByte
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
*reinterpret_cast<int8_t*>(arguments[0]) = arguments[1];
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
|
*reinterpret_cast<int8_t*>(address) = arguments[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
Avian_libcore_io_Memory_peekByte
|
Avian_libcore_io_Memory_peekByte
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<int8_t*>(arguments[0]);
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
|
return *reinterpret_cast<int8_t*>(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Avian_libcore_io_Memory_peekByteArray
|
||||||
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
|
{
|
||||||
|
int64_t address; memcpy(&address, arguments, 8);
|
||||||
|
object array = reinterpret_cast<object>(arguments[2]);
|
||||||
|
memcpy(&byteArrayBody(t, array, arguments[3]),
|
||||||
|
reinterpret_cast<int8_t*>(address),
|
||||||
|
arguments[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
|
Loading…
Reference in New Issue
Block a user