mirror of
https://github.com/corda/corda.git
synced 2025-01-23 04:48:09 +00:00
Merge branch 'master' of oss:/var/local/git/avian into dynamic
This commit is contained in:
commit
0aebe334b3
@ -87,6 +87,35 @@ GetEnv(Machine* m, Thread** t, jint version)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jsize JNICALL
|
||||||
|
GetStringLength(Thread* t, jstring s)
|
||||||
|
{
|
||||||
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
|
return stringLength(t, *s);
|
||||||
|
}
|
||||||
|
|
||||||
|
const jchar* JNICALL
|
||||||
|
GetStringChars(Thread* t, jstring s, jboolean* isCopy)
|
||||||
|
{
|
||||||
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
|
jchar* chars = static_cast<jchar*>
|
||||||
|
(t->m->heap->allocate((stringLength(t, *s) + 1) * sizeof(jchar), false));
|
||||||
|
stringChars(t, *s, reinterpret_cast<wchar_t*>(chars));
|
||||||
|
|
||||||
|
if (isCopy) *isCopy = true;
|
||||||
|
return chars;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JNICALL
|
||||||
|
ReleaseStringChars(Thread* t, jstring s, const jchar* chars)
|
||||||
|
{
|
||||||
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
|
t->m->heap->free(chars, (stringLength(t, *s) + 1) * sizeof(jchar), false);
|
||||||
|
}
|
||||||
|
|
||||||
jsize JNICALL
|
jsize JNICALL
|
||||||
GetStringUTFLength(Thread* t, jstring s)
|
GetStringUTFLength(Thread* t, jstring s)
|
||||||
{
|
{
|
||||||
@ -111,6 +140,8 @@ GetStringUTFChars(Thread* t, jstring s, jboolean* isCopy)
|
|||||||
void JNICALL
|
void JNICALL
|
||||||
ReleaseStringUTFChars(Thread* t, jstring s, const char* chars)
|
ReleaseStringUTFChars(Thread* t, jstring s, const char* chars)
|
||||||
{
|
{
|
||||||
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
t->m->heap->free(chars, stringLength(t, *s) + 1, false);
|
t->m->heap->free(chars, stringLength(t, *s) + 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1854,6 +1885,9 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
|
|||||||
|
|
||||||
memset(envTable, 0, sizeof(JNIEnvVTable));
|
memset(envTable, 0, sizeof(JNIEnvVTable));
|
||||||
|
|
||||||
|
envTable->GetStringLength = ::GetStringLength;
|
||||||
|
envTable->GetStringChars = ::GetStringChars;
|
||||||
|
envTable->ReleaseStringChars = ::ReleaseStringChars;
|
||||||
envTable->GetStringUTFLength = ::GetStringUTFLength;
|
envTable->GetStringUTFLength = ::GetStringUTFLength;
|
||||||
envTable->GetStringUTFChars = ::GetStringUTFChars;
|
envTable->GetStringUTFChars = ::GetStringUTFChars;
|
||||||
envTable->ReleaseStringUTFChars = ::ReleaseStringUTFChars;
|
envTable->ReleaseStringUTFChars = ::ReleaseStringUTFChars;
|
||||||
|
@ -2153,6 +2153,24 @@ stringChars(Thread* t, object string, char* chars)
|
|||||||
chars[stringLength(t, string)] = 0;
|
chars[stringLength(t, string)] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stringChars(Thread* t, object string, wchar_t* chars)
|
||||||
|
{
|
||||||
|
object data = stringData(t, string);
|
||||||
|
if (objectClass(t, data)
|
||||||
|
== arrayBody(t, t->m->types, Machine::ByteArrayType))
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < stringLength(t, string); ++i) {
|
||||||
|
chars[i] = byteArrayBody(t, data, stringOffset(t, string) + i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
memcpy(chars,
|
||||||
|
&charArrayBody(t, data, stringOffset(t, string)),
|
||||||
|
stringLength(t, string) * sizeof(wchar_t));
|
||||||
|
}
|
||||||
|
chars[stringLength(t, string)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isAssignableFrom(Thread* t, object a, object b)
|
isAssignableFrom(Thread* t, object a, object b)
|
||||||
{
|
{
|
||||||
|
@ -1703,6 +1703,9 @@ makeString(Thread* t, const char* format, ...);
|
|||||||
void
|
void
|
||||||
stringChars(Thread* t, object string, char* chars);
|
stringChars(Thread* t, object string, char* chars);
|
||||||
|
|
||||||
|
void
|
||||||
|
stringChars(Thread* t, object string, wchar_t* chars);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isAssignableFrom(Thread* t, object a, object b);
|
isAssignableFrom(Thread* t, object a, object b);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user