Boolean.TRUE == Boolean.TRUE

View: New views
10 Messages — Rating Filter:   Alert me  

Boolean.TRUE == Boolean.TRUE

by Paul Stadig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by teck-terracotta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Thanks Paul, sounds like there are two TC bugs in there:

 

1)       Can’t make Boolean.TRUE into a root. I’ll have to look into what is going wrong with that one. I suspect something about java.lang.Boolean being in the bootclasspath is part of the problem. It *might* work to list it in <additional-boot-jar-classes> in addition to defining the root. That said I don’t think this is proper solution to your issue.

2)       We don’t seem to be using the valueOf() methods for materializing instances of primitive wrapper objects (eg. Integer, Boolean, etc). That is pretty dumb and probably a bit of legacy from the jdk 1.4 days (which didn’t have valueOf() for all types).

 

I’ll enter some bugs in our JIRA about these.

 

I’m struggling to come up with easy workarounds in the short term. If it is possible to replace usage of Boolean in the code then you an create your own boolean type and then roots should work fine there – or use little “b” Booleans. I could easily be proposing a massive or impossible change so bear with me :-)

 

 

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by teck-terracotta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by Hung Huynh-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Before I tried (1), I looked at the bootjar and Boolean class is added uninstrumented. Found this in BootJarTool

this.bootJar.loadClassIntoJar("java.lang.Boolean", getSystemBytes("java.lang.Boolean"), false);

The "false" flag means adding it uninstrumented.

So even I explicitly added it to bootjar and instrument java.lang.Boolean through tc-config.xml, it still doesn't work (not instrumented)

Hung-

Tim Eck wrote:

Thanks Paul, sounds like there are two TC bugs in there:

 

1)       Can’t make Boolean.TRUE into a root. I’ll have to look into what is going wrong with that one. I suspect something about java.lang.Boolean being in the bootclasspath is part of the problem. It *might* work to list it in <additional-boot-jar-classes> in addition to defining the root. That said I don’t think this is proper solution to your issue.

2)       We don’t seem to be using the valueOf() methods for materializing instances of primitive wrapper objects (eg. Integer, Boolean, etc). That is pretty dumb and probably a bit of legacy from the jdk 1.4 days (which didn’t have valueOf() for all types).

 

I’ll enter some bugs in our JIRA about these.

 

I’m struggling to come up with easy workarounds in the short term. If it is possible to replace usage of Boolean in the code then you an create your own boolean type and then roots should work fine there – or use little “b” Booleans. I could easily be proposing a massive or impossible change so bear with me :-)

 

 

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________ tc-users mailing list tc-users@... http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by Paul Stadig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm able to workaround it at the moment by modifying the Clojure compiler to call booleanValue when it compares Booleans, which works, but causes a performance penalty. I think that the best solution would be able to root Boolean.TRUE/FALSE.


Paul

2009/4/2 Tim Eck <teck@...>

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:



Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users



_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by Paul Stadig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried using <additional-boot-jar-classes>, too, and it didn't work for me either.


Paul

2009/4/2 Hung Huynh <hhuynh@...>
Before I tried (1), I looked at the bootjar and Boolean class is added uninstrumented. Found this in BootJarTool

this.bootJar.loadClassIntoJar("java.lang.Boolean", getSystemBytes("java.lang.Boolean"), false);

The "false" flag means adding it uninstrumented.

So even I explicitly added it to bootjar and instrument java.lang.Boolean through tc-config.xml, it still doesn't work (not instrumented)

Hung-

Tim Eck wrote:

Thanks Paul, sounds like there are two TC bugs in there:

 

1)       Can’t make Boolean.TRUE into a root. I’ll have to look into what is going wrong with that one. I suspect something about java.lang.Boolean being in the bootclasspath is part of the problem. It *might* work to list it in <additional-boot-jar-classes> in addition to defining the root. That said I don’t think this is proper solution to your issue.

2)       We don’t seem to be using the valueOf() methods for materializing instances of primitive wrapper objects (eg. Integer, Boolean, etc). That is pretty dumb and probably a bit of legacy from the jdk 1.4 days (which didn’t have valueOf() for all types).

 

I’ll enter some bugs in our JIRA about these.

 

I’m struggling to come up with easy workarounds in the short term. If it is possible to replace usage of Boolean in the code then you an create your own boolean type and then roots should work fine there – or use little “b” Booleans. I could easily be proposing a massive or impossible change so bear with me :-)

 

 

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________ tc-users mailing list http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users



_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by teck-terracotta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Glad to hear you have a workaround. I fully intend on changing our code to use Boolean.valueOf() when materializing objects who have field values of type java.lang.Boolean. One really should be able to do reference equality checks on Boolean. I don’t really feel the same way about things like Integer even though it can work for small values [-128..127]

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 1:12 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm able to workaround it at the moment by modifying the Clojure compiler to call booleanValue when it compares Booleans, which works, but causes a performance penalty. I think that the best solution would be able to root Boolean.TRUE/FALSE.


Paul

2009/4/2 Tim Eck <teck@...>

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:



Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by Alex Miller-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
+1 on Boolean.  I think I would argue the same for Integer too, if only to reuse the cached values for memory savings.


On Apr 2, 2009, at 3:16 PM, Tim Eck wrote:

Glad to hear you have a workaround. I fully intend on changing our code to use Boolean.valueOf() when materializing objects who have field values of type java.lang.Boolean. One really should be able to do reference equality checks on Boolean. I don’t really feel the same way about things like Integer even though it can work for small values [-128..127]

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 1:12 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm able to workaround it at the moment by modifying the Clojure compiler to call booleanValue when it compares Booleans, which works, but causes a performance penalty. I think that the best solution would be able to root Boolean.TRUE/FALSE.


Paul

2009/4/2 Tim Eck <teck@...>

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:



Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by teck-terracotta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Right-o. I’m going to change our code to use valueOf() for all types. It was worded poorly, but what I meant to say is that I don’t think one should ever do reference equality checks on Integer (even though it can work in some cases). The memory savings can make a big difference depending on usage for sure.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Alex Miller
Sent: Thursday, April 02, 2009 1:21 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

+1 on Boolean.  I think I would argue the same for Integer too, if only to reuse the cached values for memory savings.

 

 

On Apr 2, 2009, at 3:16 PM, Tim Eck wrote:



Glad to hear you have a workaround. I fully intend on changing our code to use Boolean.valueOf() when materializing objects who have field values of type java.lang.Boolean. One really should be able to do reference equality checks on Boolean. I don’t really feel the same way about things like Integer even though it can work for small values [-128..127]

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 1:12 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm able to workaround it at the moment by modifying the Clojure compiler to call booleanValue when it compares Booleans, which works, but causes a performance penalty. I think that the best solution would be able to root Boolean.TRUE/FALSE.


Paul

2009/4/2 Tim Eck <teck@...>

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:



Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Boolean.TRUE == Boolean.TRUE

by Alex Miller-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
+2 :)


On Apr 2, 2009, at 3:23 PM, Tim Eck wrote:

Right-o. I’m going to change our code to use valueOf() for all types. It was worded poorly, but what I meant to say is that I don’t think one should ever do reference equality checks on Integer (even though it can work in some cases). The memory savings can make a big difference depending on usage for sure.

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Alex Miller
Sent: Thursday, April 02, 2009 1:21 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

+1 on Boolean.  I think I would argue the same for Integer too, if only to reuse the cached values for memory savings.

 

 

On Apr 2, 2009, at 3:16 PM, Tim Eck wrote:



Glad to hear you have a workaround. I fully intend on changing our code to use Boolean.valueOf() when materializing objects who have field values of type java.lang.Boolean. One really should be able to do reference equality checks on Boolean. I don’t really feel the same way about things like Integer even though it can work for small values [-128..127]

 


From: tc-users-bounces@... [tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 1:12 PM
To: tc-users@...
Subject: Re: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm able to workaround it at the moment by modifying the Clojure compiler to call booleanValue when it compares Booleans, which works, but causes a performance penalty. I think that the best solution would be able to root Boolean.TRUE/FALSE.


Paul

2009/4/2 Tim Eck <teck@...>

Forget to suggest falling back to using equals() to get the comparison of the Boolean instances. It isn’t quite as fast and it isn’t the standard idiom for Boolean, but it would workaround our bug.

 


From: tc-users-bounces@... [mailto:tc-users-bounces@...] On Behalf Of Paul Stadig
Sent: Thursday, April 02, 2009 10:58 AM
To: tc-users@...
Subject: [tc-users] Boolean.TRUE == Boolean.TRUE

 

I'm trying to get Clojure (http://clojure.org/) to work on Terracotta. I have had to workaround a few things. One of which is the fact that Boolean.TRUE != Boolean.TRUE across VMs. Not being able to do an identity compare with Boolean.TRUE has a performance penalty in Clojure. I think the easiest way to accomplish this would be to make java.lang.Boolean.TRUE/FALSE roots, but when I do so I get the following exception:



Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Boolean.__tc_getTRUE()Ljava/lang/Boolean;
    at tctest.TcTest.<clinit>(TcTest.java:4)

Is it possible to make java.lang.Boolean.TRUE/FALSE roots? If not, is there some other way to get identity comparison for Boolean.TRUE/FALSE across VMs?


Thanks,
Paul


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

 

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users