mirror of
https://github.com/corda/corda.git
synced 2025-01-01 10:46:46 +00:00
more JNIEnvVTable entries
This commit is contained in:
parent
bd4d9fdeb2
commit
a9f9755221
@ -249,6 +249,9 @@ const unsigned ACC_INTERFACE = 1 << 9;
|
|||||||
const unsigned ACC_ABSTRACT = 1 << 10;
|
const unsigned ACC_ABSTRACT = 1 << 10;
|
||||||
const unsigned ACC_STRICT = 1 << 11;
|
const unsigned ACC_STRICT = 1 << 11;
|
||||||
|
|
||||||
|
const int JNI_COMMIT = 1;
|
||||||
|
const int JNI_ABORT = 2;
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
#endif//CONSTANTS_H
|
#endif//CONSTANTS_H
|
||||||
|
1077
src/jnienv.cpp
1077
src/jnienv.cpp
File diff suppressed because it is too large
Load Diff
@ -1273,6 +1273,7 @@ Machine::Machine(System* system, Heap* heap, Finder* finder):
|
|||||||
finder(finder),
|
finder(finder),
|
||||||
rootThread(0),
|
rootThread(0),
|
||||||
exclusive(0),
|
exclusive(0),
|
||||||
|
jniReferences(0),
|
||||||
activeCount(0),
|
activeCount(0),
|
||||||
liveCount(0),
|
liveCount(0),
|
||||||
stateLock(0),
|
stateLock(0),
|
||||||
@ -1286,6 +1287,7 @@ Machine::Machine(System* system, Heap* heap, Finder* finder):
|
|||||||
monitorMap(0),
|
monitorMap(0),
|
||||||
stringMap(0),
|
stringMap(0),
|
||||||
types(0),
|
types(0),
|
||||||
|
jniInterfaceTable(0),
|
||||||
finalizers(0),
|
finalizers(0),
|
||||||
tenuredFinalizers(0),
|
tenuredFinalizers(0),
|
||||||
finalizeQueue(0),
|
finalizeQueue(0),
|
||||||
@ -1316,6 +1318,12 @@ Machine::dispose()
|
|||||||
if (libraries) {
|
if (libraries) {
|
||||||
libraries->dispose();
|
libraries->dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Reference* r = jniReferences; r;) {
|
||||||
|
Reference* t = r;
|
||||||
|
r = r->next;
|
||||||
|
system->free(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
||||||
@ -1325,6 +1333,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
|||||||
peer((parent ? parent->child : 0)),
|
peer((parent ? parent->child : 0)),
|
||||||
child(0),
|
child(0),
|
||||||
state(NoState),
|
state(NoState),
|
||||||
|
criticalLevel(0),
|
||||||
systemThread(0),
|
systemThread(0),
|
||||||
javaThread(javaThread),
|
javaThread(javaThread),
|
||||||
code(0),
|
code(0),
|
||||||
@ -1417,6 +1426,8 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
|||||||
m->monitorMap = makeWeakHashMap(this, 0, 0);
|
m->monitorMap = makeWeakHashMap(this, 0, 0);
|
||||||
m->stringMap = makeWeakHashMap(this, 0, 0);
|
m->stringMap = makeWeakHashMap(this, 0, 0);
|
||||||
|
|
||||||
|
m->jniInterfaceTable = makeVector(this, 0, 0, false);
|
||||||
|
|
||||||
populateBuiltinMap(t, m->builtinMap);
|
populateBuiltinMap(t, m->builtinMap);
|
||||||
|
|
||||||
t->javaThread = makeThread
|
t->javaThread = makeThread
|
||||||
@ -2504,6 +2515,11 @@ collect(Thread* t, Heap::CollectionType type)
|
|||||||
v->visit(&(m->monitorMap));
|
v->visit(&(m->monitorMap));
|
||||||
v->visit(&(m->stringMap));
|
v->visit(&(m->stringMap));
|
||||||
v->visit(&(m->types));
|
v->visit(&(m->types));
|
||||||
|
v->visit(&(m->jniInterfaceTable));
|
||||||
|
|
||||||
|
for (Reference* r = m->jniReferences; r; r = r->next) {
|
||||||
|
v->visit(&(r->target));
|
||||||
|
}
|
||||||
|
|
||||||
for (Thread* t = m->rootThread; t; t = t->peer) {
|
for (Thread* t = m->rootThread; t; t = t->peer) {
|
||||||
::visitRoots(t, v);
|
::visitRoots(t, v);
|
||||||
|
@ -1090,6 +1090,17 @@ strcmp(const int8_t* a, const int8_t* b)
|
|||||||
void
|
void
|
||||||
noop();
|
noop();
|
||||||
|
|
||||||
|
class Reference {
|
||||||
|
public:
|
||||||
|
Reference(object target, Reference* next):
|
||||||
|
target(target),
|
||||||
|
next(next)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
object target;
|
||||||
|
Reference* next;
|
||||||
|
};
|
||||||
|
|
||||||
class Machine {
|
class Machine {
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
@ -1111,6 +1122,7 @@ class Machine {
|
|||||||
Finder* finder;
|
Finder* finder;
|
||||||
Thread* rootThread;
|
Thread* rootThread;
|
||||||
Thread* exclusive;
|
Thread* exclusive;
|
||||||
|
Reference* jniReferences;
|
||||||
unsigned activeCount;
|
unsigned activeCount;
|
||||||
unsigned liveCount;
|
unsigned liveCount;
|
||||||
System::Monitor* stateLock;
|
System::Monitor* stateLock;
|
||||||
@ -1124,6 +1136,7 @@ class Machine {
|
|||||||
object monitorMap;
|
object monitorMap;
|
||||||
object stringMap;
|
object stringMap;
|
||||||
object types;
|
object types;
|
||||||
|
object jniInterfaceTable;
|
||||||
object finalizers;
|
object finalizers;
|
||||||
object tenuredFinalizers;
|
object tenuredFinalizers;
|
||||||
object finalizeQueue;
|
object finalizeQueue;
|
||||||
@ -1221,6 +1234,7 @@ class Thread {
|
|||||||
Thread* peer;
|
Thread* peer;
|
||||||
Thread* child;
|
Thread* child;
|
||||||
State state;
|
State state;
|
||||||
|
unsigned criticalLevel;
|
||||||
System::Thread* systemThread;
|
System::Thread* systemThread;
|
||||||
object javaThread;
|
object javaThread;
|
||||||
object code;
|
object code;
|
||||||
|
29
src/run.cpp
29
src/run.cpp
@ -2425,7 +2425,8 @@ run(Thread* t, const char* className, int argc, const char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pushArguments(Thread* t, object this_, const char* spec, va_list a)
|
pushArguments(Thread* t, object this_, const char* spec, bool indirectObjects,
|
||||||
|
va_list a)
|
||||||
{
|
{
|
||||||
if (this_) {
|
if (this_) {
|
||||||
pushObject(t, this_);
|
pushObject(t, this_);
|
||||||
@ -2438,7 +2439,8 @@ pushArguments(Thread* t, object this_, const char* spec, va_list a)
|
|||||||
case 'L':
|
case 'L':
|
||||||
while (*s and *s != ';') ++ s;
|
while (*s and *s != ';') ++ s;
|
||||||
++ s;
|
++ s;
|
||||||
pushObject(t, va_arg(a, object));
|
pushObject
|
||||||
|
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '[':
|
case '[':
|
||||||
@ -2453,7 +2455,8 @@ pushArguments(Thread* t, object this_, const char* spec, va_list a)
|
|||||||
++ s;
|
++ s;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pushObject(t, va_arg(a, object));
|
pushObject
|
||||||
|
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
@ -2637,7 +2640,7 @@ invoke(Thread* t, object method)
|
|||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
object
|
object
|
||||||
run(Thread* t, object method, object this_, ...)
|
run(Thread* t, object method, object this_, bool indirectObjects, va_list a)
|
||||||
{
|
{
|
||||||
assert(t, t->state == Thread::ActiveState
|
assert(t, t->state == Thread::ActiveState
|
||||||
or t->state == Thread::ExclusiveState);
|
or t->state == Thread::ExclusiveState);
|
||||||
@ -2651,16 +2654,24 @@ run(Thread* t, object method, object this_, ...)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* spec = reinterpret_cast<char*>
|
||||||
|
(&byteArrayBody(t, methodSpec(t, method), 0));
|
||||||
|
pushArguments(t, this_, spec, indirectObjects, a);
|
||||||
|
|
||||||
|
return invoke(t, method);
|
||||||
|
}
|
||||||
|
|
||||||
|
object
|
||||||
|
run(Thread* t, object method, object this_, ...)
|
||||||
|
{
|
||||||
va_list a;
|
va_list a;
|
||||||
va_start(a, this_);
|
va_start(a, this_);
|
||||||
|
|
||||||
const char* spec = reinterpret_cast<char*>
|
object r = run(t, method, this_, false, a);
|
||||||
(&byteArrayBody(t, methodSpec(t, method), 0));
|
|
||||||
pushArguments(t, this_, spec, a);
|
|
||||||
|
|
||||||
va_end(a);
|
va_end(a);
|
||||||
|
|
||||||
return invoke(t, method);
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
@ -2702,7 +2713,7 @@ run(Thread* t, const char* className, const char* methodName,
|
|||||||
va_list a;
|
va_list a;
|
||||||
va_start(a, this_);
|
va_start(a, this_);
|
||||||
|
|
||||||
pushArguments(t, this_, methodSpec, a);
|
pushArguments(t, this_, methodSpec, false, a);
|
||||||
|
|
||||||
va_end(a);
|
va_end(a);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user