Skip to content

Commit

Permalink
2009-12-08 Mark Probst <mark.probst@gmail.com>
Browse files Browse the repository at this point in the history
        * sgen-gc.c (create_allocator): Only use the fast path if the
        object size is within the small object size limit.

svn path=/trunk/mono/; revision=147832
  • Loading branch information
schani committed Dec 8, 2009
1 parent aa17d4e commit b10f5fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mono/metadata/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2009-12-08 Mark Probst <mark.probst@gmail.com>

* sgen-gc.c (create_allocator): Only use the fast path if the
object size is within the small object size limit.

2009-12-07 Mark Probst <mark.probst@gmail.com>

* sgen-gc.c: Make sure section->data is aligned to 8 bytes by
Expand Down
9 changes: 8 additions & 1 deletion mono/metadata/sgen-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6905,7 +6905,7 @@ static MonoMethod*
create_allocator (int atype)
{
int p_var, size_var;
guint32 slowpath_branch;
guint32 slowpath_branch, max_size_branch;
MonoMethodBuilder *mb;
MonoMethod *res;
MonoMethodSignature *csig;
Expand Down Expand Up @@ -7017,6 +7017,11 @@ create_allocator (int atype)
mono_mb_emit_byte (mb, CEE_AND);
mono_mb_emit_stloc (mb, size_var);

/* if (size > MAX_SMALL_OBJ_SIZE) goto slowpath */
mono_mb_emit_ldloc (mb, size_var);
mono_mb_emit_icon (mb, MAX_SMALL_OBJ_SIZE);
max_size_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BGT_S);

/*
* We need to modify tlab_next, but the JIT only supports reading, so we read
* another tls var holding its address instead.
Expand Down Expand Up @@ -7053,6 +7058,8 @@ create_allocator (int atype)

/* Slowpath */

mono_mb_patch_short_branch (mb, max_size_branch);

mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN);

Expand Down

0 comments on commit b10f5fc

Please sign in to comment.