Skip to content

Commit

Permalink
Enable shcopy for spawning processes
Browse files Browse the repository at this point in the history
  • Loading branch information
nickie committed Jun 8, 2012
1 parent 3d893fa commit 8a05ff0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions erts/emulator/beam/erl_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -7507,6 +7507,11 @@ erl_create_process(Process* parent, /* Parent of process (default group leader).
Eterm res = THE_NON_VALUE;
erts_aint32_t state = 0;
erts_aint32_t prio = (erts_aint32_t) PRIORITY_NORMAL;
#ifdef SHCOPY_SPAWN
unsigned shflags = 0; /* could be taken from so->flags, if necessary */
shcopy_info info;
INITIATE_SHCOPY_INFO(info);
#endif

#ifdef ERTS_SMP
erts_smp_proc_lock(parent, ERTS_PROC_LOCKS_ALL_MINOR);
Expand Down Expand Up @@ -7551,7 +7556,11 @@ erl_create_process(Process* parent, /* Parent of process (default group leader).
BM_COUNT(processes_spawned);

BM_SWAP_TIMER(system,size);
#ifdef SHCOPY_SPAWN
arg_size = copy_shared_calculate(args, &info, shflags);
#else
arg_size = size_object(args);
#endif
BM_SWAP_TIMER(size,system);
heap_need = arg_size;

Expand Down Expand Up @@ -7624,7 +7633,12 @@ erl_create_process(Process* parent, /* Parent of process (default group leader).
BM_MESSAGE(args,p,parent);
BM_START_TIMER(system);
BM_SWAP_TIMER(system,copy);
#ifdef SHCOPY_SPAWN
p->arg_reg[2] = copy_shared_perform(args, arg_size, &info, &p->htop, &p->off_heap, shflags);
DESTROY_INFO(info);
#else
p->arg_reg[2] = copy_struct(args, arg_size, &p->htop, &p->off_heap);
#endif
BM_MESSAGE_COPIED(arg_size);
BM_SWAP_TIMER(copy,system);
p->arity = 3;
Expand Down Expand Up @@ -7999,6 +8013,10 @@ delete_process(Process* p)

VERBOSE(DEBUG_PROCESSES, ("Removing process: %T\n",p->id));

#ifdef SHCOPY_DEBUG
VERBOSE_DEBUG("[pid=%T] delete process: %p %p %p %p\n", p->id, HEAP_START(p), HEAP_END(p), OLD_HEAP(p), OLD_HEND(p));
#endif

/* Cleanup psd */

if (p->psd)
Expand Down

0 comments on commit 8a05ff0

Please sign in to comment.