mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
snapshot
This commit is contained in:
parent
9bc6b0db0b
commit
9076e2fbfa
96
src/vm.cpp
96
src/vm.cpp
@ -22,11 +22,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
objectArrayLength(array));
|
objectArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -43,11 +43,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
objectArrayLength(array));
|
objectArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -94,7 +94,7 @@ run(Thread* t)
|
|||||||
PUSH(array);
|
PUSH(array);
|
||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d", c);
|
object message = makeString(t, "%d", c);
|
||||||
t->exception = makeNASException(t, message);
|
t->exception = makeNegativeArrayStoreException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -117,7 +117,7 @@ run(Thread* t)
|
|||||||
if (array) {
|
if (array) {
|
||||||
PUSH(makeInt(t, arrayLength(array)));
|
PUSH(makeInt(t, arrayLength(array)));
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} UNREACHABLE;
|
} UNREACHABLE;
|
||||||
@ -150,7 +150,7 @@ run(Thread* t)
|
|||||||
case athrow: {
|
case athrow: {
|
||||||
POP(t->exception);
|
POP(t->exception);
|
||||||
if (t->exception == 0) {
|
if (t->exception == 0) {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
}
|
}
|
||||||
goto throw_;
|
goto throw_;
|
||||||
} UNREACHABLE;
|
} UNREACHABLE;
|
||||||
@ -166,11 +166,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
byteArrayLength(array));
|
byteArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -187,11 +187,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
byteArrayLength(array));
|
byteArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -211,11 +211,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
charArrayLength(array));
|
charArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -232,11 +232,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
charArrayLength(array));
|
charArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -252,7 +252,7 @@ run(Thread* t)
|
|||||||
if (t->exception) goto throw_;
|
if (t->exception) goto throw_;
|
||||||
|
|
||||||
if (not instanceOf(t, class_, t->stack[t->sp - 1])) {
|
if (not instanceOf(t, class_, t->stack[t->sp - 1])) {
|
||||||
t->exception = makeCCException(t, 0);
|
t->exception = makeClassCastException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ run(Thread* t)
|
|||||||
|
|
||||||
PUSH(getField(instance, field));
|
PUSH(getField(instance, field));
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -370,13 +370,22 @@ run(Thread* t)
|
|||||||
uint8_t index1 = codeBody(t->code)[ip++];
|
uint8_t index1 = codeBody(t->code)[ip++];
|
||||||
uint8_t index2 = codeBody(t->code)[ip++];
|
uint8_t index2 = codeBody(t->code)[ip++];
|
||||||
uint16_t index = (index1 << 8) | index2;
|
uint16_t index = (index1 << 8) | index2;
|
||||||
|
|
||||||
object field = resolveField(t, codePool(t->code), index);
|
object field = resolveField(t, codePool(t->code), index);
|
||||||
if (t->exception) goto throw_;
|
if (t->exception) goto throw_;
|
||||||
|
|
||||||
|
if (not classInitialized(fieldClass(field))) {
|
||||||
|
frameIp(t->frame) = ip - 3;
|
||||||
|
PUSH(t->frame);
|
||||||
|
|
||||||
|
t->code = classInitializer(fieldClass(field));
|
||||||
|
t->frame = makeFrame(t, t->code);
|
||||||
|
ip = 0;
|
||||||
|
}
|
||||||
|
|
||||||
PUSH(getStatic(field));
|
PUSH(getStatic(field));
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -440,11 +449,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
intArrayLength(array));
|
intArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -468,11 +477,11 @@ run(Thread* t)
|
|||||||
} else {
|
} else {
|
||||||
object message = makeString(t, "%d not in [0,%d]", i,
|
object message = makeString(t, "%d not in [0,%d]", i,
|
||||||
intArrayLength(array));
|
intArrayLength(array));
|
||||||
t->exception = makeAIOOBException(t, message);
|
t->exception = makeArrayIndexOutOfBoundsException(t, message);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t->exception = makeNPException(t, 0);
|
t->exception = makeNullPointerException(t, 0);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
@ -753,36 +762,37 @@ run(Thread* t)
|
|||||||
}
|
}
|
||||||
} goto loop;
|
} goto loop;
|
||||||
|
|
||||||
|
case invokeinterface: {
|
||||||
|
// todo
|
||||||
|
} goto loop;
|
||||||
|
|
||||||
default: UNREACHABLE;
|
default: UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw_:
|
throw_:
|
||||||
PUSH(t->frame);
|
for (; t->frame; t->frame = frameNext(t->frame)) {
|
||||||
for (; t->sp >= 0; --(t->sp)) {
|
t->code = frameCode(t->frame);
|
||||||
if (typeOf(t->stack[t->sp]) == FrameType) {
|
object eht = codeExceptionHandlerTable(t->code);
|
||||||
t->frame = t->stack[t->sp];
|
if (eht) {
|
||||||
t->code = frameCode(t->frame);
|
for (unsigned i = 0; i < exceptionHandleTableLength(eht); ++i) {
|
||||||
object eht = codeExceptionHandlerTable(t->code);
|
ExceptionHandler* eh = exceptionHandlerTableBody(eht)[i];
|
||||||
if (eht) {
|
uint16_t catchType = exceptionHandlerCatchType(eh);
|
||||||
for (unsigned i = 0; i < exceptionHandleTableLength(eht); ++i) {
|
if (catchType == 0 or
|
||||||
ExceptionHandler* eh = exceptionHandlerTableBody(eht)[i];
|
instanceOf(rawArrayBody(codePool(t->code))[catchType],
|
||||||
uint16_t catchType = exceptionHandlerCatchType(eh);
|
t->exception))
|
||||||
if (catchType == 0 or
|
{
|
||||||
instanceOf(rawArrayBody(codePool(t->code))[catchType],
|
t->sp = frameStackBase(t->frame);
|
||||||
t->exception))
|
ip = exceptionHandlerIp(eh);
|
||||||
{
|
PUSH(t->exception);
|
||||||
t->sp = frameStackBase(t->frame);
|
t->exception = 0;
|
||||||
ip = exceptionHandlerIp(eh);
|
goto loop;
|
||||||
PUSH(t->exception);
|
|
||||||
t->exception = 0;
|
|
||||||
goto loop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t->code = defaultExceptionHandler(t);
|
t->code = defaultExceptionHandler(t);
|
||||||
|
t->frame = makeFrame(t, t->code);
|
||||||
t->sp = 0;
|
t->sp = 0;
|
||||||
ip = 0;
|
ip = 0;
|
||||||
PUSH(t->exception);
|
PUSH(t->exception);
|
||||||
|
Loading…
Reference in New Issue
Block a user