blob: 978298fc098244fa69d9ecd78edc7c7f7f7a6160 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.seaofnodes.simple.node;
import com.seaofnodes.simple.codegen.Serialize;
import com.seaofnodes.simple.type.Type;
import com.seaofnodes.simple.util.BAOS;
import com.seaofnodes.simple.util.SB;
import java.util.BitSet;
import java.util.HashMap;
import java.util.IdentityHashMap;
/**
A constant with external linkage.
*/
public class ExternNode extends ConstantNode {
public final String _extern;
// An exact external function identity has no local FunNode/Return to own.
// Its lifetime and eventual relocation are carried by the extern symbol
// and CodeGen's FIDX-to-extern mapping instead.
public ExternNode(Type t, String ex) { super(t,true); _extern = ex; }
@Override public Tag serialTag() { return Tag.Extern; }
@Override public void packed( BAOS baos, HashMap<String,Integer> strs, HashMap<Type,Integer> types, IdentityHashMap<Node, Integer> anodes ) {
baos.packed2(types.get(_con ));
baos.packed2( strs.get(_extern));
}
static Node make( BAOS bais, String[] strs, Type[] types) {
return new ExternNode(types[bais.packed2()], strs[bais.packed2()]);
}
@Override public String label() { return "#"+_con+":"+_extern; }
@Override public boolean eq(Node n) { return this==n; }
@Override public void gather( HashMap<String,Integer> strs ) {
Serialize.gather(strs,_extern);
}
}
|