forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cellvm, a java interpreter for spu. Need help compiling it.

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
boxbuilder



Joined: 17 Nov 2007
Posts: 15

PostPosted: Wed Oct 29, 2008 9:20 am    Post subject: Cellvm, a java interpreter for spu. Need help compiling it. Reply with quote

Stumbled across cellvm, a jamvm port for cell spus. It uses 1 spu per java software thread. Google: cellvm, some phd papers have been written about it. The copy I got had binaries, and source. Without libspe2 it complains when I try to run it, with libspe2-2.0.0 or 2.0.1, it starts, and says "Bus error" With newer libspe2, it hangs (though spu-top shows 1 spu thread.)

It appears that it was written for XLC. EDIT: It was compiled with gcc (read config.log)

When I try to compile it with spu-gcc, I get

Code:

[root@ps3 spu]# make
/usr/bin/ccache /usr/bin/spu-gcc     -I. -I/opt/cell/sdk/usr/include -I/opt/cell/sdk/usr/spu/include -I/usr/spu/include   -W -Wall -Winline -Wno-main  -I.  -I/usr/spu/include -I/opt/cell/sdk/usr/spu/include  -O3 -c spu_direct.c
In file included from spu_utils.h:6,
                 from spu_direct.c:26:
spu_direct.h:19: error: expected specifier-qualifier-list before 'qword'
spu_direct.h:32: error: expected specifier-qualifier-list before 'qword'
spu_direct.c: In function 'SPU_PrepareCode':
spu_direct.c:47: warning: assignment makes integer from pointer without a cast
spu_direct.c: In function 'SPU_ReInitInterpreter':
spu_direct.c:69: error: 'SPU_Frame' has no member named 'ostack'
spu_direct.c:69: error: 'SPU_Frame' has no member named 'ostack'
spu_direct.c:69: error: 'qword' undeclared (first use in this function)
spu_direct.c:69: error: (Each undeclared identifier is reported only once
spu_direct.c:69: error: for each function it appears in.)
spu_direct.c:69: error: expected expression before ')' token
spu_direct.c:69: error: expected expression before ')' token
spu_direct.c:69: error: 'new_ostack' undeclared (first use in this function)
spu_direct.c:69: error: expected expression before ')' token
spu_direct.c:69: error: 'SPU_Frame' has no member named 'lvars'
spu_direct.c:69: error: expected expression before ')' token
spu_direct.c:69: error: 'SPU_Frame' has no member named 'ostack'
spu_direct.c:88: error: 'SPU_Frame' has no member named 'lvars'
spu_direct.c:88: warning: implicit declaration of function 'si_from_uint'
make: *** [spu_direct.o] Error 1
[root@ps3 spu]#


The code in spu_direct.h reads as follows:
Code:

[root@ps3 spu]# cat spu_direct.h
/* Macros for the direct threaded interpreter uncached */
#ifndef __spu_interp_direct_h__
#define __spu_interp_direct_h__

#include "spu_config.h"

/* -------------------- TYPEDEFS AND STRUCTS -------------------- */

typedef struct spu_frame {
    int dummy[8]; /* needed for correct size of structure for DMA transfer */
    int code_size;
    int access_flags;
    void* code_addr; /* the first two entries might be overwritten during return processing, don't use in methodReturn */
    int last_pc;
    int max_stack;
    struct spu_frame* prev;
    void* mb_addr;
    unsigned int* local_code_addr;
    qword* ostack;
    qword* lvars;
    int dummy1[2];
} SPU_Frame;

there's more, but I think this is the interesting part...

It seems to be referring to a file called spu_frame.h which reads as follows
Code:

[root@ps3 spu]# cat spu_frame.h
#ifndef __spu_frame_h__
#define __spu_frame_h__

#define CREATE_BOTTOM_FRAME(mb, top, stack) {                                         \
    mb = (MethodBlock*)stack;                                                         \
    top = (SPU_Frame*)(mb + 1);                                                       \
    mb->max_stack = 0;                                                                \
    top->mb_addr = mb;                                                                \
    top->ostack = (qword*)(top + 1);                                                  \
    top->prev = 0;                                                                    \
}

