Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating binding for __wbindgen_object_drop_ref isn't optimized out #1498

Closed
alexcrichton opened this issue Apr 29, 2019 · 0 comments · Fixed by #1504
Closed

Generating binding for __wbindgen_object_drop_ref isn't optimized out #1498

alexcrichton opened this issue Apr 29, 2019 · 0 comments · Fixed by #1504

Comments

@alexcrichton
Copy link
Contributor

Currently on wasm-bindgen a bare file like:

#[wasm_bindgen]
pub fn foo() {}

will generate the JS:

import * as wasm from './add_bg';                               
                                                                
/**                                                             
* @returns {void}                                               
*/                                                              
export function foo() {                                         
    return wasm.foo();                                          
}                                                               
                                                                
const heap = new Array(32);                                     
                                                                
heap.fill(undefined);                                           
                                                                
heap.push(undefined, null, true, false);                        
                                                                
let heap_next = heap.length;                                    
                                                                
function dropObject(idx) {                                      
    if (idx < 36) return;                                       
    heap[idx] = heap_next;                                      
    heap_next = idx;                                            
}                                                               
                                                                
export function __wbindgen_object_drop_ref(i) { dropObject(i); }

but __wbindgen_object_drop_ref isn't referenced by the wasm file! Something in our passes likely needs to be reordered (aka generate bindings for __wbindgen_object_drop_ref after the gc pass), but we should understand what's happening before we do this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant