Documentation
¶
Index ¶
Constants ¶
const ( FlagMaxMemory = "max-memory" // bytes (RLIMIT_AS) FlagMaxCPUTime = "max-cpu-time" // seconds (RLIMIT_CPU) )
Flag names used to pass per-compilation resource limits to the compile-sierra child process. They are shared by the parent (which builds the child's argv) and the child command (which defines the flags and applies the limits to itself).
Variables ¶
This section is empty.
Functions ¶
func ApplySelfRLimits ¶ added in v0.16.3
ApplySelfRLimits caps the CPU time (RLIMIT_CPU, seconds) and address space (RLIMIT_AS, bytes) of the calling process. A zero value leaves the corresponding limit unchanged.
It is called by the compile-sierra child at startup, before any compilation work, so the limits are in force for the whole compile with no race window. unix.Setrlimit applies process-wide on Linux.
func CPURlimitExceeded ¶ added in v0.16.3
CPURlimitExceeded reports whether err indicates the compile-sierra child was killed by the kernel for exceeding an applied rlimit: RLIMIT_CPU raises SIGXCPU and then SIGKILL. It turns the otherwise opaque "signal: killed" exec error into a diagnosable resource-limit message.
func CompileFFI ¶ added in v0.15.20
func CompileFFI(sierra *starknet.SierraClass) (*starknet.CasmClass, error)
CompileFFI performs Sierra-to-CASM compilation via direct CGo FFI.
Types ¶
type Compiler ¶ added in v0.15.20
type Compiler interface {
Compile(ctx context.Context, sierra *starknet.SierraClass) (
*starknet.CasmClass, error,
)
}
Compiler compiles Sierra classes to CASM.
type Config ¶ added in v0.16.3
type Config struct {
// MaxMemory is the address-space limit (RLIMIT_AS) in bytes
// applied to each compilation process. Exceeding it aborts that
// compilation. Enforced on Linux only. 0 disables the limit.
MaxMemory uint64
// MaxCPUTime is the CPU-time limit (RLIMIT_CPU) in seconds
// applied to each compilation process. Exceeding it kills that
// compilation. Enforced on Linux only. 0 disables the limit.
MaxCPUTime uint64
}
Config bounds the resources used by compilation child processes.