#define CREATE_TOP_FRAME(last, local_frame, max_locals, max_s, s_end, startup) {      \
    SPU_Frame* dummy = (SPU_Frame*)(last->ostack + max_s);                            \
    dummy->mb_addr = 0;                                                               \
    dummy->prev = last;                                                               \
    dummy->ostack = (qword*)(dummy + 1);                                              \
    local_frame = (SPU_Frame*)(((qword*)(dummy + 1)) + max_locals);                   \
    qword* new_ostack = (qword*)(local_frame + 1);                                    \
                                                                                      \
    if((char*)(new_ostack + max_s) > s_end)  {                                        \
        fprintf(stderr,"Fatal Stack OverFlow!\n"); }                                  \
                                                                                      \
    local_frame->lvars = (qword*)(dummy + 1);                                         \
    local_frame->ostack = new_ostack;                                                 \
    local_frame->mb_addr = startup.mb_addr;                                           \
    local_frame->access_flags = (startup.access_flags);                               \
    local_frame->code_addr = startup.code_addr;                                       \
    local_frame->code_size = startup.ins_len;                                         \
    local_frame->local_code_addr = NULL;                                              \
    local_frame->max_stack = (startup.max_stack);                                     \
    local_frame->prev = dummy;                                                        \
}

#endif /* __spu_frame_h__ */

[root@ps3 spu]#



Maybe somebody can see what is wrong and what has to change. Maybe someone will become interested enough to want to work on it. If you can't find a copy of the program and want one, post a comment, I'll see what I can do.
Back to top
View user's profile Send private message
ouasse



Joined: 30 Jul 2007
Posts: 90
Location: Paris, France

PostPosted: Tue Nov 04, 2008 7:34 am    Post subject: Reply with quote

the qword type seems not to have been defined.

adding a
Code:
#include <spu_intrinsics.h>
line should do all the required definitions.
Back to top
View user's profile Send private message
Nano



Joined: 06 Nov 2008
Posts: 6

PostPosted: Thu Nov 06, 2008 10:19 pm    Post subject: Re: Cellvm, a java interpreter for spu. Need help compiling Reply with quote

boxbuilder wrote:
Stumbled across cellvm, a jamvm port for cell spus. It uses 1 spu per java software thread. Google: cellvm, .....


Could you please tell me where you found the download? I simply cannot find a link nor a working cvs.

Thx a lot!
Back to top
View user's profile Send private message
caviar44



Joined: 28 Jan 2008
Posts: 7

PostPosted: Mon Nov 10, 2008 6:25 pm    Post subject: Reply with quote

hi Nano,

here is a link below

http://packages.ubuntu.com/fr/source/intrepid/jamvm


I do not know if it is the last release

regards

cav
Back to top
View user's profile Send private message
Nano



Joined: 06 Nov 2008
Posts: 6

PostPosted: Thu Nov 27, 2008 2:59 am    Post subject: Reply with quote

caviar44 wrote:
hi Nano,

here is a link below

http://packages.ubuntu.com/fr/source/intrepid/jamvm


I do not know if it is the last release

regards

cav


Thx, but I meant the cellvm source. Any idea where to get it?
regards,
Marc
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Nov 27, 2008 10:41 am    Post subject: Reply with quote

Nano wrote:
caviar44 wrote:
hi Nano,

here is a link below

http://packages.ubuntu.com/fr/source/intrepid/jamvm


I do not know if it is the last release

regards

cav


Thx, but I meant the cellvm source. Any idea where to get it?
regards,
Marc


It's the link right there in the post. CellVM is just the name used for the final result when you compile JamVM targeting the Cell instead of some other CPU.
Back to top
View user's profile Send private message AIM Address
Nano



Joined: 06 Nov 2008
Posts: 6

PostPosted: Tue Dec 09, 2008 9:32 pm    Post subject: Reply with quote

J.F. wrote:
Nano wrote:
caviar44 wrote:
hi Nano,

here is a link below

http://packages.ubuntu.com/fr/source/intrepid/jamvm


I do not know if it is the last release

regards

cav


Thx, but I meant the cellvm source. Any idea where to get it?
regards,
Marc


It's the link right there in the post. CellVM is just the name used for the final result when you compile JamVM targeting the Cell instead of some other CPU.


Thx... and do you by chance know how to use 'configure' to target the cell?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Dec 10, 2008 8:44 am    Post subject: Reply with quote

Well, you're doing it for the SPU, so that should be --target="spu".
Back to top
View user's profile Send private message AIM Address
Nano



