mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 17:31:02 +00:00
solc-json-interface: do not unconditionally skip serialization of custom keys (#337)
The data structure can be used to build the JSON input for `resolc` too. In that case serializing of provided custom options should not be dismissed. Makes the memory settings struct more modular as a drive-by. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! The entry function.
|
||||
|
||||
use inkwell::types::BasicType;
|
||||
use revive_solc_json_interface::PolkaVMDefaultHeapMemorySize;
|
||||
|
||||
use crate::polkavm::context::address_space::AddressSpace;
|
||||
use crate::polkavm::context::function::runtime;
|
||||
@@ -38,9 +39,12 @@ impl Entry {
|
||||
context.xlen_type().const_zero(),
|
||||
);
|
||||
|
||||
let heap_memory_type = context
|
||||
.byte_type()
|
||||
.array_type(context.memory_config.heap_size);
|
||||
let heap_memory_type = context.byte_type().array_type(
|
||||
context
|
||||
.memory_config
|
||||
.heap_size
|
||||
.unwrap_or(PolkaVMDefaultHeapMemorySize),
|
||||
);
|
||||
context.set_global(
|
||||
crate::polkavm::GLOBAL_HEAP_MEMORY,
|
||||
heap_memory_type,
|
||||
|
||||
@@ -25,6 +25,8 @@ use inkwell::debug_info::AsDIScope;
|
||||
use inkwell::debug_info::DIScope;
|
||||
use inkwell::types::BasicType;
|
||||
use inkwell::values::BasicValue;
|
||||
use revive_solc_json_interface::PolkaVMDefaultHeapMemorySize;
|
||||
use revive_solc_json_interface::PolkaVMDefaultStackMemorySize;
|
||||
use revive_solc_json_interface::SolcStandardJsonInputSettingsPolkaVMMemory;
|
||||
|
||||
use crate::optimizer::settings::Settings as OptimizerSettings;
|
||||
@@ -233,7 +235,13 @@ where
|
||||
Self::set_data_layout(llvm, &module);
|
||||
Self::link_stdlib_module(llvm, &module);
|
||||
Self::link_polkavm_imports(llvm, &module);
|
||||
Self::set_polkavm_stack_size(llvm, &module, memory_config.stack_size);
|
||||
Self::set_polkavm_stack_size(
|
||||
llvm,
|
||||
&module,
|
||||
memory_config
|
||||
.stack_size
|
||||
.unwrap_or(PolkaVMDefaultStackMemorySize),
|
||||
);
|
||||
Self::set_module_flags(llvm, &module);
|
||||
|
||||
let intrinsics = Intrinsics::new(llvm, &module);
|
||||
@@ -1443,7 +1451,11 @@ where
|
||||
}
|
||||
|
||||
pub fn heap_size(&self) -> inkwell::values::IntValue<'ctx> {
|
||||
self.xlen_type()
|
||||
.const_int(self.memory_config.heap_size as u64, false)
|
||||
self.xlen_type().const_int(
|
||||
self.memory_config
|
||||
.heap_size
|
||||
.unwrap_or(PolkaVMDefaultHeapMemorySize) as u64,
|
||||
false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user