Skip to content

Commit

Permalink
Use lookup of name table instead of findClass.
Browse files Browse the repository at this point in the history
  • Loading branch information
maejima-fumika committed Nov 15, 2024
1 parent e83cd02 commit a7b3671
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
6 changes: 3 additions & 3 deletions server/src/jit/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export function typeStringToStaticType(typeString: string, gvnt?: GlobalVariable
} else if (typeString === 'Function') {
return 'any'
} else {
const clazz = gvnt === undefined ? undefined : gvnt.classTable().findClass(typeString)
if (clazz === undefined)
const type = gvnt === undefined ? undefined : gvnt.lookup(typeString)?.type
if (type === undefined || !(type instanceof InstanceType))
throw new ProfileError(`Cannot find the profiled class: ${typeString}`)
return clazz
return type
}
}

Expand Down
11 changes: 0 additions & 11 deletions server/src/transpiler/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,4 @@ export class ClassTable {
return { offset: offset, unboxed: unboxed,
props: props, unboxedTypes: unboxedTypes.join('')}
}

findClass(name: string, classes: InstanceType[] = this.rootClasses): InstanceType|undefined {
for (const clazz of classes) {
if (clazz.name() === name)
return clazz
const resultClass = this.findClass(name, clazz.subclasses())
if (resultClass !== undefined)
return resultClass
}
return undefined
}
}

0 comments on commit a7b3671

Please sign in to comment.