+ Make class initialization slightly more efficient
This commit is contained in:
fur%netscape.com 1999-02-26 08:40:13 +00:00
Родитель 89f2257e57
Коммит e10f049385
1 изменённых файлов: 7 добавлений и 12 удалений

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

@ -1461,14 +1461,6 @@ void ClassOrInterface::runStaticInitializers()
VM::theVM.getNoInvoke()) VM::theVM.getNoInvoke())
return; return;
/* KLUDGE ALERT Because codegen currently does not do longs, floats and
* doubles, we disable static initializers for those classes that
* use longs, floats and doubles. This should go away once codegen
* catches up.
*/
if (forbidden(name))
return;
/* Let's initially do this the easy way. Linearly search through the /* Let's initially do this the easy way. Linearly search through the
* method array for static initializers * method array for static initializers
*/ */
@ -1478,13 +1470,16 @@ void ClassOrInterface::runStaticInitializers()
extern StringPool sp; extern StringPool sp;
const char *clinitp = sp.get("<clinit>"); const char *clinitp = sp.get("<clinit>");
const char *sigp = sp.get("()V");
for (Int16 i = 0; i < methodCount; i++) { for (Int16 i = 0; i < methodCount; i++) {
if (methodInfos[i]->getName()->getUtfString() == clinitp && if (methodInfos[i]->getName()->getUtfString() == clinitp) {
methodInfos[i]->getDescriptor()->getUtfString() == sigp) {
Method &m = summary->getMethod(i);
#ifdef DEBUG
const char *sigp = sp.get("()V");
assert(methodInfos[i]->getDescriptor()->getUtfString() == sigp);
#endif
Method &m = summary->getMethod(i);
m.compile(); m.compile();
m.invoke(0, 0, 0); m.invoke(0, 0, 0);
} }