diff --git a/actors.ts b/actors.ts index b0438d23..9bb9bf7f 100644 --- a/actors.ts +++ b/actors.ts @@ -203,7 +203,7 @@ module J2ME { this.isStatic = opts.isStatic; this.isSynchronized = opts.isSynchronized; this.isAbstract = opts.isAbstract; - this.isFinal = opts.isAbstract; + this.isFinal = opts.isFinal; this.state = MethodState.Cold; this.key = (this.isStatic ? "S." : "I.") + this.name + "." + this.signature; this.implKey = this.classInfo.className + "." + this.name + "." + this.signature; diff --git a/jit/analyze.ts b/jit/analyze.ts index a0542146..37ba2540 100644 --- a/jit/analyze.ts +++ b/jit/analyze.ts @@ -88,26 +88,29 @@ module J2ME { } export function isFinalMethod(methodInfo: MethodInfo): boolean { - // XXX Determine whether we can start using the code in this function. - return false; - var result = methodInfo.isFinal; - if (!result) { - var classInfo = methodInfo.classInfo; - var allSubClasses = classInfo.allSubClasses; - result = true; - for (var i = 0; i < allSubClasses.length; i++) { - var subClassMethods = allSubClasses[i].methods; - for (var j = 0; j < subClassMethods.length; j++) { - var subClassMethodInfo = subClassMethods[j]; - if (methodInfo.name === subClassMethodInfo.name && - methodInfo.signature === subClassMethodInfo.signature) { - result = false; - break; - } - } - } + if (isFinalClass(methodInfo.classInfo)) { + return true; } - return result; + return methodInfo.isFinal; + // XXX The following can only be used if every class in all jars is loaded. + //var result = methodInfo.isFinal; + //if (!result) { + // var classInfo = methodInfo.classInfo; + // var allSubClasses = classInfo.allSubClasses; + // result = true; + // for (var i = 0; i < allSubClasses.length; i++) { + // var subClassMethods = allSubClasses[i].methods; + // for (var j = 0; j < subClassMethods.length; j++) { + // var subClassMethodInfo = subClassMethods[j]; + // if (methodInfo.name === subClassMethodInfo.name && + // methodInfo.signature === subClassMethodInfo.signature) { + // result = false; + // break; + // } + // } + // } + //} + //return result; } export function gatherCallees(callees: MethodInfo [], classInfo: ClassInfo, methodInfo: MethodInfo) {