Coder Social home page Coder Social logo

Comments (10)

jbachorik avatar jbachorik commented on July 19, 2024

[author="m_hess", created="Fri, 2 Oct 2009 17:07:41 +0200"]

Sorry about the mess with the curly braces. Somehow the formatting did not work as expected.

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Sat, 10 Oct 2009 18:19:11 +0200"]

The whole problem is in the fact that the expression
@tls =

will get transformed into something like
=
ThreadLocal variable = new ThreadLocal() {
protected Object initialValue()

{
return
}

}

as Michael pointed out and this transformation is completely wrong. This implementation works correctly for immutable objects only.

A correct solution would be to generate the following construct instead:
ThreadLocal variable = new ThreadLocal() {
protected Object initialValue()

{
return ;
}

}

Unfortunately, all those transformations are done on an already compiled BTrace probe and extracting the field initializer from the bytecode is almost impossible using the ASM Core APIs only. In order to be able to generate the required code we would need either to use the ASM Tree API for advanced transformations or to pre-process the source code to wrap the initializer expression properly.

Either way, the proper fix would mean significant changes in the BTrace core and as such it will require careful architecting.

A bit "hackish" fix would be to force the objects used as @tls into being "Cloneable" and rewrite the BTraceRuntime method to clone the initValue if possible. I will attach webrev for this patch shortly.

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Sat, 10 Oct 2009 18:20:07 +0200"]

Webrev for the proposed patch

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="m_hess", created="Mon, 12 Oct 2009 09:32:58 +0200"]

Thanks for taking care of this. Unfortunately I don't know how the process can commence.
Is there some action I need to take, like making a review of your patch?
If so, could you point me in the right direction of needed formalities? I don't konw much about webrev.

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Mon, 12 Oct 2009 09:46:15 +0200"]

The webrev is there more for Sundar (who originally wrote the whole BTrace core) to verify that I am not breaking anything.

As for webrev - you can finde index.html inside the archive which you can open in your web browser and browse the patch in a user friendly way. Also, the webrev contains the "btrace.patch" file which you can "hg import" into your btrace working directory, rebuild and test.

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="m_hess", created="Tue, 13 Oct 2009 14:11:41 +0200"]

I imported the patch into my local repository. It looks good so far, the testcase I created runs smoothly now.

"Hackish" - indeed, but it gets the job done for now. Thanks Jaroslav!

I suggest that you enhance the TLS JavaDoc to tell that the instance that is initially declared and created gets cloned and is never used itself. This might avoid some confusion on the users side, if for whatever reasons values/state get lost during the clone() operation.

I could imagine a situation were someone initializes an instance with some value and annotates it with TLS. If the clone() operation (which BTrace has no influence upon) does not clone the aforementioned value, then this might cause some headaches.

Maybe far fetched / too theoretical, but maybe still worth mentioning.

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Mon, 19 Oct 2009 14:56:23 +0200"]

Patch delivered in http://kenai.com/projects/btrace/sources/hg/revision/214

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Mon, 19 Oct 2009 15:15:11 +0200"]

updated user guide

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="jbachorik", created="Wed, 6 Jan 2010 15:54:41 +0100"]

Please, verify and close this issue

from btrace.

jbachorik avatar jbachorik commented on July 19, 2024

[author="m_hess", created="Fri, 8 Jan 2010 16:22:05 +0100"]

I would love to close this, but all operations available to me (see screenshot) do not offer any fitting operation.
Jaroslav, can you have my permissions adjusted?

from btrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.