-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Currently, Jitex only expects one 'ret' instruction AND as the last instruction in the body. When the method has multiple 'ret' instructions, we're not covering all paths.
Example:
MSIL Body from DateTime.Now:
[0] = {Instruction} call System.DateTime get_UtcNow()
[1] = {Instruction} stloc.0
[2] = {Instruction} ldloc.0
[3] = {Instruction} ldloca.s 2
[4] = {Instruction} call System.TimeSpan GetDateTimeNowUtcOffsetFromUtc(System.DateTime, Boolean ByRef)
[5] = {Instruction} stloc.s 4
[6] = {Instruction} ldloca.s 4
[7] = {Instruction} call Int64 get_Ticks()
[8] = {Instruction} stloc.1
[9] = {Instruction} ldloca.s 0
[10] = {Instruction} call Int64 get_Ticks()
[11] = {Instruction} ldloc.1
[12] = {Instruction} add
[13] = {Instruction} stloc.3
[14] = {Instruction} ldloc.3
[15] = {Instruction} ldc.i8 3155378975999999999
[16] = {Instruction} bgt.un.s 37
[17] = {Instruction} ldloc.2
[18] = {Instruction} brtrue.s 17
[19] = {Instruction} ldloc.3
[20] = {Instruction} ldc.i8 -9223372036854775808
[21] = {Instruction} or
[22] = {Instruction} newobj Void .ctor(UInt64)
[23] = {Instruction} ret <------------------------------------- HERE
[24] = {Instruction} ldloc.3
[25] = {Instruction} ldc.i8 -4611686018427387904
[26] = {Instruction} or
[27] = {Instruction} newobj Void .ctor(UInt64)
[28] = {Instruction} ret <------------------------------------- AND HERE
[29] = {Instruction} ldloc.3
[30] = {Instruction} ldc.i4.0
[31] = {Instruction} conv.i8
[32] = {Instruction} blt.s 11
[33] = {Instruction} ldc.i8 -6067993060854775809
[34] = {Instruction} br.s 9
[35] = {Instruction} ldc.i8 -9223372036854775808
[36] = {Instruction} newobj Void .ctor(UInt64)
[37] = {Instruction} ret <------------------------------- WE JUST EXPECTED THIS RET
That will cause an unexpected return.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working