mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +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_STRICT = 1 << 11;
|
||||
|
||||
const int JNI_COMMIT = 1;
|
||||
const int JNI_ABORT = 2;
|
||||
|
||||
} // namespace vm
|
||||
|
||||
#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),
|
||||
rootThread(0),
|
||||
exclusive(0),
|
||||
jniReferences(0),
|
||||
activeCount(0),
|
||||
liveCount(0),
|
||||
stateLock(0),
|
||||
@ -1286,6 +1287,7 @@ Machine::Machine(System* system, Heap* heap, Finder* finder):
|
||||
monitorMap(0),
|
||||
stringMap(0),
|
||||
types(0),
|
||||
jniInterfaceTable(0),
|
||||
finalizers(0),
|
||||
tenuredFinalizers(0),
|
||||
finalizeQueue(0),
|
||||
@ -1316,6 +1318,12 @@ Machine::dispose()
|
||||
if (libraries) {
|
||||
libraries->dispose();
|
||||
}
|
||||
|
||||
for (Reference* r = jniReferences; r;) {
|
||||
Reference* t = r;
|
||||
r = r->next;
|
||||
system->free(t);
|
||||
}
|
||||
}
|
||||
|
||||
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)),
|
||||
child(0),
|
||||
state(NoState),
|
||||
criticalLevel(0),
|
||||
systemThread(0),
|
||||
javaThread(javaThread),
|
||||
code(0),
|
||||
@ -1417,6 +1426,8 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
||||
m->monitorMap = makeWeakHashMap(this, 0, 0);
|
||||
m->stringMap = makeWeakHashMap(this, 0, 0);
|
||||
|
||||
m->jniInterfaceTable = makeVector(this, 0, 0, false);
|
||||
|
||||
populateBuiltinMap(t, m->builtinMap);
|
||||
|
||||
t->javaThread = makeThread
|
||||
@ -2504,6 +2515,11 @@ collect(Thread* t, Heap::CollectionType type)
|
||||
v->visit(&(m->monitorMap));
|
||||
v->visit(&(m->stringMap));
|
||||
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) {
|
||||
::visitRoots(t, v);
|
||||
|
@ -1090,6 +1090,17 @@ strcmp(const int8_t* a, const int8_t* b)
|
||||
void
|
||||
noop();
|
||||
|
||||
class Reference {
|
||||
public:
|
||||
Reference(object target, Reference* next):
|
||||
target(target),
|
||||
next(next)
|
||||
{ }
|
||||
|
||||
object target;
|
||||
Reference* next;
|
||||
};
|
||||
|
||||
class Machine {
|
||||
public:
|
||||
enum {
|
||||
@ -1111,6 +1122,7 @@ class Machine {
|
||||
Finder* finder;
|
||||
Thread* rootThread;
|
||||
Thread* exclusive;
|
||||
Reference* jniReferences;
|
||||
unsigned activeCount;
|
||||
unsigned liveCount;
|
||||
System::Monitor* stateLock;
|
||||
@ -1124,6 +1136,7 @@ class Machine {
|
||||
object monitorMap;
|
||||
object stringMap;
|
||||
object types;
|
||||
object jniInterfaceTable;
|
||||
object finalizers;
|
||||
object tenuredFinalizers;
|
||||
object finalizeQueue;
|
||||
@ -1221,6 +1234,7 @@ class Thread {
|
||||
Thread* peer;
|
||||
Thread* child;
|
||||
State state;
|
||||
unsigned criticalLevel;
|
||||
System::Thread* systemThread;
|
||||
object javaThread;
|
||||
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
|
||||
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_) {
|
||||
pushObject(t, this_);
|
||||
@ -2438,7 +2439,8 @@ pushArguments(Thread* t, object this_, const char* spec, va_list a)
|
||||
case 'L':
|
||||
while (*s and *s != ';') ++ s;
|
||||
++ s;
|
||||
pushObject(t, va_arg(a, object));
|
||||
pushObject
|
||||
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
|
||||
break;
|
||||
|
||||
case '[':
|
||||
@ -2453,7 +2455,8 @@ pushArguments(Thread* t, object this_, const char* spec, va_list a)
|
||||
++ s;
|
||||
break;
|
||||
}
|
||||
pushObject(t, va_arg(a, object));
|
||||
pushObject
|
||||
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
@ -2637,7 +2640,7 @@ invoke(Thread* t, object method)
|
||||
namespace vm {
|
||||
|
||||
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
|
||||
or t->state == Thread::ExclusiveState);
|
||||
@ -2651,16 +2654,24 @@ run(Thread* t, object method, object this_, ...)
|
||||
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_start(a, this_);
|
||||
|
||||
const char* spec = reinterpret_cast<char*>
|
||||
(&byteArrayBody(t, methodSpec(t, method), 0));
|
||||
pushArguments(t, this_, spec, a);
|
||||
object r = run(t, method, this_, false, a);
|
||||
|
||||
va_end(a);
|
||||
|
||||
return invoke(t, method);
|
||||
return r;
|
||||
}
|
||||
|
||||
object
|
||||
@ -2702,7 +2713,7 @@ run(Thread* t, const char* className, const char* methodName,
|
||||
va_list a;
|
||||
va_start(a, this_);
|
||||
|
||||
pushArguments(t, this_, methodSpec, a);
|
||||
pushArguments(t, this_, methodSpec, false, a);
|
||||
|
||||
va_end(a);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user