Joined: 06 Nov 2008
Posts: 6

PostPosted: Wed Dec 10, 2008 7:36 pm    Post subject: Reply with quote

J.F. wrote:
Well, you're doing it for the SPU, so that should be --target="spu".


Ok, I did a './configure --prefix=/usr/local/jamvm-cell --target=spu' and the build suceeded.

How do I verify now that it has ben built for the spu?

ldd jamvm shows:
linux-vdso32.so.1 => (0x00100000)
libz.so.1 => /lib/libz.so.1 (0x0fee0000)
libdl.so.2 => /lib/libdl.so.2 (0x0ff80000)
libm.so.6 => /lib/libm.so.6 (0x0f0c0000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0ff40000)
libc.so.6 => /lib/libc.so.6 (0x0f1a0000)
/lib/ld.so.1 (0x0ffb0000)

I would expect some spe libs to be linked in also?

Also:
jamvm: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

This looks lika a usual ppc build, no?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Dec 11, 2008 9:00 am    Post subject: Reply with quote

Hmm, you ARE using a toolchain that supports the SPU, right? Also check the makefiles after configuring... maybe it didn't correctly detect/set the SPU version of gcc. If you're using a plain copy of gcc from the PPC linux, it probably is PPC only. I think the Cell SDK has the toolchain for Cell (and hence SPU) compiling as part of it. This is where you go into the SDK and docs and read up on how to compile for the SPU. :)
Back to top
View user's profile Send private message AIM Address
Nano



Joined: 06 Nov 2008
Posts: 6

PostPosted: Thu Dec 11, 2008 9:24 am    Post subject: Reply with quote

J.F. wrote:
Hmm, you ARE using a toolchain that supports the SPU, right? Also check the makefiles after configuring... maybe it didn't correctly detect/set the SPU version of gcc. If you're using a plain copy of gcc from the PPC linux, it probably is PPC only. I think the Cell SDK has the toolchain for Cell (and hence SPU) compiling as part of it. This is where you go into the SDK and docs and read up on how to compile for the SPU. :)


You're right.. I fogot to set CC to spu-gcc.

Now I get the following:
./configure --prefix=/usr/local/jamvm-cell --target=spu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... powerpc64-unknown-linux-gnu
checking host system type... powerpc64-unknown-linux-gnu
checking for style of include used by make... GNU
checking for gcc... spu-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether spu-gcc accepts -g... yes
checking for spu-gcc option to accept ISO C89... none needed
checking dependency style of spu-gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by spu-gcc... /usr/spu/bin/ld
checking if the linker (/usr/spu/bin/ld) is GNU ld... yes
checking for /usr/spu/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking how to run the C preprocessor... spu-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from spu-gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if spu-gcc supports -fno-rtti -fno-exceptions... no
checking for spu-gcc option to produce PIC... -fPIC
checking if spu-gcc PIC flag -fPIC works... yes
checking if spu-gcc static flag -static works... yes
checking if spu-gcc supports -c -o file.o... yes
checking whether the spu-gcc linker (/usr/spu/bin/ld -m elf32ppclinux) supports shared libraries... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/spu/bin/ld -m elf32ppclinux
checking if the linker (/usr/spu/bin/ld -m elf32ppclinux) is GNU ld... no
checking whether the g++ linker (/usr/spu/bin/ld -m elf32ppclinux) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/spu/bin/ld -m elf32ppclinux) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for gfortran option to produce PIC... -fPIC
checking if gfortran PIC flag -fPIC works... yes
checking if gfortran static flag -static works... yes
checking if gfortran supports -c -o file.o... yes
checking whether the gfortran linker (/usr/spu/bin/ld -m elf32ppclinux) supports shared libraries... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
checking for gcc... (cached) spu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether spu-gcc accepts -g... (cached) yes
checking for spu-gcc option to accept ISO C89... (cached) none needed
checking dependency style of spu-gcc... (cached) gcc3
checking dependency style of spu-gcc... gcc3
checking for ecj... no
checking for jikes... no
checking for gcj... no
checking for javac... no
checking for pthread_self in -lpthread... no
configure: error: libpthread is missing
[root@ps3 jamvm-1.5.1]#

Hmm.. that's becoming too difficult for me as I'm a Java developer. Is there a binary aound somewhere maybe?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group