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

chore: refine Coprocessors' API #1180

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

arthurpaulino
Copy link
Member

@arthurpaulino arthurpaulino commented Feb 28, 2024

  • Allow coprocessor to alloc their own global constants
  • Remove Coprocessor::eval_arity since the implementer already defines CoCircuit::arity

Closes #979

* Allow coprocessor to alloc their own global constants
* Remove Coprocessor::eval_arity since the implementer already defines CoCircuit::arity
@arthurpaulino arthurpaulino requested review from a team as code owners February 28, 2024 13:06
Comment on lines +4075 to +4099
#[test]
fn test_hello_world_lang() {
use crate::coprocessor::test::HelloWorld;

let mut lang = Lang::<Fr, HelloWorld<Fr>>::new();
let hello_world = HelloWorld::new();
let name = user_sym("hello-world");

let s = &Store::default();
lang.add_coprocessor(name, hello_world);

let res = HelloWorld::intern_hello_world(s);
let terminal = s.cont_terminal();

test_aux::<_, HelloWorld<_>>(
s,
"(hello-world)",
Some(res),
None,
Some(terminal),
None,
&expect!["1"],
&Some(lang.into()),
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This test wouldn't pass without the new alloc_globals

Copy link
Member

@gabriel-barrett gabriel-barrett left a comment

Choose a reason for hiding this comment

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

LGTM. I have to say though, that GlobalAllocator could eventually be completely eliminated. A variable that is constrained to be a constant is really a waste, since we already have one such variable: one. Any other constant variable can be derived from this by a simple linear combination: the constant multiplied by the variable one. This is the third point in #1051

@arthurpaulino arthurpaulino added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit 867f0c2 Feb 29, 2024
11 checks passed
@arthurpaulino arthurpaulino deleted the ap/coprocessor-adjustments branch February 29, 2024 16:46
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.

Coprocessors' global constant allocations
2 participants