Skip to content

Commit

Permalink
codegen: fix logicinner tmp alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Mar 7, 2024
1 parent 240f1c8 commit 4b72c49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/codeGen.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ const truthy = (scope, wasm, type, intIn = false, intOut = false) => {
];

const useTmp = knownType(scope, type) == null;
const tmp = !useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);
const tmp = useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);

const def = [
// if value != 0
Expand Down Expand Up @@ -713,7 +713,7 @@ const truthy = (scope, wasm, type, intIn = false, intOut = false) => {

const falsy = (scope, wasm, type, intIn = false, intOut = false) => {
const useTmp = knownType(scope, type) == null;
const tmp = !useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);
const tmp = useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);

return [
...wasm,
Expand Down Expand Up @@ -759,7 +759,7 @@ const falsy = (scope, wasm, type, intIn = false, intOut = false) => {

const nullish = (scope, wasm, type, intIn = false, intOut = false) => {
const useTmp = knownType(scope, type) == null;
const tmp = !useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);
const tmp = useTmp && localTmp(scope, `$logicinner_tmp${intIn ? '_int' : ''}`, intIn ? Valtype.i32 : valtypeBinary);

return [
...wasm,
Expand Down

0 comments on commit 4b72c49

Please sign in to comment.