Mercurial > pub > dyncall > dyncall
comparison dyncall/dyncall_callvm_arm32_arm.c @ 17:17b10cc8ce8b
- fix for arm on some platforms (e.g. freebsd/arm32, nintendo ds) to keep compiler from overwriting return values in caller-cleanup code
author | cslag |
---|---|
date | Sat, 01 Aug 2015 19:13:21 +0200 |
parents | 3e629dc19168 |
children | 523c45dfa8fb |
comparison
equal
deleted
inserted
replaced
16:29f6ef6b170e | 17:17b10cc8ce8b |
---|---|
147 | 147 |
148 /* Call. */ | 148 /* Call. */ |
149 void dc_callvm_call_arm32_arm(DCCallVM* in_self, DCpointer target) | 149 void dc_callvm_call_arm32_arm(DCCallVM* in_self, DCpointer target) |
150 { | 150 { |
151 DCCallVM_arm32_arm* self = (DCCallVM_arm32_arm*)in_self; | 151 DCCallVM_arm32_arm* self = (DCCallVM_arm32_arm*)in_self; |
152 dcCall_arm32_arm(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead)); | 152 // This cast is needed in order for the cleanup code in the caller (this very function) to not |
153 // overwrite and use r0 and r1, as we want to pass them back. On some platforms (FreeBSD/arm, Nintendo DS | |
154 // the compiler generates cleanup code that writes to those registers by assuming dcCall_arm32_arm didn't | |
155 // use them. | |
156 ((DClonglong(*)(DCpointer, DCpointer, DCsize))&dcCall_arm32_arm)(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead)); | |
153 } | 157 } |
154 | 158 |
155 | 159 |
156 DCCallVM_vt gVT_arm32_arm = | 160 DCCallVM_vt gVT_arm32_arm = |
157 { | 161 { |