Commit 9c3ea0c5 authored by Yi Lin's avatar Yi Lin

call OptSaveVolatile.yieldpoint(), code patching yp seems working fine

parent 8c55ba5b
......@@ -89,10 +89,10 @@ public abstract class CompiledMethod {
@Uninterruptible
public final void addYPOffset(int offset) {
VM.sysWrite("adding YP offset ", offset);
VM.sysWrite(" to method: ");
VM.sysWrite(method.getDeclaringClass().getDescriptor());
VM.sysWriteln(method.getName());
// VM.sysWrite("adding YP offset ", offset);
// VM.sysWrite(" to method: ");
// VM.sysWrite(method.getDeclaringClass().getDescriptor());
// VM.sysWriteln(method.getName());
if (ypOffsetsIndex < MAX_YP) {
ypOffsets[ypOffsetsIndex] = offset;
......
......@@ -4045,7 +4045,7 @@ public final class RVMThread extends ThreadContext {
RVMThread t = getCurrentThread();
VM.sysWriteln("Thread ", t.getName(), " reaches yieldpoints");
// VM.sysWriteln("Thread ", t.getName(), " reaches yieldpoints");
boolean wasAtYieldpoint = t.atYieldpoint;
t.atYieldpoint = true;
......
......@@ -104,7 +104,7 @@ const char *bootDataFilename = 0;
const char *bootRMapFilename = 0;
/* Emit trace information? */
int lib_verbose = 1;
int lib_verbose = 0;
/* Location of jtoc within virtual machine image. */
static Address VmToc;
......@@ -654,10 +654,10 @@ hardwareTrapHandler(int signo, siginfo_t *si, void *context)
/* Test for code patching yield point */
if (YIELDPOINT_IMPL == 3 && signo == 5){
printf("code patching YP handler.\n");
printf("-cur instruction=%x\n", *(unsigned char *)(localInstructionAddress));
printf("-last instruction=%x\n", *(unsigned char *)(localInstructionAddress - 1));
printf("-next instruction=%x\n", *(unsigned char *)(localInstructionAddress + 1));
// printf("code patching YP handler.\n");
// printf("-cur instruction=%x\n", *(unsigned char *)(localInstructionAddress));
// printf("-last instruction=%x\n", *(unsigned char *)(localInstructionAddress - 1));
// printf("-next instruction=%x\n", *(unsigned char *)(localInstructionAddress + 1));
if (*(unsigned char *)(localInstructionAddress - 1) == 0xCC) {
// is INT 3 instruction
......@@ -665,11 +665,11 @@ hardwareTrapHandler(int signo, siginfo_t *si, void *context)
/* Insert artifical stackframe at the stack top */
Address * sp = (Address *)(IA32_ESP(context) - 4);
IA32_ESP(context) = IA32_ESP(context) - 4;
// instructionFollowing = getInstructionFollowing(localInstructionAddress);
instructionFollowing = getInstructionFollowing(localInstructionAddress);
*sp = localInstructionAddress;
unsigned int yieldPointHandlerAddress =
*(unsigned int *) (localJTOC + bootRecord->yieldpointFromPrologueOffset);
*(unsigned int *) (localJTOC + bootRecord->yieldpointFromPrologueOptOffset);
IA32_EIP(context) = yieldPointHandlerAddress;
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment