From cb2bcec871d73e0ca7962260952ad354eba2bbdd Mon Sep 17 00:00:00 2001 From: Andrew Binstock <920630+platypusguy@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:46:24 -0800 Subject: [PATCH] JACOBIN-575 Added further logic in instantiate.go to put the names of all superclass methods into the present class's methodList --- src/config/buildno.go | 2 +- src/jvm/instantiate.go | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/config/buildno.go b/src/config/buildno.go index b2a29240..d740c25b 100644 --- a/src/config/buildno.go +++ b/src/config/buildno.go @@ -8,4 +8,4 @@ package config -var BuildNo = 3421 \ No newline at end of file +var BuildNo = 3423 \ No newline at end of file diff --git a/src/jvm/instantiate.go b/src/jvm/instantiate.go index a6537471..79dc71c7 100644 --- a/src/jvm/instantiate.go +++ b/src/jvm/instantiate.go @@ -170,6 +170,8 @@ func InstantiateClass(classname string, frameStack *list.List) (any, error) { } // end of handling fields for one class or superclass } // end of handling fields for classes with superclasses other than Object +runInitializer: + // set up the methods in the MethodList and the GMT for _, meth := range k.Data.MethodTable { methName := k.Data.CP.Utf8Refs[meth.Name] @@ -178,23 +180,24 @@ func InstantiateClass(classname string, frameStack *list.List) (any, error) { k.Data.MethodList = append(k.Data.MethodList, FQN) classloader.GmtAddEntry(FQN, classloader.GmtEntry{MethData: &meth, MType: 'J'}) } - // go through the superclasses and add their methods to the class's MethodList - for _, superclassName := range superclasses { - superclass := classloader.MethAreaFetch(superclassName) - if superclass == nil { - errMsg := fmt.Sprintf("InstantiateClass: MethAreaFetch(superclass: %s) failed", superclassName) - trace.Error(errMsg) - } - // for _, m := range superclass.Data.MethodTable { // CURR JACOBIN-575 - // _, ok := k.Data.MethodTable[m.Name] - // if !ok { - // k.Data.MethodTable[m.Name] = m - // } - // } - } + // // go through the superclasses and add their methods to the class's MethodList + // superclasses = append(superclasses, "java/lang/Object") // add Object to the end of the list + // for _, superclassName := range superclasses { + // superclass := classloader.MethAreaFetch(superclassName) + // if superclass == nil { + // errMsg := fmt.Sprintf("InstantiateClass: MethAreaFetch(superclass: %s) failed", superclassName) + // trace.Error(errMsg) + // } + // + // for _, meth := range superclass.Data.MethodTable { // in theory, all methods should already be in the GMT + // methName := superclass.Data.CP.Utf8Refs[meth.Name] + // methType := superclass.Data.CP.Utf8Refs[meth.Desc] + // FQN := superclassName + "." + methName + methType + // k.Data.MethodList = append(k.Data.MethodList, FQN) + // } + // } -runInitializer: // check the code for validity before running initialization blocks if !k.CodeChecked && !util.IsFilePartOfJDK(&classname) { // we don't code check JDK classes for _, m := range k.Data.MethodTable {