Angelscript on Raspberry Pi

Started by
130 comments, last by WitchLord 11 years, 2 months ago
It does.

How many tests are still failing now?

I still haven't had the chance to log in to your environment to test it on my own.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Well, the string test that was failing now passes, but when performing a general pass I´ve found that I´ve managed to break a test that previously passed (not related to the r11 thing) so I´m trying to fix that before continuing fixing the other failing tests.

EDIT: False alarm, everything that was working before is working now - I must have messed something when testing.
The test that are still failing are:

TestRegisterType
TestVector3
TestStdString
It's progressing well then. I would think it's just a few minor adjustments left to make.

Where in the tests are the failures happening?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Well, the test_registertype is failing in the TestIrrTypes() function. The dim2f constructor is called, receives the values with no problem and creates an object that when inspected seems to be ok. But then when the script calls operator+ for the total_res = video_res + video_res; part, the "other" object is ok, but our own members (this->Width and this->Height) have wrong values.

The other tests I haven´t checked yet. I´m facing one bug at a time.
The operator+ method should most likely be called like this:

this pointer in r0
other pointer in r1
return value will be placed in s0, s1

It might be a good idea to dissembly the operator+ method to confirm that this is actually what the method does.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Well, operator+ uses the armFuncR0R1 function, and that´s one of the functions I haven´t changed, so that might be the problem.
That would mean that AngelScript thinks the dim2f is supposed to be returned in memory. I'm not certain this is true.

If it was I think it would have worked as the function is not taking any floats.

I think it is necessary to disassemble the operator. So we can be certain what the function actually looks like.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Long thread so this might have been mentioned already, but I wanted to make it explicit that passing floating point values in floating point registers (aka hard float) isn't a Raspberry Pi specific thing, and you can in fact get a soft-float (floating point values in int registers) Raspberry Pi OS from http://www.raspberrypi.org/downloads

If you make sure to never pass any floats between your program and pre compiled lib you could also (in theory[sup]tm[/sup]) use the hard float call convention in your programs on Android/iPhone/WinCE by providing the appropriate float abi flags to the compilers.
Yeah, the thread started out as a Raspberry Pi specific thing, but we soon saw that it was a generic Linux/ARM system.

It's interesting to see that there are multiple variants though. Do you have any idea if there is any macro defined that will allow me to differentiate between the use of soft-floats and hard-floats in as_config.h?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Sorry for the delay. Here are the disassemblies for operator+:
Code:
#include <iostream>
#include <string>
typedef unsigned long asDWORD;
template <class T>
class dimension2d
{
public:
dimension2d() : Width(0), Height(0) {}
dimension2d(const T& width, const T& height) :
Width(width), Height(height) {}
template <class U>
explicit dimension2d(const dimension2d<U>& other) :
Width((T)other.Width), Height((T)other.Height) { }
template <class U>
dimension2d<T>& operator=(const dimension2d<U>& other)
{
Width = (T) other.Width;
Height = (T) other.Height;
return *this;
}
dimension2d<T> operator+(const dimension2d<T>& other) const
{
return dimension2d<T>(Width+other.Width, Height+other.Height);
}
T Width;
T Height;
};
int main()
{
dimension2d<float> video_res(800,600);
dimension2d<float> total_res;
total_res = video_res + video_res;
std::cout << "X: " << total_res.Width << ".\n";
std::cout << "Y: " << total_res.Height << ".\n";
return 0;
}

