mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
wasm backend struggles
This commit is contained in:
parent
9c85fb90d3
commit
51f3752c94
7 changed files with 262 additions and 35 deletions
|
@ -1593,17 +1593,22 @@ trait Backend<'a> {
|
|||
self.build_ptr_cast(sym, &args[0])
|
||||
}
|
||||
LowLevel::PtrStore => {
|
||||
let element_layout = match self.interner().get_repr(*ret_layout) {
|
||||
LayoutRepr::Boxed(boxed) => boxed,
|
||||
let element_layout = match self.interner().get_repr(arg_layouts[0]) {
|
||||
LayoutRepr::Ptr(inner) => inner,
|
||||
LayoutRepr::Boxed(inner) => inner,
|
||||
_ => unreachable!("cannot write to {:?}", self.interner().dbg(*ret_layout)),
|
||||
};
|
||||
|
||||
self.build_ptr_write(*sym, args[0], args[1], element_layout);
|
||||
self.build_ptr_store(*sym, args[0], args[1], element_layout);
|
||||
}
|
||||
LowLevel::PtrLoad => {
|
||||
//
|
||||
todo!()
|
||||
self.build_ptr_load(*sym, args[0], *ret_layout);
|
||||
}
|
||||
|
||||
LowLevel::PtrToStackValue => {
|
||||
self.build_ptr_to_stack_value(*sym, args[0], arg_layouts[0]);
|
||||
}
|
||||
|
||||
LowLevel::RefCountDecRcPtr => self.build_fn_call(
|
||||
sym,
|
||||
bitcode::UTILS_DECREF_RC_PTR.to_string(),
|
||||
|
@ -2232,7 +2237,7 @@ trait Backend<'a> {
|
|||
/// build_refcount_getptr loads the pointer to the reference count of src into dst.
|
||||
fn build_ptr_cast(&mut self, dst: &Symbol, src: &Symbol);
|
||||
|
||||
fn build_ptr_write(
|
||||
fn build_ptr_store(
|
||||
&mut self,
|
||||
sym: Symbol,
|
||||
ptr: Symbol,
|
||||
|
@ -2240,6 +2245,15 @@ trait Backend<'a> {
|
|||
element_layout: InLayout<'a>,
|
||||
);
|
||||
|
||||
fn build_ptr_load(&mut self, sym: Symbol, ptr: Symbol, element_layout: InLayout<'a>);
|
||||
|
||||
fn build_ptr_to_stack_value(
|
||||
&mut self,
|
||||
sym: Symbol,
|
||||
value: Symbol,
|
||||
element_layout: InLayout<'a>,
|
||||
);
|
||||
|
||||
/// literal_map gets the map from symbol to literal and layout, used for lazy loading and literal folding.
|
||||
fn literal_map(&mut self) -> &mut MutMap<Symbol, (*const Literal<'a>, *const InLayout<'a>)>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue