Skip to content

Commit

Permalink
JACOBIN-575 Added further logic in instantiate.go to put the names of…
Browse files Browse the repository at this point in the history
… all superclass methods into the present class's methodList
  • Loading branch information
platypusguy committed Jan 18, 2025
1 parent 3b62d18 commit cb2bcec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/config/buildno.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

package config

var BuildNo = 3421
var BuildNo = 3423
33 changes: 18 additions & 15 deletions src/jvm/instantiate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 {
Expand Down

0 comments on commit cb2bcec

Please sign in to comment.