Skip to content

Commit 2da9123

Browse files
committed
Stub in serialization context builder, with some explanation of what it's aimed at doing.
1 parent e6663bb commit 2da9123

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

build/Makefile.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ HLL_SOURCES = \
6767
src/HLL/Actions.pm \
6868
src/HLL/Compiler.pm \
6969
src/HLL/CommandLine.pm \
70+
src/HLL/SerializationContextBuilder.pm \
7071

7172
P6REGEX_SOURCES = \
7273
src/Regex/P6Regex.pir \
@@ -114,6 +115,7 @@ HLLGRAMMAR_A = gen/hllgrammar-actions.pir
114115

115116
HLLCOMPILER_PIR = gen/hllcompiler.pir
116117
HLLCOMMANDLINE_PIR = gen/hllcommandline.pir
118+
HLLSERIALIZATIONCONTEXTBUILDER_PIR = gen/hllserializationcontextbuilder.pir
117119

118120
P6REGEX_PBC = P6Regex.pbc
119121
P6REGEX_G = gen/p6regex-grammar.pir
@@ -257,6 +259,9 @@ $(STAGE1)/$(HLL_PBC): $(STAGE0_PBCS) $(HLL_SOURCES)
257259
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
258260
--target=pir --output=$(STAGE1)/$(HLLCOMMANDLINE_PIR) \
259261
src/HLL/CommandLine.pm
262+
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
263+
--target=pir --output=$(STAGE1)/$(HLLSERIALIZATIONCONTEXTBUILDER_PIR) \
264+
src/HLL/SerializationContextBuilder.pm
260265
$(PARROT) --include=$(STAGE1) -o $(STAGE1)/$(HLL_PBC) \
261266
src/HLL.pir
262267

@@ -310,6 +315,9 @@ $(STAGE2)/$(HLL_PBC): $(STAGE1_PBCS) $(HLL_SOURCES)
310315
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
311316
--target=pir --output=$(STAGE2)/$(HLLCOMMANDLINE_PIR) \
312317
src/HLL/CommandLine.pm
318+
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
319+
--target=pir --output=$(STAGE2)/$(HLLSERIALIZATIONCONTEXTBUILDER_PIR) \
320+
src/HLL/SerializationContextBuilder.pm
313321
$(PARROT) --include=$(STAGE2) -o $(STAGE2)/$(HLL_PBC) \
314322
src/HLL.pir
315323

src/HLL.pir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and HLL::Grammar.
2626
.include 'gen/hllgrammar-actions.pir'
2727
.include 'gen/hllcompiler.pir'
2828
.include 'gen/hllcommandline.pir'
29+
.include 'gen/hllserializationcontextbuilder.pir'
2930

3031
.sub '' :anon :load :init
3132
$P0 = get_hll_global ['HLL'], 'Compiler'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# A serialization context contains a bunch of objects that we want to persist
2+
# across the compile time / run time boundary.
3+
#
4+
# The long term goal is that we'll support actually serializing these in an
5+
# efficient way, and be able to do load-time linking between objects in
6+
# different libraries. For now, that's a lot of work, so we adopt a simpler
7+
# approach, in the hope that it will be upgradeable to a "full blown"
8+
# mechanism in the future.
9+
#
10+
# A serialization context is essentially made up of objects and "events" that
11+
# we perform on them. By performing an action on an object through the context
12+
# builder, it ensures that the action is performed both on the object now, and
13+
# also enough information is persisted to be able to re-create an object with
14+
# the same state. There are two common situations.
15+
#
16+
# 1) We compile some code and run it straight away. In this case, the objects
17+
# have already been created, and we only need to do some fixing up.
18+
# 2) We compile some code and persist it as PIR. In this case, the objects need
19+
# to be re-created by replaying the event stream that creates them.
20+
#
21+
# Essentially, we use PIR as our serialization language until we can do better.
22+
# Note that deserialization and installation aren't the same thing; the first
23+
# step sees us producing an array of objects, while the second is about putting
24+
# them in places the HLL can find them.
25+
class HLL::Compiler::SerializationContextBuilder {
26+
}

0 commit comments

Comments
 (0)