diff --git a/Makefile b/Makefile index b006c6c9..d3cc35fe 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ TOOLS_DIR := $(BASE_DIR)/tools .PHONY: setup setup: - $(MAKE) -C external + $(MAKE) -C external setup $(MAKE) -C client setup .PHONY: setup-git diff --git a/client/rsh/src/bc2c/runtime.h b/client/rsh/src/bc2c/runtime.h index 5f1d296e..40fd205f 100644 --- a/client/rsh/src/bc2c/runtime.h +++ b/client/rsh/src/bc2c/runtime.h @@ -7,7 +7,6 @@ // MAKE SURE Rinternals.h is not listed! #include "R_ext/Boolean.h" #include "runtime_internals.h" -#include #include #include #include diff --git a/server/src/main/java/org/prlprg/bc2c/BC2CCompiler.java b/server/src/main/java/org/prlprg/bc2c/BC2CCompiler.java index 52a23efe..8e505587 100644 --- a/server/src/main/java/org/prlprg/bc2c/BC2CCompiler.java +++ b/server/src/main/java/org/prlprg/bc2c/BC2CCompiler.java @@ -243,11 +243,11 @@ private void compile(BcInstr instr, int pc) { } case BcInstr.Dup() -> { stack.push(); - yield "%s = %s;".formatted(stack.get(0), stack.get(-2)); + yield "%s = %s;".formatted(stack.get(0), stack.get(-1)); } case BcInstr.Dup2nd() -> { stack.push(); - yield "%s = %s;".formatted(stack.get(0), stack.get(-3)); + yield "%s = %s;".formatted(stack.get(0), stack.get(-2)); } default -> { if (instr.label().orElse(null) instanceof BcLabel l) { diff --git a/server/src/test/java/org/prlprg/bc2c/BC2CCompilerTest.java b/server/src/test/java/org/prlprg/bc2c/BC2CCompilerTest.java index b74e4209..d263ee13 100644 --- a/server/src/test/java/org/prlprg/bc2c/BC2CCompilerTest.java +++ b/server/src/test/java/org/prlprg/bc2c/BC2CCompilerTest.java @@ -535,7 +535,8 @@ public void testIf(BC2CSnapshot snapshot) { } @Test - public void testAdhoc(BC2CSnapshot snapshot) { + public void testSubsetAndComplexAssign(BC2CSnapshot snapshot) { + // from bounce benchmark snapshot.verify(""" b <- list() b[[1]] <- c(1,2,3) diff --git a/server/src/test/resources/org/prlprg/bc2c/snapshots/BC2CCompilerTest/testSubsetAndComplexAssign.RDS b/server/src/test/resources/org/prlprg/bc2c/snapshots/BC2CCompilerTest/testSubsetAndComplexAssign.RDS new file mode 100644 index 00000000..e4f1b8e7 Binary files /dev/null and b/server/src/test/resources/org/prlprg/bc2c/snapshots/BC2CCompilerTest/testSubsetAndComplexAssign.RDS differ