Compare commits

..

6 Commits

Author SHA1 Message Date
Jordi Baylina
f25842f67c 0.5.7 2020-04-07 13:02:51 +02:00
Jordi Baylina
92399017df FIX: c tester in linux 2020-04-07 13:02:39 +02:00
Jordi Baylina
1463685b11 Merge pull request #57 from iden3/feature/c-tester-linux
add `-pthread` for linux g++ command
2020-04-07 13:00:51 +02:00
Jordi Baylina
a1ae6e4a44 0.5.6 2020-04-07 12:54:30 +02:00
Jordi Baylina
c7c6b799ad FIX: Error in wasm generation of big circuits 2020-04-07 12:53:58 +02:00
krlosMata
b107a11432 add -pthread for linux 2020-04-07 11:51:48 +02:00
4 changed files with 26 additions and 23 deletions

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.5.5",
"version": "0.5.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -592,9 +592,9 @@
}
},
"ffjavascript": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.0.4.tgz",
"integrity": "sha512-6eiRvy+YuGCRjH4U8KdJbRel5VBW0zeuUL1FXQ+fFxTp5xv2ClqTfCYf5ClUtq0voGpd9XJAdUCvgIxHDbAQ0Q==",
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.0.5.tgz",
"integrity": "sha512-7je6PydOWLDUj3vU8JeCUgeezg4yrG/6qjlukQNuPHeeavnM4REcrN9LA2+xtqIMIPdx/wdUkPMQpixsz+CdIw==",
"requires": {
"big-integer": "^1.6.48"
}

View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.5.5",
"version": "0.5.7",
"description": "Language to generate logic circuits",
"main": "index.js",
"directories": {
@@ -33,7 +33,7 @@
"chai": "^4.2.0",
"circom_runtime": "0.0.3",
"ffiasm": "0.0.2",
"ffjavascript": "0.0.4",
"ffjavascript": "0.0.5",
"ffwasm": "0.0.6",
"fnv-plus": "^1.3.1",
"r1csfile": "0.0.3",

View File

@@ -42,11 +42,14 @@ async function c_tester(circomFile, _options) {
await fs.promises.writeFile(path.join(dir.path, "fr.h"), source.h, "utf8");
await fs.promises.writeFile(path.join(dir.path, "fr.c"), source.c, "utf8");
let pThread = "";
if (process.platform === "darwin") {
await exec("nasm -fmacho64 --prefix _ " +
` ${path.join(dir.path, "fr.asm")}`
);
} else if (process.platform === "linux") {
pThread = "-pthread";
await exec("nasm -felf64 " +
` ${path.join(dir.path, "fr.asm")}`
);
@@ -54,7 +57,7 @@ async function c_tester(circomFile, _options) {
const cdir = path.join(path.dirname(require.resolve("circom_runtime")), "c");
await exec("g++" +
await exec("g++" + ` ${pThread}` +
` ${path.join(cdir, "main.cpp")}` +
` ${path.join(cdir, "calcwit.cpp")}` +
` ${path.join(cdir, "utils.cpp")}` +

View File

@@ -923,41 +923,41 @@ class BuilderWasm {
}
_buildComponents(module) {
const bytes = [];
const bytes = new Array(this.components.length*5*4);
bytes.length=0;
for (let i=0; i<this.components.length; i++) {
const c = this.components[i];
bytes.push(intToBytes32(this.hashMaps[c.hashMapName].pointer));
bytes.push(intToBytes32(this.componentEntriesTables[c.entryTableName].pointer));
bytes.push(intToBytes32(i));
bytes.push(intToBytes32(c.nInSignals));
bytes.push(intToBytes32(c.newThread ? 1 : 0));
bytes.push(...intToBytes32(this.hashMaps[c.hashMapName].pointer));
bytes.push(...intToBytes32(this.componentEntriesTables[c.entryTableName].pointer));
bytes.push(...intToBytes32(i));
bytes.push(...intToBytes32(c.nInSignals));
bytes.push(...intToBytes32(c.newThread ? 1 : 0));
module.addFunctionToTable(c.functionName);
}
const fBytes = [].concat(...bytes);
this.pComponents = module.alloc(fBytes);
this.pComponents = module.alloc(bytes);
}
_buildMapIsInput(module) {
const bytes = [];
const bytes = new Array(this.mapIsInput.length*4);
bytes.length=0;
for (let i=0; i<this.mapIsInput.length; i++) {
bytes.push(intToBytes32(this.mapIsInput[i]));
bytes.push(...intToBytes32(this.mapIsInput[i]));
}
const fBytes = [].concat(...bytes);
this.pMapIsInput = module.alloc(fBytes);
this.pMapIsInput = module.alloc(bytes);
}
_buildWit2Sig(module) {
const bytes = [];
const bytes = new Array(this.wit2sig.length*4);
bytes.length =0;
for (let i=0; i<this.wit2sig.length; i++) {
bytes.push(intToBytes32(this.wit2sig[i]));
bytes.push(...intToBytes32(this.wit2sig[i]));
}
const fBytes = [].concat(...bytes);
this.pWit2sig = module.alloc(fBytes);
this.pWit2sig = module.alloc(bytes);
}
_buildCircuitVar(module) {