Don't check isStatic when looking up methods and fields (since they're uniquely identified by name and descriptor)

This commit is contained in:
Marco Castelluccio 2015-03-10 22:42:48 +01:00
Родитель 3dd2b3a663
Коммит 1a44b32963
3 изменённых файлов: 14 добавлений и 14 удалений

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

@ -454,7 +454,7 @@ module J2ME {
release || Debug.assert(!U, "Unexpected unwind during createException.");
runtimeCounter && runtimeCounter.count("createException " + className);
var exception = new classInfo.klass();
var methodInfo = classInfo.getMethodByName("<init>", "(Ljava/lang/String;)V", false);
var methodInfo = classInfo.getMethodByName("<init>", "(Ljava/lang/String;)V");
jsGlobal[methodInfo.mangledClassAndMethodName].call(exception, message ? newString(message) : null);
return exception;

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

@ -38,8 +38,8 @@ module J2ME {
// The <init> frames go at the end of the array so they are executed first to initialize the thread and isolate.
ctx.start([
Frame.create(isolateClassInfo.getMethodByName("start", "()V", false), [ isolate ], 0),
Frame.create(isolateClassInfo.getMethodByName("<init>", "(Ljava/lang/String;[Ljava/lang/String;)V", false),
Frame.create(isolateClassInfo.getMethodByName("start", "()V"), [ isolate ], 0),
Frame.create(isolateClassInfo.getMethodByName("<init>", "(Ljava/lang/String;[Ljava/lang/String;)V"),
[ isolate, J2ME.newString(className.replace(/\./g, "/")), array ], 0)
]);
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
@ -71,7 +71,7 @@ module J2ME {
ctx.start([
Frame.create(entryPoint, [ args ], 0),
Frame.create(CLASSES.java_lang_Thread.getMethodByName("<init>", "(Ljava/lang/String;)V", false),
Frame.create(CLASSES.java_lang_Thread.getMethodByName("<init>", "(Ljava/lang/String;)V"),
[ runtime.mainThread, J2ME.newString("main") ], 0)
]);
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");

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

@ -362,7 +362,7 @@ module J2ME {
if (tag === TAGS.CONSTANT_Fieldref) {
r = this.resolved[i] = classInfo.getFieldByName(name, type, isStatic);
} else {
r = this.resolved[i] = classInfo.getMethodByName(name, type, isStatic);
r = this.resolved[i] = classInfo.getMethodByName(name, type);
}
if (!r) {
throw $.newRuntimeException(classInfo.className + "." + name + "." + type + " not found");
@ -791,24 +791,24 @@ module J2ME {
return <MethodInfo>this.methods[i];
}
indexOfMethod(name: string, signature: string, isStatic: boolean): number {
indexOfMethod(name: string, signature: string): number {
var methods = this.methods;
if (!methods) {
return -1;
}
for (var i = 0; i < methods.length; i++) {
var method = this.getMethodByIndex(i);
if (method.name === name && method.signature === signature && method.isStatic === isStatic) {
if (method.name === name && method.signature === signature) {
return i;
}
}
return -1;
}
getMethodByName(name: string, signature: string, isStatic: boolean): MethodInfo {
getMethodByName(name: string, signature: string): MethodInfo {
var c = this;
do {
var i = c.indexOfMethod(name, signature, isStatic);
var i = c.indexOfMethod(name, signature);
if (i >= 0) {
return c.getMethodByIndex(i);
}
@ -818,7 +818,7 @@ module J2ME {
if (this.isInterface) {
var interfaces = this.getInterfaces();
for (var n = 0; n < interfaces.length; ++n) {
var method = interfaces[n].getMethodByName(name, signature, isStatic);
var method = interfaces[n].getMethodByName(name, signature);
if (method) {
return method;
}
@ -849,14 +849,14 @@ module J2ME {
return <FieldInfo>this.fields[i];
}
indexOfField(name: string, signature: string, isStatic: boolean): number {
indexOfField(name: string, signature: string): number {
var fields = this.fields;
if (!fields) {
return -1;
}
for (var i = 0; i < fields.length; i++) {
var field = this.getFieldByIndex(i);
if (field.name === name && field.signature === signature && field.isStatic === isStatic) {
if (field.name === name && field.signature === signature) {
return i;
}
}
@ -866,7 +866,7 @@ module J2ME {
getFieldByName(name: string, signature: string, isStatic: boolean): FieldInfo {
var c = this;
do {
var i = c.indexOfField(name, signature, isStatic);
var i = c.indexOfField(name, signature);
if (i >= 0) {
return c.getFieldByIndex(i);
}
@ -940,7 +940,7 @@ module J2ME {
}
get staticInitializer(): MethodInfo {
return this.getMethodByName("<clinit>", "()V", true);
return this.getMethodByName("<clinit>", "()V");
}
/**