зеркало из https://github.com/mozilla/pluotsorbet.git
remove localBase, which is constantly 0.
This commit is contained in:
Родитель
da2f45501d
Коммит
42641c7c4c
|
@ -1066,7 +1066,7 @@ module J2ME {
|
||||||
!calleeTargetMethodInfo.isSynchronized &&
|
!calleeTargetMethodInfo.isSynchronized &&
|
||||||
!calleeTargetMethodInfo.isNative &&
|
!calleeTargetMethodInfo.isNative &&
|
||||||
calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
||||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, [], 0);
|
var calleeFrame = Frame.create(calleeTargetMethodInfo, []);
|
||||||
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
||||||
frames.push(calleeFrame);
|
frames.push(calleeFrame);
|
||||||
frame = calleeFrame;
|
frame = calleeFrame;
|
||||||
|
@ -1174,7 +1174,7 @@ module J2ME {
|
||||||
}
|
}
|
||||||
// Call method directly in the interpreter if we can.
|
// Call method directly in the interpreter if we can.
|
||||||
if (calleeTargetMethodInfo && !calleeTargetMethodInfo.isNative && calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
if (calleeTargetMethodInfo && !calleeTargetMethodInfo.isNative && calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
||||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, [], 0);
|
var calleeFrame = Frame.create(calleeTargetMethodInfo, []);
|
||||||
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
||||||
frames.push(calleeFrame);
|
frames.push(calleeFrame);
|
||||||
frame = calleeFrame;
|
frame = calleeFrame;
|
||||||
|
|
|
@ -18,7 +18,7 @@ function asyncImpl(returnKind, promise) {
|
||||||
}, function(exception) {
|
}, function(exception) {
|
||||||
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
||||||
var methodInfo = classInfo.getMethodByNameString("throwException", "(Ljava/lang/Exception;)V", true);
|
var methodInfo = classInfo.getMethodByNameString("throwException", "(Ljava/lang/Exception;)V", true);
|
||||||
ctx.frames.push(Frame.create(methodInfo, [exception], 0));
|
ctx.frames.push(Frame.create(methodInfo, [exception]));
|
||||||
ctx.execute();
|
ctx.execute();
|
||||||
});
|
});
|
||||||
$.pause("Async");
|
$.pause("Async");
|
||||||
|
@ -309,7 +309,7 @@ Native["java/lang/Class.invoke_clinit.()V"] = function() {
|
||||||
var className = classInfo.getClassNameSlow();
|
var className = classInfo.getClassNameSlow();
|
||||||
var clinit = classInfo.staticInitializer;
|
var clinit = classInfo.staticInitializer;
|
||||||
if (clinit && clinit.classInfo.getClassNameSlow() === className) {
|
if (clinit && clinit.classInfo.getClassNameSlow() === className) {
|
||||||
$.ctx.executeFrame(Frame.create(clinit, [], 0));
|
$.ctx.executeFrame(Frame.create(clinit, []));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ Native["java/lang/Thread.start0.()V"] = function() {
|
||||||
|
|
||||||
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
||||||
var run = classInfo.getMethodByNameString("runThread", "(Ljava/lang/Thread;)V", true);
|
var run = classInfo.getMethodByNameString("runThread", "(Ljava/lang/Thread;)V", true);
|
||||||
newCtx.start([new Frame(run, [ this ], 0)]);
|
newCtx.start([Frame.create(run, [ this ])]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Native["java/lang/Thread.isAlive.()Z"] = function() {
|
Native["java/lang/Thread.isAlive.()Z"] = function() {
|
||||||
|
|
|
@ -79,7 +79,6 @@ module J2ME {
|
||||||
pc: number;
|
pc: number;
|
||||||
opPC: number;
|
opPC: number;
|
||||||
cp: any;
|
cp: any;
|
||||||
localBase: number;
|
|
||||||
lockObject: java.lang.Object;
|
lockObject: java.lang.Object;
|
||||||
|
|
||||||
static dirtyStack: Frame [] = [];
|
static dirtyStack: Frame [] = [];
|
||||||
|
@ -87,24 +86,24 @@ module J2ME {
|
||||||
/**
|
/**
|
||||||
* Denotes the start of the context frame stack.
|
* Denotes the start of the context frame stack.
|
||||||
*/
|
*/
|
||||||
static Start: Frame = Frame.create(null, null, 0);
|
static Start: Frame = Frame.create(null, null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a frame set.
|
* Marks a frame set.
|
||||||
*/
|
*/
|
||||||
static Marker: Frame = Frame.create(null, null, 0);
|
static Marker: Frame = Frame.create(null, null);
|
||||||
|
|
||||||
static isMarker(frame: Frame) {
|
static isMarker(frame: Frame) {
|
||||||
return frame.methodInfo === null;
|
return frame.methodInfo === null;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(methodInfo: MethodInfo, local: any [], localBase: number) {
|
constructor(methodInfo: MethodInfo, local: any []) {
|
||||||
frameCount ++;
|
frameCount ++;
|
||||||
this.stack = [];
|
this.stack = [];
|
||||||
this.reset(methodInfo, local, localBase);
|
this.reset(methodInfo, local);
|
||||||
}
|
}
|
||||||
|
|
||||||
reset(methodInfo: MethodInfo, local: any [], localBase: number) {
|
reset(methodInfo: MethodInfo, local: any []) {
|
||||||
this.methodInfo = methodInfo;
|
this.methodInfo = methodInfo;
|
||||||
this.cp = methodInfo ? methodInfo.classInfo.constantPool : null;
|
this.cp = methodInfo ? methodInfo.classInfo.constantPool : null;
|
||||||
this.code = methodInfo ? methodInfo.codeAttribute.code : null;
|
this.code = methodInfo ? methodInfo.codeAttribute.code : null;
|
||||||
|
@ -112,18 +111,17 @@ module J2ME {
|
||||||
this.opPC = 0;
|
this.opPC = 0;
|
||||||
this.stack.length = 0;
|
this.stack.length = 0;
|
||||||
this.local = local;
|
this.local = local;
|
||||||
this.localBase = localBase;
|
|
||||||
this.lockObject = null;
|
this.lockObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(methodInfo: MethodInfo, local: any [], localBase: number): Frame {
|
static create(methodInfo: MethodInfo, local: any []): Frame {
|
||||||
var dirtyStack = Frame.dirtyStack;
|
var dirtyStack = Frame.dirtyStack;
|
||||||
if (dirtyStack.length) {
|
if (dirtyStack.length) {
|
||||||
var frame = dirtyStack.pop();
|
var frame = dirtyStack.pop();
|
||||||
frame.reset(methodInfo, local, localBase);
|
frame.reset(methodInfo, local);
|
||||||
return frame;
|
return frame;
|
||||||
} else {
|
} else {
|
||||||
return new Frame(methodInfo, local, localBase);
|
return new Frame(methodInfo, local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,16 +131,15 @@ module J2ME {
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocal(i: number): any {
|
getLocal(i: number): any {
|
||||||
return this.local[this.localBase + i];
|
return this.local[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocal(i: number, value: any) {
|
setLocal(i: number, value: any) {
|
||||||
this.local[this.localBase + i] = value;
|
this.local[i] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
incLocal(i: number, value: any) {
|
incLocal(i: number, value: any) {
|
||||||
var j = this.localBase + i;
|
this.local[i] += value | 0;
|
||||||
this.local[j] = this.local[j] + value | 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
read8(): number {
|
read8(): number {
|
||||||
|
@ -618,7 +615,7 @@ module J2ME {
|
||||||
|
|
||||||
bailout(methodInfo: MethodInfo, pc: number, nextPC: number, local: any [], stack: any [], lockObject: java.lang.Object) {
|
bailout(methodInfo: MethodInfo, pc: number, nextPC: number, local: any [], stack: any [], lockObject: java.lang.Object) {
|
||||||
// perfWriter && perfWriter.writeLn("C Unwind: " + methodInfo.implKey);
|
// perfWriter && perfWriter.writeLn("C Unwind: " + methodInfo.implKey);
|
||||||
var frame = Frame.create(methodInfo, local, 0);
|
var frame = Frame.create(methodInfo, local);
|
||||||
frame.stack = stack;
|
frame.stack = stack;
|
||||||
frame.pc = nextPC;
|
frame.pc = nextPC;
|
||||||
frame.opPC = pc;
|
frame.opPC = pc;
|
||||||
|
|
|
@ -38,9 +38,9 @@ module J2ME {
|
||||||
|
|
||||||
// The <init> frames go at the end of the array so they are executed first to initialize the thread and isolate.
|
// The <init> frames go at the end of the array so they are executed first to initialize the thread and isolate.
|
||||||
ctx.start([
|
ctx.start([
|
||||||
Frame.create(isolateClassInfo.getMethodByNameString("start", "()V"), [ isolate ], 0),
|
Frame.create(isolateClassInfo.getMethodByNameString("start", "()V"), [ isolate ]),
|
||||||
Frame.create(isolateClassInfo.getMethodByNameString("<init>", "(Ljava/lang/String;[Ljava/lang/String;)V"),
|
Frame.create(isolateClassInfo.getMethodByNameString("<init>", "(Ljava/lang/String;[Ljava/lang/String;)V"),
|
||||||
[ isolate, J2ME.newString(className.replace(/\./g, "/")), array ], 0)
|
[ isolate, J2ME.newString(className.replace(/\./g, "/")), array ])
|
||||||
]);
|
]);
|
||||||
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ module J2ME {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.start([
|
ctx.start([
|
||||||
Frame.create(entryPoint, [ args ], 0),
|
Frame.create(entryPoint, [ args ]),
|
||||||
Frame.create(CLASSES.java_lang_Thread.getMethodByNameString("<init>", "(Ljava/lang/String;)V"),
|
Frame.create(CLASSES.java_lang_Thread.getMethodByNameString("<init>", "(Ljava/lang/String;)V"),
|
||||||
[ runtime.mainThread, J2ME.newString("main") ], 0)
|
[ runtime.mainThread, J2ME.newString("main") ])
|
||||||
]);
|
]);
|
||||||
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1273,7 +1273,7 @@ module J2ME {
|
||||||
// Adapter for the most common case.
|
// Adapter for the most common case.
|
||||||
if (!methodInfo.isSynchronized && !methodInfo.hasTwoSlotArguments) {
|
if (!methodInfo.isSynchronized && !methodInfo.hasTwoSlotArguments) {
|
||||||
var method = function fastInterpreterFrameAdapter() {
|
var method = function fastInterpreterFrameAdapter() {
|
||||||
var frame = Frame.create(methodInfo, [], 0);
|
var frame = Frame.create(methodInfo, []);
|
||||||
var j = 0;
|
var j = 0;
|
||||||
if (!methodInfo.isStatic) {
|
if (!methodInfo.isStatic) {
|
||||||
frame.setLocal(j++, this);
|
frame.setLocal(j++, this);
|
||||||
|
@ -1289,7 +1289,7 @@ module J2ME {
|
||||||
}
|
}
|
||||||
|
|
||||||
var method = function interpreterFrameAdapter() {
|
var method = function interpreterFrameAdapter() {
|
||||||
var frame = Frame.create(methodInfo, [], 0);
|
var frame = Frame.create(methodInfo, []);
|
||||||
var j = 0;
|
var j = 0;
|
||||||
if (!methodInfo.isStatic) {
|
if (!methodInfo.isStatic) {
|
||||||
frame.setLocal(j++, this);
|
frame.setLocal(j++, this);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче