Clojure

map->R returns different class when invoked from AOT code

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.3, Release 1.4, Release 1.5, Release 1.6
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    Mac OS X 10.5, lein 1.7 and lein 2.0

Description

Compiling a class via `deftype` during AOT compilation gives different results for the different constructors. These hashes should be identical.

user=> (binding [*compile-files* true] (eval '(deftype Abc [])))
user.Abc
user=> (hash Abc)
16446700
user=> (hash (class (->Abc)))
31966239

Activity

Alex Miller made changes -
Field Original Value New Value
Labels aot
Alex Miller made changes -
Description (defrecord Dontwork [a])

(= (type (Dontwork. nil))
   (type (map->Dontwork {:a 1})))

Will return true if the namespace is not AOT compiled and false if it is.

I have created a small example project with AOT and non-AOT namespaces to demonstrate
https://github.com/ejackson/aotquestion


{code}
(defrecord Dontwork [a])

(= (type (Dontwork. nil))
   (type (map->Dontwork {:a 1})))
{code}

Will return true if the namespace is not AOT compiled and false if it is.

I have created a small example project with AOT and non-AOT namespaces to demonstrate
https://github.com/ejackson/aotquestion


Summary map->R returns different class when invoked from AOT ccode map->R returns different class when invoked from AOT code
Ambrose Bonnaire-Sergeant made changes -
Attachment clj-979-symptoms.patch [ 12903 ]
Ambrose Bonnaire-Sergeant made changes -
Description {code}
(defrecord Dontwork [a])

(= (type (Dontwork. nil))
   (type (map->Dontwork {:a 1})))
{code}

Will return true if the namespace is not AOT compiled and false if it is.

I have created a small example project with AOT and non-AOT namespaces to demonstrate
https://github.com/ejackson/aotquestion


Compiling a class via `deftype` during AOT compilation gives different results for the different constructors. These hashes should be identical.

{code}
user=> (binding [*compile-files* true] (eval '(deftype Abc [])))
user.Abc
user=> (hash Abc)
16446700
user=> (hash (class (->Abc)))
31966239
{code}
Affects Version/s Release 1.6 [ 10157 ]
Affects Version/s Release 1.5 [ 10150 ]

People

Vote (1)
Watch (4)

Dates

  • Created:
    Updated: