[OpenJDK Rasterizer] AWT & gcc 4.8 optimization options
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Wed Dec 9 14:43:04 UTC 2015
On 09/12/15 09:07, Laurent Bourgès wrote:
> Hi Sergey,
>
> Do you have made some progress ?
>
> If you modify the Maskfill C code, could you explain me how it works as
> I would like implementing in the future the correct gamma correction in
> this software loop ?
From the current source code point of view it is not an easy task to
understand how it works. The easiest way to study it is to compile the
jdk using this option in AWT2dLibraries.gmk
--- a/make/lib/Awt2dLibraries.gmk Tue Dec 08 19:50:14 2015 +0300
+++ b/make/lib/Awt2dLibraries.gmk Wed Dec 09 17:10:55 2015 +0300
@@ -242,7 +242,7 @@
EXCLUDES := $(LIBAWT_EXCLUDES), \
EXCLUDE_FILES := $(LIBAWT_EXFILES), \
OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+ CFLAGS := -save-temps $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
format-nonliteral parentheses, \
DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
This will save result of preprocessor. Also it will save an assembler
code which can be useful to investigate how the compiler optimize the
code, especially in case of vectorization.
When you take a look to the code after preprocessor you will be able to
understand the DSL which is used in the AlphaMacros.h for the
"DEFINE_ALPHA_MASKBLIT"
There are a bunch of files in the
java.desktop/share/native/libawt/java2d/loops/. Some of them have the
general code like LoopMacros.h, AlphaMacros.h, others have
implementation for a some specific types.
For example take a look to the IntRgb.c
It have 2 parts:
- The array IntRgbPrimitives, which contain the list of supported
operations(it will register the functions which should be called in
MaskBlit.c for some particular types). For example it contains
REGISTER_ALPHA_MASKBLIT from/to a different types.
- Definitions of the functions like DEFINE_SRCOVER_MASKBLIT(IntArgb,
IntRgb, 4ByteArgb); This macros provide a function which will support
the maskblit IntArgb->IntRgb;
So to understand how it work you need to trace these calls:
- MaskBlit.java -> MaskBlit(.....)
- MaskBlit.c -> *pPrim->funcs.maskblit
- The function which is generated from the DEFINE_SRCOVER_MASKBLIT for a
particular type.
Note that if for some reason we have no specific implementation of
DEFINE_SRCOVER_MASKBLIT will meant that General MaskBlit from the
MaskBlit.java will be used and it is quite slow.
I am on the road of investigation...
>
> Could you help me on this task
>
> Cheers,
> Laurent
>
> Le 27 nov. 2015 12:07, "Sergey Bylokhov" <Sergey.Bylokhov at oracle.com
> <mailto:Sergey.Bylokhov at oracle.com>> a écrit :
> >
> > Right now I am trying to investigate where the code is affected by
> these options, and also I am trying to investigate possibility of code
> improvement.
> >
> >
> > On 27.11.15 13:28, Laurent Bourgès wrote:
> >>
> >> Hi,
> >>
> >> Just a reminder on this compiler issue.
> >>
> >> I tested today the impact of the proposed patch changing compiler
> >> options for AWT on my machine (i7 gcc 4.8.4):
> >>
> >> Without patch (clean build - client libs):
> >> EllipseTests-fill-true.ser 1 25 445.220
> >> 445.336 445.196 0.127 444.944 445.543 25
> >>
> >> With patch:
> >> EllipseTests-fill-true.ser 1 26 402.889
> >> 403.861 403.134 0.446 402.603 404.294 26
> >>
> >> The impact is very important on this test (large mask fills) ~ 10%
> >>
> >> Sergey, could you check on gcc 4.9.2 ?
> >>
> >> Laurent
> >>
> >> 2015-10-21 21:04 GMT+02:00 Sergey Bylokhov
> <Sergey.Bylokhov at oracle.com <mailto:Sergey.Bylokhov at oracle.com>
> >> <mailto:Sergey.Bylokhov at oracle.com
> <mailto:Sergey.Bylokhov at oracle.com>>>:
> >>
> >>
> >> The bug was filed:
> >> https://bugs.openjdk.java.net/browse/JDK-8140266
> >>
> >> I will try a few steps before push the current solution:
> >> - change the code, so this option will not be necessary.
> >> - check other compilers, it seems gcc 4.9.2 will be default for
> jdk9.
> >>
> >
> >
> > --
> > Best regards, Sergey.
>
--
Best regards, Sergey.
More information about the graphics-rasterizer-dev
mailing list