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

[NUP] A06 Vsevolod Vaskin #1406

Conversation

Seva-Vaskin
Copy link

No description provided.

@danyaberezun danyaberezun reopened this Apr 9, 2024
case expr of
Var (x) -> [c, lookup(s, x)]
| Ref (x) -> [c, x]
| Const (x) -> [c, x]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap in Var

Comment on lines +519 to +555
fun pushRegisters(registers) {
fun pushRegister(code, register) {
code <+ Push(register)
}
foldl(pushRegister, emptyBuffer(), registers)
}

fun popRegisters(registers) {
fun popRegister(code, register) {
code <+ Pop(register)
}
foldl(popRegister, emptyBuffer(), registers)
}

fun pushArguments([env, code], nArgs) {
case nArgs of
0 -> [env, code]
| nArgs -> case pop(env) of
[argument, env] -> pushArguments([env, code <+ Push(argument)], nArgs - 1)
esac
esac
}

case pushArguments([env, emptyBuffer()], nArgs) of
[env, pushedArguments] ->
case allocate(env) of
[res, env] ->
[env, code
<+> pushRegisters(registers)
<+> pushedArguments
<+ Call(fLabel)
<+ Binop("+", L(wordSize * nArgs), esp)
<+> popRegisters(reverse(registers))
<+> move(eax, res)
]
esac
esac
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@e2e4b6b7
Copy link
Collaborator

ping

@Seva-Vaskin
Copy link
Author

Fixed

@Seva-Vaskin Seva-Vaskin requested a review from e2e4b6b7 May 25, 2024 15:36
@e2e4b6b7 e2e4b6b7 closed this May 25, 2024
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

Successfully merging this pull request may close these issues.

3 participants