Alexandre,
I tried to apply the patch to V8 r3220 and compile the code, but ran into
some issues mainly due to compiling in a 64-bit linux.. I think the changes
to the SConstruct file could be streamlined a bit so that you can get rid of
the "pseudo architecture" mips-simu. I have added some comments on the code
review site, and there is a patch below which can be applied to a fresh
SConstruct from r3220.
With this patch I can compile some of the code using
scons simulator=mips
The first error is:
g++ -o obj/release/mips/simulator-mips.o -c -Wall -Werror -W
-Wno-unused-parameter -Wnon-virtual-dtor -pedantic -O3 -fomit-frame-pointer
-fdata-sections -ffunction-sections -ansi -m32 -fno-rtti -fno-exceptions
-fvisibility=hidden -DV8_TARGET_ARCH_MIPS -DENABLE_DEBUGGER_SUPPORT
-DV8_NATIVE_REGEXP -DENABLE_LOGGING_AND_PROFILING
-I/home/sgjesse/prj/v8/mips/src
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc
cc1plus: warnings being treated as errors
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc: In member function
'int32_t assembler::mips::Simulator::get_CregisterHI(int) const':
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc:525: warning:
dereferencing type-punned pointer will break strict-aliasing rules
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc: In member function
'void
assembler::mips::Simulator::DecodeType1(assembler::mips::Instruction*)':
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc:961: warning:
dereferencing type-punned pointer will break strict-aliasing rules
/home/sgjesse/prj/v8/mips/src/mips/simulator-mips.cc:965: warning:
dereferencing type-punned pointer will break strict-aliasing rules
scons: *** [obj/release/mips/simulator-mips.o] Error 1
scons: building terminated because of errors.
The code there looks quite as work in progress and from your last message
you are working on the simulator, so I did not further into that. One thing
to note is that you should not use C-style casts, but only the C++-style
casts reinterpret_cast, static_cast, etc.
I am using gcc 4.2.4.
Regards,
Søren
Index: ../SConstruct
===================================================================
--- ../SConstruct (revision 3220)
+++ ../SConstruct (working copy)
@@ -173,6 +173,17 @@
'CCFLAGS': ['-m32'],
'LINKFLAGS': ['-m32']
},
+ 'arch:mips': {
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
+ 'simulator:none': {
+ 'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2',
'-fno-inline'],
+ 'LDFLAGS': ['-EL']
+ }
+ },
+ 'simulator:mips': {
+ 'CCFLAGS': ['-m32'],
+ 'LINKFLAGS': ['-m32']
+ },
'arch:x64': {
'CPPDEFINES': ['V8_TARGET_ARCH_X64'],
'CCFLAGS': ['-m64'],
@@ -281,6 +292,9 @@
# used by the arm simulator.
'WARNINGFLAGS': ['/wd4996']
},
+ 'arch:mips': {
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
+ },
'disassembler:on': {
'CPPDEFINES': ['ENABLE_DISASSEMBLER']
}
@@ -423,10 +437,22 @@
'CCFLAGS': ['-m64'],
'LINKFLAGS': ['-m64']
},
+ 'arch:mips': {
+ 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'],
+ 'simulator:none': {
+ 'CCFLAGS': ['-EL', '-mips32r2', '-Wa,-mips32r2',
'-fno-inline'],
+ 'LINKFLAGS': ['-EL'],
+ 'LDFLAGS': ['-EL']
+ }
+ },
'simulator:arm': {
'CCFLAGS': ['-m32'],
'LINKFLAGS': ['-m32']
},
+ 'simulator:mips': {
+ 'CCFLAGS': ['-m32'],
+ 'LINKFLAGS': ['-m32']
+ },
'mode:release': {
'CCFLAGS': ['-O2']
},
@@ -560,7 +586,7 @@
'help': 'the os to build for (' + OS_GUESS + ')'
},
'arch': {
- 'values':['arm', 'ia32', 'x64'],
+ 'values':['arm', 'ia32', 'x64', 'mips'],
'default': ARCH_GUESS,
'help': 'the architecture to build for (' + ARCH_GUESS + ')'
},
@@ -610,7 +636,7 @@
'help': 'use Microsoft Visual C++ link-time code generation'
},
'simulator': {
- 'values': ['arm', 'none'],
+ 'values': ['arm', 'mips', 'none'],
'default': 'none',
'help': 'build with simulator'
},
On Wed, Jan 20, 2010 at 01:05, Alexandre Rames <[email protected]>wrote:
> Hi,
>
> I answer quickly before I get back working on all this.
>
> Please don't look too much at the MIPS code right now, I'll soon give
> you a version correcting bugs and issues, and with the debugger which
> should be quite useful.
>
> About splitting it in smaller pieces, how do you suggest we do it? I
> think we can remove the macro-assembler part, but the rest does with
> the assembler, disassembler, or simulator.
>
> I've given the contributor license to my boss. It should be sent quite
> soon.
>
> Regards,
>
> Alexandre
>
>
> On Jan 19, 3:08 pm, Søren Gjesse <[email protected]> wrote:
> > Thank you for doing this work.
> >
> > I have provided some initial comments to your change (should arrive in a
> > separate mail), most of a more general kind, and not related to the meat
> of
> > the MIPS stuff. In general all the files where the implementation is
> stubbed
> > out using UNIMPLEMENTED() or returning some default value all the code in
> > comments should be removed.
> >
> > Please take a look athttp://
> google-styleguide.googlecode.com/svn/trunk/cppguide.xmlfor code
> > style guidelines. Also try to run tools/presubmit.py to lint the code.
> >
> > This is a BIG change, so we need to somehow land it in smaller pieces
> while
> > keeping all other platforms running. Maybe aiming for an initial change
> with
> > the assembler, disassembler and simulator and a simple test could get
> things
> > started. Maybe tests like in test-assembler-ia32.cc or
> test-disasm-ia32.cc
> > which can run in the simulator.
> >
> > You should know, that we are working on a new optimizing compiler to
> replace
> > the initial one in the codegen-xxx files.
> >
> > Also before we can land any of your code you will have to sign sign
> > contributor license which can be signed
> > electronically here:
> http://code.google.com/legal/individual-cla-v1.0.html.
> >
> > Regards,
> > Søren
> >
> > On Tue, Jan 19, 2010 at 02:27, Alexandre Rames <
> [email protected]>wrote:
> >
> >
> >
> > > Sorry for the following posts... I'll try to stop posting a little
> > > after this one. It's just that I'd like the first part of the code to
> > > be good enough.
> > > I added the Debugger implementation to the Simulator.
> >
> > > Alexandre
> >
> > > On Jan 18, 3:52 pm, Alexandre Rames <[email protected]> wrote:
> > > > I am fixing bugs in the simulator. There are quite a few...
> >
> > > > On Jan 18, 2:47 pm, Alexandre Rames <[email protected]>
> wrote:
> >
> > > > > The code is uploading right now.
> > > > > I hope I did everything right. Here are some details about the
> > > > > uploaded code.
> >
> > > > > The code implements MIPS assembly generation, simulator and
> > > > > disassembler.
> > > > > Not all instructions supported in the simulator have been tested
> > > > > thoroughly yet.
> >
> > > > > The files containing the code concerned are:
> > > > > - constants-mips.h / .cc holds the assembly constants and some
> > > > > helpers. They are shared by the assembler, the simulator, and the
> > > > > disassembler.
> > > > > - assembler-mips.h / .cc holds the assembler code.
> > > > > - macro-assembler-mips.h / .cc is partly implemented: pseudo
> > > > > instructions, etc.
> > > > > - simulator-mips.h / .cc for the simulator
> > > > > - disasm-mips.cc for the disassembler
> >
> > > > > The architecture dependent files are modified to support the mips
> > > > > architecture.
> > > > > In bootstrapper.cc I added some pre-processor condition around the
> > > > > configuration of the environment. MIPS needs this to skip compiling
> > > > > natives and others (for this code).
> >
> > > > > In the SConstruct file there are two architectures defined for
> mips:
> > > > > "mips" and "mips-simu".
> > > > > This is because when compiling for the hardware we need some flags
> we
> > > > > don't want when compiling for the simulator. So when compiling for
> the
> > > > > simulator we take the arguments in the "mips-simu" architecture
> > > > > instead.
> >
> > > > > Also an interface for testing all this is implemented with
> > > > > - test-mips.h / .cc in which, a test stub is declared, and
> where
> > > > > we can write some assembly code.
> > > > > - test-interface-mips.h / .cc makes the interface between the
> user
> > > > > and test-mips files.
> >
> > > > > To run the interface compile v8 ( scons simulator=mips mode=debug
> -
> > > > > j4 )
> > > > > then compile the test interface. I use the following
> > > > > "compile_mips_test.sh" script to do all this:
> >
> > > > > #!/bin/sh
> > > > > INTERFACE=test-interface-mips.cc
> > > > > TESTCORE=test-mips.cc
> > > > > TESTCORE_O=$PWD/obj/debug/mips/test-mips.o
> > > > > PATH_TO_TEST=$PWD/src/mips
> > > > > ARGS="-Wall -Werror"
> > > > > V8ARGS="-Iinclude libv8_g.a -lpthread"
> > > > > echo "g++ ${PATH_TO_TEST}/${INTERFACE} -o mips-test-interface $
> > > > > {TESTCORE_O} ${V8ARGS} ${ARGS}"
> > > > > g++ ${PATH_TO_TEST}/${INTERFACE} -o mips-test-interface
> ${TESTCORE_O} $
> > > > > {V8ARGS} ${ARGS}
> >
> > > --
> > > v8-users mailing list
> > > [email protected]
> > >http://groups.google.com/group/v8-users
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users