aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process.h
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2013-06-05 12:02:11 +0200
committerPatrik Nyblom <[email protected]>2013-06-05 12:02:11 +0200
commit47d6fd3ccf35a4d921591dd0a9b5e69b9804b5b0 (patch)
tree7403e950f4fbfe94de47038fb1042154496711a3 /erts/emulator/beam/erl_process.h
parent6d366f0ae53669a17de96db0094ef62217b60f1b (diff)
downloadotp-47d6fd3ccf35a4d921591dd0a9b5e69b9804b5b0.tar.gz
otp-47d6fd3ccf35a4d921591dd0a9b5e69b9804b5b0.tar.bz2
otp-47d6fd3ccf35a4d921591dd0a9b5e69b9804b5b0.zip
Make all steps ofterm_to_binary work in chunks and yield
Rewrite and extend of Happi's initial work Extra_root to process structure to enable GC of state - Changed the process structure to point to a separate struct, the struct also contains a destructor function to allow for proper cleanup. Rewrote encode_size_struct and enc_term to have internal versions with reduction counters which will result in interrupt for later restart when the counter reaches zero - removed the EWA_STACK from Happis version and directly save the ESTACK's and WSTACK's in the above mentioned struct (or array thereof) that are pointed out from the process structure. The destructor will take care of the deallocation in case of process death. Added ESTACK and WSTACK macros to save and restore stack and to change allocator, which makes the previously mentioned stack-save work. Rewrote enc_term to not store pointers on the stack, and use one WSTACK for commands etc and another ESTACK for Eterms - Slightly different than Happis version to make halfword code simpler. Rewrote encode_size_struct2 so that it does not store pointers on the stack, also switched to ESTACK instead of WSTACK, this also handles halfword correctly. Added interfaces for chunkwise compression, that are used from term_to_binary/2 when the compressed option is given.
Diffstat (limited to 'erts/emulator/beam/erl_process.h')
-rw-r--r--erts/emulator/beam/erl_process.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h
index fca83dba8f..56cefc9e7d 100644
--- a/erts/emulator/beam/erl_process.h
+++ b/erts/emulator/beam/erl_process.h
@@ -699,6 +699,14 @@ struct ErtsPendingSuspend_ {
#endif
+
+typedef struct ErlExtraRootSet_ ErlExtraRootSet;
+struct ErlExtraRootSet_ {
+ Eterm *objv;
+ Uint sz;
+ void (*cleanup)(ErlExtraRootSet *);
+};
+
/* Defines to ease the change of memory architecture */
# define HEAP_START(p) (p)->heap
# define HEAP_TOP(p) (p)->htop
@@ -792,10 +800,7 @@ struct process {
ErlMessageQueue msg; /* Message queue */
- Eterm *extra_root; /* Extra root set, used e.g. by yielding bifs. */
- Uint extra_root_sz; /* Size of extra root set. */
- ErtsAlcType_t extra_root_allocator; /* Type of memory allocator used,
- used for freeing extra_root if process dies. */
+ ErlExtraRootSet *extra_root; /* Used by trapping BIF's */
union {
ErtsBifTimer *bif_timers; /* Bif timers aiming at this process */
@@ -1980,6 +1985,7 @@ erts_sched_poke(ErtsSchedulerSleepInfo *ssi)
}
}
+
#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */
#endif /* #ifdef ERTS_SMP */