Don't try to call static constructors if there aren't any.

This commit is contained in:
Michael Bebenita 2015-01-21 19:51:51 -08:00
Родитель c63990a0fe
Коммит bd748126d7
2 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -472,10 +472,32 @@ module J2ME {
}
pushClassInitFrame(classInfo: ClassInfo) {
if (this.runtime.initialized[classInfo.className]) {
if (this.runtime.initialized[classInfo.className] ||
this.runtime.pending[classInfo.className]) {
return;
}
var needsInitialization = true;
if (!classInfo.staticInitializer) {
needsInitialization = false;
// Special case Isolate.
if (classInfo.className === "com/sun/cldc/isolate/Isolate") {
needsInitialization = true;
}
var superClass = classInfo.superClass;
while (superClass) {
if (!this.runtime.initialized[superClass.className] &&
superClass.staticInitializer) {
needsInitialization = true;
break;
}
superClass = superClass.superClass;
}
}
linkKlass(classInfo);
if (!needsInitialization) {
this.runtime.initialized[classInfo.className] = true;
return;
}
var classInitFrame = this.getClassInitFrame(classInfo);
this.executeFrames([classInitFrame]);
}

Просмотреть файл

@ -1691,7 +1691,7 @@ module J2ME {
}
export function classInitCheck(classInfo: ClassInfo, pc: number) {
if (classInfo.isArrayClass || $.initialized[classInfo.className]) {
if (classInfo.isArrayClass) {
return;
}
$.ctx.pushClassInitFrame(classInfo);