summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/coder.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
committerKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
commit16d128e5e10d541a78654b86409d5a3539f07708 (patch)
tree66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/coder.cc
parentb20f78c549859ec0e8610bdd3ad904245e86b489 (diff)
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/coder.cc')
-rw-r--r--Build/source/utils/asymptote/coder.cc46
1 files changed, 35 insertions, 11 deletions
diff --git a/Build/source/utils/asymptote/coder.cc b/Build/source/utils/asymptote/coder.cc
index 01d3ff3a58f..fc71f730b44 100644
--- a/Build/source/utils/asymptote/coder.cc
+++ b/Build/source/utils/asymptote/coder.cc
@@ -24,15 +24,25 @@ function *inittype();
function *bootuptype();
}
+vm::lambda *newLambda(string name) {
+ assert(!name.empty());
+ vm::lambda *l = new vm::lambda;
+#ifdef DEBUG_FRAME
+ l->name = name;
+#endif
+ return l;
+}
+
+
// The dummy environment of the global environment.
// Used purely for global variables and static code blocks of file
// level modules.
-coder::coder(modifier sord)
- : level(new frame(0, 0)),
+coder::coder(string name, modifier sord)
+ : level(new frame(name, 0, 0)),
recordLevel(0),
recordType(0),
isCodelet(false),
- l(new vm::lambda),
+ l(newLambda(name)),
funtype(bootuptype()),
parent(0),
sord(sord),
@@ -46,13 +56,16 @@ coder::coder(modifier sord)
}
// Defines a new function environment.
-coder::coder(function *t, coder *parent, modifier sord, bool reframe)
- : level(reframe ? new frame(parent->getFrame(), t->sig.getNumFormals()) :
- parent->getFrame()),
+coder::coder(string name, function *t, coder *parent,
+ modifier sord, bool reframe)
+ : level(reframe ? new frame(name,
+ parent->getFrame(),
+ t->sig.getNumFormals()) :
+ parent->getFrame()),
recordLevel(parent->recordLevel),
recordType(parent->recordType),
isCodelet(!reframe),
- l(new vm::lambda),
+ l(newLambda(name)),
funtype(t),
parent(parent),
sord(sord),
@@ -85,21 +98,22 @@ coder::coder(record *t, coder *parent, modifier sord)
encodeAllocInstruction();
}
-coder coder::newFunction(function *t, modifier sord)
+coder coder::newFunction(string name, function *t, modifier sord)
{
- return coder(t, this, sord);
+ return coder(name, t, this, sord);
}
coder coder::newCodelet()
{
- return coder(new function(primVoid()), this, DEFAULT_DYNAMIC, false);
+ return coder("<codelet>", new function(primVoid()), this,
+ DEFAULT_DYNAMIC, false);
}
record *coder::newRecord(symbol *id)
{
frame *underlevel = getFrame();
- frame *level = new frame(underlevel, 0);
+ frame *level = new frame(*id, underlevel, 0);
record *r = new record(id, level);
@@ -111,6 +125,16 @@ coder coder::newRecordInit(record *r, modifier sord)
return coder(r, this, sord);
}
+#ifdef DEBUG_BLTIN
+void assertBltinLookup(inst::opcode op, item it)
+{
+ if (op == inst::builtin) {
+ string name=lookupBltin(vm::get<vm::bltin>(it));
+ assert(!name.empty());
+ }
+}
+#endif
+
bool coder::encode(frame *f)
{