Skip to content

Commit

Permalink
Merge pull request #26 from petrroll/fixed-optimization-levels
Browse files Browse the repository at this point in the history
Removed fixed Options.OptimizationLevels.
  • Loading branch information
jakubmisek committed Mar 28, 2017
2 parents 04b871d + cccacc7 commit 6fec17d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Peachpie.CodeAnalysis/CodeGen/Graph/BoundStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void EmitInit(Emit.PEModuleBuilder module, DiagnosticBag diagnostic, PhpCompilat

holder.EmitInit(module, (il) =>
{
var cg = new CodeGenerator(il, module, diagnostic, OptimizationLevel.Release, false,
var cg = new CodeGenerator(il, module, diagnostic, compilation.Options.OptimizationLevel, false,
holder.ContainingType, new ArgPlace(compilation.CoreTypes.Context, 1), new ArgPlace(holder, 0));
var valuePlace = new FieldPlace(cg.ThisPlaceOpt, holder.ValueField);
Expand Down Expand Up @@ -237,7 +237,7 @@ void EmitInit(Emit.PEModuleBuilder module, DiagnosticBag diagnostic, PhpCompilat
{
// emit default value only if it won't be initialized by Init above
var cg = new CodeGenerator(il, module, diagnostic, OptimizationLevel.Release, false,
var cg = new CodeGenerator(il, module, diagnostic, compilation.Options.OptimizationLevel, false,
holder.ContainingType, null, new ArgPlace(holder, 0));
var valuePlace = new FieldPlace(cg.ThisPlaceOpt, holder.ValueField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void GenerateGhostBody(PEModuleBuilder module, DiagnosticBag diagnosti
var body = MethodGenerator.GenerateMethodBody(module, ghost,
(il) =>
{
var cg = new CodeGenerator(il, module, diagnostic, OptimizationLevel.Release, false, this.ContainingType, this.GetContextPlace(), this.GetThisPlace());
var cg = new CodeGenerator(il, module, diagnostic, module.Compilation.Options.OptimizationLevel, false, this.ContainingType, this.GetContextPlace(), this.GetThisPlace());
// return (T){routine}(p0, ..., pN);
cg.EmitConvert(cg.EmitThisCall(this, ghost), 0, ghost.ReturnType);
Expand Down Expand Up @@ -232,7 +232,7 @@ void SynthesizeEmptyBody(PEModuleBuilder module, DiagnosticBag diagnostic)

module.SetMethodBody(this, MethodGenerator.GenerateMethodBody(module, this, (il) =>
{
var cg = new CodeGenerator(this, il, module, diagnostic, OptimizationLevel.Release, false);
var cg = new CodeGenerator(this, il, module, diagnostic, module.Compilation.Options.OptimizationLevel, false);
// Template: return default(T)
cg.EmitRetDefault();
Expand Down
10 changes: 5 additions & 5 deletions src/Peachpie.CodeAnalysis/CodeGen/Symbols/SourceTypeSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void EmitFieldsCctor(Emit.PEModuleBuilder module)
// note, their initializers do not have Context available, since they are not bound to a Context

var cctor = module.GetStaticCtorBuilder(this);
var cg = new CodeGenerator(cctor, module, DiagnosticBag.GetInstance(), OptimizationLevel.Release, false, this, null, null);
var cg = new CodeGenerator(cctor, module, DiagnosticBag.GetInstance(), module.Compilation.Options.OptimizationLevel, false, this, null, null);

foreach (var f in sflds)
{
Expand Down Expand Up @@ -98,7 +98,7 @@ void EmitPhpCallable(Emit.PEModuleBuilder module, DiagnosticBag diagnostics)

module.SetMethodBody(invoke, MethodGenerator.GenerateMethodBody(module, invoke, il =>
{
var cg = new CodeGenerator(il, module, diagnostics, OptimizationLevel.Release, false, this, new ParamPlace(invoke.Parameters[0]), new ArgPlace(this, 0));
var cg = new CodeGenerator(il, module, diagnostics, module.Compilation.Options.OptimizationLevel, false, this, new ParamPlace(invoke.Parameters[0]), new ArgPlace(this, 0));
var argsplace = new ParamPlace(invoke.Parameters[1]);
var args_element = ((ArrayTypeSymbol)argsplace.TypeOpt).ElementType;
Expand Down Expand Up @@ -176,7 +176,7 @@ void EmitPhpCallable(Emit.PEModuleBuilder module, DiagnosticBag diagnostics)
module.SetMethodBody(tophpvalue, MethodGenerator.GenerateMethodBody(module, tophpvalue, il =>
{
var thisPlace = new ArgPlace(this, 0);
var cg = new CodeGenerator(il, module, diagnostics, OptimizationLevel.Release, false, this, new FieldPlace(thisPlace, this.ContextStore), thisPlace);
var cg = new CodeGenerator(il, module, diagnostics, module.Compilation.Options.OptimizationLevel, false, this, new FieldPlace(thisPlace, this.ContextStore), thisPlace);
// return PhpValue.FromClass(this)
cg.EmitThis();
Expand All @@ -195,7 +195,7 @@ void EmitPhpCtors(ImmutableArray<MethodSymbol> instancectors, Emit.PEModuleBuild
{
Debug.Assert(SpecialParameterSymbol.IsContextParameter(ctor.Parameters[0]));
var cg = new CodeGenerator(il, module, diagnostics, OptimizationLevel.Release, false, this, new ParamPlace(ctor.Parameters[0]), new ArgPlace(this, 0));
var cg = new CodeGenerator(il, module, diagnostics, module.Compilation.Options.OptimizationLevel, false, this, new ParamPlace(ctor.Parameters[0]), new ArgPlace(this, 0));
Debug.Assert(ctor.BaseCtor != null);
Expand Down Expand Up @@ -261,7 +261,7 @@ void EmitToString(Emit.PEModuleBuilder module)
module.SetMethodBody(tostring, MethodGenerator.GenerateMethodBody(module, tostring, il =>
{
var thisPlace = new ArgPlace(this, 0);
var cg = new CodeGenerator(il, module, DiagnosticBag.GetInstance(), OptimizationLevel.Release, false, this, new FieldPlace(thisPlace, this.ContextStore), thisPlace);
var cg = new CodeGenerator(il, module, DiagnosticBag.GetInstance(), module.Compilation.Options.OptimizationLevel, false, this, new FieldPlace(thisPlace, this.ContextStore), thisPlace);
if (__tostring != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal void EmitCtors(Emit.PEModuleBuilder module)

var body = MethodGenerator.GenerateMethodBody(module, ctor, (il) =>
{
var cg = new CodeGenerator(il, module, diagnostic, OptimizationLevel.Release, false, this, null, new ArgPlace(this, 0));
var cg = new CodeGenerator(il, module, diagnostic, module.Compilation.Options.OptimizationLevel, false, this, null, new ArgPlace(this, 0));
// base..ctor()
cg.EmitThis(); // this
Expand Down Expand Up @@ -71,7 +71,7 @@ void EmitInit(Emit.PEModuleBuilder module)

var body = MethodGenerator.GenerateMethodBody(module, initMethod, (il) =>
{
var cg = new CodeGenerator(il, module, diagnostic, OptimizationLevel.Release, false, this, new ArgPlace(tt.Context, 1), new ArgPlace(this, 0));
var cg = new CodeGenerator(il, module, diagnostic, module.Compilation.Options.OptimizationLevel, false, this, new ArgPlace(tt.Context, 1), new ArgPlace(this, 0));
foreach (var fld in this.Fields)
{
Expand Down

0 comments on commit 6fec17d

Please sign in to comment.