Comments (2)
The correct main C module looks like this:
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
extern int64_t _heap_ptr_;
int64_t grinMain();
int64_t _prim_int_print(int64_t i) {
printf("%ld\n", i);
return i;
}
int main() {
int64_t* heap = malloc(100*1024*1024);
_heap_ptr_ = (int64_t)heap;
grinMain();
printf("used memory: %ld bytes\n", (uint64_t)_heap_ptr_ - (uint64_t)heap);
free(heap);
return 0;
}
This code allocates the heap area also.
Currently GRIN does not have a linker compiler phase. For testing we use the GRIN interpreter.
We will add a simple linker phase to GRIN in 1-3 months.
from grin.
Ok, just got to testing this. It works, and makes sense! Thanks, I didn't think about allocation, or that the smaller examples might be working because they don't need it. I've also taken note of the --eval
option (which I guess is what you mean by interpreter); that works too.
from grin.
Related Issues (20)
- Clang dependency for tests HOT 2
- How to cite paper HOT 3
- Lambda/GrinCodeGenBoxed.hs does not exist
- SimpleDeadParameterElimination causes "undefined variable" errors
- Question: does GRIN requires a runtime? HOT 1
- What LLVM versions are supported by the codegen? HOT 1
- InlineApply causes non-defined function when self recursive HOT 1
- Confused about non-covered alternatives and RunPure HOT 3
- Foreign pointer primitive type HOT 5
- Binary download?
- Windows support?
- Fix E2E tests for OSX HOT 1
- Clean FFI and primitive operations. This should be modular and specific to frontends.
- Modular PrimOps HOT 4
- Specification of the undefined value semantics
- SparseCaseOptimisation removes useful alternatives HOT 8
- Stop pipeline on errors and add --continue-on-lint option for the current behavior. HOT 3
- Counting Immutable Beans HOT 6
- Improve case hoisting
- Fix data dependencies in pipeline
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grin.