daedalus-core 1.0 → 1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb568ae793d1465fd93871cf7405e53735bfd723
4
- data.tar.gz: ad15e9874523e393217a35c8930dd08cd054ccc6
3
+ metadata.gz: 8dfabb584ca953d43b3e2fbaef94117cf8d6ad7c
4
+ data.tar.gz: 16389e1ba87675ed97edd176e3124631d08291cf
5
5
  SHA512:
6
- metadata.gz: 7f34910a0c15c910753c42a095d57363f8ada6ff57fb1cb7fed6b2af2c4152aebccd35441a7d017617069aab6051a917c495f84d90d178c085e53dc19deb1865
7
- data.tar.gz: 347ce6b97068a06020e5b269efd6e0c2bf10dff68346c1a78ece1ecd114d7145a3275f1a5f2d3cc28d3343917adac8fecfcfadebd0890bb77d61369821fb61de
6
+ metadata.gz: 55eafc6b2e96945051c4fdbab5ffde89c62149e93f2e49681d6e8af53b2785b22ce8f94c35d6e310416612050953b109e748d13730e6bd6121d7b1650d3730f7
7
+ data.tar.gz: 24815340a8e9209643a49d0db24a5071b0458b1d5c0667372f8a9fcacf24fcabc1e407e39ae3bffc0a2ddd5f597f62306af68e3089f6313b76cabc969bc5b39d
data/lib/daedalus.rb CHANGED
@@ -476,26 +476,45 @@ module Daedalus
476
476
  class InstructionSourceFile < SourceFile
477
477
  def ll_compile(ctx, source, object)
478
478
  ctx.log.show "LL", source
479
- ctx.log.command "#{ctx.cxx} -S -emit-llvm #{ctx.cflags.join(" ")} #{ctx.cxxflags.join(" ")} -c -o #{object} #{source}"
480
479
 
481
- re = %r[tail call i64 %\d+\(%"class.rubinius::State"\*( nonnull)? %state, %"struct.rubinius::CallFrame"*( nonnull)? %call_frame, i64\* %opcodes\)]
480
+ flags = (ctx.cflags + ctx.cxxflags).join(" ").
481
+ gsub(/-g[^ ]*/, "").
482
+ gsub(/-O.?/, "")
483
+ flags << " -glldb -gline-tables-only -Oz"
484
+
485
+ ctx.log.command "#{ctx.cxx} -S -emit-llvm #{flags} -c -o #{object} #{source}"
486
+
487
+ re = %r[tail call i64 %\d+\(%"class.rubinius::State"\*( nonnull)? %state, %"struct.rubinius::CallFrame"\*( nonnull)? %call_frame, i64\*( nonnull)? %opcodes\)]
482
488
 
483
489
  lines = File.readlines object
484
- lines.each do |line|
490
+
491
+ i = 0
492
+ t = lines.size
493
+
494
+ while i < t
495
+ line = lines[i]
485
496
  if re =~ line
486
- line.sub!(/tail call/, "musttail call")
497
+ if next_line = lines[i+1] and next_line =~ /^\s+ret\s/
498
+ line.sub!(/tail call/, "musttail call")
499
+ end
487
500
  end
501
+ i += 1
488
502
  end
489
503
 
490
- File.open object, "w" do |insn_file|
491
- lines.each { |line| insn_file.print line }
504
+ File.open object, "wb" do |insn_file|
505
+ lines.each { |l| insn_file.print l }
492
506
  end
493
507
  end
494
508
 
495
509
  def cxx_compile(ctx, source, object)
496
510
  ctx.log.show "CXX", source
497
511
 
498
- flags = (ctx.cflags + ctx.cxxflags).join(" ").gsub(/-I[^ ]*/, "")
512
+ flags = (ctx.cflags + ctx.cxxflags).join(" ").
513
+ gsub(/-I\s?[^ ]*/, "").
514
+ gsub(/-g[^ ]*/, "").
515
+ gsub(/-O.?/, "")
516
+ flags << " -glldb -gline-tables-only -Oz"
517
+
499
518
  ctx.log.command "#{ctx.cxx} #{flags} -c -o #{object} #{source}"
500
519
  end
501
520
 
@@ -1,3 +1,3 @@
1
1
  module Daedalus
2
- VERSION = "1.0"
2
+ VERSION = "1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daedalus-core
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-03 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake