harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Cornwall (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5654) [classlib][pack200] Init methods cannot be synchronized
Date Mon, 31 Mar 2008 21:54:24 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583895#action_12583895
] 

Andrew Cornwall commented on HARMONY-5654:
------------------------------------------

It appears the right thing to do is not to add the synthetic flag. (In other words, I think
the code is correct.) The Sun-decompiled version of the .pack.gz archive has:

  method {
    access_flag = x00  // 
    name_index = #3  // "<init>"
    descriptor_index = #28  // "(Lorg/apache/harmony/pack200/NewAttributeBands;Lorg/apache/harmony/pack200/NewAttributeBands$LayoutElement;)V"
    attributes_count = 2
      attributes {
        attribute Synthetic {
          attribute_name_index = #11  // "Synthetic"
          attribute_length = 0
        }
        attribute Code {
          attribute_name_index = #5  // "Code"
          attribute_length = 38
          max_stack = 2
          max_locals = 3
          code_length = 6
          code asm {
          0:	aload_0
...

and we have:
  method {
    access_flag = x00  // 
    name_index = #2  // "<init>"
    descriptor_index = #21  // "(Lorg/apache/harmony/pack200/NewAttributeBands;Lorg/apache/harmony/pack200/NewAttributeBands$LayoutElement;)V"
    attributes_count = 2
      attributes {
        attribute Synthetic {
          attribute_name_index = #37  // "Synthetic"
          attribute_length = 0
        }
        attribute Code {
          attribute_name_index = #30  // "Code"
          attribute_length = 38
          max_stack = 2
          max_locals = 3
          code_length = 6
          code asm {
          0:	aload_0
...

which looks right to me. I'm wondering now if a similar situation exists for the BRIDGE flag?


> [classlib][pack200] Init methods cannot be synchronized
> -------------------------------------------------------
>
>                 Key: HARMONY-5654
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5654
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All pack200
>            Reporter: Andrew Cornwall
>            Assignee: Sian January
>         Attachments: pack200.pack.gz
>
>
> In the current code, it's possible for a CPMethod  <init> to be emitted as synchronized.
This will not pass Sun's verification. For instance, if you run pack200 on itself, NewAttributeBands$LayoutElement
in the following will be emitted with a synchronized <init>.
> I've temporarily hacked this with the following code in CPMethod:
> 	public CPMethod(CPUTF8 name, CPUTF8 descriptor, long flags, List attributes) {
> 		// TODO Check that we only pass these on, or remap
>         super(name, descriptor, 0x7FFF & flags, attributes);
> 	    if(name.underlyingString().equals("<init>")) {
> 	        // hack hack - init should never be synchronized
> 	        SegmentUtils.debug("Hacking off synchronized on an init method");
> 	        this.flags = (short)(this.flags & 0x7FDF);
> 	    }
> 	}
> but I really need to look into it more deeply and find out why the 0x20 flag is being
passed in. (This may end up being an encoding issue, but I need to look more first).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message