main:
0x8620 push {r11, lr}
0x8624 add r11, sp, #4
0x8628 sub sp, sp, #32
0x862c ldr r3, [pc, #212] ; 0x8708 <main()+232>
0x8630 str r3, [r11, #-12]
0x8634 ldr r3, [pc, #208] ; 0x870c <main()+236>
0x8638 str r3, [r11, #-8]
0x863c sub r1, r11, #20
0x8640 sub r2, r11, #12
0x8644 sub r3, r11, #8
0x8648 mov r0, r1
0x864c mov r1, r2
0x8650 mov r2, r3
0x8654 bl 0x87a0 <dimension2d<float>::dimension2d(float const&, float const&)>
0x8658 sub r3, r11, #28
0x865c mov r0, r3
0x8660 bl 0x87ec <dimension2d<float>::dimension2d()>
0x8664 sub r2, r11, #20
0x8668 sub r3, r11, #20
0x866c mov r0, r2
0x8670 mov r1, r3
0x8674 bl 0x882c <dimension2d<float>::operator+(dimension2d<float> const&) const>
0x8678 vmov.f32 s14, s0
0x867c vmov.f32 s15, s1
0x8680 vstr s14, [r11, #-36] ; 0xffffffdc
0x8684 vstr s15, [r11, #-32] ; 0xffffffe0
0x8688 sub r3, r11, #28
0x868c sub r2, r11, #36 ; 0x24
0x8690 ldm r2, {r0, r1}
0x8694 stm r3, {r0, r1}
0x8698 ldr r0, [pc, #112] ; 0x8710 <main()+240>
0x869c ldr r1, [pc, #112] ; 0x8714 <main()+244>
0x86a0 bl 0x8550 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
0x86a4 mov r3, r0
0x86a8 vldr s15, [r11, #-28] ; 0xffffffe4
0x86ac mov r0, r3
0x86b0 vmov.f32 s0, s15
0x86b4 bl 0x8568 <std::ostream::operator<<(float)>
0x86b8 mov r3, r0
0x86bc mov r0, r3
0x86c0 ldr r1, [pc, #80] ; 0x8718 <main()+248>
0x86c4 bl 0x8550 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
0x86c8 ldr r0, [pc, #64] ; 0x8710 <main()+240>
0x86cc ldr r1, [pc, #72] ; 0x871c <main()+252>
0x86d0 bl 0x8550 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
0x86d4 mov r3, r0
0x86d8 vldr s15, [r11, #-24] ; 0xffffffe8
0x86dc mov r0, r3
0x86e0 vmov.f32 s0, s15
0x86e4 bl 0x8568 <std::ostream::operator<<(float)>
0x86e8 mov r3, r0
0x86ec mov r0, r3
0x86f0 ldr r1, [pc, #32] ; 0x8718 <main()+248>
0x86f4 bl 0x8550 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)>
0x86f8 mov r3, #0
0x86fc mov r0, r3
0x8700 sub sp, r11, #4
0x8704 pop {r11, pc}
0x8708 strbmi r0, [r8], #-0
0x870c ldrmi r0, [r6], #-0
0x8710 ; <UNDEFINED> instruction: 0x00010ab0
0x8714 andeq r8, r0, r12, lsr #18
0x8718 andeq r8, r0, r0, lsr r9
0x871c andeq r8, r0, r4, lsr r9

operator+:

0x882c push {r11, lr}
0x8830 add r11, sp, #4
0x8834 sub sp, sp, #40 ; 0x28
0x8838 str r0, [r11, #-32]
0x883c str r1, [r11, #-36] ; 0x24
0x8840 ldr r3, [r11, #-32]
0x8844 vldr s14, [r3]
0x8848 ldr r3, [r11, #-36] ; 0x24
0x884c vldr s15, [r3]
0x8850 vadd.f32 s15, s14, s15
0x8854 vstr s15, [r11, #-12]
0x8858 ldr r3, [r11, #-32]
0x885c vldr s14, [r3, #4]
0x8860 ldr r3, [r11, #-36] ; 0x24
0x8864 vldr s15, [r3, #4]
0x8868 vadd.f32 s15, s14, s15
0x886c vstr s15, [r11, #-8]
0x8870 sub r1, r11, #20
0x8874 sub r2, r11, #12
0x8878 sub r3, r11, #8
0x887c mov r0, r1
0x8880 mov r1, r2
0x8884 mov r2, r3
0x8888 bl 0x87a0 <dimension2d<float>::dimension2d(float const&, float const&)>
0x888c sub r3, r11, #28
0x8890 sub r2, r11, #20
0x8894 ldm r2, {r0, r1}
0x8898 stm r3, {r0, r1}
0x889c ldr r2, [r11, #-28]
0x88a0 ldr r3, [r11, #-24]
0x88a4 vmov s14, r2
0x88a8 vmov s15, r3
0x88ac vmov.f32 s0, s14
0x88b0 vmov.f32 s1, s15
0x88b4 sub sp, r11, #4
0x88b8 pop {r11, pc}

Can you see where the problem might be?

This topic is closed to new replies.

Advertisement