implement another bump allocator for WAMR's Alloc_With_Allocator
This commit is contained in:
@ -54,7 +54,7 @@ my @aot_section_variants = (
|
||||
"Place AOT array in .text.wamr_aot",
|
||||
"Let the linker decide where the AOT array is located",
|
||||
);
|
||||
my $selected_aot_variant =
|
||||
my ($selected_aot_variant) =
|
||||
TUI::select_from_list( "Select WAMR Array.Text Variant",
|
||||
0, @aot_section_variants );
|
||||
die "No AOT section variant selected" unless $selected_aot_variant;
|
||||
@ -68,7 +68,7 @@ my @mmap_variants = (
|
||||
"Place mmap_space in .text.wamr_mmap",
|
||||
"Let the linker decide where mmap_space is located"
|
||||
);
|
||||
my $selected_mmap_variant =
|
||||
my ($selected_mmap_variant) =
|
||||
TUI::select_from_list( "Select WAMR Mmap.Text Variant", 0, @mmap_variants );
|
||||
die "No variant selected" unless $selected_mmap_variant;
|
||||
local $ENV{WAMR_USE_MMAP_IN_TEXT} =
|
||||
@ -81,18 +81,18 @@ my @allocator_variants = (
|
||||
"Pool allocator (Alloc_With_Pool)",
|
||||
"Allocator with usage (Alloc_With_Allocator)",
|
||||
);
|
||||
my $selected_allocator_variant =
|
||||
my ($selected_allocator_variant) =
|
||||
TUI::select_from_list( "Select WAMR Allocator Variant",
|
||||
0, @allocator_variants );
|
||||
die "No allocator variant selected" unless $selected_allocator_variant;
|
||||
local $ENV{WAMR_USE_ALLOCATOR} =
|
||||
( $selected_allocator_variant eq $allocator_variants[0] )
|
||||
? "true"
|
||||
: "false";
|
||||
? "false"
|
||||
: "true";
|
||||
|
||||
# Select XIP variant
|
||||
my @xip_variants = ( "Compile AOT with --xip", "Compile AOT without --xip" );
|
||||
my $selected_xip_variant =
|
||||
my ($selected_xip_variant) =
|
||||
TUI::select_from_list( "Select WAMRC XIP Variant", 0, @xip_variants );
|
||||
die "No XIP variant selected" unless $selected_xip_variant;
|
||||
local $ENV{WAMR_USE_XIP} =
|
||||
|
||||
@ -71,6 +71,11 @@ my $cmake_c_flags = join( ' ', @variant_cflags );
|
||||
my @variant_cmake_flags;
|
||||
push @variant_cmake_flags, '-DWAMR_BUILD_ALLOC_WITH_USAGE=1' if $use_allocator;
|
||||
|
||||
# Defines forwarded to the host compilation so wasm_host.c sees the same
|
||||
# WASM_MEM_ALLOC_WITH_USAGE value as libiwasm.a was built with.
|
||||
my @host_variant_cflags;
|
||||
push @host_variant_cflags, '-DWASM_MEM_ALLOC_WITH_USAGE=1' if $use_allocator;
|
||||
|
||||
# ========================================================================================= #
|
||||
# Compiler / linker flags
|
||||
# ========================================================================================= #
|
||||
@ -260,10 +265,7 @@ sub make_interp_array {
|
||||
|
||||
sub prepare_wasm_host {
|
||||
my ( $module, $bd, $mode ) = @_;
|
||||
my $template =
|
||||
$use_allocator
|
||||
? 'targets/wasm-host/wasm_host_allocator.c'
|
||||
: 'targets/wasm-host/wasm_host_pool.c';
|
||||
my $template = 'targets/wasm-host/wasm_host.c';
|
||||
|
||||
my $mod_c = ( $module =~ s/-/_/gr );
|
||||
my ( $array_file, $array_sym, $len_sym ) =
|
||||
@ -290,29 +292,26 @@ sub compile_wasm_host {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
if ( $target eq 'fail' ) {
|
||||
Util::run(
|
||||
$cross_cc, '-I./targets/wasm-host',
|
||||
@cross_cflags, @wamr_inc_baremetal,
|
||||
'-DTARGET_FAIL', '-c',
|
||||
"$bd/module_host.c", '-o',
|
||||
"$bd/system.o"
|
||||
$cross_cc, '-I./targets/wasm-host',
|
||||
@cross_cflags, @host_variant_cflags,
|
||||
@wamr_inc_baremetal, '-DTARGET_FAIL',
|
||||
'-c', "$bd/module_host.c", '-o', "$bd/system.o"
|
||||
);
|
||||
}
|
||||
elsif ( $target eq 'linux' ) {
|
||||
Util::run(
|
||||
$linux_cc, '-I./targets/wasm-host',
|
||||
@linux_cflags, @wamr_inc_linux,
|
||||
'-DTARGET_LINUX', '-c',
|
||||
"$bd/module_host.c", '-o',
|
||||
"$bd/system.o"
|
||||
$linux_cc, '-I./targets/wasm-host',
|
||||
@linux_cflags, @host_variant_cflags,
|
||||
@wamr_inc_linux, '-DTARGET_LINUX',
|
||||
'-c', "$bd/module_host.c", '-o', "$bd/system.o"
|
||||
);
|
||||
}
|
||||
elsif ( $target eq 'linux-baremetal' ) {
|
||||
Util::run(
|
||||
$cross_cc, '-I./targets/wasm-host',
|
||||
@linux_baremetal_cflags, @wamr_inc_baremetal,
|
||||
'-DTARGET_LINUX_BAREMETAL', '-c',
|
||||
"$bd/module_host.c", '-o',
|
||||
"$bd/system.o"
|
||||
$cross_cc, '-I./targets/wasm-host',
|
||||
@linux_baremetal_cflags, @host_variant_cflags,
|
||||
@wamr_inc_baremetal, '-DTARGET_LINUX_BAREMETAL',
|
||||
'-c', "$bd/module_host.c", '-o', "$bd/system.o"
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user