зеркало из https://github.com/mozilla/pluotsorbet.git
Merge commit '13dbd3bc1fd73cc7f4e8576a7192ced856fbaf7a' into jitjit
Conflicts: classinfo.js vm.js
This commit is contained in:
Коммит
adbfb7d54b
|
@ -90,6 +90,11 @@ function MethodInfo(opts) {
|
|||
this.alternateImpl = null;
|
||||
}
|
||||
|
||||
this.consumes = Signature.getINSlots(this.signature);
|
||||
if (!this.isStatic) {
|
||||
this.consumes++;
|
||||
}
|
||||
|
||||
this.numCalled = 100;
|
||||
this.compiled = null;
|
||||
this.dontCompile = false;
|
||||
|
|
10
context.js
10
context.js
|
@ -18,9 +18,9 @@ Context.prototype.current = function() {
|
|||
return frames[frames.length - 1];
|
||||
}
|
||||
|
||||
Context.prototype.pushFrame = function(methodInfo, consumes) {
|
||||
Context.prototype.pushFrame = function(methodInfo) {
|
||||
var caller = this.current();
|
||||
var callee = new Frame(methodInfo, caller.stack, caller.stack.length - consumes);
|
||||
var callee = new Frame(methodInfo, caller.stack, caller.stack.length - methodInfo.consumes);
|
||||
this.frames.push(callee);
|
||||
Instrument.callEnterHooks(methodInfo, caller, callee);
|
||||
return callee;
|
||||
|
@ -41,6 +41,7 @@ Context.prototype.pushClassInitFrame = function(classInfo) {
|
|||
var syntheticMethod = new MethodInfo({
|
||||
name: "ClassInitSynthetic",
|
||||
signature: "()V",
|
||||
isStatic: false,
|
||||
classInfo: {
|
||||
className: classInfo.className,
|
||||
vmc: {},
|
||||
|
@ -72,7 +73,7 @@ Context.prototype.pushClassInitFrame = function(classInfo) {
|
|||
])
|
||||
});
|
||||
this.current().stack.push(classInfo.getClassObject(this));
|
||||
this.pushFrame(syntheticMethod, 1);
|
||||
this.pushFrame(syntheticMethod);
|
||||
}
|
||||
|
||||
Context.prototype.raiseException = function(className, message) {
|
||||
|
@ -82,6 +83,7 @@ Context.prototype.raiseException = function(className, message) {
|
|||
var syntheticMethod = new MethodInfo({
|
||||
name: "RaiseExceptionSynthetic",
|
||||
signature: "()V",
|
||||
isStatic: true,
|
||||
classInfo: {
|
||||
className: className,
|
||||
vmc: {},
|
||||
|
@ -106,7 +108,7 @@ Context.prototype.raiseException = function(className, message) {
|
|||
0xbf // athrow
|
||||
])
|
||||
});
|
||||
this.pushFrame(syntheticMethod, 0);
|
||||
this.pushFrame(syntheticMethod);
|
||||
}
|
||||
|
||||
Context.prototype.raiseExceptionAndYield = function(className, message) {
|
||||
|
|
|
@ -272,6 +272,7 @@ Native["java/lang/Class.newInstance.()Ljava/lang/Object;"] = function(ctx, stack
|
|||
var syntheticMethod = new MethodInfo({
|
||||
name: "ClassNewInstanceSynthetic",
|
||||
signature: "()Ljava/lang/Object;",
|
||||
isStatic: true,
|
||||
classInfo: {
|
||||
className: className,
|
||||
vmc: {},
|
||||
|
@ -293,7 +294,7 @@ Native["java/lang/Class.newInstance.()Ljava/lang/Object;"] = function(ctx, stack
|
|||
0xb0 // areturn
|
||||
]),
|
||||
});
|
||||
ctx.pushFrame(syntheticMethod, 0);
|
||||
ctx.pushFrame(syntheticMethod);
|
||||
throw VM.Yield;
|
||||
};
|
||||
|
||||
|
|
10
vm.js
10
vm.js
|
@ -86,8 +86,8 @@ function classInitCheck(ctx, frame, classInfo, ip) {
|
|||
throw VM.Yield;
|
||||
}
|
||||
|
||||
function pushFrame(ctx, methodInfo, consumes) {
|
||||
var frame = ctx.pushFrame(methodInfo, consumes);
|
||||
function pushFrame(ctx, methodInfo) {
|
||||
var frame = ctx.pushFrame(methodInfo);
|
||||
if (frame.isSynchronized) {
|
||||
if (!frame.lockObject) {
|
||||
frame.lockObject = methodInfo.isStatic
|
||||
|
@ -1043,10 +1043,8 @@ VM.execute = function(ctx) {
|
|||
if (isStatic)
|
||||
classInitCheck(ctx, frame, methodInfo.classInfo, startip);
|
||||
}
|
||||
var consumes = Signature.getINSlots(methodInfo.signature);
|
||||
if (!isStatic) {
|
||||
++consumes;
|
||||
var obj = stack[stack.length - consumes];
|
||||
var obj = stack[stack.length - methodInfo.consumes];
|
||||
if (!obj) {
|
||||
ctx.raiseExceptionAndYield("java/lang/NullPointerException");
|
||||
break;
|
||||
|
@ -1089,7 +1087,7 @@ VM.execute = function(ctx) {
|
|||
}
|
||||
Instrument.callResumeHooks(frame);
|
||||
|
||||
frame = pushFrame(ctx, methodInfo, consumes);
|
||||
frame = pushFrame(ctx, methodInfo);
|
||||
|
||||
if (methodInfo.compiled) {
|
||||
frame = methodInfo.compiled(ctx);
|
||||
|
|
Загрузка…
Ссылка в новой задаче