s390x port progress: patch queue for hotspot assembled.

Volker Simonis volker.simonis at gmail.com
Mon Jul 4 14:07:46 UTC 2016


On Mon, Jul 4, 2016 at 3:17 PM, Andrew Haley <aph at redhat.com> wrote:
> On 04/07/16 12:22, David Holmes wrote:
>
>> Unless the files are included into more than one other file then adding
>> a level of indirection doesn't really help anything.
>
> I'm not sure what this means.
>
>> But I don't see why the platform part of the name needs to be kept when
>> it is already part of the path?
>
> When switching between files in an editor, one doesn't usually
> type in the full path, but the filename.  I'd be very sad to lose
> that, and I think that unique filenames are a nice thing to have.
>

In Emacs you can try the uniquify [1] extension which would solve the
problem. I already use it for editing various hotspot version (i.e.
hs-comp, jdk9-dev) in one Emacs. But I agree that Emacs is probably
not a practical solution for everybody :)

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html

> Andrew.
>

We could try something like this (adapted from [2]) although I'm not
sure if that's really a good solution (i.e. if it is treated right by
various IDEs):

include_test.cpp
============

#define xstr(x) #x
#define str(x) xstr(x)
#define sub(x) x
#define cpu_header(x) str(sub(x)sub(_)CPU.hpp)
#define os_header(x) str(sub(x)sub(_)OS.hpp)
#define os_cpu_header(x) str(sub(x)sub(_)sub(OS)sub(_)CPU.hpp)

#include cpu_header(assembler)
#include os_header(assembler)
#include os_cpu_header(assembler)

assembler_s390x.hpp
================
#pragma message ("including \"assembler_s390x.h\"")

assembler_linux.hpp
===============
#pragma message ("including \"assembler_linux.h\"")

assembler_linux_s390x.hpp
====================
#pragma message ("including \"assembler_linux_s390x.h\"")


It works on all the platforms I have tested so far (see below) except
Linux where it needs some tweaks (see comments below):


Solaris:
======
/SS12u4/SUNWspro/bin/CC -DCPU=s390x -DOS="linux" -E include_test.cpp
#1 "include_test.cpp"
#1 "assembler_s390x.hpp"
#pragma message ( "including \"assembler_s390x.h\"" )
#1 "assembler_linux.hpp"
#pragma message ( "including \"assembler_linux.h\"" )
#1 "assembler_linux_s390x.hpp"
#pragma message ( "including \"assembler_linux_s390x.h\"" )

AIX:
===
/usr/vacpp_V12/usr/vacpp/bin/xlC_r -DCPU=s390x -DOS=linux -c include_test.cpp
"assembler_s390x.hpp", line 1.9: 1540-1401 (I) An unknown "pragma
message" is specified.
"assembler_linux.hpp", line 1.9: 1540-1401 (I) An unknown "pragma
message" is specified.
"assembler_linux_s390x.hpp", line 1.9: 1540-1401 (I) An unknown
"pragma message" is specified.

MacOS X
=======
/usr/bin/clang++ -DCPU=s390x -DOS=linux -c include_test.cpp
In file included from include_test.cpp:8:
./assembler_s390x.hpp:1:9: warning: including "assembler_s390x.h"
[-W#pragma-messages]
#pragma message ("including \"assembler_s390x.h\"")
        ^
In file included from include_test.cpp:9:
./assembler_linux.hpp:1:9: warning: including "assembler_linux.h"
[-W#pragma-messages]
#pragma message ("including \"assembler_linux.h\"")
        ^
In file included from include_test.cpp:10:
./assembler_linux_s390x.hpp:1:9: warning: including
"assembler_linux_s390x.h" [-W#pragma-messages]
#pragma message ("including \"assembler_linux_s390x.h\"")
        ^
3 warnings generated.

Windows:
=======
$ /cygdrive/c/progra~2/micros~1.0/vc/bin/amd64/cl -DCPU=s390x
-DOS=linux -c include_test.
cpp
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

include_test.cpp
including "assembler_s390x.h"
including "assembler_linux.h"
including "assembler_linux_s390x.h"

HPUX:
=====
$ /opt/aCC/bin/aCC -DCPU=s390x -DOS=linux -c include_test.cpp
Info #4087-D: "including \"assembler_s390x.h\""

Info #4087-D: "including \"assembler_linux.h\""

Info #4087-D: "including \"assembler_linux_s390x.h\""

Linux:
=====
g++ -DCPU=s390x -DOS=linux -c include_test.cpp
include_test.cpp:9:30: fatal error: assembler_1.hpp: No such file or directory
compilation terminated.

The problem on Linux is that 'linux' is already predefined to '1' but
that could be easily fixed for example by slightly changing the name
or by adding the underscore to the definiton of the OS macro (i.e.
-DOS=_linux).

As I said, I'm still not sure if this looks nice? I just wanted to
post my findings for discussion :)

Regards,
Volker

[2] http://stackoverflow.com/questions/1852652/how-can-i-include-a-file-whose-name-is-built-up-from-a-macro


More information about the hotspot-dev mailing list