use of php.runtime.loader.dump.io.DumpInputStream in project jphp by jphp-compiler.
the class ConstantDumper method load.
@Override
public ConstantEntity load(InputStream input) throws IOException {
DumpInputStream dump = new DumpInputStream(input);
boolean cs = dump.readBoolean();
Modifier modifier = dump.readModifier();
String name = dump.readName();
TraceInfo trace = dump.readTrace(context);
Memory value = dump.readMemory();
ConstantEntity entity = new ConstantEntity(name, value, cs);
entity.setContext(context);
entity.setTrace(trace);
dump.readRawData();
return entity;
}
use of php.runtime.loader.dump.io.DumpInputStream in project jphp by jphp-compiler.
the class FunctionDumper method load.
@Override
public FunctionEntity load(InputStream input) throws IOException {
DumpInputStream data = new DumpInputStream(input);
FunctionEntity entity = new FunctionEntity(context);
entity.setStatic(data.readBoolean());
entity.setName(data.readName());
entity.setInternalName(data.readName());
entity.setReturnReference(data.readBoolean());
entity.setUsesStackTrace(data.readBoolean());
entity.setImmutable(data.readBoolean());
entity.setResult(data.readMemory());
entity.setEmpty(data.readBoolean());
entity.setTrace(data.readTrace(context));
int paramCount = data.readInt();
if (paramCount < 0)
throw new DumpException("Invalid param count");
entity.setParameters(new ParameterEntity[paramCount]);
for (int i = 0; i < paramCount; i++) {
ParameterEntity param = parameterDumper.load(input);
param.setTrace(entity.getTrace());
entity.getParameters()[i] = param;
}
entity.setData(data.readRawData(Integer.MAX_VALUE));
data.readRawData();
return entity;
}
use of php.runtime.loader.dump.io.DumpInputStream in project jphp by jphp-compiler.
the class ModuleDumper method load.
@Override
public ModuleEntity load(InputStream input) throws IOException {
DumpInputStream data = new DumpInputStream(input);
int STAMP = data.readInt();
if (STAMP != DUMP_STAMP)
throw new DumpException("Invalid file format");
int VERSION = data.readInt();
if (VERSION != DUMP_VERSION)
throw new DumpException("Invalid dump version - " + VERSION + ", only " + DUMP_VERSION);
// legacy
data.readLangMode();
ModuleEntity entity = new ModuleEntity(context);
entity.setName(data.readName());
entity.setInternalName(data.readName());
entity.setTrace(data.readTrace(context));
// constants
int count = data.readInt();
for (int i = 0; i < count; i++) {
ConstantEntity el = constantDumper.load(input);
el.setModule(entity);
entity.addConstant(el);
}
// closures
count = data.readInt();
for (int i = 0; i < count; i++) {
ClosureEntity el = closureDumper.load(input);
el.setModule(entity);
entity.addClosure(el);
}
count = data.readInt();
for (int i = 0; i < count; i++) {
GeneratorEntity el = generatorDumper.load(input);
el.setModule(entity);
entity.addGenerator(el);
}
// functions
count = data.readInt();
for (int i = 0; i < count; i++) {
FunctionEntity el = functionDumper.load(input);
el.setModule(entity);
entity.addFunction(el);
}
// classes
count = data.readInt();
ClassDumper classDumper = new ClassDumper(context, entity, env, debugInformation);
for (int i = 0; i < count; i++) {
ClassEntity el = classDumper.load(input);
el.setModule(entity);
entity.addClass(el);
}
// byte code
entity.setData(data.readRawData(Integer.MAX_VALUE));
data.readRawData(1024 * 1024 * 5);
return entity;
}
use of php.runtime.loader.dump.io.DumpInputStream in project jphp by jphp-compiler.
the class ParameterDumper method load.
@Override
public ParameterEntity load(InputStream input) throws IOException {
DumpInputStream data = new DumpInputStream(input);
ParameterEntity entity = new ParameterEntity(context);
entity.setType(data.readHintType());
String typeClass = data.readName();
if (typeClass != null && !typeClass.isEmpty()) {
entity.setTypeClass(typeClass);
}
entity.setReference(data.readBoolean());
entity.setMutable(data.readBoolean());
entity.setUsed(data.readBoolean());
entity.setVariadic(data.readBoolean());
entity.setNullable(data.readBoolean());
entity.setName(data.readName());
entity.setTrace(data.readTrace(context));
entity.setDefaultValue(data.readMemory());
entity.setDefaultValueConstName(data.readName());
byte[] raw = data.readRawData();
return entity;
}
Aggregations