-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into update-readme
- Loading branch information
Showing
66 changed files
with
1,783 additions
and
699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# System Functions | ||
|
||
Some parts of the C++ standard library that interact with the host system are restricted or unavailable in services. | ||
|
||
## I/O | ||
|
||
Only stdout and stderr are available. They both write to a single merged stream which is in included the transaction trace. stdin is not supported. | ||
|
||
Supported APIs: | ||
- `write` | ||
- `printf` family | ||
- `std::cout`, `std::cerr`, `std::clog` | ||
|
||
## Clocks | ||
|
||
UTC, monotonic, and CPU clocks are available to subjective services. The monotonic clock is only guaranteed to be monotonic within a block. The CPU clock measures CPU time spent on the current transaction. | ||
|
||
Supported APIs: | ||
- `clock_gettime` with `CLOCK_REALITME`, `CLOCK_MONOTONIC`, or `CLOCK_PROCESS_CPUTIME_ID` | ||
- `clock` | ||
- `time` | ||
- `std::chrono::system_clock` | ||
- `std::chrono::monotonic_clock` | ||
- `std::chrono::high_resolution_clock` | ||
|
||
## Unavailable Functionality | ||
|
||
- Filesystem | ||
- Nondeterministic random numbers | ||
- Concurrency | ||
- Exceptions | ||
- `setjmp`/`longjmp` |
Submodule eos-vm
updated
21 files
+15 −0 | include/eosio/vm/bitcode_writer.hpp | |
+17 −15 | include/eosio/vm/execution_context.hpp | |
+159 −38 | include/eosio/vm/interpret_visitor.hpp | |
+15 −0 | include/eosio/vm/null_writer.hpp | |
+15 −7 | include/eosio/vm/opcodes_def.hpp | |
+9 −0 | include/eosio/vm/options.hpp | |
+36 −0 | include/eosio/vm/parser.hpp | |
+64 −3 | include/eosio/vm/softfloat.hpp | |
+2 −0 | include/eosio/vm/types.hpp | |
+1 −1 | include/eosio/vm/wasm_stack.hpp | |
+128 −13 | include/eosio/vm/x86_64.hpp | |
+277 −93 | tests/spec/conversions_tests.cpp | |
+911 −911 | tests/spec/f32_tests.cpp | |
+911 −911 | tests/spec/f64_tests.cpp | |
+85 −85 | tests/spec/float_exprs_tests.cpp | |
+31 −31 | tests/spec/float_literals_tests.cpp | |
+15 −15 | tests/spec/float_memory_tests.cpp | |
+1 −1 | tests/spec/float_misc_tests.cpp | |
+15 −0 | tests/spec/i32_tests.cpp | |
+230 −205 | tests/spec/i64_tests.cpp | |
+18 −3 | tests/spec_test_generator/spec_test_generator.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <condition_variable> | ||
#include <functional> | ||
#include <mutex> | ||
#include <thread> | ||
#include <vector> | ||
|
||
#include <time.h> | ||
|
||
namespace psibase | ||
{ | ||
|
||
struct CpuClock | ||
{ | ||
using rep = std::int64_t; | ||
using period = std::ratio<1, 1000000000>; | ||
using duration = std::chrono::duration<rep, period>; | ||
using time_point = std::chrono::time_point<CpuClock>; | ||
static constexpr bool is_steady = false; | ||
static time_point now(clockid_t clock = CLOCK_THREAD_CPUTIME_ID); | ||
}; | ||
|
||
class Watchdog; | ||
|
||
class WatchdogManager | ||
{ | ||
public: | ||
WatchdogManager(); | ||
~WatchdogManager(); | ||
|
||
private: | ||
friend class Watchdog; | ||
void add(Watchdog* wd); | ||
void remove(Watchdog* wd); | ||
void run(); | ||
std::mutex mutex; | ||
std::condition_variable cond; | ||
std::vector<Watchdog*> children; | ||
bool done = false; | ||
std::thread worker; | ||
}; | ||
|
||
class Watchdog | ||
{ | ||
public: | ||
Watchdog(WatchdogManager& m, std::function<void()> f); | ||
~Watchdog(); | ||
void setLimit(CpuClock::duration dur); | ||
void pause(); | ||
void resume(); | ||
CpuClock::duration elapsed(); | ||
void interrupt(); | ||
|
||
private: | ||
friend class WatchdogManager; | ||
// Called with manager mutex held | ||
CpuClock::duration wait_duration(); | ||
WatchdogManager* manager; | ||
bool paused; | ||
CpuClock::duration elapsedOrStart; | ||
CpuClock::duration limit = CpuClock::duration::max(); | ||
clockid_t cpuclock; | ||
std::function<void()> handler; | ||
}; | ||
|
||
} // namespace psibase |
Oops, something went wrong.