4.1.2-12
This commit is contained in:
parent
1b9112c69f
commit
a1271c1402
@ -1 +1 @@
|
||||
gcc-4.1.2-20070424.tar.bz2
|
||||
gcc-4.1.2-20070503.tar.bz2
|
||||
|
89
gcc41-dtor-relro.patch
Normal file
89
gcc41-dtor-relro.patch
Normal file
@ -0,0 +1,89 @@
|
||||
2007-05-03 Ulrich Drepper <drepper@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* crtstuff.c (HIDDEN_DTOR_LIST_END): New macro.
|
||||
(__do_global_dtors_aux): Use more paranoid loop to run
|
||||
destructors if HIDDEN_DTOR_LIST_END.
|
||||
(__DTOR_END__): Export as a hidden symbol when HIDDEN_DTOR_LIST_END.
|
||||
|
||||
--- gcc/crtstuff.c.jj 2007-01-24 22:24:21.000000000 +0100
|
||||
+++ gcc/crtstuff.c 2007-05-03 10:40:29.000000000 +0200
|
||||
@@ -106,6 +107,11 @@ call_ ## FUNC (void) \
|
||||
# define EH_FRAME_SECTION_CONST
|
||||
#endif
|
||||
|
||||
+#if !defined(DTOR_LIST_END) && defined(OBJECT_FORMAT_ELF) \
|
||||
+ && defined(HAVE_GAS_HIDDEN) && !defined(FINI_ARRAY_SECTION_ASM_OP)
|
||||
+# define HIDDEN_DTOR_LIST_END
|
||||
+#endif
|
||||
+
|
||||
/* We do not want to add the weak attribute to the declarations of these
|
||||
routines in unwind-dw2-fde.h because that will cause the definition of
|
||||
these symbols to be weak as well.
|
||||
@@ -265,10 +271,6 @@ extern void __cxa_finalize (void *) TARG
|
||||
static void __attribute__((used))
|
||||
__do_global_dtors_aux (void)
|
||||
{
|
||||
-#ifndef FINI_ARRAY_SECTION_ASM_OP
|
||||
- static func_ptr *p = __DTOR_LIST__ + 1;
|
||||
- func_ptr f;
|
||||
-#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
|
||||
static _Bool completed;
|
||||
|
||||
if (__builtin_expect (completed, 0))
|
||||
@@ -282,12 +284,32 @@ __do_global_dtors_aux (void)
|
||||
#ifdef FINI_ARRAY_SECTION_ASM_OP
|
||||
/* If we are using .fini_array then destructors will be run via that
|
||||
mechanism. */
|
||||
+#elif defined(HIDDEN_DTOR_LIST_END)
|
||||
+ {
|
||||
+ /* Safer version that makes sure only .dtors function pointers are
|
||||
+ called even if the static variable is maliciously changed. */
|
||||
+ extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
|
||||
+ static size_t dtor_idx;
|
||||
+ const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
|
||||
+ func_ptr f;
|
||||
+
|
||||
+ while (dtor_idx < max_idx)
|
||||
+ {
|
||||
+ f = __DTOR_LIST__[++dtor_idx];
|
||||
+ f ();
|
||||
+ }
|
||||
+ }
|
||||
#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
|
||||
- while ((f = *p))
|
||||
- {
|
||||
- p++;
|
||||
- f ();
|
||||
- }
|
||||
+ {
|
||||
+ static func_ptr *p = __DTOR_LIST__ + 1;
|
||||
+ func_ptr f;
|
||||
+
|
||||
+ while ((f = *p))
|
||||
+ {
|
||||
+ p++;
|
||||
+ f ();
|
||||
+ }
|
||||
+ }
|
||||
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
|
||||
|
||||
#ifdef USE_EH_FRAME_REGISTRY
|
||||
@@ -471,6 +493,17 @@ STATIC func_ptr __CTOR_END__[1]
|
||||
|
||||
#ifdef DTOR_LIST_END
|
||||
DTOR_LIST_END;
|
||||
+#elif defined(HIDDEN_DTOR_LIST_END)
|
||||
+#ifdef DTORS_SECTION_ASM_OP
|
||||
+asm (DTORS_SECTION_ASM_OP);
|
||||
+#endif
|
||||
+func_ptr __DTOR_END__[1]
|
||||
+ __attribute__ ((unused,
|
||||
+#ifndef DTORS_SECTION_ASM_OP
|
||||
+ section(".dtors"),
|
||||
+#endif
|
||||
+ aligned(sizeof(func_ptr)), visibility ("hidden")))
|
||||
+ = { (func_ptr) 0 };
|
||||
#elif defined(DTORS_SECTION_ASM_OP)
|
||||
asm (DTORS_SECTION_ASM_OP);
|
||||
STATIC func_ptr __DTOR_END__[1]
|
186
gcc41-libgomp-ncpus.patch
Normal file
186
gcc41-libgomp-ncpus.patch
Normal file
@ -0,0 +1,186 @@
|
||||
2007-05-02 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/linux/proc.c: New file.
|
||||
|
||||
--- libgomp/config/linux/proc.c.jj 2007-05-02 13:50:37.000000000 +0200
|
||||
+++ libgomp/config/linux/proc.c 2007-05-02 16:00:47.000000000 +0200
|
||||
@@ -0,0 +1,179 @@
|
||||
+/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
|
||||
+
|
||||
+ This file is part of the GNU OpenMP Library (libgomp).
|
||||
+
|
||||
+ Libgomp is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
||||
+ more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with libgomp; see the file COPYING.LIB. If not, write to the
|
||||
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+/* As a special exception, if you link this library with other files, some
|
||||
+ of which are compiled with GCC, to produce an executable, this library
|
||||
+ does not by itself cause the resulting executable to be covered by the
|
||||
+ GNU General Public License. This exception does not however invalidate
|
||||
+ any other reasons why the executable file might be covered by the GNU
|
||||
+ General Public License. */
|
||||
+
|
||||
+/* This file contains system specific routines related to counting
|
||||
+ online processors and dynamic load balancing. */
|
||||
+
|
||||
+#ifndef _GNU_SOURCE
|
||||
+#define _GNU_SOURCE 1
|
||||
+#endif
|
||||
+#include "libgomp.h"
|
||||
+#include <sched.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#ifdef HAVE_GETLOADAVG
|
||||
+# ifdef HAVE_SYS_LOADAVG_H
|
||||
+# include <sys/loadavg.h>
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef HAVE_PTHREAD_AFFINITY_NP
|
||||
+static unsigned long
|
||||
+cpuset_popcount (cpu_set_t *cpusetp)
|
||||
+{
|
||||
+#ifdef CPU_COUNT
|
||||
+ /* glibc 2.6 and above provide a macro for this. */
|
||||
+ return CPU_COUNT (cpusetp);
|
||||
+#else
|
||||
+ size_t i;
|
||||
+ unsigned long ret = 0;
|
||||
+ extern int check[sizeof (cpusetp->__bits[0]) == sizeof (unsigned long int)];
|
||||
+
|
||||
+ (void) check;
|
||||
+ for (i = 0; i < sizeof (*cpusetp) / sizeof (cpusetp->__bits[0]); i++)
|
||||
+ {
|
||||
+ unsigned long int mask = cpusetp->__bits[i];
|
||||
+ if (mask == 0)
|
||||
+ continue;
|
||||
+ ret += __builtin_popcountl (mask);
|
||||
+ }
|
||||
+ return ret;
|
||||
+#endif
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+/* At startup, determine the default number of threads. It would seem
|
||||
+ this should be related to the number of cpus online. */
|
||||
+
|
||||
+void
|
||||
+gomp_init_num_threads (void)
|
||||
+{
|
||||
+#ifdef HAVE_PTHREAD_AFFINITY_NP
|
||||
+ cpu_set_t cpuset;
|
||||
+
|
||||
+ if (pthread_getaffinity_np (pthread_self (), sizeof (cpuset), &cpuset) == 0)
|
||||
+ {
|
||||
+ /* Count only the CPUs this process can use. */
|
||||
+ gomp_nthreads_var = cpuset_popcount (&cpuset);
|
||||
+ if (gomp_nthreads_var == 0)
|
||||
+ gomp_nthreads_var = 1;
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
+#ifdef _SC_NPROCESSORS_ONLN
|
||||
+ gomp_nthreads_var = sysconf (_SC_NPROCESSORS_ONLN);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+get_num_procs (void)
|
||||
+{
|
||||
+#ifdef HAVE_PTHREAD_AFFINITY_NP
|
||||
+ cpu_set_t cpuset;
|
||||
+
|
||||
+ if (gomp_cpu_affinity == NULL)
|
||||
+ {
|
||||
+ /* Count only the CPUs this process can use. */
|
||||
+ if (pthread_getaffinity_np (pthread_self (), sizeof (cpuset),
|
||||
+ &cpuset) == 0)
|
||||
+ {
|
||||
+ int ret = cpuset_popcount (&cpuset);
|
||||
+ return ret != 0 ? ret : 1;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ size_t idx;
|
||||
+ static int affinity_cpus;
|
||||
+
|
||||
+ /* We can't use pthread_getaffinity_np in this case
|
||||
+ (we have changed it ourselves, it binds to just one CPU).
|
||||
+ Count instead the number of different CPUs we are
|
||||
+ using. */
|
||||
+ CPU_ZERO (&cpuset);
|
||||
+ if (affinity_cpus == 0)
|
||||
+ {
|
||||
+ int cpus = 0;
|
||||
+ for (idx = 0; idx < gomp_cpu_affinity_len; idx++)
|
||||
+ if (! CPU_ISSET (gomp_cpu_affinity[idx], &cpuset))
|
||||
+ {
|
||||
+ cpus++;
|
||||
+ CPU_SET (gomp_cpu_affinity[idx], &cpuset);
|
||||
+ }
|
||||
+ affinity_cpus = cpus;
|
||||
+ }
|
||||
+ return affinity_cpus;
|
||||
+ }
|
||||
+#endif
|
||||
+#ifdef _SC_NPROCESSORS_ONLN
|
||||
+ return sysconf (_SC_NPROCESSORS_ONLN);
|
||||
+#else
|
||||
+ return gomp_nthreads_var;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+/* When OMP_DYNAMIC is set, at thread launch determine the number of
|
||||
+ threads we should spawn for this team. */
|
||||
+/* ??? I have no idea what best practice for this is. Surely some
|
||||
+ function of the number of processors that are *still* online and
|
||||
+ the load average. Here I use the number of processors online
|
||||
+ minus the 15 minute load average. */
|
||||
+
|
||||
+unsigned
|
||||
+gomp_dynamic_max_threads (void)
|
||||
+{
|
||||
+ unsigned n_onln, loadavg;
|
||||
+
|
||||
+ n_onln = get_num_procs ();
|
||||
+ if (n_onln > gomp_nthreads_var)
|
||||
+ n_onln = gomp_nthreads_var;
|
||||
+
|
||||
+ loadavg = 0;
|
||||
+#ifdef HAVE_GETLOADAVG
|
||||
+ {
|
||||
+ double dloadavg[3];
|
||||
+ if (getloadavg (dloadavg, 3) == 3)
|
||||
+ {
|
||||
+ /* Add 0.1 to get a kind of biased rounding. */
|
||||
+ loadavg = dloadavg[2] + 0.1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ if (loadavg >= n_onln)
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return n_onln - loadavg;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+omp_get_num_procs (void)
|
||||
+{
|
||||
+ return get_num_procs ();
|
||||
+}
|
||||
+
|
||||
+ialias (omp_get_num_procs)
|
@ -5,18 +5,15 @@
|
||||
|
||||
--- libgomp/configure.tgt.jj 2007-04-20 12:55:40.000000000 +0200
|
||||
+++ libgomp/configure.tgt 2007-05-02 17:32:15.000000000 +0200
|
||||
@@ -11,14 +11,11 @@
|
||||
@@ -11,11 +11,8 @@
|
||||
# XLDFLAGS Add extra link flags to use.
|
||||
|
||||
# Optimize TLS usage by avoiding the overhead of dynamic allocation.
|
||||
-# This does require that the library be present during process
|
||||
-# startup, so mark the library as not to be dlopened.
|
||||
if test $have_tls = yes ; then
|
||||
case "${target}" in
|
||||
|
||||
*-*-linux*)
|
||||
if test $have_tls = yes && test "$with_gnu_ld" = "yes"; then
|
||||
XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
|
||||
- XLDFLAGS="${XLDFLAGS} -Wl,-z,nodlopen"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Since we require POSIX threads, assume a POSIX system by default.
|
||||
|
@ -1,65 +0,0 @@
|
||||
2007-04-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/30558
|
||||
* tree-eh.c (lower_eh_filter): If EH_FILTER_MUST_NOT_THROW
|
||||
clear this_state.prev_try.
|
||||
|
||||
* g++.dg/gomp/pr30558.C: New test.
|
||||
|
||||
--- gcc/tree-eh.c.jj 2007-03-12 17:18:17.000000000 +0100
|
||||
+++ gcc/tree-eh.c 2007-04-24 17:32:16.000000000 +0200
|
||||
@@ -1497,6 +1497,10 @@ lower_eh_filter (struct leh_state *state
|
||||
EH_FILTER_TYPES (inner));
|
||||
this_state = *state;
|
||||
this_state.cur_region = this_region;
|
||||
+ /* For must not throw regions any cleanup regions inside it
|
||||
+ can't reach outer catch regions. */
|
||||
+ if (EH_FILTER_MUST_NOT_THROW (inner))
|
||||
+ this_state.prev_try = NULL;
|
||||
|
||||
lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0));
|
||||
|
||||
--- gcc/testsuite/g++.dg/gomp/pr30558.C.jj 2007-04-24 17:41:47.000000000 +0200
|
||||
+++ gcc/testsuite/g++.dg/gomp/pr30558.C 2007-04-24 17:42:24.000000000 +0200
|
||||
@@ -0,0 +1,41 @@
|
||||
+// PR tree-optimization/30558
|
||||
+// { dg-do compile }
|
||||
+// { dg-options "-fopenmp" }
|
||||
+
|
||||
+template <typename T> struct F
|
||||
+{
|
||||
+ ~F ();
|
||||
+ F (T);
|
||||
+ const T &operator[] (unsigned i) const;
|
||||
+};
|
||||
+
|
||||
+template <typename T> F<T> foo (const F<T> &x)
|
||||
+{
|
||||
+ return F<T> (x[1]);
|
||||
+}
|
||||
+
|
||||
+struct G
|
||||
+{
|
||||
+ G () { bar (2); }
|
||||
+ F<int> &operator () (F<int> x);
|
||||
+ void bar (int);
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ try
|
||||
+ {
|
||||
+ G g;
|
||||
+#pragma omp parallel for
|
||||
+ for (int i = 0; i < 10; ++i)
|
||||
+ {
|
||||
+ F<int> j (i);
|
||||
+ F<int> f = g (j);
|
||||
+ F<int> h = foo (f);
|
||||
+ }
|
||||
+ }
|
||||
+ catch (int &e)
|
||||
+ {
|
||||
+ }
|
||||
+}
|
@ -1,96 +0,0 @@
|
||||
2007-04-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/31598
|
||||
* tree-inline.c (copy_body_r): Don't touch TREE_TYPE of OMP_CLAUSE.
|
||||
|
||||
* semantics.c (finish_omp_clauses): Don't create CP_OMP_CLAUSE_INFO
|
||||
for type dependent OMP_CLAUSE_DECLs.
|
||||
|
||||
* g++.dg/gomp/pr31598.C: New test.
|
||||
|
||||
--- gcc/tree-inline.c.jj 2007-04-14 14:55:25.000000000 +0200
|
||||
+++ gcc/tree-inline.c 2007-04-24 11:33:19.000000000 +0200
|
||||
@@ -650,7 +650,8 @@ copy_body_r (tree *tp, int *walk_subtree
|
||||
(NULL_TREE,
|
||||
id->eh_region_offset + TREE_INT_CST_LOW (TREE_OPERAND (*tp, 0)));
|
||||
|
||||
- TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
|
||||
+ if (TREE_CODE (*tp) != OMP_CLAUSE)
|
||||
+ TREE_TYPE (*tp) = remap_type (TREE_TYPE (*tp), id);
|
||||
|
||||
/* The copied TARGET_EXPR has never been expanded, even if the
|
||||
original node was expanded already. */
|
||||
--- gcc/cp/semantics.c.jj 2007-04-01 20:16:51.000000000 +0200
|
||||
+++ gcc/cp/semantics.c 2007-04-24 10:45:35.000000000 +0200
|
||||
@@ -3627,7 +3627,8 @@ finish_omp_clauses (tree clauses)
|
||||
Save the results, because later we won't be in the right context
|
||||
for making these queries. */
|
||||
if (CLASS_TYPE_P (inner_type)
|
||||
- && (need_default_ctor || need_copy_ctor || need_copy_assignment))
|
||||
+ && (need_default_ctor || need_copy_ctor || need_copy_assignment)
|
||||
+ && !type_dependent_expression_p (t))
|
||||
{
|
||||
int save_errorcount = errorcount;
|
||||
tree info;
|
||||
--- gcc/testsuite/g++.dg/gomp/pr31598.C.jj 2007-04-24 10:47:50.000000000 +0200
|
||||
+++ gcc/testsuite/g++.dg/gomp/pr31598.C 2007-04-24 11:49:35.000000000 +0200
|
||||
@@ -0,0 +1,59 @@
|
||||
+// PR c++/31598
|
||||
+// { dg-do compile }
|
||||
+//
|
||||
+// Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
+// Contributed by Theodore.Papadopoulo
|
||||
+// 16 Apr 2007 <Theodore.Papadopoulo@sophia.inria.fr>
|
||||
+
|
||||
+int i;
|
||||
+template <typename> struct A { A() {} };
|
||||
+template <typename> struct C { C() { i++; } C(const C &) { i += 2; } };
|
||||
+struct D { D() {} };
|
||||
+
|
||||
+struct M { typedef double E; };
|
||||
+
|
||||
+template <typename T>
|
||||
+struct R
|
||||
+{
|
||||
+ R()
|
||||
+ {
|
||||
+ typedef A<typename T::E> B;
|
||||
+ B b;
|
||||
+ #pragma omp parallel for firstprivate(b) schedule(guided)
|
||||
+ for (int t = 0; t < 10; ++t)
|
||||
+ ;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+template <typename T>
|
||||
+struct S
|
||||
+{
|
||||
+ S()
|
||||
+ {
|
||||
+ typedef C<typename T::E> B;
|
||||
+ B b;
|
||||
+ #pragma omp parallel for firstprivate(b)
|
||||
+ for (int t = 0; t < 10; ++t)
|
||||
+ ;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+struct U
|
||||
+{
|
||||
+ U()
|
||||
+ {
|
||||
+ D b;
|
||||
+ #pragma omp parallel for firstprivate(b)
|
||||
+ for (int t = 0; t < 10; ++t)
|
||||
+ ;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ R<M> r;
|
||||
+ S<M> s;
|
||||
+ U u;
|
||||
+ return 0;
|
||||
+}
|
43
gcc41-pr31748.patch
Normal file
43
gcc41-pr31748.patch
Normal file
@ -0,0 +1,43 @@
|
||||
2007-05-01 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/31748
|
||||
* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
|
||||
DECL_P in not a variable and appears more than once error messages.
|
||||
|
||||
* g++.dg/gomp/pr31748.C: New test.
|
||||
|
||||
--- gcc/cp/semantics.c.jj 2007-04-26 09:30:58.000000000 +0200
|
||||
+++ gcc/cp/semantics.c 2007-05-01 14:22:58.000000000 +0200
|
||||
@@ -3376,14 +3376,17 @@ finish_omp_clauses (tree clauses)
|
||||
{
|
||||
if (processing_template_decl)
|
||||
break;
|
||||
- error ("%qE is not a variable in clause %qs", t, name);
|
||||
+ if (DECL_P (t))
|
||||
+ error ("%qD is not a variable in clause %qs", t, name);
|
||||
+ else
|
||||
+ error ("%qE is not a variable in clause %qs", t, name);
|
||||
remove = true;
|
||||
}
|
||||
else if (bitmap_bit_p (&generic_head, DECL_UID (t))
|
||||
|| bitmap_bit_p (&firstprivate_head, DECL_UID (t))
|
||||
|| bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
|
||||
{
|
||||
- error ("%qE appears more than once in data clauses", t);
|
||||
+ error ("%qD appears more than once in data clauses", t);
|
||||
remove = true;
|
||||
}
|
||||
else
|
||||
--- gcc/testsuite/g++.dg/gomp/pr31748.C.jj 2007-05-01 14:26:13.000000000 +0200
|
||||
+++ gcc/testsuite/g++.dg/gomp/pr31748.C 2007-05-01 14:26:07.000000000 +0200
|
||||
@@ -0,0 +1,10 @@
|
||||
+// PR c++/31748
|
||||
+
|
||||
+struct A;
|
||||
+
|
||||
+void
|
||||
+foo ()
|
||||
+{
|
||||
+#pragma omp parallel private(A) // { dg-error "struct A.*is not a variable" }
|
||||
+ ;
|
||||
+}
|
@ -1,633 +0,0 @@
|
||||
2007-04-02 Francis Kung <fkung@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
|
||||
(fontSet): Initialize to null.
|
||||
(FreetypeGlyphVector(Font, int[], FontRenderContext)): Populate fontSet
|
||||
array with default font if needed.
|
||||
(FreetypeGlyphVector(FreetypeGlyphVector)): Clone all fields.
|
||||
(getNativeFontPointer): New native method.
|
||||
* include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h: Regenerated.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer):
|
||||
New function.
|
||||
|
||||
2007-04-02 Francis Kung <fkung@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/CairoGraphics2D.java
|
||||
(cairoDrawGlyphVector): Added parameter.
|
||||
(drawGlyphVector): Retrieve and pass fontset parameter.
|
||||
* gnu/java/awt/peer/gtk/ComponentGraphics.java
|
||||
(cairoDrawGlyphVector): Added parameter.
|
||||
(lock): Removed unnecessary cast.
|
||||
(unlock): Removed unnecessary cast and explicitly set to ONE variable.
|
||||
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
|
||||
(fontSet): New field.
|
||||
(dispose): New native method.
|
||||
(finalize): New method.
|
||||
(getGlyphFonts): New method.
|
||||
(getGlyphOutline): Pass fontSet parameter to native method.
|
||||
(getGlyphOutlineNative): Added parameter.
|
||||
(getGlyphs): Pass extra parameters to native method.
|
||||
(getGlyphsNative): Added parameters.
|
||||
(getKerning): Added fontSet parameter.
|
||||
(getMetricsNative): Added fontSet parameter.
|
||||
(performDefaultLayout): Only check kerning if glyphs use the same font.
|
||||
(setupGlyphMetrics): Pass extra parameters to native methods.
|
||||
* include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
|
||||
* include/gnu_java_awt_peer_gtk_FreetypGlyphVector.h: Regenerated.
|
||||
* native/jni/gtk-peer/gdkfont.h: Enable pango engine.
|
||||
(peerfont): Add variable for fontset.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
|
||||
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector): Accept
|
||||
array of font pointers to use when drawing glyphs.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
|
||||
(getFontSet): New function.
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose): New function.
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative):
|
||||
Added and use new fontSet parameter.
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs): Use pango
|
||||
to retrieve glyphs and estimate font, if the current font does not contain
|
||||
a requested glyph.
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning): Added and use
|
||||
new fontSet parameter.
|
||||
(Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative): Added
|
||||
and use new fontSet parameter.
|
||||
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
|
||||
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose): Free fontset.
|
||||
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont): Load fontset.
|
||||
|
||||
--- libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java 16 Mar 2007 15:14:53 -0000 1.67
|
||||
+++ libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java 2 Apr 2007 19:39:26 -0000 1.68
|
||||
@@ -392,7 +392,7 @@ public abstract class CairoGraphics2D ex
|
||||
*/
|
||||
native void cairoDrawGlyphVector(long pointer, GdkFontPeer font,
|
||||
float x, float y, int n,
|
||||
- int[] codes, float[] positions);
|
||||
+ int[] codes, float[] positions, long[] fontset);
|
||||
|
||||
/**
|
||||
* Set the font in cairo.
|
||||
@@ -1676,6 +1676,7 @@ public abstract class CairoGraphics2D ex
|
||||
{
|
||||
int n = gv.getNumGlyphs ();
|
||||
int[] codes = gv.getGlyphCodes (0, n, null);
|
||||
+ long[] fontset = ((FreetypeGlyphVector)gv).getGlyphFonts (0, n, null);
|
||||
float[] positions = gv.getGlyphPositions (0, n, null);
|
||||
|
||||
setFont (gv.getFont ());
|
||||
@@ -1683,7 +1684,7 @@ public abstract class CairoGraphics2D ex
|
||||
synchronized (fontPeer)
|
||||
{
|
||||
cairoDrawGlyphVector(nativePointer, fontPeer,
|
||||
- x, y, n, codes, positions);
|
||||
+ x, y, n, codes, positions, fontset);
|
||||
}
|
||||
}
|
||||
else
|
||||
--- libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java 16 Mar 2007 15:14:53 -0000 1.25
|
||||
+++ libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java 2 Apr 2007 19:39:26 -0000 1.26
|
||||
@@ -134,6 +134,8 @@ public class ComponentGraphics extends C
|
||||
hasLock.set(null);
|
||||
end_gdk_drawing();
|
||||
}
|
||||
+ else if (i.intValue() == 2)
|
||||
+ hasLock.set(ONE);
|
||||
else
|
||||
hasLock.set(Integer.valueOf(i.intValue() - 1));
|
||||
}
|
||||
--- libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java 6 Mar 2007 19:38:31 -0000 1.16
|
||||
+++ libjava/classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java 2 Apr 2007 21:28:58 -0000 1.18
|
||||
@@ -79,6 +79,11 @@ public class FreetypeGlyphVector extends
|
||||
* The glyph codes
|
||||
*/
|
||||
private int[] glyphCodes;
|
||||
+
|
||||
+ /**
|
||||
+ * The set of fonts used in this glyph vector.
|
||||
+ */
|
||||
+ private long[] fontSet = null;
|
||||
|
||||
/**
|
||||
* Glyph transforms. (de facto only the translation is used)
|
||||
@@ -86,6 +91,19 @@ public class FreetypeGlyphVector extends
|
||||
private AffineTransform[] glyphTransforms;
|
||||
|
||||
private GlyphMetrics[] metricsCache;
|
||||
+
|
||||
+ private native void dispose(long[] fonts);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a pointer to the native PangoFcFont object.
|
||||
+ *
|
||||
+ * The object will be referenced with g_object_ref n times before being
|
||||
+ * returned, and must be unreferenced a corresponding number of times.
|
||||
+ *
|
||||
+ * @param n Number of times to reference the object.
|
||||
+ * @return Pointer to the native default font.
|
||||
+ */
|
||||
+ private native long getNativeFontPointer(int n);
|
||||
|
||||
/**
|
||||
* Create a glyphvector from a given (Freetype) font and a String.
|
||||
@@ -135,6 +153,13 @@ public class FreetypeGlyphVector extends
|
||||
glyphCodes = new int[ codes.length ];
|
||||
System.arraycopy(codes, 0, glyphCodes, 0, codes.length);
|
||||
nGlyphs = glyphCodes.length;
|
||||
+
|
||||
+ if (fontSet == null)
|
||||
+ {
|
||||
+ fontSet = new long[nGlyphs];
|
||||
+ Arrays.fill(fontSet, getNativeFontPointer(nGlyphs));
|
||||
+ }
|
||||
+
|
||||
performDefaultLayout();
|
||||
}
|
||||
|
||||
@@ -157,6 +182,7 @@ public class FreetypeGlyphVector extends
|
||||
}
|
||||
|
||||
glyphCodes = new int[ nGlyphs ];
|
||||
+ fontSet = new long[nGlyphs];
|
||||
glyphPositions = new float[(nGlyphs + 1) * 2];
|
||||
glyphTransforms = new AffineTransform[ nGlyphs ];
|
||||
for(int i = 0; i < nGlyphs; i++ )
|
||||
@@ -166,6 +192,13 @@ public class FreetypeGlyphVector extends
|
||||
}
|
||||
System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
|
||||
glyphPositions.length);
|
||||
+ System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs);
|
||||
+ System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs);
|
||||
+ }
|
||||
+
|
||||
+ public void finalize()
|
||||
+ {
|
||||
+ dispose(fontSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,6 +208,7 @@ public class FreetypeGlyphVector extends
|
||||
{
|
||||
nGlyphs = s.codePointCount( 0, s.length() );
|
||||
glyphCodes = new int[ nGlyphs ];
|
||||
+ fontSet = new long[ nGlyphs ];
|
||||
int[] codePoints = new int[ nGlyphs ];
|
||||
int stringIndex = 0;
|
||||
|
||||
@@ -194,22 +228,22 @@ public class FreetypeGlyphVector extends
|
||||
}
|
||||
}
|
||||
|
||||
- glyphCodes = getGlyphs( codePoints );
|
||||
+ getGlyphs( codePoints, glyphCodes, fontSet );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the glyph code within the font for a given character
|
||||
*/
|
||||
- public native int[] getGlyphs(int[] codepoints);
|
||||
+ public native int[] getGlyphs(int[] codepoints, int[] glyphs, long[] fonts);
|
||||
|
||||
/**
|
||||
* Returns the kerning of a glyph pair
|
||||
*/
|
||||
- private native Point2D getKerning(int leftGlyph, int rightGlyph);
|
||||
+ private native Point2D getKerning(int leftGlyph, int rightGlyph, long font);
|
||||
|
||||
- private native double[] getMetricsNative( int glyphCode );
|
||||
+ private native double[] getMetricsNative(int glyphCode, long font);
|
||||
|
||||
- private native GeneralPath getGlyphOutlineNative(int glyphIndex);
|
||||
+ private native GeneralPath getGlyphOutlineNative(int glyphIndex, long font);
|
||||
|
||||
|
||||
public Object clone()
|
||||
@@ -267,10 +301,12 @@ public class FreetypeGlyphVector extends
|
||||
|
||||
x += gm.getAdvanceX();
|
||||
y += gm.getAdvanceY();
|
||||
-
|
||||
- if (i != nGlyphs-1)
|
||||
+
|
||||
+ // Get the kerning only if it's not the last glyph, and the two glyphs are
|
||||
+ // using the same font
|
||||
+ if (i != nGlyphs-1 && fontSet[i] == fontSet[i+1])
|
||||
{
|
||||
- Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1]);
|
||||
+ Point2D p = getKerning(glyphCodes[i], glyphCodes[i + 1], fontSet[i]);
|
||||
x += p.getX();
|
||||
y += p.getY();
|
||||
}
|
||||
@@ -305,6 +341,26 @@ public class FreetypeGlyphVector extends
|
||||
return rval;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns pointers to the fonts used in this glyph vector.
|
||||
+ *
|
||||
+ * The array index matches that of the glyph vector itself.
|
||||
+ */
|
||||
+ protected long[] getGlyphFonts(int beginGlyphIndex, int numEntries,
|
||||
+ long[] codeReturn)
|
||||
+ {
|
||||
+ long[] rval;
|
||||
+
|
||||
+ if( codeReturn == null || codeReturn.length < numEntries)
|
||||
+ rval = new long[ numEntries ];
|
||||
+ else
|
||||
+ rval = codeReturn;
|
||||
+
|
||||
+ System.arraycopy(fontSet, beginGlyphIndex, rval, 0, numEntries);
|
||||
+
|
||||
+ return rval;
|
||||
+ }
|
||||
+
|
||||
public Shape getGlyphLogicalBounds(int glyphIndex)
|
||||
{
|
||||
GlyphMetrics gm = getGlyphMetrics( glyphIndex );
|
||||
@@ -335,11 +391,10 @@ public class FreetypeGlyphVector extends
|
||||
|
||||
for(int i = 0; i < nGlyphs; i++)
|
||||
{
|
||||
- GlyphMetrics gm = (GlyphMetrics)
|
||||
- peer.getGlyphMetrics( glyphCodes[ i ] );
|
||||
+ GlyphMetrics gm = (GlyphMetrics)peer.getGlyphMetrics(glyphCodes[i]);
|
||||
if( gm == null )
|
||||
{
|
||||
- double[] val = getMetricsNative( glyphCodes[ i ] );
|
||||
+ double[] val = getMetricsNative(glyphCodes[i], fontSet[i]);
|
||||
if( val == null )
|
||||
gm = null;
|
||||
else
|
||||
@@ -374,7 +429,8 @@ public class FreetypeGlyphVector extends
|
||||
*/
|
||||
public Shape getGlyphOutline(int glyphIndex)
|
||||
{
|
||||
- GeneralPath gp = getGlyphOutlineNative( glyphCodes[ glyphIndex ] );
|
||||
+ GeneralPath gp = getGlyphOutlineNative(glyphCodes[glyphIndex],
|
||||
+ fontSet[glyphIndex]);
|
||||
if (glyphTransforms[glyphIndex] != null)
|
||||
gp.transform( glyphTransforms[glyphIndex]);
|
||||
|
||||
--- libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h 16 Mar 2007 15:14:53 -0000 1.17
|
||||
+++ libjava/classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h 2 Apr 2007 19:39:26 -0000 1.18
|
||||
@@ -22,7 +22,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jlong, jint);
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetLine (JNIEnv *env, jobject, jlong, jdouble, jint, jint, jdouble);
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetDash (JNIEnv *env, jobject, jlong, jdoubleArray, jint, jdouble);
|
||||
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jlong, jobject, jfloat, jfloat, jint, jintArray, jfloatArray);
|
||||
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector (JNIEnv *env, jobject, jlong, jobject, jfloat, jfloat, jint, jintArray, jfloatArray, jlongArray);
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoSetFont (JNIEnv *env, jobject, jlong, jobject);
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoRectangle (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble);
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoArc (JNIEnv *env, jobject, jlong, jdouble, jdouble, jdouble, jdouble, jdouble);
|
||||
--- libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h 11 Jun 2006 08:29:57 -0000 1.2
|
||||
+++ libjava/classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h 2 Apr 2007 21:28:58 -0000 1.4
|
||||
@@ -10,10 +10,12 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs (JNIEnv *env, jobject, jintArray);
|
||||
-JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning (JNIEnv *env, jobject, jint, jint);
|
||||
-JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint);
|
||||
-JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint);
|
||||
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs (JNIEnv *env, jobject, jintArray, jintArray, jlongArray);
|
||||
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning (JNIEnv *env, jobject, jint, jint, jlong);
|
||||
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint, jlong);
|
||||
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint, jlong);
|
||||
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose (JNIEnv *env, jobject, jlongArray);
|
||||
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer (JNIEnv *env, jobject, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--- libjava/classpath/native/jni/gtk-peer/gdkfont.h 21 Nov 2006 14:14:25 -0000 1.10
|
||||
+++ libjava/classpath/native/jni/gtk-peer/gdkfont.h 2 Apr 2007 19:39:26 -0000 1.11
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "gtkpeer.h"
|
||||
|
||||
+#define PANGO_ENABLE_ENGINE
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pango-context.h>
|
||||
#include <pango/pango-fontmap.h>
|
||||
@@ -123,6 +124,7 @@ extern struct state_table *cp_gtk_native
|
||||
struct peerfont
|
||||
{
|
||||
PangoFont *font;
|
||||
+ PangoFontset *set;
|
||||
PangoFontDescription *desc;
|
||||
PangoContext *ctx;
|
||||
PangoLayout *layout;
|
||||
--- libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c 16 Mar 2007 15:14:55 -0000 1.21
|
||||
+++ libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c 2 Apr 2007 19:39:26 -0000 1.22
|
||||
@@ -308,9 +308,8 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics
|
||||
jobject font,
|
||||
jfloat x, jfloat y, jint n,
|
||||
jintArray java_codes,
|
||||
- jfloatArray java_positions)
|
||||
+ jfloatArray java_positions, jlongArray java_fontset)
|
||||
{
|
||||
-
|
||||
struct cairographics2d *gr = NULL;
|
||||
struct peerfont *pfont = NULL;
|
||||
cairo_glyph_t *glyphs = NULL;
|
||||
@@ -333,6 +332,7 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics
|
||||
native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
|
||||
native_positions = (*env)->GetFloatArrayElements (env, java_positions, NULL);
|
||||
|
||||
+ /* Set up glyphs and layout */
|
||||
for (i = 0; i < n; ++i)
|
||||
{
|
||||
glyphs[i].index = native_codes[i];
|
||||
@@ -343,10 +343,31 @@ Java_gnu_java_awt_peer_gtk_CairoGraphics
|
||||
(*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
|
||||
(*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
|
||||
|
||||
- pango_fc_font_lock_face( (PangoFcFont *)pfont->font );
|
||||
- cairo_show_glyphs (gr->cr, glyphs, n);
|
||||
- pango_fc_font_unlock_face( (PangoFcFont *)pfont->font );
|
||||
+ /* Iterate through glyphs and draw */
|
||||
+ jlong* fonts = (*env)->GetLongArrayElements (env, java_fontset, NULL);
|
||||
+ for (i = 0; i < n; i++)
|
||||
+ {
|
||||
+ PangoFcFont *font = JLONG_TO_PTR(PangoFcFont, fonts[i]);
|
||||
+
|
||||
+ /* Draw as many glyphs as possible with the current font */
|
||||
+ int length = 0;
|
||||
+ while (i < n-1 && fonts[i] == fonts[i+1])
|
||||
+ {
|
||||
+ length++;
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
+ FT_Face face = pango_fc_font_lock_face( font );
|
||||
+ cairo_font_face_t *ft = cairo_ft_font_face_create_for_ft_face (face, 0);
|
||||
+ g_assert (ft != NULL);
|
||||
|
||||
+ cairo_set_font_face (gr->cr, ft);
|
||||
+ cairo_show_glyphs (gr->cr, &glyphs[i-length], length+1);
|
||||
+
|
||||
+ cairo_font_face_destroy (ft);
|
||||
+ pango_fc_font_unlock_face(font);
|
||||
+ }
|
||||
+
|
||||
g_free(glyphs);
|
||||
}
|
||||
|
||||
--- libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c 11 Jun 2006 11:31:03 -0000 1.4
|
||||
+++ libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c 2 Apr 2007 21:28:59 -0000 1.6
|
||||
@@ -35,6 +35,7 @@ this exception to your version of the li
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
+#define PANGO_ENABLE_ENGINE
|
||||
#include <jni.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
@@ -43,6 +44,7 @@ exception statement from your version. *
|
||||
#include <pango/pangofc-font.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
#include <freetype/ftoutln.h>
|
||||
+#include "jcl.h"
|
||||
#include "native_state.h"
|
||||
#include "gdkfont.h"
|
||||
#include "gnu_java_awt_peer_gtk_FreetypeGlyphVector.h"
|
||||
@@ -81,42 +83,92 @@ getFont(JNIEnv *env, jobject obj)
|
||||
return (PangoFcFont *)pfont->font;
|
||||
}
|
||||
|
||||
-JNIEXPORT jintArray JNICALL
|
||||
+static PangoFontset *
|
||||
+getFontSet(JNIEnv *env, jobject obj)
|
||||
+{
|
||||
+ jfieldID fid;
|
||||
+ jobject data;
|
||||
+ jclass cls;
|
||||
+ struct peerfont *pfont;
|
||||
+
|
||||
+ cls = (*env)->GetObjectClass (env, obj);
|
||||
+ fid = (*env)->GetFieldID (env, cls, "peer",
|
||||
+ "Lgnu/java/awt/peer/gtk/GdkFontPeer;");
|
||||
+ g_assert (fid != 0);
|
||||
+
|
||||
+ data = (*env)->GetObjectField (env, obj, fid);
|
||||
+ g_assert (data != NULL);
|
||||
+
|
||||
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, data);
|
||||
+ g_assert (pfont != NULL);
|
||||
+ g_assert (pfont->font != NULL);
|
||||
+
|
||||
+ return (PangoFontset *)pfont->set;
|
||||
+}
|
||||
+
|
||||
+JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
|
||||
- (JNIEnv *env, jobject obj, jintArray codepoints)
|
||||
+ (JNIEnv *env, jobject obj, jintArray codepoints, jintArray glyphs,
|
||||
+ jlongArray fonts)
|
||||
{
|
||||
- FT_Face ft_face;
|
||||
- jintArray retArray;
|
||||
- PangoFcFont *font;
|
||||
- jint *values, *cpvals;
|
||||
+ PangoFcFont *default_font, *current_font;
|
||||
+ PangoFontset *pfs;
|
||||
+ jint *cpvals;
|
||||
jint length;
|
||||
int i;
|
||||
|
||||
- font = getFont(env, obj);
|
||||
-
|
||||
- ft_face = pango_fc_font_lock_face( font );
|
||||
- g_assert (ft_face != NULL);
|
||||
+ /* Set up default font and fontset */
|
||||
+ default_font = getFont(env, obj);
|
||||
+ current_font = default_font;
|
||||
+ pfs = getFontSet(env, obj);
|
||||
|
||||
+ /* Retrieve string information */
|
||||
length = (*env)->GetArrayLength (env, codepoints);
|
||||
cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
|
||||
+
|
||||
+ jint *glyphArray = (*env)->GetIntArrayElements (env, glyphs, NULL);
|
||||
+ jlong *fontArray = (*env)->GetLongArrayElements (env, fonts, NULL);
|
||||
|
||||
- retArray = (*env)->NewIntArray (env, length);
|
||||
- values = (*env)->GetIntArrayElements (env, retArray, NULL);
|
||||
+ /* A design goal of Pango is to be threadsafe, but it's admitted that it is
|
||||
+ * not actually threadsafe at the moment. Using gdk locking here to be safe,
|
||||
+ * but I don't know if if actually helps at all... */
|
||||
+ gdk_threads_enter();
|
||||
|
||||
for( i = 0; i < length; i++ )
|
||||
- values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
|
||||
+ {
|
||||
+ /* Ensure the current font has the requested character; if it doesn't,
|
||||
+ * try the default font before pulling a new font out of the fontset.
|
||||
+ * Once chosen, a font will be used until a character not in the font is
|
||||
+ * encountered. */
|
||||
+ if (!pango_fc_font_has_char(current_font, cpvals[i]))
|
||||
+ {
|
||||
+ if (pango_fc_font_has_char(default_font, cpvals[i]))
|
||||
+ {
|
||||
+ current_font = default_font;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ current_font = (PangoFcFont*)pango_fontset_get_font(pfs, cpvals[i]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Get glyph, and store both glyph and pointer to font */
|
||||
+ glyphArray[i] = (int)pango_fc_font_get_glyph(current_font,
|
||||
+ (gunichar)cpvals[i]);
|
||||
+ g_object_ref(current_font);
|
||||
+ fontArray[i] = PTR_TO_JLONG(current_font);
|
||||
+ }
|
||||
+
|
||||
+ gdk_threads_leave();
|
||||
|
||||
- (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
|
||||
+ (*env)->ReleaseIntArrayElements (env, glyphs, glyphArray, 0);
|
||||
(*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
|
||||
-
|
||||
- pango_fc_font_unlock_face (font);
|
||||
-
|
||||
- return retArray;
|
||||
+ (*env)->ReleaseLongArrayElements (env, fonts, fontArray, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKerning
|
||||
-(JNIEnv *env, jobject obj, jint rightGlyph, jint leftGlyph)
|
||||
+(JNIEnv *env, jobject obj __attribute__((unused)), jint rightGlyph, jint leftGlyph, jlong fnt)
|
||||
{
|
||||
FT_Face ft_face;
|
||||
FT_Vector kern;
|
||||
@@ -125,7 +177,7 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyph
|
||||
jvalue values[2];
|
||||
PangoFcFont *font;
|
||||
|
||||
- font = getFont(env, obj);
|
||||
+ font = JLONG_TO_PTR(PangoFcFont, fnt);
|
||||
ft_face = pango_fc_font_lock_face( font );
|
||||
g_assert (ft_face != NULL);
|
||||
FT_Get_Kerning( ft_face, rightGlyph, leftGlyph, FT_KERNING_DEFAULT, &kern );
|
||||
@@ -142,14 +194,14 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyph
|
||||
|
||||
JNIEXPORT jdoubleArray JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
|
||||
-(JNIEnv *env, jobject obj, jint glyphIndex )
|
||||
+(JNIEnv *env, jobject obj __attribute__((unused)), jint glyphIndex, jlong fnt)
|
||||
{
|
||||
FT_Face ft_face;
|
||||
jdouble *values;
|
||||
jdoubleArray retArray = NULL;
|
||||
PangoFcFont *font;
|
||||
|
||||
- font = getFont(env, obj);
|
||||
+ font = JLONG_TO_PTR(PangoFcFont, fnt);
|
||||
ft_face = pango_fc_font_lock_face( font );
|
||||
|
||||
g_assert (ft_face != NULL);
|
||||
@@ -285,7 +337,7 @@ static int _curveTo( const FT_Vector* c
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative
|
||||
- (JNIEnv *env, jobject obj, jint glyphIndex)
|
||||
+ (JNIEnv *env, jobject obj __attribute__((unused)), jint glyphIndex, jlong fnt)
|
||||
{
|
||||
generalpath *path;
|
||||
jobject gp;
|
||||
@@ -302,7 +354,7 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyph
|
||||
FT_Face ft_face;
|
||||
FT_Glyph glyph;
|
||||
|
||||
- font = getFont(env, obj);
|
||||
+ font = JLONG_TO_PTR(PangoFcFont, fnt);
|
||||
ft_face = pango_fc_font_lock_face( font );
|
||||
|
||||
g_assert (ft_face != NULL);
|
||||
@@ -345,4 +397,39 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyph
|
||||
return gp;
|
||||
}
|
||||
|
||||
+JNIEXPORT void JNICALL
|
||||
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose
|
||||
+ (JNIEnv *env, jobject obj __attribute__((unused)), jlongArray fontset)
|
||||
+{
|
||||
+ PangoFcFont *font;
|
||||
+ jlong *fontArray;
|
||||
+ int i, length;
|
||||
|
||||
+ length = (*env)->GetArrayLength (env, fontset);
|
||||
+ fontArray = (*env)->GetLongArrayElements (env, fontset, NULL);
|
||||
+
|
||||
+ gdk_threads_enter();
|
||||
+
|
||||
+ for( i = 0; i < length; i++ )
|
||||
+ {
|
||||
+ font = JLONG_TO_PTR(PangoFcFont, fontArray[i]);
|
||||
+ g_object_unref(font);
|
||||
+ }
|
||||
+
|
||||
+ gdk_threads_leave();
|
||||
+
|
||||
+ (*env)->ReleaseLongArrayElements (env, fontset, fontArray, 0);
|
||||
+}
|
||||
+
|
||||
+JNIEXPORT jlong JNICALL
|
||||
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer
|
||||
+ (JNIEnv *env, jobject obj, jint n)
|
||||
+{
|
||||
+ int i;
|
||||
+ PangoFcFont *font = getFont(env, obj);
|
||||
+
|
||||
+ for (i = 0; i < n; i++)
|
||||
+ g_object_ref(font);
|
||||
+
|
||||
+ return PTR_TO_JLONG(font);
|
||||
+}
|
||||
--- libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 26 Feb 2007 22:11:38 -0000 1.22
|
||||
+++ libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c 2 Apr 2007 19:39:26 -0000 1.23
|
||||
@@ -35,6 +35,7 @@
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
+#define PANGO_ENABLE_ENGINE
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pangoft2.h>
|
||||
#include <pango/pangofc-font.h>
|
||||
@@ -97,6 +98,8 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_d
|
||||
g_object_unref (pfont->layout);
|
||||
if (pfont->font != NULL)
|
||||
g_object_unref (pfont->font);
|
||||
+ if (pfont->set != NULL)
|
||||
+ g_object_unref (pfont->set);
|
||||
if (pfont->ctx != NULL)
|
||||
g_object_unref (pfont->ctx);
|
||||
if (pfont->desc != NULL)
|
||||
@@ -257,6 +260,8 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s
|
||||
g_object_unref (pfont->ctx);
|
||||
if (pfont->font != NULL)
|
||||
g_object_unref (pfont->font);
|
||||
+ if (pfont->set != NULL)
|
||||
+ g_object_unref (pfont->set);
|
||||
if (pfont->desc != NULL)
|
||||
pango_font_description_free (pfont->desc);
|
||||
|
||||
@@ -268,7 +273,6 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s
|
||||
pango_font_description_set_family (pfont->desc, family_name);
|
||||
(*env)->ReleaseStringUTFChars(env, family_name_str, family_name);
|
||||
|
||||
-
|
||||
if (style & java_awt_font_BOLD)
|
||||
pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD);
|
||||
|
||||
@@ -293,6 +297,8 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_s
|
||||
|
||||
pango_context_set_font_description (pfont->ctx, pfont->desc);
|
||||
pango_context_set_language (pfont->ctx, gtk_get_default_language());
|
||||
+ pfont->set = pango_context_load_fontset(pfont->ctx, pfont->desc,
|
||||
+ gtk_get_default_language());
|
||||
pfont->font = pango_context_load_font (pfont->ctx, pfont->desc);
|
||||
g_assert (pfont->font != NULL);
|
||||
|
33
gcc41-tls-data-alignment.patch
Normal file
33
gcc41-tls-data-alignment.patch
Normal file
@ -0,0 +1,33 @@
|
||||
2007-05-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* varasm.c (align_variable): Don't increase alignment for
|
||||
DECL_THREAD_LOCAL_P variables above BITS_PER_WORD through
|
||||
DATA_ALIGNMENT or CONSTANT_ALIGNMENT.
|
||||
|
||||
--- gcc/varasm.c.jj 2007-04-14 14:55:25.000000000 +0200
|
||||
+++ gcc/varasm.c 2007-05-03 11:23:56.000000000 +0200
|
||||
@@ -1097,11 +1097,22 @@ align_variable (tree decl, bool dont_out
|
||||
if (! DECL_USER_ALIGN (decl))
|
||||
{
|
||||
#ifdef DATA_ALIGNMENT
|
||||
- align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
|
||||
+ unsigned int data_align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
|
||||
+ /* Don't increase alignment too much for TLS variables - TLS space
|
||||
+ is too precious. */
|
||||
+ if (! DECL_THREAD_LOCAL_P (decl) || data_align <= BITS_PER_WORD)
|
||||
+ align = data_align;
|
||||
#endif
|
||||
#ifdef CONSTANT_ALIGNMENT
|
||||
if (DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != error_mark_node)
|
||||
- align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);
|
||||
+ {
|
||||
+ unsigned int const_align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl),
|
||||
+ align);
|
||||
+ /* Don't increase alignment too much for TLS variables - TLS space
|
||||
+ is too precious. */
|
||||
+ if (! DECL_THREAD_LOCAL_P (decl) || const_align <= BITS_PER_WORD)
|
||||
+ align = const_align;
|
||||
+ }
|
||||
#endif
|
||||
}
|
||||
|
33
gcc41.spec
33
gcc41.spec
@ -1,6 +1,6 @@
|
||||
%define DATE 20070424
|
||||
%define DATE 20070503
|
||||
%define gcc_version 4.1.2
|
||||
%define gcc_release 11
|
||||
%define gcc_release 12
|
||||
%define _unpackaged_files_terminate_build 0
|
||||
%define multilib_64_archs sparc64 ppc64 s390x x86_64
|
||||
%define include_gappletviewer 1
|
||||
@ -137,12 +137,14 @@ Patch25: gcc41-pr29299.patch
|
||||
Patch26: gcc41-java-bogus-debugline.patch
|
||||
Patch27: gcc41-libjava-visibility.patch
|
||||
Patch28: gcc41-pr31187.patch
|
||||
Patch29: gcc41-rh231818.patch
|
||||
Patch29: gcc41-dtor-relro.patch
|
||||
Patch30: gcc41-rh234515.patch
|
||||
Patch31: gcc41-pr30558.patch
|
||||
Patch31: gcc41-libgomp-ncpus.patch
|
||||
Patch32: gcc41-rh236895.patch
|
||||
Patch33: gcc41-pr31598.patch
|
||||
Patch33: gcc41-pr28482.patch
|
||||
Patch34: gcc41-rh235008.patch
|
||||
Patch35: gcc41-pr31748.patch
|
||||
Patch36: gcc41-tls-data-alignment.patch
|
||||
|
||||
%define _gnu %{nil}
|
||||
%ifarch sparc
|
||||
@ -450,12 +452,14 @@ which are required to run programs compiled with the GNAT.
|
||||
%patch26 -p0 -b .java-bogus-debugline~
|
||||
%patch27 -p0 -b .libjava-visibility~
|
||||
%patch28 -p0 -b .pr31187~
|
||||
%patch29 -p0 -b .rh231818~
|
||||
%patch29 -p0 -b .dtor-relro~
|
||||
%patch30 -p0 -b .rh234515~
|
||||
%patch31 -p0 -b .pr30558~
|
||||
%patch31 -p0 -b .libgomp-ncpus~
|
||||
%patch32 -p0 -b .rh236895~
|
||||
%patch33 -p0 -b .pr31598~
|
||||
%patch33 -p0 -b .pr28482~
|
||||
%patch34 -p0 -b .rh235008~
|
||||
%patch35 -p0 -b .pr31748~
|
||||
%patch36 -p0 -b .tls-data-alignment~
|
||||
|
||||
sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c
|
||||
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
|
||||
@ -1579,6 +1583,19 @@ fi
|
||||
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
|
||||
|
||||
%changelog
|
||||
* Thu May 3 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-12
|
||||
- update from gcc-4_1-branch (-r124100:124365)
|
||||
- PRs c++/30016, c++/30221, middle-end/30761, target/18989,
|
||||
target/28675, tree-optimization/29446, tree-optimization/31698
|
||||
- add default.css Java resource (Tom Fitzsimmons, #237304)
|
||||
- don't increase alignment of TLS variables too much
|
||||
- __do_global_dtors_aux hardening
|
||||
- allow libgomp to be dlopened (PR libgomp/28482)
|
||||
- speed up and improve libgomp omp_get_num_procs and dynamic
|
||||
thread count computation
|
||||
- GOMP_CPU_AFFINITY support
|
||||
- fix ICE on C++ type passed as OpenMP clause variable (PR c++/31748)
|
||||
|
||||
* Wed Apr 25 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-11
|
||||
- update from gcc-4_1-branch (-r123951:124100)
|
||||
- PRs middle-end/31448, preprocessor/30468, target/28623, target/31641
|
||||
|
Loading…
Reference in New Issue
Block a user