How does the .NET IL .maxstack directive work?

后端 未结 3 2094
清酒与你
清酒与你 2021-01-01 11:10

I\'d like to know how does .maxstack really work. I know it doesn\'t have to do with the actual size of the types you are declaring but with the number of them. My questions

3条回答
  •  执笔经年
    2021-01-01 11:46

    It has nothing to do with the number of variables declared, but instead everything to do with how many values you need to push on a stack at any given time in order to compute some expression.

    For instance, in the following expression, I would assume 2 values needs to be pushed onto the stack:

    x = y + z;
    

    This is unrelated to the fact that there are at least 3 variables present, x, y, and z, and possibly others as well.

    Unfortunately I don't know the answer to your other questions, and I would guess experimentation would be one way to find some answers.

提交回复
热议问题