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

Bc if invisible #1232

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanups
JanJecmen committed Jul 26, 2022
commit 32ba6b5c4251151c08ab074ee64305b2483f7950
3 changes: 1 addition & 2 deletions rir/src/bc/CodeVerifier.cpp
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ void CodeVerifier::calculateAndVerifyStack(Code* code) {
Opcode* cptr = code->code();
q.push(State(cptr));

while (not q.empty()) {
while (!q.empty()) {
State i = q.top();
q.pop();
if (state.find(i.pc) != state.end()) {
@@ -259,7 +259,6 @@ void CodeVerifier::verifyFunctionLayout(SEXP sexp) {
Rf_error("RIR Verifier: cached clear_binding_cache_ with "
"invalid index");
}

if (*cptr == Opcode::mk_promise_ ||
*cptr == Opcode::mk_eager_promise_) {
unsigned* promidx = reinterpret_cast<Immediate*>(cptr + 1);
10 changes: 6 additions & 4 deletions rir/src/bc/Compiler.cpp
Original file line number Diff line number Diff line change
@@ -116,7 +116,6 @@ class CompilerContext {
};

class PromiseContext : public CodeContext {

public:
PromiseContext(SEXP ast, FunctionWriter& fun, CodeContext* p)
: CodeContext(ast, fun, p) {}
@@ -1759,7 +1758,7 @@ static void compileLoadOneArg(CompilerContext& ctx, SEXP arg, ArgType arg_type,
}

// Constant arguments do not need to be promise wrapped
if (arg_type != ArgType::EAGER_PROMISE_FROM_TOS)
if (arg_type != ArgType::EAGER_PROMISE_FROM_TOS) {
switch (TYPEOF(CAR(arg))) {
case LANGSXP:
case SYMSXP:
@@ -1777,6 +1776,7 @@ static void compileLoadOneArg(CompilerContext& ctx, SEXP arg, ArgType arg_type,
cs << BC::push(eager);
return;
}
}

Code* prom;
if (arg_type == ArgType::EAGER_PROMISE) {
@@ -1788,12 +1788,14 @@ static void compileLoadOneArg(CompilerContext& ctx, SEXP arg, ArgType arg_type,
prom = compilePromiseNoRir(ctx, CAR(arg));
} else if (arg_type == ArgType::EAGER_PROMISE_FROM_TOS) {
// The value we want to wrap in the argument's promise is
// already on TOS, no nead to compile the expression.
// already on TOS, no need to compile the expression.
// Wrap it in a promise without rir code.
prom = compilePromiseNoRir(ctx, CAR(arg));
} else { // ArgType::PROMISE
} else if (arg_type == ArgType::PROMISE) {
// Compile the expression as a promise.
prom = compilePromise(ctx, CAR(arg));
} else {
assert(false);
}

size_t idx = cs.addPromise(prom);