Issue Details (XML | Word | Printable)

Key: RVM-368
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Ian Rogers
Reporter: Yuval Yarom
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
RVM

Compiler confusion over equal but non-identical objects

Created: 06/Feb/08 03:12 AM   Updated: 09/Feb/08 04:18 AM
Component/s: Compiler: Optimizing
Affects Version/s: 2.9.2
Fix Version/s: 2.9.3

Time Tracking:
Not Specified

File Attachments: 1. Java Source File Confusion.java (0.7 kB)
2. File patch.diff (3 kB)
3. File patch2.diff (3 kB)

Issue Links:
Related
 

Testcase included: yes
Patch Submitted: Yes


 Description  « Hide
When the optimising compiler folds a chain of final references it may substitute the target of the references chain with an equal but non-identical object.

The attached patch against 2.9.2 fixes this by changing VM_Statics.objectLiterals to use identity instead of equality. While this corrects the problem it may or may not be the best way of solving it.

STATEMENT OF ORIGIN FOR A SINGLE CONTRIBUTOR
I, Yuval Yarom:

(a) represent that either:

I am the only author and owner of the contributed software
(described as/entitled fixing runtime package isolation),
which was neither derived nor copied from any other software,
or

(ii) that any exception to is software which was obtained under the
CPL (Common Public License),

and

(b) hereby agree to license this contributed software under the CPL.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ian Rogers added a comment - 06/Feb/08 05:49 AM
I agree with the problem and that the fix should solve it, however, it seems ugly to me to put an identity hash map implementation in to the already crowded VM_Statics. We could refactor VM_HashMap so that it has an overridable means of determining whether two values are equal and then create an identity hash map that overrides this method (to use == instead of .equals). We can then change the map for objects in VM_Statics to use an identity hashmap rather than a regular hashmap, and the rest of the code in VM_Statics can remain unchanged.

Yuval Yarom added a comment - 06/Feb/08 06:28 AM
A second fix - following Ian's comment.

Ian Rogers added a comment - 06/Feb/08 07:27 AM
Thanks Yuval, this change appears to be exposing a latent bug in the boot image in DaCapo's jython. I'm looking into it, here's the trace:

WARNING: bad level 'INFO'
java.lang.IllegalArgumentException: Not the name of a standard logging level: "INFO"
at java.util.logging.Level.parse(Level.java:363)
at java.util.logging.LogManager.readConfiguration(LogManager.java:593)
at java.util.logging.LogManager.readConfiguration(LogManager.java:527)
at java.util.logging.LogManager.initLogManager(LogManager.java:203)
at java.util.logging.LogManager.getLogManager(LogManager.java:168)
at java.util.logging.Logger.getLogger(Logger.java:276)
at java.util.logging.Logger.getLogger(Logger.java:224)
at java.util.logging.Logger$1.run(Logger.java:91)
at java.security.AccessController.doPrivileged(AccessController.java:96)
at java.util.logging.Logger.<clinit>(Logger.java:86)
at org.jikesrvm.VM.runClassInitializer(VM.java:475)
at org.jikesrvm.VM.finishBooting(VM.java:349)
at org.jikesrvm.VM.boot(VM.java:151)
sys-package-mgr: processing new jar, '/home/antigua/IanR/workspace/ligen/jikesrvm/components/dacapo/2006-10-MR2/dacapo.jar'
sys-package-mgr: processing new jar, '/home/antigua/IanR/workspace/ligen/jikesrvm/dist/development_ia32-linux/jksvm.jar'
sys-package-mgr: processing new jar, '/home/antigua/IanR/workspace/ligen/jikesrvm/dist/development_ia32-linux/rvmrt.jar'
error importing site
Traceback (innermost last):
File "/home/antigua/IanR/workspace/ligen/jikesrvm/./scratch/jython/Lib/site.py", line 66, in ?
AttributeError: 'stringmap' object has no attribute 'values'


Ian Rogers added a comment - 06/Feb/08 08:53 AM
So the problem is that VM_Statics.findStringLiteral is broken after this change, it's at least broken for Strings from the bootstrap compared to those created in the running VM.. we call findStringLiteral from java.lang.VMString.intern. I'm trying to think of the best fix.

Ian Rogers added a comment - 06/Feb/08 03:49 PM
Patch and fix to interning committed in r13956.