diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-03-20 16:32:25 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-03-20 16:44:56 -0700 |
| commit | 855c99ea758186096a68a8c13edeb0d89105a410 (patch) | |
| tree | 7bfdc8876d35a42a9f4bfadbce36c2d5ed441419 /src/rt/rust_builtin.cpp | |
| parent | f5087aa64b3f8263b61431fbfc323fcaa356bc5b (diff) | |
| download | rust-855c99ea758186096a68a8c13edeb0d89105a410.tar.gz rust-855c99ea758186096a68a8c13edeb0d89105a410.zip | |
Some tests for passing and returning structures by value on x64. Close #1402. Close #1970.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index b7abcdd9c26..ee6db7dcf86 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -200,6 +200,43 @@ rand_free(randctx *rctx) { task->free(rctx); } + +/* Debug helpers strictly to verify ABI conformance. + * + * FIXME: move these into a testcase when the testsuite + * understands how to have explicit C files included. + */ + +struct quad { + uint64_t a; + uint64_t b; + uint64_t c; + uint64_t d; +}; + +struct floats { + double a; + uint8_t b; + double c; +}; + +extern "C" quad +debug_abi_1(quad q) { + quad qq = { q.c + 1, + q.d - 1, + q.a + 1, + q.b - 1 }; + return qq; +} + +extern "C" floats +debug_abi_2(floats f) { + floats ff = { f.c + 1.0, + 0xff, + f.a - 1.0 }; + return ff; +} + /* Debug builtins for std::dbg. */ static void |
