Skip to content

Commit

Permalink
fix parameters bigger than 4 bytes being passed through registers
Browse files Browse the repository at this point in the history
  • Loading branch information
dankmeme01 committed Mar 18, 2024
1 parent a46fb9e commit 7fa328b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/convention/WindowsConvention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ class PushParameters final {
size_t index = 0;
for (auto& [oindex, param] : reordered) {
// first primitive through ecx
if (registersUsed == 0 && param.m_kind == AbstractTypeKind::Primitive) {
if (registersUsed == 0 && param.m_kind == AbstractTypeKind::Primitive && param.m_size <= sizeof(void*)) {
res.push(param, Register::ECX, oindex);
registersUsed = 1;
}
// second primitive through edx
else if (registersUsed == 1 && param.m_kind == AbstractTypeKind::Primitive) {
else if (registersUsed == 1 && param.m_kind == AbstractTypeKind::Primitive && param.m_size <= sizeof(void*)) {
res.push(param, Register::EDX, oindex);
registersUsed = 2;
}
Expand Down Expand Up @@ -283,7 +283,7 @@ class PushParameters final {
size_t index = 0;
for (auto& [oindex, param] : reordered) {
// first primitive through ecx
if (registersUsed == 0 && param.m_kind == AbstractTypeKind::Primitive) {
if (registersUsed == 0 && param.m_kind == AbstractTypeKind::Primitive && param.m_size <= sizeof(void*)) {
res.push(param, Register::ECX, oindex);
registersUsed = 1;
}
Expand Down

0 comments on commit 7fa328b

Please sign in to comment.