4.1. Brecha de género
4.1.5. Por categoría ocupacional
One may be tempted to handle a constructor call pointcut by replacing a single in- struction, like a method call pointcut, because calling a constructor is indeed im- plemented by aninvokespecialinstruction, one of the method invocation instruc- tions. However, this results in a veri cation failure1because a constructor can be invoked only on an uninitialized object, created by anewinstruction, but the re- placement, which moves theinvokespecialinstruction to the extracted method, causes the intra-procedural veri er to fail to recognize the newly created object as uninitialized.
To avoid such veri cation failures, the presented technique moves not only the invokespecialinstruction but also the correspondingnewinstruction and some
others. is movement requires a careful instruction manipulation because creating an object and assigning it to a variable are done in a series of instructions. For example, consider the following Java code fragment:
𝑛𝑒𝑤𝑜𝑏𝑗 =newClassName(𝑎𝑟𝑔, 𝑎𝑟𝑔, ⋯ , 𝑎𝑟𝑔𝑛);
From this code, a Java compiler generates the following:
1 new // create an object of ClassName type 2 dup // duplicate the created object 3 ... // prepare arg_1, arg_2, ..., arg_n 4 invokespecial // invoke the constructor
5 astore_1 // store the created object in ’newobj’
Here a Java compiler insertsdupbecause the created object is used twice: once for providing the target object of the constructor call (line 4), and for storing in the variable (line 5).2 What is represented by line 3 can be arbitrarily many instruc- tions because multiple arguments can exist and preparing an argument may require many instructions. Moreover, it may contain another object creation—one of ar- guments can be another newly created object. In order to nd the exactnewand dupinstructions that correspond to theinvokespecialinstruction, the presented technique considers the stack depth while iterating over instructions backwards.
Aer identifying the correspondingnewanddup, it rst extracts a static method from lines 1, 2 and 4:
1 static ClassName from_124(type_1 arg_1, ..., type_n arg_n) { 2 return new ClassName(arg_1, arg_2, ..., arg_n);
3 }
where 𝑡𝑦𝑝𝑒𝑖is the type of 𝑖-th parameter of the constructor. At the bytecode level,
the body of this method is the following (each instruction moved from the caller is pre xed by “+”):
1 + new
2 + dup
3 ... // load arg_1, arg_2, ..., arg_n 4 + invokespecial
5 areturn // return the created object
en, in the originating method,invokespecialis replaced byinvokestatic, so that the extracted method is invoked; consequently, the remaining code looks like the following (an instruction that newly appears is pre xed by “+”):
1 ... // prepare arg_1, arg_2, ..., arg_n 2 + invokestatic // invoke the extracted method 3 astore_1 // store the created object in ’newobj’
Since the extracted method takes the exactly same arguments as the construc- tor, it is possible to pass the arguments, which is prepared on line 1, to the extracted method. Also, the stack aer executing the aboveinvokestaticinstruction con- tains exactly one reference to the created object, which is the same as the stack aer executing the replacedinvokespecialinstruction. erefore, this replacement is correct. e code size of the caller is not increased becausenew(and alsodupif this exists) is moved out andinvokespecialis replaced byinvokestatic, which is no longer thaninvokespecial.
References
[1] M. Acharya, T. Xie, J. Pei, and J. Xu. Mining API patterns as partial orders from source code: from usage scenarios to speci cations. In FSE, 2007. 19 [2] C. Allan, P. Avgustinov, A. S. Christensen, L. J. Hendren, S. Kuzins, O. Lhoták,
O. de Moor, D. Sereni, G. Sittampalam, and J. Tibble. Adding trace matching with free variables to AspectJ. In OOPSLA, 2005. 1, 9, 21, 22
[3] G. Ammons, R. Bodík, and J. R. Larus. Mining speci cations. In POPL, 2002. 17
[4] D. Angluin. Learning regular sets from queries and counterexamples. Inf.
Comput., 75:87–106, 1987. 15, 20, 21
[5] Apache JAMES. http://james.apache.org/. 44, 45 [6] Apache Lucene. http://lucene.apache.org/core/. 44 [7] Apache Xalan.http://xalan.apache.org/. 79
[8] M. Arnold, M. Vechev, and E. Yahav. Qvm: an efficient runtime for detecting defects in deployed systems. In OOPSLA’08. ACM, 2008. 1, 22
[9] P. Avgustinov, J. Tibble, and O. de Moor. Making trace monitors feasible. In
OOPSLA’07. ACM, 2007. 1, 22, 66
[10] H. Barringer, D. Rydeheard, and K. Havelund. Rule systems for run-time mon- itoring: from eagle to ruler. In RV’07. Springer-Verlag, 2007. 1, 22
[11] A. W. Biermann and J. A. Feldman. On the synthesis of nite-state machines from samples of their behavior. IEEE Transactions on Computers, 21:592–597, June 1972. 15, 20, 39
[12] S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. e DaCapo bench- marks: Java benchmarking development and analysis. In OOPSLA’06. ACM, 2006. 44, 45, 72, 78
[13] E. Bodden. J-LO, a tool for runtime-checking temporal assertions. Master’s thesis, RWTH Aachen University, 2005. 22
[14] E. Bodden. Efficient hybrid typestate analysis by determining continuation- equivalent states. In ICSE, 2010. 1
[15] E. Bodden. Stateful breakpoints: a practical approach to de ning parameter- ized runtime monitors. In Proceedings of the 19th ACM SIGSOFT symposium
and the 13th European conference on Foundations of soware engineering, 2011.
81
[16] E. Bodden and V. Stolz. Tracechecks: De ning semantic interfaces with tem- poral logic. In SC’06. Springer-Verlag, 2006. 22
[17] E. Bodden, L. Hendren, and O. Lhoták. A staged static program analysis to improve the performance of runtime monitoring. In ECOOP, 2007. 15 [18] S. Chaudhuri and R. Alur. Instumenting C programs with nested word mon-
itors. In SPIN’07. Springer, 2007. 1, 22
[19] F. Chen. Monitoring Oriented Programming and Analysis. PhD thesis, Univer- sity of Illinois at Urbana-Champaign, 2009. 22
[20] F. Chen and G. Roşu. MOP: An efficient and generic runtime veri cation framework. In Object-Oriented Programming, Systems, Languages and Appli-
cations (OOPSLA’07), pages 569–588. ACM, 2007. 3
[21] F. Chen and G. Roşu. Parametric trace slicing and monitoring. In TACAS, 2009. 6, 12, 13, 44
[22] F. Chen, P. O. Meredith, D. Jin, and G. Rosu. Efficient formalism-independent monitoring of parametric properties. In ASE, 2009. 1, 3, 13, 44, 72, 81 [23] V. Dallmeier, C. Lindig, A. Wasylkowski, and A. Zeller. Mining object behavior
with ADABU. In Proceedings of the 2006 International Workshop on Dynamic
Systems Analysis (WODA’06). ACM, 2006. 19
[24] V. Dallmeier, N. Knopp, C. Mallon, S. Hack, and A. Zeller. Generating test cases for speci cation mining. In Proceedings of the 19th international sympo-
sium on Soware testing and analysis, 2010. 20
[25] M. d’Amorim and K. Havelund. Event-based runtime veri cation of Java pro- grams. SIGSOFT Sow. Eng. Notes, 2005. 1, 22
[26] G. de Caso, V. Braberman, D. Garbervetsky, and S. Uchitel. Automated ab- stractions for contract validation. IEEE Transactions on Soware Engineering, 38:141–162, 2012. 21
[27] U. Dekel and J. D. Herbsleb. Improving API documentation usability with knowledge pushing. In ICSE, 2009. 22
[28] E. W. Dijkstra. Cooperating sequential processes. 1968. URLhttp://www.cs. utexas.edu/users/EWD/ewd01xx/EWD123.PDF. 67
[29] D. Drusinsky. e Temporal Rover and the ATG Rover. In SPIN’00, 2000. 1, 22
[30] eclipse.http://www.eclipse.org/. 22
[31] U. Erlingsson and F. B. Schneider. Irm enforcement of java stack inspection. In SP’00. IEEE, 2000. 1, 22
[32] M. Gabel and Z. Su. Javert: fully automatic mining of general temporal prop- erties from dynamic traces. In FSE, 2008. 19
[33] S. Goldsmith, R. O’Callahan, and A. Aiken. Relational queries over program traces. In OOPSLA’05. ACM, 2005. 1, 22
[34] K. W. Hamlen and M. Jones. Aspect-oriented in-lined reference monitors. In
PLAS’08. ACM, 2008. 1, 22
[35] K. Havelund and G. Roşu. Monitoring Java programs with Java PathExplorer. In RV’01. Elsevier, 2001. 1, 22
[36] J. Henkel, C. Reichenbach, and A. Diwan. Discovering documentation for java container classes. IEEE Trans. on Soware Engineering, 33:526–543, 2007. 19 [37] How to Write Doc Comments for the Javadoc Tool.http://www.oracle.com/
technetwork/java/javase/documentation/index-137868.html. 50
[38] JAR les revealed. http://www.ibm.com/developerworks/library/j-jar/ #N1014A. 84
[39] Java Agent. http://docs.oracle.com/javase/6/docs/api/java/lang/ instrument/package-summary.html. 10, 86
[40] Java SE 6 HotSpot Virtual Machine Garbage Collection Tuning. http://www. oracle.com/technetwork/java/javase/gc-tuning-6-140523.html. 73 [41] Java Virtual Machine Tool Interface. http://download.oracle.com/javase/
6/docs/technotes/guides/jvmti. 10, 29, 31, 45, 70, 83, 84
[42] Javassist. http://www.ibm.com/developerworks/library/j-jar/#N1014A. 10, 89
[43] D. Jin. Making Runtime Monitoring of Parametric Properties Practical. PhD thesis, University of Illinois at Urbana-Champaign, 2012. 22, 23, 72, 73, 75 [44] D. Jin, P. O. Meredith, D. Griffith, and G. Rosu. Garbage collection for moni-
toring parametric properties. In PLDI, 2011. 1, 2, 3, 23, 71, 74 [45] jMiner Webpage.http://fsl.cs.uiuc.edu/jMiner. 47
[46] G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In ECOOP’01. Springer-Verlag, 2001. 3, 7, 9
[47] M. Kim, M. Viswanathan, S. Kannan, I. Lee, and O. Sokolsky. Java-MaC: A run-time assurance approach for Java programs. J. Formal Methods in System
[48] K. J. Lang. Random dfa’s can be approximately learned from sparse uniform examples. In Proceedings of the Fih Annual Workshop on Computational
Learning eory, 1992. 15
[49] C. Lee, F. Chen, and G. Roşu. Mining parametric speci cations. In ICSE, 2011. 25
[50] C. Lee, D. Jin, P. O. Meredith, and G. Roşu. Towards categorizing and formal- izing the JDK API. Technical Report http://hdl.handle.net/2142/30006, De- partment of Computer Science, University of Illinois at Urbana-Champaign, 2012. 24
[51] D. Lorenzoli, L. Mariani, and M. Pezzè. Automatic generation of soware behavioral models. In ICSE, 2008. 20
[52] M. Martin, V. B. Livshits, and M. S. Lam. Finding application errors and secu- rity aws using PQL: a program query language. In OOPSLA’07. ACM, 2005. 1, 22
[53] P. Meredith, D. Jin, F. Chen, and G. Roşu. Efficient monitoring of parametric context-free patterns. JASE, 2010. 1, 3
[54] P. O. Meredith. Efficient, Expressive, and Effiective Runtime Veri cation. PhD thesis, University of Illinois at Urbana-Champaign, 2012. 22
[55] P. O. Meredith, D. Jin, D. Griffith, F. Chen, and G. Roşu. An overview of the MOP runtime veri cation framework. International Journal on Soware Tools
for Technology Transfer (STTT), pages 1–41, 2011. 1, 4, 7, 9, 21, 22, 66
[56] MOPBox. https://code.google.com/p/mopbox/. 66, 78, 79
[57] K. P. Murphy. Passively learning nite automata. Technical Report 96-04-017, Santa Fe Institute, 1995. 20
[58] J. Oncina and P. García. Identifying regular languages in polynomial time.
Advances in Structural and Syntactic Pattern Recognition, 5:99–108, 1992. 15,
20
[59] OpenJDK.http://openjdk.java.net. 31, 44
[60] E. Poll, P. Chalin, D. Cok, J. Kiniry, and G. T. Leavens. Beyond assertions: Advanced speci cation and veri cation with JML and ESC/Java2. In FMCO, 2005. 21, 22
[61] M. Pradel and T. R. Gross. Automatic generation of object usage speci cations from large method traces. In ASE, 2009. 18, 29, 48
[62] R. Purandare, M. B. Dwyer, and S. G. Elbaum. Optimizing monitoring of nite state properties through monitor compaction. In ISSTA, 2013. 23
[63] A. Raman, J. Patrick, and P. North. e sk-strings method for inferring PFSA. In ICML, 1997. 15, 20, 39
[64] V. Stolz and E. Bodden. Temporal Assertions using AspectJ. In RV’05, 2005. 1, 22
[65] R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing soware reliability. IEEE Transactions on Soware Engineering, 12: 157–171, January 1986. 6
[66] e class File Format. http://docs.oracle.com/javase/specs/jvms/se7/ html/jvms-4.html. 89
[67] e Java Virtual Machine Speci cation. http://docs.oracle.com/javase/ specs/jvms/se7/html/. 10, 77, 78
[68] B. Trakhtenbrot and I. Barzdin. Finite Automata: Behavior and Synthesis. Fun- damental Studies in Computer Science, V. 1. North-Holland Publishing Com- pany; New York: American Elsevier, 1973. 15
[69] VisualVM.https://visualvm.java.net/. 72
[70] W. Weimer and G. C. Necula. Mining temporal speci cations for error detec- tion. In TACAS, 2005. 29
[71] J. Yang, D. Evans, D. Bhardwaj, T. Bhat, and M. Das. Perracotta: mining tem- poral API rules from imperfect traces. In ICSE, 2006. 18, 19
[72] H. Zhong, T. Xie, L. Zhang, J. Pei, and H. Mei. MAPO: Mining and recom- mending API usage patterns. In ECOOP, 2009. 19
[73] H. Zhong, L. Zhang, T. Xie, and H. Mei. Inferring resource speci cations from natural language API documentation. In ASE, 2009. 19