#2725 java.lang.VerifyError: Stack size too large

SlimerDude Wed 9 Jan

A strange one this:

class Failure {
    Str field := ""

    Void main() {
        fn   := |->Str| { "" }
        key  := "wotever"
        vals := Field:Obj?[:]
        [,].each {
            switch (key) {
                case "00":  vals[#field] = fn()
                case "01":  vals[#field] = fn()
                case "02":  vals[#field] = fn()
                case "03":  vals[#field] = fn()
                case "04":  vals[#field] = fn()
                case "05":  vals[#field] = fn()
                case "06":  vals[#field] = fn()
                case "07":  vals[#field] = fn()
                case "08":  vals[#field] = fn()
                case "09":  vals[#field] = fn()
                case "10":  vals[#field] = fn()
                case "11":  vals[#field] = fn()
                case "12":  vals[#field] = fn()
                case "13":  vals[#field] = fn()
                case "14":  vals[#field] = fn()
                case "15":  vals[#field] = fn()
            }
        }
    }
}

Gives:

java.lang.VerifyError: (class: fan/acme/Failure, method: main signature: ()V) Stack size too large
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
	at java.lang.Class.getDeclaredFields(Class.java:1916)
	at fan.sys.ClassType.finishSlots(ClassType.java:591)
	at fan.sys.ClassType.finish(ClassType.java:553)
	at fan.sys.Method$MethodFunc.isStatic(Method.java:489)
	at fan.sys.Method$MethodFunc.callList(Method.java:205)
	at fan.sys.Type.make(Type.java:246)
	at fan.sys.ClassType.make(ClassType.java:110)
	at fan.sys.Type.make(Type.java:236)
	at fanx.tools.Fan.callMain(Fan.java:185)
	at fanx.tools.Fan.executeType(Fan.java:147)
	at fanx.tools.Fan.execute(Fan.java:41)
	at fanx.tools.Fan.run(Fan.java:308)
	at fanx.tools.Fan.main(Fan.java:346)
sys::Err: Method not mapped to java.lang.reflect correctly 

It's something to do with the switch statement being too large and inside of the each loop.

brian Wed 9 Jan

Ticket promoted to #2725 and assigned to brian

I'll mark it as a ticket, but doubt I will do much with it myself. The max stack isn't ever calculated - just set to a fixed number right now. So its expected to fail in certain cases. Its pretty involved to calculate correctly (but probably been a decade since I last looked at it).

Login or Signup to reply.