bugKawa - Bugs: bug #15151, (slot-ref obj 'class) gives...

 
 

bug #15151: (slot-ref obj 'class) gives different result than (invoke obj 'getClass)

Submitted by:  Dean Ferreyra <dferreyra>
Submitted on:  Tue 06 Dec 2005 12:20:30 AM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Unexpected resultStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 06 Dec 2005 07:58:56 AM UTC, comment #1:

Oops. The intent of the code is to handle (CLASS:.class),
and (static-field CLASS 'class). But it doesn't work for
for non-static field accesses. It does happen to work
in apply, when we know the actual type, but not compile.

It might be reasonable to suppress the translation of
(field OBJECT 'class) -> (invoke OBJECT 'getClass)
since I'm not sure "class" should be considered a
"property" of the OBJECT, in teh JavaBean sense.

I checked in the patch and a test-case. The tricky
part was actually the test-case, because it triggered
a completely unrelated bug that I felt compelled to fix.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Tue 06 Dec 2005 12:20:30 AM UTC, original submission:

Here's a snippet of code that demonstrates this:

(module-static #t)

(define o (make <java.util.Date>))

(display (format "slot-ref class: ~A~%" (slot-ref o 'class)))
(display (format "getClass(): ~A~%" (invoke o 'getClass)))

When I execute the resulting class, I get:

slot-ref class: class java.lang.Object
getClass(): class java.util.Date

Looking at the byte-code, it looks like the slot-ref is being optimized directly to class java.lang.Object.

We were afraid that this might have larger implications, though I see now that SlotGet.java treats 'class as a special case.

Dean Ferreyra <dferreyra>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #2495:  class-slot.patch added by bothner (633B - application/octet-stream - Patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Tue 06 Dec 2005 07:58:56 AM UTCbothnerStatusNone=>Fixed
  Assigned toNone=>bothner
  Open/ClosedOpen=>Closed
  Attached File-=>Added class-slot.patch, #3164

Back to the top


Powered by Savane 3.1-cleanup1