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

feat: revmc-worker #73

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: revmc-worker #73

wants to merge 4 commits into from

Conversation

djm07073
Copy link

@djm07073 djm07073 commented Feb 21, 2025

Feature Suggestion Summary

This pull request introduces a new feature, revmc-worker, which enables AOT (Ahead-of-Time) compilation for frequently executed (hot) contracts that exceed a configurable execution threshold in the node runtime.

Detailed Description

The revmc-worker feature enhances performance by precompiling hot contracts, reducing execution latency. The threshold for determining hot contracts is configurable, allowing node operators to fine-tune performance based on their specific requirements (e.g., VM specifications).

The revmc-worker module efficiently manages AOT compilation concurrently with the following optimizations:
• Multi-process and multi-threaded execution: Leverages parallelism to optimize AOT compilation.
• Hot contract detection & AOT compilation (instead of JIT): Reduces execution latency impact on the client and help prevent DoS attacks.
• LRU cache for compiled artifacts: Minimizes the overhead of loading shared object files via libloading.

This approach improves overall execution efficiency while maintaining flexibility for node operators.

image

* feat: push ext mutex inwards

* feat: utilize TryLock for non blocking lock operation

* feat: remove box, add comments

* chore: remove unnecessary locks

* comment: add supplementary comments

* comment: more comments

* examples: worker example

* refactor: fix unused code, force using arc

* examples: add working worker example

* examples: few bugs and fixes

* fix: refactor

- make enum to improve readablity
- delete unused crates import
- clean up test code
- use rwlock more precise way

* chore: fixes, and refactor

* chore: remove unnecessay immports

---------

wip: revmc-worker

feat: revmc-compiler-worker crate

fix: update cargo toml

bump dependencies

refactor: match dependencides import with root

refactor: visibility, to be able to import

feat: semaphore in worker

chore: delete out directory

chore: import lru

feat: cache external functions

feat: cache size interface

fix: remove unnecessary locks

feat: CompileWorker to have DB generic

feat: cache_load() error handling

test: test separate utility function

wip: fn pointer bug

fix: match types

test: cache test, add calldata

test: manual account info insert

test: caching + access list success

chore: remove comments

refactor: use fixedbytes for cache key, instead of string

chore: add supplementary comment about cache usage

chore: rename types for clarity

refactor: extract db from ext

fix: clippy & add some comments

fix: use mutex and arc in lru cache (#3)

* fix: use reccell in external worker

* fix: use mutex and arc to handle multi thread

Co-Authored-By: suha jin <[email protected]>

Update Cargo.lock

fix: refactor (#5)

* fix: refactor

* docs: extra docs

* fmt

---------

Co-authored-by: Ji Hwan An <[email protected]>

restore readme

fix: clippy and add docs (#6)

feat: replace db & add spin lock to get local file (#7)

* fix: replace sleddb with rocksdb

* fix: spin lock

* chore: fmt and clippy

* chore: fmt

* fix: test code

* wip: test code

* wip: test code

* wip: test code

* fix: rename and debug

* wip: ci test

* fix: replace code hash with module name

* feat: more safe way to complie

* fix: optimize compiler and error def

* fix: cleanup dependency

* fix: only spin lock in test code

* fix: error handling in test code

* fix: lru cache put with tuple

* chore: fix dependency

* chore: delete log

* chore: fix test codes
@djm07073 djm07073 requested a review from DaniPopes as a code owner February 21, 2025 16:38
@djm07073
Copy link
Author

djm07073 commented Feb 21, 2025

I’m encountering build dependency issues when exporting built-in symbols in shared object (.so) files. Comparing these two commits:
without build dependency commit
with build dependency commit

Each has different behavior across platforms:

  1. The first commit resolves the issue on macOS but introduces linking errors on Ubuntu.
    1

  2. The second commit works on Ubuntu but causes linking errors on macOS.
    2

The errors occur when loading and linking .so files in this line.

I developed this based on the logic from revmc-cli crates. However, revmc-cli works without issues on both platforms, while my implementation runs into platform-specific linking errors.

Do you have any insights on what might be causing this discrepancy?

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.

1 participant