<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>27051</bug_id>
          
          <creation_ts>2009-07-07 18:39:02 -0700</creation_ts>
          <short_desc>Use fastMalloc when neither MMAP nor VIRTUALALLOC are enabled</short_desc>
          <delta_ts>2009-09-02 02:49:50 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>S60 Hardware</rep_platform>
          <op_sys>S60 3rd edition</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>27065</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Norbert Leser">norbert.leser</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>eric</cc>
    
    <cc>ggaren</cc>
    
    <cc>hausmann</cc>
    
    <cc>laszlo.gombos</cc>
    
    <cc>yongjun.zhang</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>130326</commentid>
    <comment_count>0</comment_count>
      <attachid>32410</attachid>
    <who name="Norbert Leser">norbert.leser</who>
    <bug_when>2009-07-07 18:39:02 -0700</bug_when>
    <thetext>Created attachment 32410
Code patch for Registerfile ccp and h

RegisterFile constructor currently throws #error when both MMAP and VIRTUALALLOC conditions fail.
On any platform that does not provide these features (for instance, Symbian), the fallback should be regular malloc (or fastMalloc).
Memory allocation with fastMalloc functionally equivalent in this case, even though it may have certain drawbacks such as lack of dynamic pre-allocation.

This should be the general, preferred way of fixing the issue, as opposed to introducing conditional code block for platform Symbian.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130814</commentid>
    <comment_count>1</comment_count>
      <attachid>32410</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2009-07-09 20:13:09 -0700</bug_when>
    <thetext>Comment on attachment 32410
Code patch for Registerfile ccp and h

I&apos;ll have to check into whether this works - I don&apos;t remember whether there are special alignment or lazy commit requirements.

But I also noticed that PLATFORM(SYMBIAN) uses fastMalloc in place of VM allocation inside Collector.cpp. That&apos;s definitely bugus - the GC counts on the guaranteed alignment provided by vm_map, VirtualAlloc and posix_memalign. Failing to meet the alignment requirements will lead to random crashes. If Symbian has no way to get aligned memory chunks, it needs to do a trick to fix up the alignment, like the mmap() code path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>137350</commentid>
    <comment_count>2</comment_count>
    <who name="Norbert Leser">norbert.leser</who>
    <bug_when>2009-08-05 11:18:02 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; (From update of attachment 32410 [details])
&gt; I&apos;ll have to check into whether this works - I don&apos;t remember whether there are
&gt; special alignment or lazy commit requirements.
&gt; 
&gt; But I also noticed that PLATFORM(SYMBIAN) uses fastMalloc in place of VM
&gt; allocation inside Collector.cpp. That&apos;s definitely bugus - the GC counts on the
&gt; guaranteed alignment provided by vm_map, VirtualAlloc and posix_memalign.
&gt; Failing to meet the alignment requirements will lead to random crashes. If
&gt; Symbian has no way to get aligned memory chunks, it needs to do a trick to fix
&gt; up the alignment, like the mmap() code path.

Maciej, did you have a chance, in the meantime, to verify whether there are special requirements for alignment, etc? I could not find any just by looking at the code, and we are running my patch here for a while already without seeing any impact. 

It would be great if we can resolve this issue soon.
If you can point me to alignment issues, I could easily submit my initial code that mimics alignment via fastMalloc() but otherwise it would certainly be cleaner to leave that overhead out and just implement my patch as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139422</commentid>
    <comment_count>3</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2009-08-12 10:57:45 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; (From update of attachment 32410 [details])
&gt; I&apos;ll have to check into whether this works - I don&apos;t remember whether there are
&gt; special alignment or lazy commit requirements.

The code depends on lazy commit to avoid wasting memory, but not for correctness.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>140963</commentid>
    <comment_count>4</comment_count>
      <attachid>32410</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-08-17 18:28:51 -0700</bug_when>
    <thetext>Comment on attachment 32410
Code patch for Registerfile ccp and h

I think this needs a comment in the code indicating that this is not the preferred method.  That platforms should provide instead an allocator which provides lazy commit.

I&apos;m assuming for the moment that there are no alignment requirements.  If there are, this patch is invalid for other reasons.

Please track down othermaciej or ggaren over irc for the alignment requirements.  I&apos;m ready to r+ a change with an added comment about how fastMalloc does not lazy commit and that platforms should instead provide a better allocator.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>142647</commentid>
    <comment_count>5</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2009-08-25 11:06:20 -0700</bug_when>
    <thetext>&gt; I&apos;m assuming for the moment that there are no alignment requirements.  If there
&gt; are, this patch is invalid for other reasons.

The only alignment requirement I know of is that the buffer must be aligned to sizeof(Register).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>142925</commentid>
    <comment_count>6</comment_count>
      <attachid>38633</attachid>
    <who name="Norbert Leser">norbert.leser</who>
    <bug_when>2009-08-26 12:48:33 -0700</bug_when>
    <thetext>Created attachment 38633
Update of patch file for bug #27051

Added comment in code about drawbacks of this alternate branch, as suggested by Eric.

Confirmed in the meantime with Maciej and Geoffrey that there are no specific alignment requirements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>144160</commentid>
    <comment_count>7</comment_count>
      <attachid>38633</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-09-02 02:35:52 -0700</bug_when>
    <thetext>Comment on attachment 38633
Update of patch file for bug #27051

Seems OK to me.  No one else has voiced further objections so r+.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>144167</commentid>
    <comment_count>8</comment_count>
      <attachid>38633</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-09-02 02:49:41 -0700</bug_when>
    <thetext>Comment on attachment 38633
Update of patch file for bug #27051

Clearing flags on attachment: 38633

Committed r47959: &lt;http://trac.webkit.org/changeset/47959&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>144168</commentid>
    <comment_count>9</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-09-02 02:49:50 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>32410</attachid>
            <date>2009-07-07 18:39:02 -0700</date>
            <delta_ts>2009-08-26 12:48:33 -0700</delta_ts>
            <desc>Code patch for Registerfile ccp and h</desc>
            <filename>patch_RegisterFile.txt</filename>
            <type>text/plain</type>
            <size>2190</size>
            <attacher name="Norbert Leser">norbert.leser</attacher>
            
              <data encoding="base64">SW5kZXg6IENoYW5nZUxvZw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIENoYW5nZUxvZwkocmV2aXNpb24gNDU2
MDQpCisrKyBDaGFuZ2VMb2cJKHdvcmtpbmcgY29weSkKQEAgLTEsMyArMSwyMCBAQAorMjAwOS0w
Ny0wNyAgTm9yYmVydCBMZXNlciAgPG5vcmJlcnQubGVzZXJAbm9raWEuY29tPgorCisgICAgICAg
IFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFVzZSBmYXN0TWFsbG9jIHdo
ZW4gbmVpdGhlciBNTUFQIG5vciBWSVJU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G1lbW9yeSBvbiB0aGlzIHBsYXRmb3JtLiIKKyAgICAjZWxzZSAvLyBOZWl0aGVyIE1N
QVAgbm9yIFZJUlRVQUxBTExPQyAtIHVzZSBmYXN0TWFsbG9jIGluc3RlYWQKKyAgICAgICAgbV9i
dWZmZXIgPSBzdGF0aWNfY2FzdDxSZWdpc3Rlcio+KGZhc3RNYWxsb2MoYnVmZmVyTGVuZ3RoKSk7
CiAgICAgI2VuZGlmCiAgICAgICAgIG1fc3RhcnQgPSBtX2J1ZmZlciArIG1heEdsb2JhbHM7CiAg
ICAgICAgIG1fZW5kID0gbV9zdGFydDsK
</data>
<flag name="review"
          id="18812"
          type_id="1"
          status="-"
          setter="eric"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>38633</attachid>
            <date>2009-08-26 12:48:33 -0700</date>
            <delta_ts>2009-09-02 02:49:41 -0700</delta_ts>
            <desc>Update of patch file for bug #27051</desc>
            <filename>patch_RegisterFile_27051_2.txt</filename>
            <type>text/plain</type>
            <size>2658</size>
            <attacher name="Norbert Leser">norbert.leser</attacher>
            
              <data encoding="base64">SW5kZXg6IEphdmFTY3JpcHRDb3JlL0NoYW5nZUxvZw0KPT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIEphdmFTY3Jp
cHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gNDc3ODUpCisrKyBKYXZhU2NyaXB0Q29yZS9DaGFu
Z2VMb2cJKHdvcmtpbmcgY29weSkKQEAgLTEsMyArMSwyMiBAQAorMjAwOS0wOC0yNiAgTm9yYmVy
dCBMZXNlciAgPG5vcmJlcnQubGVzZXJAbm9raWEuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5
IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFVzZSBmYXN0TWFsbG9jIHdoZW4gbmVpdGhlciBN
TUFQIG5vciBWSVJUVU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AgICAgI2Vycm9y
ICJEb24ndCBrbm93IGhvdyB0byByZXNlcnZlIHZpcnR1YWwgbWVtb3J5IG9uIHRoaXMgcGxhdGZv
cm0uIgorICAgICNlbHNlIAorICAgICAgICAvKiAKKyAgICAgICAgICogSWYgbmVpdGhlciBNTUFQ
IG5vciBWSVJUVUFMQUxMT0MgYXJlIGF2YWlsYWJsZSAtIHVzZSBmYXN0TWFsbG9jIGluc3RlYWQu
CisgICAgICAgICAqCisgICAgICAgICAqIFBsZWFzZSBub3RlIHRoYXQgdGhpcyBpcyB0aGUgZmFs
bGJhY2sgY2FzZSwgd2hpY2ggaXMgbm9uLW9wdGltYWwuCisgICAgICAgICAqIElmIGFueSBwb3Nz
aWJsZSwgdGhlIHBsYXRmb3JtIHNob3VsZCBwcm92aWRlIGZvciBhIGJldHRlciBtZW1vcnkKKyAg
ICAgICAgICogYWxsb2NhdGlvbiBtZWNoYW5pc20gdGhhdCBhbGxvd3MgZm9yICJsYXp5IGNvbW1p
dCIgb3IgZHluYW1pYworICAgICAgICAgKiBwcmUtYWxsb2NhdGlvbiwgc2ltaWxhciB0byBtbWFw
IG9yIFZpcnR1YWxBbGxvYywgdG8gYXZvaWQgd2FzdGUgb2YgbWVtb3J5LgorICAgICAgICAgKi8K
KyAgICAgICAgbV9idWZmZXIgPSBzdGF0aWNfY2FzdDxSZWdpc3Rlcio+KGZhc3RNYWxsb2MoYnVm
ZmVyTGVuZ3RoKSk7CiAgICAgI2VuZGlmCiAgICAgICAgIG1fc3RhcnQgPSBtX2J1ZmZlciArIG1h
eEdsb2JhbHM7CiAgICAgICAgIG1fZW5kID0gbV9zdGFydDsK
</data>

          </attachment>
      

    </bug>

</bugzilla>