diff options
author | glewis <glewis@FreeBSD.org> | 2004-10-17 01:12:22 +0800 |
---|---|---|
committer | glewis <glewis@FreeBSD.org> | 2004-10-17 01:12:22 +0800 |
commit | 2a4ef02e1ae89be3762e267b38cc660e6b68f42e (patch) | |
tree | 1165bb7095f1897b69d371e201943e6e0d678992 /java | |
parent | b1804bdc3a68d3bc73616e302657824e77399226 (diff) | |
download | freebsd-ports-gnome-2a4ef02e1ae89be3762e267b38cc660e6b68f42e.tar.gz freebsd-ports-gnome-2a4ef02e1ae89be3762e267b38cc660e6b68f42e.tar.zst freebsd-ports-gnome-2a4ef02e1ae89be3762e267b38cc660e6b68f42e.zip |
. Fix the Server VM for gcc 3.4 part 1/2.
The HotSpot code (ab)uses named enums as ints in a number of places.
The problem with this is that according the the C++ spec, the compiler
(essentially) only needs to use an integral type wide enough to hold
the values defined in the enum. Earlier versions of gcc appear to have
just used an int whether they could have got away with a narrower type
or not, hence the code worked as expected. gcc 3.4 now appears to
implement this part of the spec, so using an enum blindly as an int
causes various problems due to overflow.
This case is particularly bogus since the enums are merely to define
a named integral type within a class (VMReg::Name doesn't even have
any values enumerated in the declaration). So, convert these two
enums to simply be typedef'ed ints.
Sleuth work, discussion and code suggestions: peadar
Diffstat (limited to 'java')
-rw-r--r-- | java/jdk14/files/patch-interpreter_shared.hpp | 38 | ||||
-rw-r--r-- | java/jdk15/files/patch-interpreter_shared.hpp | 38 | ||||
-rw-r--r-- | java/jdk16/files/patch-interpreter_shared.hpp | 38 |
3 files changed, 114 insertions, 0 deletions
diff --git a/java/jdk14/files/patch-interpreter_shared.hpp b/java/jdk14/files/patch-interpreter_shared.hpp new file mode 100644 index 000000000000..25feb1ff8da9 --- /dev/null +++ b/java/jdk14/files/patch-interpreter_shared.hpp @@ -0,0 +1,38 @@ +$FreeBSD$ + +--- ../../hotspot/src/share/vm/interpreter/shared.hpp 22 Oct 2003 23:05:05 -0000 1.1.1.2 ++++ ../../hotspot/src/share/vm/interpreter/shared.hpp 10 Oct 2004 05:03:55 -0000 +@@ -41,19 +41,17 @@ + // to control the C++ namespace. + class OptoReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { +- // Chunk 0 ++ typedef int Name; + #ifdef COMPILER2 +- Physical = AdlcVMDeps::Physical, // Start of physical regs ++ static const Name Physical = AdlcVMDeps::Physical; // Start of physical regs + #endif + // A few oddballs at the edge of the world +- Special = -2, // All special (not allocated) values +- Bad = -1 // Not a register +- }; ++ static const Name Special = -2; // All special (not allocated) values ++ static const Name Bad = -1; // Not a register + + // Increment a register number. As in: + // "for ( OptoReg::Name i; i=Control; i = add(i,1) ) ..." +- static Name add( Name x, int y ) { return Name(x+y); } ++ static Name add( Name x, int y ) { return (x+y); } + + // (We would like to have an operator+ for RegName, but it is not + // a class, so this would be illegal in C++.) +@@ -70,7 +68,7 @@ + // when we do not yet know how big the frame will be. + class VMReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { }; ++ typedef int Name; + }; + + diff --git a/java/jdk15/files/patch-interpreter_shared.hpp b/java/jdk15/files/patch-interpreter_shared.hpp new file mode 100644 index 000000000000..25feb1ff8da9 --- /dev/null +++ b/java/jdk15/files/patch-interpreter_shared.hpp @@ -0,0 +1,38 @@ +$FreeBSD$ + +--- ../../hotspot/src/share/vm/interpreter/shared.hpp 22 Oct 2003 23:05:05 -0000 1.1.1.2 ++++ ../../hotspot/src/share/vm/interpreter/shared.hpp 10 Oct 2004 05:03:55 -0000 +@@ -41,19 +41,17 @@ + // to control the C++ namespace. + class OptoReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { +- // Chunk 0 ++ typedef int Name; + #ifdef COMPILER2 +- Physical = AdlcVMDeps::Physical, // Start of physical regs ++ static const Name Physical = AdlcVMDeps::Physical; // Start of physical regs + #endif + // A few oddballs at the edge of the world +- Special = -2, // All special (not allocated) values +- Bad = -1 // Not a register +- }; ++ static const Name Special = -2; // All special (not allocated) values ++ static const Name Bad = -1; // Not a register + + // Increment a register number. As in: + // "for ( OptoReg::Name i; i=Control; i = add(i,1) ) ..." +- static Name add( Name x, int y ) { return Name(x+y); } ++ static Name add( Name x, int y ) { return (x+y); } + + // (We would like to have an operator+ for RegName, but it is not + // a class, so this would be illegal in C++.) +@@ -70,7 +68,7 @@ + // when we do not yet know how big the frame will be. + class VMReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { }; ++ typedef int Name; + }; + + diff --git a/java/jdk16/files/patch-interpreter_shared.hpp b/java/jdk16/files/patch-interpreter_shared.hpp new file mode 100644 index 000000000000..25feb1ff8da9 --- /dev/null +++ b/java/jdk16/files/patch-interpreter_shared.hpp @@ -0,0 +1,38 @@ +$FreeBSD$ + +--- ../../hotspot/src/share/vm/interpreter/shared.hpp 22 Oct 2003 23:05:05 -0000 1.1.1.2 ++++ ../../hotspot/src/share/vm/interpreter/shared.hpp 10 Oct 2004 05:03:55 -0000 +@@ -41,19 +41,17 @@ + // to control the C++ namespace. + class OptoReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { +- // Chunk 0 ++ typedef int Name; + #ifdef COMPILER2 +- Physical = AdlcVMDeps::Physical, // Start of physical regs ++ static const Name Physical = AdlcVMDeps::Physical; // Start of physical regs + #endif + // A few oddballs at the edge of the world +- Special = -2, // All special (not allocated) values +- Bad = -1 // Not a register +- }; ++ static const Name Special = -2; // All special (not allocated) values ++ static const Name Bad = -1; // Not a register + + // Increment a register number. As in: + // "for ( OptoReg::Name i; i=Control; i = add(i,1) ) ..." +- static Name add( Name x, int y ) { return Name(x+y); } ++ static Name add( Name x, int y ) { return (x+y); } + + // (We would like to have an operator+ for RegName, but it is not + // a class, so this would be illegal in C++.) +@@ -70,7 +68,7 @@ + // when we do not yet know how big the frame will be. + class VMReg VALUE_OBJ_CLASS_SPEC { + public: +- enum Name { }; ++ typedef int Name; + }; + + |