Comments (2)
Hi,
Actually, you don't need brk
to implement malloc, we do have an example contract running mruby
, which involves a lot of malloc, https://github.com/nervosnetwork/mruby-contracts and runs perfectly fine. The trick to this is to use a modified version of libc which works in userspace without needing brk
: nervosnetwork/riscv-newlib@dbc4aa7
To answer your question more directly: we thought a lot about whether we want brk
, in fact, at some earlier stage of this project, we do implement a MMU which can enable brk
, but later we decided to remove it completely. The reason behind this, is that we believe CKB VM should be as simple as possible, while an MMU might help developing a contract, in production you really want the maximum performance, and the minimal attack surface. Plus, any MMU we implement here will only be nice to one kind of application, but might bring obstacles to applications with different memory usage patterns.
As a result, we decide to go without MMU nor brk
in the official CKB spec, and defer to modifications in libc to implement malloc and free.
BTW: we do speak both English and Chinese but let's keep using English here for broader audience :)
from ckb-vm.
Thank you so much for getting back to me so quickly. Reading through, I better understand that decision -- that makes sense. I'll play around with that newlib
implementation you shared. Thank you!
οΌε₯½η π ε¨θΏιζδΌεͺη¨θ±θ―οΌ
from ckb-vm.
Related Issues (20)
- Upgrade goblin to 0.3.5 HOT 2
- Tagging pointers HOT 2
- Use `reset()` as a general means to reuse machine HOT 11
- Remove confusing constructor like `machine::latest()` or `machine::default()` HOT 2
- Macro-op-fusion: Pattern design of ADC and SBB HOT 2
- Remove RS3 macro from ASM code HOT 1
- Rebuild test binarys by new gcc
- Expand the memory to 8 or 16 M (experimental) HOT 1
- Formally Verify CKB-VM via Sail
- USDT Probes on ckb-vm AsmMachine
- Support A extension HOT 1
- Fuzzing on ISA IMC HOT 1
- Phase plan of the V instruction set HOT 1
- Enhance performance by changing trace cache strategy HOT 2
- Discussion: Remove duplicate out of bounds checks HOT 6
- Remove all `movq IMMEDIATE, %rcx` in execute_x64.S HOT 1
- Redefining slow path instruction at 0x00 to 0x0f HOT 1
- Mark memset function as unsafe
- Slow performance HOT 4
- Failed to build on Windows in GitHub Actions. HOT 2
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 ckb-vm.