Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

필요한 스택 길이 검사가 최적화에서 사라집니다. #5

Closed
Sait2000 opened this issue Sep 4, 2017 · 0 comments
Closed

Comments

@Sait2000
Copy link

Sait2000 commented Sep 4, 2017

원래는 스택 길이가 0이 되면 종료하는 코드가 -O1에서 검사가 사라져서 에러가 발생합니다.

바뱌희빠마며

; python2.7, 1.2.2, -O0

L0:     PUSH 0     ; L0   바 / [  0,  0] RIGHT1
        PUSH 0     ; L1   뱌 / [  0,  1] RIGHT2
L2:     BRPOP1 L9   ; L2   
        DUP        ; L3   빠 / [  0,  3] RIGHT1
        BRPOP1 L10  ; L4   
        POP        ; L5   마 / [  0,  4] RIGHT1
        BRPOP1 L11  ; L6   
        POP        ; L7   며 / [  0,  5] LEFT 2
        JMP  L2    ; L8   
L9:     HALT       ; L9   희 / [  0,  2] LEFT 1
L10:    JMP  L2    ; L10  
L11:    JMP  L0    ; L11  


; python2.7, 1.2.2, -O1

        PUSH 0     ; L0   바 / [  0,  0] RIGHT1
        PUSH 0     ; L1   뱌 / [  0,  1] RIGHT2
L2:     DUP        ; L2   빠 / [  0,  3] RIGHT1
        POP        ; L3   마 / [  0,  4] RIGHT1
        POP        ; L4   며 / [  0,  5] LEFT 2
        JMP  L2    ; L5   


; python2.7, 1.2.2, -O2

        PUSH 0     ; L0   바 / [  0,  0] RIGHT1
        PUSH 0     ; L1   뱌 / [  0,  1] RIGHT2
L2:     BRPOP1 L7   ; L2   
        DUP        ; L3   빠 / [  0,  3] RIGHT1
        POP        ; L4   마 / [  0,  4] RIGHT1
        POP        ; L5   며 / [  0,  5] LEFT 2
        JMP  L2    ; L6   
L7:     HALT       ; L7   희 / [  0,  2] LEFT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant