diff options
| author | Graydon Hoare <[email protected]> | 2010-12-20 11:41:22 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-12-20 11:41:32 -0800 |
| commit | 490da3564be081eb40a711e83ae05fe07d5c6d2c (patch) | |
| tree | 9c450215d0e387c2afa6f3af28a09f518fe7e100 /src | |
| parent | Trailing whitespace police. (diff) | |
| download | rust-490da3564be081eb40a711e83ae05fe07d5c6d2c.tar.xz rust-490da3564be081eb40a711e83ae05fe07d5c6d2c.zip | |
Use gvars for vtbls rather than returning const immediates.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/middle/trans.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index d4cd64bd..3388b100 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2355,7 +2355,13 @@ impure fn trans_vtbl(@crate_ctxt cx, &ast._obj ob) -> ValueRef { trans_fn(cx, m.node.meth, m.node.id, m.node.ann); methods += llfn; } - ret C_struct(methods); + auto vtbl = C_struct(methods); + auto gvar = llvm.LLVMAddGlobal(cx.llmod, + val_ty(vtbl), + _str.buf("_rust_vtbl" + "." + cx.path)); + llvm.LLVMSetInitializer(gvar, vtbl); + llvm.LLVMSetGlobalConstant(gvar, True); + ret gvar; } impure fn trans_obj(@crate_ctxt cx, &ast._obj ob, ast.def_id oid, |