Compare commits
13
Commits
822b59d70e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e6037e59
|
||
|
|
aad3b85d8f
|
||
|
|
df83623101
|
||
|
|
7a3d1610ba
|
||
|
|
167c3a1290
|
||
|
|
8c9cc08de0
|
||
|
|
47e0cf129e
|
||
|
|
2d624c725c
|
||
|
|
edaf9bd8ba
|
||
|
|
98ecd11d2b
|
||
|
|
4e8bf01da9
|
||
|
|
a6e68ef800
|
||
|
|
9baf6605ed
|
@@ -6,3 +6,4 @@
|
||||
/db.conf
|
||||
/fail/bin/resultbrowser/app/__pycache__
|
||||
/fail/bin/VisualFAIL/CONFIGURATION.php
|
||||
/qemu.log
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8
-4
@@ -202,7 +202,6 @@ local $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} =
|
||||
# ========================================================================================= #
|
||||
|
||||
# NOTE: The runner will prefix "-Wf," to each flag
|
||||
# TODO: Exclude --wamr-exceptions from C builds automatically
|
||||
my %catch_flag_map = (
|
||||
"--catch-outer" => "--catch-outerspace",
|
||||
"--catch-text" => "--catch-write-textsegment",
|
||||
@@ -219,12 +218,17 @@ if ( grep { $_ eq "fail" } @selected_targets ) {
|
||||
# Build everything
|
||||
# ========================================================================================= #
|
||||
|
||||
# TODO: linux-baremetal target is broken
|
||||
system( "mkdir", "-p", "$local_builds_dir" );
|
||||
foreach my $experiment (@selected_experiments) {
|
||||
foreach my $target (@selected_targets) {
|
||||
foreach my $mode (@selected_modes) {
|
||||
|
||||
# Remove --wamr-exceptions for C builds, it is WAMR-specific
|
||||
my @build_catch_flags =
|
||||
$mode eq "c"
|
||||
? grep { $_ ne "--wamr-exceptions" } @selected_catch_flags
|
||||
: @selected_catch_flags;
|
||||
|
||||
my $allocator_info = "";
|
||||
if ( $mode eq "aot" || $mode eq "interp" ) {
|
||||
$allocator_info =
|
||||
@@ -268,7 +272,7 @@ foreach my $experiment (@selected_experiments) {
|
||||
&& $selected_linear_pool_variant eq $linear_pool_variants[0] )
|
||||
? "wamr_linear_pool"
|
||||
: "";
|
||||
my $flags_info = join " ", @selected_catch_flags;
|
||||
my $flags_info = join " ", @build_catch_flags;
|
||||
|
||||
my $info_str = join " ",
|
||||
grep { length } (
|
||||
@@ -289,7 +293,7 @@ foreach my $experiment (@selected_experiments) {
|
||||
"$local_root/build-$experiment/runner_flags";
|
||||
open( my $fhandle, '>', $runner_flags_path )
|
||||
or die "Cannot write $runner_flags_path: $!";
|
||||
print $fhandle "$catch_flag_map{$_}\n" for @selected_catch_flags;
|
||||
print $fhandle "$catch_flag_map{$_}\n" for @build_catch_flags;
|
||||
close($fhandle);
|
||||
|
||||
system( "mv", "$local_root/build.log",
|
||||
|
||||
+36
-10
@@ -1,8 +1,11 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_comparison.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# One coordinate system per base experiment (facet); c/aot/interp variants
|
||||
# share each facet, coloured by variant.
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
@@ -20,17 +23,36 @@ exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args
|
||||
}
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
dir_name,
|
||||
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||
)
|
||||
if (is.na(match[1, 1])) {
|
||||
warning(paste("Could not parse:", dir_name))
|
||||
return(NULL)
|
||||
}
|
||||
list(base_name = match[1, 2], variant = match[1, 3], path = path)
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
csv_file <- file.path(arg, csv_suffix)
|
||||
info <- extract_info(arg)
|
||||
if (is.null(info)) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$experiment <- basename(arg)
|
||||
df$base_name <- info$base_name
|
||||
df$variant <- info$variant
|
||||
all_data <- bind_rows(all_data, df)
|
||||
}
|
||||
|
||||
@@ -39,7 +61,7 @@ if (nrow(all_data) == 0) {
|
||||
}
|
||||
|
||||
totals <- all_data |>
|
||||
group_by(experiment, resulttype) |>
|
||||
group_by(base_name, variant, resulttype) |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE), .groups = "drop") |>
|
||||
ungroup()
|
||||
|
||||
@@ -57,21 +79,25 @@ totals$resulttype <- factor(totals$resulttype, levels = marker_order)
|
||||
|
||||
plot <- ggplot(
|
||||
totals,
|
||||
aes(x = resulttype, y = faults, colour = experiment, group = experiment)
|
||||
aes(x = resulttype, y = faults, colour = variant, group = variant)
|
||||
) +
|
||||
geom_point(size = 2) +
|
||||
geom_line() +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10() +
|
||||
labs(
|
||||
x = "Marker",
|
||||
y = "Faults",
|
||||
title = "Combined Comparison",
|
||||
color = "Experiment"
|
||||
x = "Fault Type",
|
||||
y = "Fault Count",
|
||||
title = "Fault Count Comparison",
|
||||
color = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/combined_comparison", suffix, ".svg")
|
||||
outfile <- paste0("injections/fault_count_comparison", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
+38
-32
@@ -4,8 +4,8 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript ratio_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Plots correlation between aot/c and interp/c ratios
|
||||
# Usage: Rscript combined_fault_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Plots correlation between raw aot and interp fault counts (no C baseline).
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
@@ -69,48 +69,52 @@ all_data <- all_data |>
|
||||
group_by(base_name, variant, benchmark, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
|
||||
baseline <- all_data |> filter(variant == "c")
|
||||
comparisons <- all_data |> filter(variant != "c")
|
||||
# Only aot/interp matter; C is not used as a baseline here.
|
||||
counts <- all_data |> filter(variant %in% c("aot", "interp"))
|
||||
|
||||
ratios <- comparisons |>
|
||||
left_join(
|
||||
baseline |> select(base_name, benchmark, resulttype, faults),
|
||||
by = c("base_name", "benchmark", "resulttype"),
|
||||
suffix = c("", "_baseline")
|
||||
) |>
|
||||
filter(!is.na(faults_baseline), faults_baseline > 0) |>
|
||||
mutate(ratio = faults / faults_baseline)
|
||||
|
||||
if (nrow(ratios) == 0) {
|
||||
stop("No ratios computed (missing baseline or zero values)")
|
||||
}
|
||||
|
||||
# Pivot to get aot and interp ratios side by side
|
||||
ratio_wide <- ratios |>
|
||||
select(base_name, benchmark, resulttype, variant, ratio) |>
|
||||
pivot_wider(names_from = variant, values_from = ratio) |>
|
||||
# Pivot to get aot and interp fault counts side by side
|
||||
counts_wide <- counts |>
|
||||
select(base_name, benchmark, resulttype, variant, faults) |>
|
||||
pivot_wider(names_from = variant, values_from = faults) |>
|
||||
filter(!is.na(aot), !is.na(interp))
|
||||
|
||||
if (nrow(ratio_wide) == 0) {
|
||||
stop("No paired aot/interp ratios found")
|
||||
if (nrow(counts_wide) == 0) {
|
||||
stop("No paired aot/interp fault counts found")
|
||||
}
|
||||
|
||||
# Compute correlation
|
||||
cor_result <- cor(ratio_wide$aot, ratio_wide$interp, method = "pearson")
|
||||
cat(sprintf("Pearson correlation: %.4f\n", cor_result))
|
||||
cor_raw <- cor(counts_wide$aot, counts_wide$interp, method = "pearson")
|
||||
cor_log <- cor(
|
||||
log10(counts_wide$aot),
|
||||
log10(counts_wide$interp),
|
||||
method = "pearson"
|
||||
)
|
||||
cat(sprintf("Pearson correlation (raw): %.4f\n", cor_raw))
|
||||
cat(sprintf("Pearson correlation (log10): %.4f\n", cor_log))
|
||||
|
||||
# Create plot
|
||||
plot <- ggplot(
|
||||
ratio_wide,
|
||||
counts_wide,
|
||||
aes(x = aot, y = interp, color = base_name, shape = resulttype)
|
||||
) +
|
||||
# geom_abline(
|
||||
# slope = 1,
|
||||
# intercept = 0,
|
||||
# colour = "grey70",
|
||||
# linetype = "dotted"
|
||||
# ) +
|
||||
geom_point(size = 3, alpha = 0.7) +
|
||||
scale_x_log10(name = "AOT / C Ratio") +
|
||||
scale_y_log10(name = "Interpreter / C Ratio") +
|
||||
scale_x_log10(name = "AOT Fault Count") +
|
||||
scale_y_log10(name = "Interpreter Fault Count") +
|
||||
labs(
|
||||
title = sprintf("Ratio Correlation (r = %.4f)", cor_result),
|
||||
# title = sprintf(
|
||||
# "Fault Count Correlation (r_raw = %.4f, r_log = %.4f)",
|
||||
# cor_raw,
|
||||
# cor_log
|
||||
# ),
|
||||
title = "Fault Count Correlation",
|
||||
color = "Experiment",
|
||||
shape = "Marker"
|
||||
shape = "Fault Type"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
@@ -118,5 +122,7 @@ plot <- ggplot(
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave("injections/ratio_correlation.svg", plot = plot, width = 10, height = 8)
|
||||
print("Saved ratio_correlation.svg")
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_count_correlation", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,115 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_fault_rates.r exp_abspath1 exp_abspath2 ... [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
# Faults / instruction count, per experiment
|
||||
rates <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
faults_file <- file.path(arg, csv_suffix)
|
||||
mnem_file <- file.path(arg, "mnemonics.csv")
|
||||
|
||||
if (!file.exists(faults_file)) {
|
||||
warning(paste("Missing:", faults_file))
|
||||
next
|
||||
}
|
||||
if (!file.exists(mnem_file)) {
|
||||
warning(paste("Missing:", mnem_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(faults_file, col_types = cols())
|
||||
mdf <- read_csv(mnem_file, col_types = cols())
|
||||
|
||||
total_faults <- df |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE)) |>
|
||||
pull(faults)
|
||||
|
||||
total_instrs <- sum(mdf$count, na.rm = TRUE)
|
||||
|
||||
if (is.na(total_instrs) || total_instrs == 0) {
|
||||
warning(paste("Zero instruction count for", arg))
|
||||
next
|
||||
}
|
||||
|
||||
match <- str_match(
|
||||
basename(arg),
|
||||
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||
)
|
||||
if (is.na(match[1, 1])) {
|
||||
base_name <- basename(arg)
|
||||
variant <- "unknown"
|
||||
} else {
|
||||
base_name <- match[1, 2]
|
||||
variant <- match[1, 3]
|
||||
}
|
||||
|
||||
rates <- bind_rows(
|
||||
rates,
|
||||
data.frame(
|
||||
base_name = base_name,
|
||||
variant = variant,
|
||||
fault_rate = total_faults / total_instrs
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (nrow(rates) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# Order base_names by their max fault rate
|
||||
base_order <- rates |>
|
||||
group_by(base_name) |>
|
||||
summarise(max_rate = max(fault_rate), .groups = "drop") |>
|
||||
arrange(desc(max_rate)) |>
|
||||
pull(base_name)
|
||||
|
||||
rates <- rates |>
|
||||
mutate(
|
||||
base_name = factor(base_name, levels = base_order),
|
||||
variant = factor(variant, levels = c("c", "aot", "interp", "unknown"))
|
||||
)
|
||||
|
||||
plot <- ggplot(
|
||||
rates,
|
||||
aes(x = base_name, y = fault_rate, fill = variant)
|
||||
) +
|
||||
geom_col(position = position_dodge(preserve = "single")) +
|
||||
scale_y_log10() +
|
||||
labs(
|
||||
title = "Fault Rate per Instruction",
|
||||
x = "Experiment",
|
||||
y = "Faults / Instruction Count",
|
||||
fill = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_rates_per_instruction", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,133 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
|
||||
# Usage: Rscript combined_instr_fault_correlation.r exp_abspath1 exp_abspath2 ... [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
# TODO: I should probably stop duplicating this each time
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
# Don't use counts from faults.csv, as that would correlate completely
|
||||
# because only mnemonics with faults are listed there
|
||||
# NOTE: Doesn't match selected filters for faults.csv
|
||||
mnemonics_file <- "mnemonics.csv"
|
||||
|
||||
freq_data <- data.frame()
|
||||
faults_data <- data.frame()
|
||||
|
||||
# TODO: I should probably stop duplicating this each time
|
||||
for (arg in exp_args) {
|
||||
mnem_path <- file.path(arg, mnemonics_file)
|
||||
faults_path <- file.path(arg, csv_suffix)
|
||||
|
||||
if (!file.exists(mnem_path)) {
|
||||
warning(paste("Missing:", mnem_path))
|
||||
next
|
||||
}
|
||||
if (!file.exists(faults_path)) {
|
||||
warning(paste("Missing:", faults_path))
|
||||
next
|
||||
}
|
||||
|
||||
mdf <- read_csv(mnem_path, col_types = cols())
|
||||
mdf$experiment <- basename(arg)
|
||||
freq_data <- bind_rows(freq_data, mdf)
|
||||
|
||||
fdf <- read_csv(faults_path, col_types = cols())
|
||||
fdf$experiment <- basename(arg)
|
||||
faults_data <- bind_rows(faults_data, fdf)
|
||||
}
|
||||
|
||||
if (nrow(freq_data) == 0 || nrow(faults_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# x-axis: mnemonics.csv counts
|
||||
instr_freq <- freq_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(instr_count = sum(count, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# y-axis: no OK_MARKERs, sum GROUP1_MARKER + TRAP.
|
||||
marker_count <- faults_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
mutate(
|
||||
resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype)
|
||||
) |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(marker_count = sum(faults, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
correlation <- instr_freq |>
|
||||
inner_join(marker_count, by = "mnemonic") |>
|
||||
filter(instr_count > 0, marker_count > 0)
|
||||
|
||||
if (nrow(correlation) < 2) {
|
||||
stop("Not enough mnemonics to compute a correlation")
|
||||
}
|
||||
|
||||
cor_raw <- cor(
|
||||
correlation$instr_count,
|
||||
correlation$marker_count,
|
||||
method = "pearson"
|
||||
)
|
||||
cor_log <- cor(
|
||||
log10(correlation$instr_count),
|
||||
log10(correlation$marker_count),
|
||||
method = "pearson"
|
||||
)
|
||||
cat(sprintf("Pearson correlation (raw): %.4f\n", cor_raw))
|
||||
cat(sprintf("Pearson correlation (log10): %.4f\n", cor_log))
|
||||
|
||||
plot <- ggplot(
|
||||
correlation,
|
||||
aes(x = instr_count, y = marker_count)
|
||||
) +
|
||||
geom_smooth(
|
||||
method = "lm",
|
||||
se = FALSE,
|
||||
colour = "grey50",
|
||||
linetype = "dashed"
|
||||
) +
|
||||
geom_point(aes(colour = mnemonic), size = 3, alpha = 0.8) +
|
||||
geom_text(
|
||||
aes(label = mnemonic),
|
||||
size = 3,
|
||||
vjust = -0.8,
|
||||
check_overlap = TRUE
|
||||
) +
|
||||
scale_x_log10(name = "Instruction Executions") +
|
||||
scale_y_log10(name = "Fault Count") +
|
||||
labs(
|
||||
# title = sprintf(
|
||||
# "Instruction / Fault Correlation (r_raw = %.4f, r_log = %.4f)",
|
||||
# cor_raw,
|
||||
# cor_log
|
||||
# ),
|
||||
title = "Instruction / Fault Correlation",
|
||||
colour = "Mnemonic"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
legend.position = "none",
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/instr_fault_correlation", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,120 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(viridisLite)
|
||||
|
||||
# Usage: Rscript combined_instr_fault_correlation_heatmap.r exp_abspath1 ... [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
all_mnem <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
csv_file <- file.path(arg, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$experiment <- basename(arg)
|
||||
all_data <- bind_rows(all_data, df)
|
||||
|
||||
# TODO: This is ignoring any filters currently
|
||||
mnem_file <- file.path(arg, "mnemonics.csv")
|
||||
if (!file.exists(mnem_file)) {
|
||||
warning(paste("Missing:", mnem_file))
|
||||
next
|
||||
}
|
||||
mdf <- read_csv(mnem_file, col_types = cols())
|
||||
all_mnem <- bind_rows(all_mnem, mdf)
|
||||
}
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No faults.csv data loaded")
|
||||
}
|
||||
|
||||
if (nrow(all_mnem) == 0) {
|
||||
stop("No mnemonics.csv data loaded")
|
||||
}
|
||||
|
||||
# no OK_MARKER, sum GROUP1 + TRAP.
|
||||
all_data <- all_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
mutate(
|
||||
resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype)
|
||||
)
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No failure-marker data to plot")
|
||||
}
|
||||
|
||||
# Sum faults per (mnemonic, marker) pair for all experiments
|
||||
heat <- all_data |>
|
||||
group_by(mnemonic, resulttype) |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# Sum mnemonic counts for all experiments
|
||||
mnem_counts <- all_mnem |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(count = sum(count, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# Normalize by mnemonic count
|
||||
heat <- heat |>
|
||||
left_join(mnem_counts, by = "mnemonic") |>
|
||||
filter(!is.na(count), count > 0) |>
|
||||
mutate(fault_rate = faults / count)
|
||||
|
||||
if (nrow(heat) == 0) {
|
||||
stop("Heat join failed")
|
||||
}
|
||||
|
||||
# Order by fault rate
|
||||
mnem_order <- heat |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(total = sum(fault_rate), .groups = "drop") |>
|
||||
arrange(desc(total)) |>
|
||||
pull(mnemonic)
|
||||
|
||||
heat <- heat |>
|
||||
mutate(mnemonic = factor(mnemonic, levels = mnem_order))
|
||||
|
||||
plot <- ggplot(
|
||||
heat,
|
||||
aes(x = mnemonic, y = resulttype, fill = fault_rate)
|
||||
) +
|
||||
geom_tile(colour = "white") +
|
||||
scale_fill_viridis_c(name = "Fault rate", trans = "log10") +
|
||||
labs(
|
||||
title = "Instruction / Fault Rate Heatmap (Normalized)",
|
||||
x = "Instruction",
|
||||
y = "Fault Type"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
panel.grid = element_blank(),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/instr_fault_rate_heatmap", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -83,12 +83,18 @@ plot <- ggplot(
|
||||
) +
|
||||
geom_point(size = 2) +
|
||||
geom_line() +
|
||||
facet_wrap(~base_name, scales = "free_x") +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10(name = "Ratio (to C)") +
|
||||
scale_x_discrete(name = "Marker") +
|
||||
labs(color = "Variant") +
|
||||
scale_x_discrete(name = "Fault Type") +
|
||||
labs(
|
||||
title = "Fault Count Ratios",
|
||||
color = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave("injections/ratio_comparison.svg", plot = plot, width = 12, height = 8)
|
||||
print("Saved ratio_comparison.svg")
|
||||
|
||||
@@ -3,8 +3,8 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript ratio_comparison_merged.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Sums all benchmarks
|
||||
# Usage: Rscript ratio_comparison_merged_trap.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Sums all benchmarks, merges GROUP1_MARKER into TRAP
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
@@ -59,7 +59,9 @@ if (nrow(all_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# Add all benchs together (per marker type)
|
||||
all_data <- all_data |>
|
||||
mutate(resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype))
|
||||
|
||||
merged_data <- all_data |>
|
||||
group_by(base_name, variant, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
@@ -88,15 +90,21 @@ plot <- ggplot(
|
||||
geom_line() +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10(name = "Ratio (to C)") +
|
||||
scale_x_discrete(name = "Marker") +
|
||||
labs(color = "Variant") +
|
||||
scale_x_discrete(name = "Fault Type") +
|
||||
labs(
|
||||
color = "Variant",
|
||||
title = "Fault Count Ratios"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave(
|
||||
"injections/ratio_comparison_merged.svg",
|
||||
"injections/ratio_comparison_merged_trap.svg",
|
||||
plot = plot,
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
print("Saved ratio_comparison_merged.svg")
|
||||
print("Saved ratio_comparison_merged_trap.svg")
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript ratio_comparison_merged_trap.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Sums all benchmarks, merges GROUP1_MARKER into TRAP
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) args[-length(args)] else args
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
dir_name,
|
||||
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||
)
|
||||
if (is.na(match[1, 1])) {
|
||||
warning(paste("Could not parse:", dir_name))
|
||||
return(NULL)
|
||||
}
|
||||
list(base_name = match[1, 2], variant = match[1, 3], path = path)
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
info <- extract_info(arg)
|
||||
if (is.null(info)) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$base_name <- info$base_name
|
||||
df$variant <- info$variant
|
||||
all_data <- bind_rows(all_data, df)
|
||||
}
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
all_data <- all_data |>
|
||||
mutate(resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype))
|
||||
|
||||
merged_data <- all_data |>
|
||||
group_by(base_name, variant, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
|
||||
baseline <- merged_data |> filter(variant == "c")
|
||||
comparisons <- merged_data |> filter(variant != "c")
|
||||
|
||||
ratios <- comparisons |>
|
||||
left_join(
|
||||
baseline |> select(base_name, resulttype, faults),
|
||||
by = c("base_name", "resulttype"),
|
||||
suffix = c("", "_baseline")
|
||||
) |>
|
||||
filter(!is.na(faults_baseline), faults_baseline > 0) |>
|
||||
mutate(ratio = faults / faults_baseline)
|
||||
|
||||
if (nrow(ratios) == 0) {
|
||||
stop("No ratios computed (missing baseline or zero values)")
|
||||
}
|
||||
|
||||
plot <- ggplot(
|
||||
ratios,
|
||||
aes(x = resulttype, y = ratio, color = variant, group = variant)
|
||||
) +
|
||||
geom_point(size = 2) +
|
||||
geom_line() +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10(name = "Ratio (to C)") +
|
||||
scale_x_discrete(name = "Marker") +
|
||||
labs(color = "Variant") +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
|
||||
ggsave(
|
||||
"injections/ratio_comparison_merged_trap.svg",
|
||||
plot = plot,
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
print("Saved ratio_comparison_merged_trap.svg")
|
||||
@@ -1,129 +0,0 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript ratio_correlation_no_mem.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Plots correlation between aot/c and interp/c ratios, ignoring mem benchmark
|
||||
# NOTE: Just a copy of the ratio_correlation.r script where I've changed the filter in line 67
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
dir_name,
|
||||
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||
)
|
||||
if (is.na(match[1, 1])) {
|
||||
warning(paste("Could not parse:", dir_name))
|
||||
return(NULL)
|
||||
}
|
||||
list(base_name = match[1, 2], variant = match[1, 3], path = path)
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
info <- extract_info(arg)
|
||||
if (is.null(info)) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$base_name <- info$base_name
|
||||
df$variant <- info$variant
|
||||
all_data <- bind_rows(all_data, df)
|
||||
}
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# Ignore OK_MARKER (only plot failures) and sum GROUP1_MARKER with TRAP
|
||||
# Also ignore mem benchmark
|
||||
all_data <- all_data |>
|
||||
filter(resulttype %in% c("TRAP", "GROUP1_MARKER"), benchmark == "ip") |>
|
||||
mutate(resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype))
|
||||
|
||||
all_data <- all_data |>
|
||||
group_by(base_name, variant, benchmark, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
|
||||
baseline <- all_data |> filter(variant == "c")
|
||||
comparisons <- all_data |> filter(variant != "c")
|
||||
|
||||
ratios <- comparisons |>
|
||||
left_join(
|
||||
baseline |> select(base_name, benchmark, resulttype, faults),
|
||||
by = c("base_name", "benchmark", "resulttype"),
|
||||
suffix = c("", "_baseline")
|
||||
) |>
|
||||
filter(!is.na(faults_baseline), faults_baseline > 0) |>
|
||||
mutate(ratio = faults / faults_baseline)
|
||||
|
||||
if (nrow(ratios) == 0) {
|
||||
stop("No ratios computed (missing baseline or zero values)")
|
||||
}
|
||||
|
||||
# Pivot to get aot and interp ratios side by side
|
||||
ratio_wide <- ratios |>
|
||||
select(base_name, benchmark, resulttype, variant, ratio) |>
|
||||
pivot_wider(names_from = variant, values_from = ratio) |>
|
||||
filter(!is.na(aot), !is.na(interp))
|
||||
|
||||
if (nrow(ratio_wide) == 0) {
|
||||
stop("No paired aot/interp ratios found")
|
||||
}
|
||||
|
||||
# Compute correlation
|
||||
cor_result <- cor(ratio_wide$aot, ratio_wide$interp, method = "pearson")
|
||||
cat(sprintf("Pearson correlation: %.4f\n", cor_result))
|
||||
|
||||
# Create plot
|
||||
plot <- ggplot(
|
||||
ratio_wide,
|
||||
aes(x = aot, y = interp, color = base_name, shape = resulttype)
|
||||
) +
|
||||
geom_point(size = 3, alpha = 0.7) +
|
||||
scale_x_log10(name = "AOT / C Ratio") +
|
||||
scale_y_log10(name = "Interpreter / C Ratio") +
|
||||
labs(
|
||||
title = sprintf("Ratio Correlation (r = %.4f)", cor_result),
|
||||
color = "Experiment",
|
||||
shape = "Marker"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
legend.position = "right",
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave(
|
||||
"injections/ratio_correlation_customized.svg",
|
||||
plot = plot,
|
||||
width = 10,
|
||||
height = 8
|
||||
)
|
||||
print("Saved ratio_correlation_customized.svg")
|
||||
+38
-18
@@ -123,8 +123,7 @@ my @cross_ldflags_base = (
|
||||
my @linux_ldflags_base = ( '-Wl,--build-id=none', '-m32', '-lm' );
|
||||
my @baremetal_ldflags_base = (
|
||||
'-Wl,--build-id=none', '-static', '-nostdlib', '-m32',
|
||||
'-lc', '-lgcc', '-lm', '--entry',
|
||||
'main'
|
||||
'-lc', '-lgcc', '-lm'
|
||||
);
|
||||
my @cross_ldflags_nowasm = (
|
||||
'-Wl,--build-id=none', '-static', '-nostdlib', '-m32',
|
||||
@@ -192,13 +191,15 @@ sub build {
|
||||
compile_c_module( $module, $bd, $target );
|
||||
compile_c_host( $module, $bd, $target );
|
||||
compile_startup( $module, $bd, $target );
|
||||
compile_syscalls( $module, $bd, $target );
|
||||
link_c( $module, $bd, $target );
|
||||
}
|
||||
else {
|
||||
die "Unknown mode '$mode'; expected: aot, interp, c\n";
|
||||
}
|
||||
|
||||
build_iso( $module, $bd );
|
||||
build_iso( $module, $bd )
|
||||
if $target eq 'fail' || $target eq 'linux-baremetal';
|
||||
}
|
||||
|
||||
# ========================================================================================= #
|
||||
@@ -265,14 +266,15 @@ sub compile_wasm_module {
|
||||
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
|
||||
Util::run(
|
||||
"$wasi_root/bin/clang", @wasi_cflags,
|
||||
"-Dmain=tacle_main_bullshit", "-I$inc",
|
||||
"targets/wasm-module/$module.cpp", @$srcs,
|
||||
'-o', "$bd/wasm_module.wasm"
|
||||
"-Dmain=tacle_main_bullshit", "-DTARGET_WASM",
|
||||
"-I$inc", "targets/wasm-module/$module.cpp",
|
||||
@$srcs, '-o',
|
||||
"$bd/wasm_module.wasm"
|
||||
);
|
||||
}
|
||||
else {
|
||||
Util::run( "$wasi_root/bin/clang", @wasi_cflags,
|
||||
"targets/wasm-module/$module.cpp",
|
||||
"-DTARGET_WASM", "targets/wasm-module/$module.cpp",
|
||||
'-o', "$bd/wasm_module.wasm" );
|
||||
|
||||
}
|
||||
@@ -371,9 +373,10 @@ sub compile_wasm_host {
|
||||
sub compile_c_module {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
my ( $cc, @flags ) =
|
||||
( $target eq 'linux' )
|
||||
? ( $linux_cc, @linux_cflags )
|
||||
: ( $cross_cc, @cross_cflags );
|
||||
( $target eq 'linux' ) ? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
|
||||
: ( $target eq 'linux-baremetal' )
|
||||
? ( $cross_cc, @linux_baremetal_cflags, '-DTARGET_LINUX_BAREMETAL' )
|
||||
: ( $cross_cc, @cross_cflags, '-DTARGET_FAIL' );
|
||||
|
||||
if ( Util::module_is_tacle($module) ) {
|
||||
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
|
||||
@@ -402,8 +405,9 @@ sub compile_c_module {
|
||||
sub compile_c_host {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
my ( $cc, @flags ) =
|
||||
( $target eq 'linux' )
|
||||
? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
|
||||
( $target eq 'linux' ) ? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
|
||||
: ( $target eq 'linux-baremetal' )
|
||||
? ( $cross_cc, @linux_baremetal_cflags, '-DTARGET_LINUX_BAREMETAL' )
|
||||
: ( $cross_cc, @cross_cflags, '-DTARGET_FAIL' );
|
||||
Util::run( $cc, @flags, '-c', 'targets/c-host/c_host.c', '-o',
|
||||
"$bd/c_host.o" );
|
||||
@@ -412,7 +416,7 @@ sub compile_c_host {
|
||||
|
||||
sub compile_startup {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
return unless $target eq 'fail';
|
||||
return unless $target eq 'fail' || $target eq 'linux-baremetal';
|
||||
Util::run( $cross_cc, 'targets/startup.s', '-I./targets/wasm-host',
|
||||
@cross_cflags, '-c', '-o', "$bd/startup.o" );
|
||||
}
|
||||
@@ -448,8 +452,13 @@ sub link_wasm {
|
||||
@linux_ldflags_base, '-o', "$bd/system.elf" );
|
||||
}
|
||||
elsif ( $target eq 'linux-baremetal' ) {
|
||||
Util::run( $cross_cc, "$bd/system.o", "$bd/syscalls.o",
|
||||
"$bd/libiwasm.a", @baremetal_ldflags_base, '-o', "$bd/system.elf" );
|
||||
Util::run(
|
||||
$cross_cc, '-Wl,-T',
|
||||
'targets/linker.ld', "$bd/system.o",
|
||||
"$bd/startup.o", "$bd/syscalls.o",
|
||||
"$bd/libiwasm.a", @baremetal_ldflags_base,
|
||||
'-o', "$bd/system.elf"
|
||||
);
|
||||
}
|
||||
else {
|
||||
die "Unknown target '$target'\n";
|
||||
@@ -464,15 +473,26 @@ sub link_c {
|
||||
Util::run(
|
||||
$cross_cc, '-Wl,-T',
|
||||
'targets/linker.ld', "$bd/c_host.o",
|
||||
"$bd/startup.o", "$bd/c_module.o",
|
||||
@tacle_objs, @cross_ldflags_nowasm,
|
||||
'-o', "$bd/system.elf"
|
||||
"$bd/startup.o", "$bd/syscalls.o",
|
||||
"$bd/c_module.o", @tacle_objs,
|
||||
@cross_ldflags_nowasm, '-o',
|
||||
"$bd/system.elf"
|
||||
);
|
||||
}
|
||||
elsif ( $target eq 'linux' ) {
|
||||
Util::run( $linux_cc, "$bd/c_host.o", "$bd/c_module.o", @tacle_objs,
|
||||
@linux_ldflags_nowasm, '-o', "$bd/system.elf" );
|
||||
}
|
||||
elsif ( $target eq 'linux-baremetal' ) {
|
||||
Util::run(
|
||||
$cross_cc, '-Wl,-T',
|
||||
'targets/linker.ld', "$bd/c_host.o",
|
||||
"$bd/startup.o", "$bd/syscalls.o",
|
||||
"$bd/c_module.o", @tacle_objs,
|
||||
@baremetal_ldflags_base, '-o',
|
||||
"$bd/system.elf"
|
||||
);
|
||||
}
|
||||
else {
|
||||
die "C mode is not supported for target '$target'\n";
|
||||
}
|
||||
|
||||
+87
-27
@@ -33,6 +33,7 @@ my $local_db_conf = "$local_root/db.conf";
|
||||
|
||||
my $resultbrowser_port = '5000';
|
||||
my $resultbrowser = 'resultbrowser.py';
|
||||
my $qemu_gdb_port = '9000';
|
||||
|
||||
my $remote_root = '/home/lab/smchurla/Documents/failnix';
|
||||
my $remote_builds_dir = "$remote_root/builds";
|
||||
@@ -523,11 +524,44 @@ my %handlers = (
|
||||
|
||||
my $build_dir = "$local_builds_dir/$selected_build";
|
||||
my $build_name = $selected_build =~ s/.*?_.*?_(.*?)_.*$/$1/r;
|
||||
my $is_baremetal = $selected_build =~ /linux-baremetal$/;
|
||||
my $is_wasm = $build_name eq 'aot' || $build_name eq 'interp';
|
||||
|
||||
say "$build_name";
|
||||
|
||||
system(
|
||||
'gdb',
|
||||
# Baremetal builds boot the iso in qemu and attach gdb
|
||||
my $qemu_pid;
|
||||
if ($is_baremetal) {
|
||||
say "Forking...";
|
||||
$qemu_pid = fork();
|
||||
die "fork failed: $!\n" unless defined $qemu_pid;
|
||||
|
||||
if ( $qemu_pid == 0 ) {
|
||||
|
||||
# child -> qemu.
|
||||
exec(
|
||||
'qemu-system-i386',
|
||||
'-drive',
|
||||
"file=$build_dir/system.iso,media=cdrom",
|
||||
'-boot',
|
||||
'd',
|
||||
'-m',
|
||||
'32',
|
||||
'-D',
|
||||
"$local_root/qemu.log",
|
||||
'-d',
|
||||
"int,cpu_reset",
|
||||
'-no-reboot',
|
||||
'-no-shutdown',
|
||||
'-S',
|
||||
'-gdb',
|
||||
"tcp::$qemu_gdb_port",
|
||||
) or die "failed to exec qemu: $!\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Shared gdb args
|
||||
my @gdb_args = (
|
||||
'--tui',
|
||||
'-q',
|
||||
"$build_dir/system.elf",
|
||||
@@ -537,29 +571,52 @@ my %handlers = (
|
||||
"set substitute-path 'build-$build_name' '$build_dir'",
|
||||
'-ex',
|
||||
"set substitute-path '/build/source/core' '$local_wamr/core'",
|
||||
'-ex',
|
||||
'break main',
|
||||
'-ex',
|
||||
'break fail_start_trace',
|
||||
'-ex',
|
||||
'break fail_stop_trace',
|
||||
'-ex',
|
||||
'break fail_marker_positive',
|
||||
'-ex',
|
||||
'break fail_marker_detected',
|
||||
'-ex',
|
||||
'break fail_marker_negative',
|
||||
'-ex',
|
||||
'break fail_marker_group1',
|
||||
'-ex',
|
||||
'break os_mmap',
|
||||
'-ex',
|
||||
'break wamr_malloc',
|
||||
'-ex',
|
||||
'break wamr_realloc',
|
||||
'-ex',
|
||||
'break wamr_free',
|
||||
);
|
||||
|
||||
# Specific gdb args
|
||||
if ($is_baremetal) {
|
||||
push @gdb_args,
|
||||
'-ex', "target remote localhost:$qemu_gdb_port",
|
||||
'-ex', 'break os_main';
|
||||
}
|
||||
else {
|
||||
push @gdb_args, '-ex', 'break main';
|
||||
}
|
||||
|
||||
# Shared breakpoints
|
||||
my @shared_breakpoints = (
|
||||
'fail_start_trace', 'fail_stop_trace',
|
||||
'fail_marker_positive', 'fail_marker_detected',
|
||||
'fail_marker_negative',
|
||||
);
|
||||
|
||||
# Breakpoints for native C
|
||||
my @c_breakpoints = ();
|
||||
|
||||
# Breakpoints for Wasm
|
||||
my @wasm_breakpoints = (
|
||||
'fail_marker_group1',
|
||||
|
||||
# 'os_mmap',
|
||||
# 'wamr_malloc',
|
||||
# 'wamr_realloc',
|
||||
# 'wamr_free',
|
||||
);
|
||||
my @breakpoints = (
|
||||
@shared_breakpoints, $is_wasm ? @wasm_breakpoints : @c_breakpoints,
|
||||
);
|
||||
push @gdb_args, '-ex', "break $_" for @breakpoints;
|
||||
|
||||
# Autostart execution
|
||||
push @gdb_args, '-ex', ( $is_baremetal ? 'continue' : 'run' );
|
||||
|
||||
system( 'gdb', @gdb_args );
|
||||
|
||||
if ($is_baremetal) {
|
||||
say "Killing qemu with pid $qemu_pid...";
|
||||
kill 'TERM', $qemu_pid;
|
||||
waitpid( $qemu_pid, 0 );
|
||||
}
|
||||
},
|
||||
|
||||
'30. Plot Results' => sub {
|
||||
@@ -574,10 +631,13 @@ my %handlers = (
|
||||
|
||||
# Need to know which chart uses which datafile
|
||||
my @faults_charts =
|
||||
grep { /heatmap|scatter|sankey|instr_fault_correlation/ }
|
||||
@selected_charts;
|
||||
grep {
|
||||
/_heatmap|_scatter|_sankey|_instr_fault_correlation|_instr_fault_rate_heatmap|fault_rates_per_instruction/
|
||||
} @selected_charts;
|
||||
my @resultsdata_charts =
|
||||
grep { /result|combined_comparison|combined_ratio/ } @selected_charts;
|
||||
grep {
|
||||
/_result|_fault_count_comparison|_ratio_comparison|_fault_count_correlation/
|
||||
} @selected_charts;
|
||||
|
||||
# Select if faults.csv or a filtered variant should be used
|
||||
my $faults_csv;
|
||||
|
||||
+12
-6
@@ -10,30 +10,37 @@
|
||||
#define IMPORT(fnct) __attribute__((import_module("env"), import_name(fnct)))
|
||||
|
||||
#if !defined(TARGET_FAIL) && !defined(TARGET_LINUX_BAREMETAL) && \
|
||||
!defined(TARGET_LINUX)
|
||||
!defined(TARGET_LINUX) && !defined(TARGET_WASM)
|
||||
// Set to linux while editing to prevent lsp errors
|
||||
#define TARGET_LINUX
|
||||
#endif
|
||||
|
||||
// Both the wasm wrapper and the wasm module use lib.h
|
||||
// TARGET_WASM is for the wasm module...
|
||||
#ifdef TARGET_WASM
|
||||
#define PRINT(fmt, ...) print(fmt)
|
||||
#endif
|
||||
|
||||
// ...the rest is for the wasm wrapper
|
||||
#ifdef TARGET_FAIL
|
||||
#define MAIN void os_main(void)
|
||||
#define PRINT(fmt, ...)
|
||||
#define PRINT_ERROR(fmt, ...)
|
||||
#define PRINT_SUCCESS(fmt, ...)
|
||||
#define HOST_PRINT(msg)
|
||||
#define RET(val) return
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_LINUX_BAREMETAL
|
||||
#define MAIN int main(int argc, char *argv[])
|
||||
#define MAIN void os_main(void)
|
||||
#define PRINT(fmt, ...)
|
||||
#define PRINT_ERROR(fmt, ...)
|
||||
#define PRINT_SUCCESS(fmt, ...)
|
||||
#define HOST_PRINT(msg)
|
||||
#define RET(val) return
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_LINUX
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define MAIN int main(int argc, char *argv[])
|
||||
#define PRINT(fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__)
|
||||
#define PRINT_ERROR(fmt, ...) \
|
||||
@@ -42,8 +49,7 @@
|
||||
#define PRINT_SUCCESS(fmt, ...) \
|
||||
fprintf(stdout, "[Success] "); \
|
||||
fprintf(stdout, fmt, ##__VA_ARGS__)
|
||||
#define HOST_PRINT(msg) print(msg)
|
||||
#define RET(val) return val;
|
||||
#define RET(val) return val
|
||||
#endif
|
||||
|
||||
typedef uint16_t enc_t;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file lib_export.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LIB_EXPORT_H_
|
||||
#define _LIB_EXPORT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct NativeSymbol {
|
||||
const char *symbol;
|
||||
void *func_ptr;
|
||||
const char *signature;
|
||||
/* attachment which can be retrieved in native API by
|
||||
calling wasm_runtime_get_function_attachment(exec_env) */
|
||||
void *attachment;
|
||||
} NativeSymbol;
|
||||
|
||||
/* clang-format off */
|
||||
#define EXPORT_WASM_API(symbol) \
|
||||
{ #symbol, (void *)symbol, NULL, NULL }
|
||||
#define EXPORT_WASM_API2(symbol) \
|
||||
{ #symbol, (void *)symbol##_wrapper, NULL, NULL }
|
||||
|
||||
#define EXPORT_WASM_API_WITH_SIG(symbol, signature) \
|
||||
{ #symbol, (void *)symbol, signature, NULL }
|
||||
#define EXPORT_WASM_API_WITH_SIG2(symbol, signature) \
|
||||
{ #symbol, (void *)symbol##_wrapper, signature, NULL }
|
||||
|
||||
#define EXPORT_WASM_API_WITH_ATT(symbol, signature, attachment) \
|
||||
{ #symbol, (void *)symbol, signature, attachment }
|
||||
#define EXPORT_WASM_API_WITH_ATT2(symbol, signature, attachment) \
|
||||
{ #symbol, (void *)symbol##_wrapper, signature, attachment }
|
||||
/* clang-format on */
|
||||
|
||||
/**
|
||||
* Get the exported APIs of base lib
|
||||
*
|
||||
* @param p_base_lib_apis return the exported API array of base lib
|
||||
*
|
||||
* @return the number of the exported API
|
||||
*/
|
||||
uint32_t get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _LIB_EXPORT_H_ */
|
||||
@@ -3,10 +3,6 @@
|
||||
#include "bh_platform.h"
|
||||
|
||||
#include "__WASM_ARRAY_FILE__"
|
||||
#ifdef TARGET_LINUX
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
// FAIL* instrumentation symbols
|
||||
void fail_start_trace(void) {}
|
||||
@@ -60,13 +56,11 @@ static char linear_pool_buf[LINEAR_POOL_SIZE];
|
||||
|
||||
// mem_alloc_usage_t: 0 = Alloc_For_Runtime, 1 = Alloc_For_LinearMemory
|
||||
static BumpPool pools[] = {
|
||||
{ runtime_pool_buf, RUNTIME_POOL_SIZE, 0 },
|
||||
{ linear_pool_buf, LINEAR_POOL_SIZE, 0 },
|
||||
{runtime_pool_buf, RUNTIME_POOL_SIZE, 0},
|
||||
{linear_pool_buf, LINEAR_POOL_SIZE, 0},
|
||||
};
|
||||
|
||||
static size_t align_up(size_t x, size_t a) {
|
||||
return (x + a - 1) & ~(a - 1);
|
||||
}
|
||||
static size_t align_up(size_t x, size_t a) { return (x + a - 1) & ~(a - 1); }
|
||||
|
||||
static size_t alloc_size(void *ptr) {
|
||||
size_t header_size = align_up(sizeof(size_t), ALIGNMENT);
|
||||
|
||||
@@ -52,11 +52,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
};
|
||||
|
||||
if (cmp(Calculated, Expected)) {
|
||||
HOST_PRINT("result correct.\n");
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("result incorrect.\n");
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
fail_stop_trace();
|
||||
|
||||
if (X == 5) {
|
||||
HOST_PRINT("result correct.\n");
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("result incorrect.\n");
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ static void naive_vote(void) {
|
||||
} else if (YC == ZC) {
|
||||
vote_res = YC;
|
||||
} else {
|
||||
HOST_PRINT("all replicas differ.\n");
|
||||
PRINT("all replicas differ.\n");
|
||||
fail_marker_detected();
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
fail_stop_trace();
|
||||
|
||||
if (vote_res == 5) {
|
||||
HOST_PRINT("vote success.\n");
|
||||
PRINT("vote success.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("undetected error.\n");
|
||||
PRINT("undetected error.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static enc_t sum_out[REPLICA_COUNT];
|
||||
|
||||
static INLINE enc_t apply(enc_t vc, sign_t bdyn) {
|
||||
if (bdyn > SIG_MAX) {
|
||||
HOST_PRINT("signature overflow.\n");
|
||||
PRINT("signature overflow.\n");
|
||||
fail_marker_detected();
|
||||
}
|
||||
return vc + bdyn;
|
||||
@@ -49,7 +49,7 @@ static sign_t cored_vote(void) {
|
||||
cored_res = apply(XC, (XC - ZC));
|
||||
return SIG_s_XZ;
|
||||
} else {
|
||||
HOST_PRINT("all replicas differ.\n");
|
||||
PRINT("all replicas differ.\n");
|
||||
fail_marker_detected();
|
||||
return 0;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
vote_result_sig = SIG_Y;
|
||||
break;
|
||||
default:
|
||||
HOST_PRINT("unknown static_sig.\n");
|
||||
PRINT("unknown static_sig.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -102,18 +102,18 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
/* Validate Vote result */
|
||||
if (!check(cored_res, THE_A, vote_result_sig)) {
|
||||
HOST_PRINT("voted result invalid.\n");
|
||||
PRINT("voted result invalid.\n");
|
||||
fail_marker_detected();
|
||||
return 2;
|
||||
}
|
||||
|
||||
plain_t res = decode(cored_res, THE_A, vote_result_sig);
|
||||
if (res == 5) {
|
||||
HOST_PRINT("cored success.\n");
|
||||
PRINT("cored success.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("undetected error.\n");
|
||||
PRINT("undetected error.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ static void naive_vote(void) {
|
||||
} else if (YC == ZC) {
|
||||
vote_res = YC;
|
||||
} else {
|
||||
HOST_PRINT("all replicas differ.\n");
|
||||
PRINT("all replicas differ.\n");
|
||||
fail_marker_detected();
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
fail_stop_trace();
|
||||
|
||||
if (vote_res == 5) {
|
||||
HOST_PRINT("vote success.\n");
|
||||
PRINT("vote success.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("undetected error.\n");
|
||||
PRINT("undetected error.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static enc_t sum_out[REPLICA_COUNT];
|
||||
|
||||
static INLINE enc_t apply(enc_t vc, sign_t bdyn) {
|
||||
if (bdyn > SIG_MAX) {
|
||||
HOST_PRINT("signature overflow.\n");
|
||||
PRINT("signature overflow.\n");
|
||||
fail_marker_detected();
|
||||
}
|
||||
return vc + bdyn;
|
||||
@@ -49,7 +49,7 @@ static sign_t cored_vote(void) {
|
||||
cored_res = apply(XC, (XC - ZC));
|
||||
return SIG_s_XZ;
|
||||
} else {
|
||||
HOST_PRINT("all replicas differ.\n");
|
||||
PRINT("all replicas differ.\n");
|
||||
fail_marker_detected();
|
||||
return 0;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
vote_result_sig = SIG_Y;
|
||||
break;
|
||||
default:
|
||||
HOST_PRINT("unknown static_sig.\n");
|
||||
PRINT("unknown static_sig.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -102,18 +102,18 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
/* Validate Vote result */
|
||||
if (!check(cored_res, THE_A, vote_result_sig)) {
|
||||
HOST_PRINT("voted result invalid.\n");
|
||||
PRINT("voted result invalid.\n");
|
||||
fail_marker_detected();
|
||||
return 2;
|
||||
}
|
||||
|
||||
plain_t res = decode(cored_res, THE_A, vote_result_sig);
|
||||
if (res == 5) {
|
||||
HOST_PRINT("cored success.\n");
|
||||
PRINT("cored success.\n");
|
||||
fail_marker_positive();
|
||||
return 0;
|
||||
} else {
|
||||
HOST_PRINT("undetected error.\n");
|
||||
PRINT("undetected error.\n");
|
||||
fail_marker_negative();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = binarysearch_return() - (-1);
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = bsort_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = complex_updates_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = countnegative_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = fft_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = matrix1_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = md5_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = (quicksort_return() - 1527923179 != 0);
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = recursion_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
|
||||
|
||||
int ret = sha_return();
|
||||
if (ret == 0) {
|
||||
PRINT("result correct.\n");
|
||||
fail_marker_positive();
|
||||
} else {
|
||||
PRINT("result incorrect.\n");
|
||||
fail_marker_negative();
|
||||
}
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
#define MAXSIZE 20
|
||||
#define MAXSIZE 8
|
||||
|
||||
/*
|
||||
Type definition for the matrix
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
|
||||
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
|
||||
|
||||
#define N_FFT 1024
|
||||
#define N_FFT 16
|
||||
#define NUMBER_OF_BITS 13 /* fract format 1.NUMBER_OF_BITS = 1.13 */
|
||||
|
||||
#define BITS_PER_TWID 13 /* bits per twiddle coefficient */
|
||||
|
||||
@@ -37,7 +37,7 @@ __attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
|
||||
|
||||
void
|
||||
recursion_init() {
|
||||
int volatile temp_input = 10;
|
||||
int volatile temp_input = 7;
|
||||
recursion_input = temp_input;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ recursion_fib(int i) {
|
||||
|
||||
int
|
||||
recursion_return() {
|
||||
return (recursion_result + (-89)) != 0;
|
||||
return (recursion_result + (-21)) != 0;
|
||||
}
|
||||
|
||||
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
|
||||
|
||||
+95
-145
@@ -12,9 +12,9 @@
|
||||
#ifndef _WASM_EXPORT_H
|
||||
#define _WASM_EXPORT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lib_export.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef WASM_RUNTIME_API_EXTERN
|
||||
#if defined(_MSC_BUILD)
|
||||
@@ -361,8 +361,7 @@ typedef struct SharedHeapInitArgs {
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_init(void);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init(void);
|
||||
|
||||
/**
|
||||
* Initialize the WASM runtime environment, WASM running mode,
|
||||
@@ -373,16 +372,14 @@ wasm_runtime_init(void);
|
||||
*
|
||||
* @return return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_full_init(RuntimeInitArgs *init_args);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_full_init(RuntimeInitArgs *init_args);
|
||||
|
||||
/**
|
||||
* Set the log level. To be called after the runtime is initialized.
|
||||
*
|
||||
* @param level the log level to set
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_log_level(log_level_t level);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_log_level(log_level_t level);
|
||||
|
||||
/**
|
||||
* Query whether a certain running mode is supported for the runtime
|
||||
@@ -409,8 +406,7 @@ wasm_runtime_set_default_running_mode(RunningMode running_mode);
|
||||
/**
|
||||
* Destroy the WASM runtime environment.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_destroy(void);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy(void);
|
||||
|
||||
/**
|
||||
* Allocate memory from runtime memory environment.
|
||||
@@ -419,8 +415,7 @@ wasm_runtime_destroy(void);
|
||||
*
|
||||
* @return the pointer to memory allocated
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void *
|
||||
wasm_runtime_malloc(unsigned int size);
|
||||
WASM_RUNTIME_API_EXTERN void *wasm_runtime_malloc(unsigned int size);
|
||||
|
||||
/**
|
||||
* Reallocate memory from runtime memory environment
|
||||
@@ -430,14 +425,13 @@ wasm_runtime_malloc(unsigned int size);
|
||||
*
|
||||
* @return the pointer to memory reallocated
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void *
|
||||
wasm_runtime_realloc(void *ptr, unsigned int size);
|
||||
WASM_RUNTIME_API_EXTERN void *wasm_runtime_realloc(void *ptr,
|
||||
unsigned int size);
|
||||
|
||||
/*
|
||||
* Free memory to runtime memory environment.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_free(void *ptr);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_free(void *ptr);
|
||||
|
||||
/*
|
||||
* Get memory info, only pool mode is supported now.
|
||||
@@ -453,8 +447,8 @@ wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
|
||||
*
|
||||
* @return the package type, return Package_Type_Unknown if the type is unknown
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN package_type_t
|
||||
get_package_type(const uint8_t *buf, uint32_t size);
|
||||
WASM_RUNTIME_API_EXTERN package_type_t get_package_type(const uint8_t *buf,
|
||||
uint32_t size);
|
||||
|
||||
/**
|
||||
* Get the package type of a buffer (same as get_package_type).
|
||||
@@ -517,8 +511,8 @@ wasm_runtime_get_current_package_version(package_type_t package_type);
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_is_xip_file(const uint8_t *buf, uint32_t size);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_xip_file(const uint8_t *buf,
|
||||
uint32_t size);
|
||||
|
||||
/**
|
||||
* Callback to load a module file into a buffer in multi-module feature
|
||||
@@ -588,9 +582,8 @@ wasm_runtime_find_module_registered(const char *module_name);
|
||||
*
|
||||
* @return return WASM module loaded, NULL if failed
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_t
|
||||
wasm_runtime_load(uint8_t *buf, uint32_t size, char *error_buf,
|
||||
uint32_t error_buf_size);
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_t wasm_runtime_load(
|
||||
uint8_t *buf, uint32_t size, char *error_buf, uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
* Load a WASM module with specified load argument.
|
||||
@@ -603,8 +596,7 @@ wasm_runtime_load_ex(uint8_t *buf, uint32_t size, const LoadArgs *args,
|
||||
* Resolve symbols for a previously loaded WASM module. Only useful when the
|
||||
* module was loaded with LoadArgs::no_resolve set to true
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_resolve_symbols(wasm_module_t module);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_resolve_symbols(wasm_module_t module);
|
||||
/**
|
||||
* Load a WASM module from a specified WASM or AOT section list.
|
||||
*
|
||||
@@ -624,8 +616,7 @@ wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot,
|
||||
*
|
||||
* @param module the module to be unloaded
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_unload(wasm_module_t module);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_unload(wasm_module_t module);
|
||||
|
||||
/**
|
||||
* Get the module hash of a WASM module, currently only available on
|
||||
@@ -635,8 +626,7 @@ wasm_runtime_unload(wasm_module_t module);
|
||||
*
|
||||
* @return the module hash of the WASM module
|
||||
*/
|
||||
char *
|
||||
wasm_runtime_get_module_hash(wasm_module_t module);
|
||||
char *wasm_runtime_get_module_hash(wasm_module_t module);
|
||||
|
||||
/**
|
||||
* Set WASI parameters.
|
||||
@@ -671,13 +661,11 @@ wasm_runtime_get_module_hash(wasm_module_t module);
|
||||
* INVALID_HANDLE_VALUE on Windows), the platform default
|
||||
* for STDERR is used.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_wasi_args_ex(wasm_module_t module, const char *dir_list[],
|
||||
uint32_t dir_count, const char *map_dir_list[],
|
||||
uint32_t map_dir_count, const char *env[],
|
||||
uint32_t env_count, char *argv[], int argc,
|
||||
int64_t stdinfd, int64_t stdoutfd,
|
||||
int64_t stderrfd);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_wasi_args_ex(
|
||||
wasm_module_t module, const char *dir_list[], uint32_t dir_count,
|
||||
const char *map_dir_list[], uint32_t map_dir_count, const char *env[],
|
||||
uint32_t env_count, char *argv[], int argc, int64_t stdinfd,
|
||||
int64_t stdoutfd, int64_t stderrfd);
|
||||
|
||||
/**
|
||||
* Set WASI parameters.
|
||||
@@ -718,11 +706,9 @@ wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module,
|
||||
*
|
||||
* @return return the instantiated WASM module instance, NULL if failed
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
|
||||
wasm_runtime_instantiate(const wasm_module_t module,
|
||||
uint32_t default_stack_size,
|
||||
uint32_t host_managed_heap_size, char *error_buf,
|
||||
uint32_t error_buf_size);
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate(
|
||||
const wasm_module_t module, uint32_t default_stack_size,
|
||||
uint32_t host_managed_heap_size, char *error_buf, uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
* Instantiate a WASM module, with specified instantiation arguments
|
||||
@@ -730,9 +716,8 @@ wasm_runtime_instantiate(const wasm_module_t module,
|
||||
* Same as wasm_runtime_instantiate, but it also allows overwriting maximum
|
||||
* memory
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
|
||||
wasm_runtime_instantiate_ex(const wasm_module_t module,
|
||||
const InstantiationArgs *args, char *error_buf,
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate_ex(
|
||||
const wasm_module_t module, const InstantiationArgs *args, char *error_buf,
|
||||
uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
@@ -768,22 +753,15 @@ WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_wasi_arg(struct InstantiationArgs2 *p,
|
||||
char *argv[], int argc);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_wasi_env(struct InstantiationArgs2 *p,
|
||||
const char *env[],
|
||||
uint32_t env_count);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_env(
|
||||
struct InstantiationArgs2 *p, const char *env[], uint32_t env_count);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_wasi_dir(struct InstantiationArgs2 *p,
|
||||
const char *dir_list[],
|
||||
uint32_t dir_count,
|
||||
const char *map_dir_list[],
|
||||
uint32_t map_dir_count);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_dir(
|
||||
struct InstantiationArgs2 *p, const char *dir_list[], uint32_t dir_count,
|
||||
const char *map_dir_list[], uint32_t map_dir_count);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_wasi_stdio(struct InstantiationArgs2 *p,
|
||||
int64_t stdinfd,
|
||||
int64_t stdoutfd,
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_stdio(
|
||||
struct InstantiationArgs2 *p, int64_t stdinfd, int64_t stdoutfd,
|
||||
int64_t stderrfd);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
@@ -802,9 +780,8 @@ wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
|
||||
* Same as wasm_runtime_instantiate_ex, but this version takes
|
||||
* InstantiationArgs2, which can be extended without breaking the ABI.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
|
||||
wasm_runtime_instantiate_ex2(const wasm_module_t module,
|
||||
const struct InstantiationArgs2 *args,
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate_ex2(
|
||||
const wasm_module_t module, const struct InstantiationArgs2 *args,
|
||||
char *error_buf, uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
@@ -879,9 +856,8 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
|
||||
*
|
||||
* @return the function instance found, NULL if not found
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_function_inst_t
|
||||
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
|
||||
const char *name);
|
||||
WASM_RUNTIME_API_EXTERN wasm_function_inst_t wasm_runtime_lookup_function(
|
||||
const wasm_module_inst_t module_inst, const char *name);
|
||||
|
||||
/**
|
||||
* Get parameter count of the function instance
|
||||
@@ -891,9 +867,8 @@ wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
|
||||
*
|
||||
* @return the parameter count of the function instance
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_func_get_param_count(const wasm_function_inst_t func_inst,
|
||||
const wasm_module_inst_t module_inst);
|
||||
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_param_count(
|
||||
const wasm_function_inst_t func_inst, const wasm_module_inst_t module_inst);
|
||||
|
||||
/**
|
||||
* Get result count of the function instance
|
||||
@@ -903,9 +878,8 @@ wasm_func_get_param_count(const wasm_function_inst_t func_inst,
|
||||
*
|
||||
* @return the result count of the function instance
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_func_get_result_count(const wasm_function_inst_t func_inst,
|
||||
const wasm_module_inst_t module_inst);
|
||||
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_result_count(
|
||||
const wasm_function_inst_t func_inst, const wasm_module_inst_t module_inst);
|
||||
|
||||
/**
|
||||
* Get parameter types of the function instance
|
||||
@@ -940,9 +914,8 @@ wasm_func_get_result_types(const wasm_function_inst_t func_inst,
|
||||
* @return the execution environment, NULL if failed, e.g. invalid
|
||||
* stack size is passed
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_exec_env_t
|
||||
wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
|
||||
uint32_t stack_size);
|
||||
WASM_RUNTIME_API_EXTERN wasm_exec_env_t wasm_runtime_create_exec_env(
|
||||
wasm_module_inst_t module_inst, uint32_t stack_size);
|
||||
|
||||
/**
|
||||
* Destroy the execution environment.
|
||||
@@ -1018,9 +991,8 @@ wasm_runtime_get_exec_env_singleton(wasm_module_inst_t module_inst);
|
||||
*
|
||||
* @return debug port if success, 0 otherwise.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_runtime_start_debug_instance_with_port(wasm_exec_env_t exec_env,
|
||||
int32_t port);
|
||||
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_start_debug_instance_with_port(
|
||||
wasm_exec_env_t exec_env, int32_t port);
|
||||
|
||||
/**
|
||||
* Same as wasm_runtime_start_debug_instance_with_port(env, -1).
|
||||
@@ -1040,20 +1012,17 @@ wasm_runtime_start_debug_instance(wasm_exec_env_t exec_env);
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_init_thread_env(void);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init_thread_env(void);
|
||||
|
||||
/**
|
||||
* Destroy the thread environment
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_destroy_thread_env(void);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_thread_env(void);
|
||||
|
||||
/**
|
||||
* Whether the thread environment is initialized
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_thread_env_inited(void);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_thread_env_inited(void);
|
||||
|
||||
/**
|
||||
* Get WASM module instance from execution environment
|
||||
@@ -1088,9 +1057,8 @@ wasm_runtime_set_module_inst(wasm_exec_env_t exec_env,
|
||||
*
|
||||
* @return The memory instance if found, NULL otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t
|
||||
wasm_runtime_lookup_memory(const wasm_module_inst_t module_inst,
|
||||
const char *name);
|
||||
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t wasm_runtime_lookup_memory(
|
||||
const wasm_module_inst_t module_inst, const char *name);
|
||||
|
||||
/**
|
||||
* @brief Get the default memory instance
|
||||
@@ -1171,8 +1139,8 @@ wasm_memory_get_base_address(const wasm_memory_inst_t memory_inst);
|
||||
*
|
||||
* @return True if successful, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_memory_enlarge(wasm_memory_inst_t memory_inst, uint64_t inc_page_count);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_memory_enlarge(wasm_memory_inst_t memory_inst,
|
||||
uint64_t inc_page_count);
|
||||
|
||||
/**
|
||||
* Call the given WASM function of a WASM module instance with
|
||||
@@ -1409,9 +1377,8 @@ wasm_runtime_is_bounds_checks_enabled(wasm_module_inst_t module_inst);
|
||||
* it is not an absolute address.
|
||||
* Return non-zero if success, zero if failed.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_runtime_module_malloc(wasm_module_inst_t module_inst, uint64_t size,
|
||||
void **p_native_addr);
|
||||
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_module_malloc(
|
||||
wasm_module_inst_t module_inst, uint64_t size, void **p_native_addr);
|
||||
|
||||
/**
|
||||
* Free memory to the heap of WASM module instance
|
||||
@@ -1435,9 +1402,8 @@ wasm_runtime_module_free(wasm_module_inst_t module_inst, uint64_t ptr);
|
||||
* it is not an absolute address.
|
||||
* Return non-zero if success, zero if failed.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_runtime_module_dup_data(wasm_module_inst_t module_inst, const char *src,
|
||||
uint64_t size);
|
||||
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_module_dup_data(
|
||||
wasm_module_inst_t module_inst, const char *src, uint64_t size);
|
||||
|
||||
/**
|
||||
* Validate the app address, check whether it belongs to WASM module
|
||||
@@ -1516,9 +1482,8 @@ wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
|
||||
*
|
||||
* @return the app address converted
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
|
||||
void *native_ptr);
|
||||
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_addr_native_to_app(
|
||||
wasm_module_inst_t module_inst, void *native_ptr);
|
||||
|
||||
/**
|
||||
* Get the app address range (relative address) that a app address belongs to
|
||||
@@ -1530,11 +1495,9 @@ wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
|
||||
*
|
||||
* @return true if success, false otherwise.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst,
|
||||
uint64_t app_offset,
|
||||
uint64_t *p_app_start_offset,
|
||||
uint64_t *p_app_end_offset);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_get_app_addr_range(
|
||||
wasm_module_inst_t module_inst, uint64_t app_offset,
|
||||
uint64_t *p_app_start_offset, uint64_t *p_app_end_offset);
|
||||
|
||||
/**
|
||||
* Get the native address range (absolute address) that a native address
|
||||
@@ -1549,11 +1512,9 @@ wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst,
|
||||
*
|
||||
* @return true if success, false otherwise.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_get_native_addr_range(wasm_module_inst_t module_inst,
|
||||
uint8_t *native_ptr,
|
||||
uint8_t **p_native_start_addr,
|
||||
uint8_t **p_native_end_addr);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_runtime_get_native_addr_range(
|
||||
wasm_module_inst_t module_inst, uint8_t *native_ptr,
|
||||
uint8_t **p_native_start_addr, uint8_t **p_native_end_addr);
|
||||
|
||||
/**
|
||||
* Get the number of import items for a WASM module
|
||||
@@ -1631,9 +1592,8 @@ wasm_func_type_get_param_count(const wasm_func_type_t func_type);
|
||||
*
|
||||
* @return the kind of the parameter if successful, -1 otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_valkind_t
|
||||
wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
|
||||
uint32_t param_index);
|
||||
WASM_RUNTIME_API_EXTERN wasm_valkind_t wasm_func_type_get_param_valkind(
|
||||
const wasm_func_type_t func_type, uint32_t param_index);
|
||||
|
||||
/**
|
||||
* Get the number of results for a function type
|
||||
@@ -1653,9 +1613,8 @@ wasm_func_type_get_result_count(const wasm_func_type_t func_type);
|
||||
*
|
||||
* @return the kind of the result if successful, -1 otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_valkind_t
|
||||
wasm_func_type_get_result_valkind(const wasm_func_type_t func_type,
|
||||
uint32_t result_index);
|
||||
WASM_RUNTIME_API_EXTERN wasm_valkind_t wasm_func_type_get_result_valkind(
|
||||
const wasm_func_type_t func_type, uint32_t result_index);
|
||||
|
||||
/**
|
||||
* Get the kind for a global type
|
||||
@@ -1978,8 +1937,7 @@ typedef uintptr_t wasm_thread_t;
|
||||
*
|
||||
* @param num maximum thread num
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_max_thread_num(uint32_t num);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_max_thread_num(uint32_t num);
|
||||
|
||||
/**
|
||||
* Spawn a new exec_env, the spawned exec_env
|
||||
@@ -2022,8 +1980,8 @@ wasm_runtime_spawn_thread(wasm_exec_env_t exec_env, wasm_thread_t *tid,
|
||||
*
|
||||
* @return 0 if success, error number otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN int32_t
|
||||
wasm_runtime_join_thread(wasm_thread_t tid, void **retval);
|
||||
WASM_RUNTIME_API_EXTERN int32_t wasm_runtime_join_thread(wasm_thread_t tid,
|
||||
void **retval);
|
||||
|
||||
/**
|
||||
* Map external object to an internal externref index: if the index
|
||||
@@ -2076,8 +2034,8 @@ wasm_externref_set_cleanup(wasm_module_inst_t module_inst, void *extern_obj,
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_externref_ref2obj(uint32_t externref_idx,
|
||||
void **p_extern_obj);
|
||||
|
||||
/**
|
||||
* Retain an extern object which is mapped to the internal externref
|
||||
@@ -2088,8 +2046,7 @@ wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj);
|
||||
* to retain
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_externref_retain(uint32_t externref_idx);
|
||||
WASM_RUNTIME_API_EXTERN bool wasm_externref_retain(uint32_t externref_idx);
|
||||
|
||||
/**
|
||||
* Dump the call stack to stdout
|
||||
@@ -2123,9 +2080,8 @@ wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env);
|
||||
* @return bytes dumped to the buffer, including the terminating null
|
||||
* byte ('\0'), 0 means error and data in buf may be invalid
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_runtime_dump_call_stack_to_buf(wasm_exec_env_t exec_env, char *buf,
|
||||
uint32_t len);
|
||||
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_dump_call_stack_to_buf(
|
||||
wasm_exec_env_t exec_env, char *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* Get the size required to store the LLVM PGO profile data
|
||||
@@ -2147,9 +2103,8 @@ wasm_runtime_get_pgo_prof_data_size(wasm_module_inst_t module_inst);
|
||||
* @return bytes dumped to the buffer, 0 means error and data in buf
|
||||
* may be invalid
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
|
||||
char *buf, uint32_t len);
|
||||
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_dump_pgo_prof_data_to_buf(
|
||||
wasm_module_inst_t module_inst, char *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* Get a custom section by name
|
||||
@@ -2212,8 +2167,7 @@ typedef void (*enlarge_memory_error_callback_t)(
|
||||
/**
|
||||
* Setup callback invoked when memory.grow fails
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_enlarge_mem_error_callback(
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_enlarge_mem_error_callback(
|
||||
const enlarge_memory_error_callback_t callback, void *user_data);
|
||||
|
||||
/*
|
||||
@@ -2268,21 +2222,19 @@ wasm_runtime_set_enlarge_mem_error_callback(
|
||||
* - The destructor is called only on the main instance.
|
||||
*/
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void *
|
||||
wasm_runtime_create_context_key(void (*dtor)(wasm_module_inst_t inst,
|
||||
void *ctx));
|
||||
WASM_RUNTIME_API_EXTERN void *wasm_runtime_create_context_key(
|
||||
void (*dtor)(wasm_module_inst_t inst, void *ctx));
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_destroy_context_key(void *key);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_context_key(void *key);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_context(wasm_module_inst_t inst, void *key, void *ctx);
|
||||
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_context(wasm_module_inst_t inst,
|
||||
void *key, void *ctx);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_context_spread(wasm_module_inst_t inst, void *key, void *ctx);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void *
|
||||
wasm_runtime_get_context(wasm_module_inst_t inst, void *key);
|
||||
WASM_RUNTIME_API_EXTERN void *wasm_runtime_get_context(wasm_module_inst_t inst,
|
||||
void *key);
|
||||
|
||||
/*
|
||||
* wasm_runtime_begin_blocking_op/wasm_runtime_end_blocking_op
|
||||
@@ -2419,9 +2371,8 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args);
|
||||
* @param body The body of the shared heap chain to be appended.
|
||||
* @return The new head of the shared heap chain. NULL if failed.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_shared_heap_t
|
||||
wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head,
|
||||
wasm_shared_heap_t body);
|
||||
WASM_RUNTIME_API_EXTERN wasm_shared_heap_t wasm_runtime_chain_shared_heaps(
|
||||
wasm_shared_heap_t head, wasm_shared_heap_t body);
|
||||
|
||||
/**
|
||||
* This function unchains the shared heaps from the given head. If
|
||||
@@ -2434,8 +2385,8 @@ wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head,
|
||||
* @return The new head of the shared heap chain. Or the last shared heap in the
|
||||
* chain if `entire_chain` is true.
|
||||
*/
|
||||
wasm_shared_heap_t
|
||||
wasm_runtime_unchain_shared_heaps(wasm_shared_heap_t head, bool entire_chain);
|
||||
wasm_shared_heap_t wasm_runtime_unchain_shared_heaps(wasm_shared_heap_t head,
|
||||
bool entire_chain);
|
||||
|
||||
/**
|
||||
* Reset shared heap chain. For each shared heap in the chain, if it is a
|
||||
@@ -2482,9 +2433,8 @@ wasm_runtime_detach_shared_heap(wasm_module_inst_t module_inst);
|
||||
* (when the wasm memory is 64-bit). Note that it is not an absolute address.
|
||||
* Return non-zero if success, zero if failed.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_runtime_shared_heap_malloc(wasm_module_inst_t module_inst, uint64_t size,
|
||||
void **p_native_addr);
|
||||
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_shared_heap_malloc(
|
||||
wasm_module_inst_t module_inst, uint64_t size, void **p_native_addr);
|
||||
|
||||
/**
|
||||
* Free the memory allocated from shared heap, or the non-preallocated shared
|
||||
|
||||
Reference in New Issue
Block a user